rt

解决方案 »

  1.   

    代码如下:
    private void Page_Load(object sender, System.EventArgs e)
    {

    if(Session["UserName"]==null)
    {
    Response.Write("<script>window.alert('由于系统无法识别您的身份,请重新登陆!');</script>");
    Response.Write("<script>window.opener='null';</script>");
    Response.Write("<script>window.close();</script>");

    }
    Response.Cache.SetNoStore();
    Response.CacheControl="no-cache";
    Response.Expires=-1;
    string ID="";

    try
    {
    ID=Request.QueryString["id"].ToString();
    }
    catch
    {
    }
    if(!Page.IsPostBack)
    {
    ListButton11.SelectedIndex=0;
    }
    string SeleString="select * from CaptialPlanTable where Noid='"+ID+"'";
    string Connstr=ConfigurationSettings.AppSettings["conn"];
    SqlConnection Myconn=new SqlConnection(Connstr);
    SqlCommand objCommand=new SqlCommand(SeleString,Myconn);
    objCommand.Connection.Open();
    SqlDataReader dr=objCommand.ExecuteReader(); if(dr.Read())
    {
    Te1.Text=dr.GetValue(0).ToString();
    Label6.Text=opendatas(dr.GetValue(0).ToString().Substring(0,3),2,"ProInfo","NoID");
    Te2.Text=dr.GetValue(1).ToString();
    Te3.Text=dr.GetValue(2).ToString();
    Te4.Text=dr.GetValue(3).ToString();
    Te5.Text=dr.GetValue(4).ToString();
    Te6.Text=dr.GetValue(5).ToString();
    Te7.Text=dr.GetValue(6).ToString();
    Te31.Text=dr.GetValue(32).ToString();
    if(Convert.ToInt32(dr.GetValue(7).ToString())==0)
    {
    Te8.Text="";
    }
    else
    {
    Te8.Text=dr.GetValue(7).ToString();
    }
    //科目项目及费用分类
    try
    {
    if(dr.GetValue(8).ToString().Length<=5)
    {
    Textbox5.Text=opendatas(dr.GetValue(8).ToString().Substring(0,2),2,"List1","id");
    Textbox6.Text=opendatas(dr.GetValue(8).ToString().Substring(0,4),2,"List1","id");
    }
    else
    {
    Textbox5.Text=opendatas(dr.GetValue(8).ToString().Substring(0,2),2,"List1","id");
    Textbox6.Text=opendatas(dr.GetValue(8).ToString().Substring(0,4),2,"List1","id")+"--"+opendatas(dr.GetValue(8).ToString().Substring(0,6),2,"List1","id");
    }
    }
    catch
    {
    }
    Textbox31.Text="";
    Label11.Text="";
    try
    {
    if(Convert.ToInt32(dr.GetValue(9).ToString())==1)
    {
    Che1.Checked=true;
    Textbox31.Text="总价合同";
    Label11.Text="";
    try
    {
    if(Convert.ToInt32(dr.GetValue(41).ToString())==1)
    {
    Textbox31.Text="单价合同";
    Label11.Text="暂估价";
      

  2.   

    }

    }
    catch
    {
    }
    }
    else
    {
    Che1.Checked=false;
    }
    }
    catch
    {
    Che1.Checked=false;
    } Te10.Text=dr.GetValue(10).ToString();
    try
    {
    Te11.Text=(Convert.ToDouble(dr.GetValue(11))).ToString("c");
    }
    catch
    {
    Te11.Text="";
    }
    Te12.Text=dr.GetValue(12).ToString();
    try
    {
    Te13.Text=(Convert.ToDouble(dr.GetValue(13))).ToString("c");
    }
    catch
    {
    Te13.Text="";
    }
    Te14.Text=dr.GetValue(14).ToString();
    Te15.Text=dr.GetValue(15).ToString(); Textbox30.Text=dr.GetValue(42).ToString();
    //急办
    try
    {
    if(Convert.ToInt32(dr.GetValue(16).ToString())==1)
    Che2.Checked=true;
    else
    Che2.Checked=false;
    }
    catch
    {
    Che2.Checked=false;
    } //特批
    try
    {
    if(Convert.ToInt32(dr.GetValue(17).ToString())==1)
    Che3.Checked=true;
    else
    Che3.Checked=false;
    }
    catch
    {
    Che3.Checked=false;
    }

    try
    {
    L001.Text=dr.GetValue(33).ToString();
    }
    catch
    {
    }
    try
    {
    L002.Text=dr.GetValue(34).ToString();
    }
    catch
    {
    }
    Te18.Text="";
    Te18.Text="";
    try 
    {
    if(Convert.ToInt32(dr.GetValue(18).ToString())==1)
    {
    Te18.Text="同意";
    }
    if(Convert.ToInt32(dr.GetValue(18).ToString())==2)
    {
    Te18.Text="不同意";
    }
    }
    catch
    {
    }
    if(Te1.Text.Trim().Substring(0,3)=="012")
    {
    try
    {
    L001.Text=L001.Text+"  "+dr.GetValue(51).ToString();
    }
    catch
    {
    }
    try
    {
    if(Convert.ToInt32(dr.GetValue(52).ToString())==1)
    {
    Te18.Text=Te18.Text+"  同意";
    }
    if(Convert.ToInt32(dr.GetValue(52).ToString())==2)
    {
    Te18.Text=Te18.Text+"  不同意";
    }
    }
    catch
    {
    }
    }
    //商务经理审批
    Te19.Text="";
    try 
    {
    if(Convert.ToInt32(dr.GetValue(19).ToString())==1)
    {
    Te19.Text="同意";
    }
    if(Convert.ToInt32(dr.GetValue(19).ToString())==2)
    {
    Te19.Text="不同意";
    }
    }
    catch
    {
    } //身份认证
    if(Convert.ToInt32(opendatabase("Step","Flow",Session["UserName"].ToString().Trim(),"PersonEN"))<=0)
    {
    //无权查看
    Panel1.Visible=false;
    Panel2.Visible=false;
    Panel3.Visible=false;
    Panel4.Visible=false;
    Sata.Visible=true;
    Sata.Text="您无权查看!";
    }
    else
    {


    try
    {
    L101.Text=dr.GetValue(35).ToString();
    }
    catch
    {
    }
    try
    {
    L201.Text=dr.GetValue(36).ToString();
    }
    catch
    {
    }
    try
    {
    L301.Text=dr.GetValue(37).ToString();
    }
    catch
    {
    }
    try
    {
    L401.Text=dr.GetValue(38).ToString();
    }
    catch
    {
    } int checking=Convert.ToInt32(opendatas(Session["UserName"].ToString(),6,"Crm","NaEN")); //Crm中的Role角色
    int equas=Convert.ToInt32(opendatabase("Step","Flow",Session["UserName"].ToString().Trim(),"PersonEN"));//审批流程中的审批级别 1:商务部经理审批;2:主管部门经理审批;3:主管经理审批;4:总经理审批
    if(checking<=7)
    {
    //项目经理审批
    Te18.Text="";
    Te18.Text="";
    try 
    {
    if(Convert.ToInt32(dr.GetValue(18).ToString())==1)
    {
    Te18.Text="同意";
    }
    if(Convert.ToInt32(dr.GetValue(18).ToString())==2)
    {
    Te18.Text="不同意";
    }
    }
    catch
    {
    }

    //商务经理审批
    Te19.Text="";
    try 
    {
    if(Convert.ToInt32(dr.GetValue(19).ToString())==1)
    {
    Te19.Text="同意";
    }
    if(Convert.ToInt32(dr.GetValue(19).ToString())==2)
    {
    Te19.Text="不同意";
    }
    }
    catch
    {
    }

    if(equas==1)
    {
    //商务部经理级别
    Panel1.Visible=true;
    Panel2.Visible=false;
    Panel3.Visible=false;
    Panel4.Visible=false;
    But01.Visible=true;
    But01.Enabled=false;
    try
    {
    if(Convert.ToInt32(dr.GetValue(20).ToString())==2 || Convert.ToInt32(dr.GetValue(20).ToString())==1)
    {
    if(opendatas(Te1.Text.Trim(),35,"CaptialPlanTable","Noid").Trim()==Session["CNName"].ToString().Trim())
    {
    Te101.Text=dr.GetValue(21).ToString();
    Te101.TextMode=System.Web.UI.WebControls.TextBoxMode.MultiLine;
    Te101.Visible=true;
    Te101.BackColor=System.Drawing.Color.Transparent;
    Te101.BorderStyle=System.Web.UI.WebControls.BorderStyle.None;
    Te101.ForeColor=System.Drawing.Color.White;
    Che101.Visible=false;

    L101.Text=dr.GetValue(35).ToString();
    if(Convert.ToInt32(dr.GetValue(20).ToString())==1)
    {
    Che11.Checked=true;
    Che12.Checked=false;
    }
    else
    {
    Che12.Checked=true;
    Che11.Checked=false;
    }
    Che11.Enabled=false;
    Che12.Enabled=false;

    But01.Enabled=false;
    return;
    }
    else
    {
    Te101.Text="已批";
    Te101.TextMode=System.Web.UI.WebControls.TextBoxMode.SingleLine;
    Te101.Visible=true;
    Che101.Visible=false;
    Che11.Visible=false;
    Che12.Visible=false;

    L101.Text=dr.GetValue(35).ToString(); }
    return;
    }
    else
    {
    Che11.Visible=false;
    Che12.Visible=false;
    Te101.Visible=true;
    Che101.Visible=true;
    Sata.Text="尚未审批!";
    But01.Enabled=true;
    L101.Text=Session["CNName"].ToString();
    return;
    }
    }
    catch
    {
    Che11.Visible=false;
    Che12.Visible=false;
    Te101.Visible=true;
    Che101.Visible=true;
    Sata.Text="尚未审批!";
    But01.Enabled=true;
    L101.Text=Session["CNName"].ToString();
    return;
    }
    }
    if(equas==2)
    {
    //部门经理级别
    Panel2.Visible=true;
    Panel1.Visible=false;
    Panel3.Visible=false;
    Panel4.Visible=false;
    But02.Visible=true;
    But02.Enabled=false;
    try
    {
    if(Convert.ToInt32(dr.GetValue(22).ToString())==2 || Convert.ToInt32(dr.GetValue(22).ToString())==1)
    {
    if(opendatas(Te1.Text.Trim(),36,"CaptialPlanTable","Noid").Trim()==Session["CNName"].ToString().Trim())
    { Te201.Text=dr.GetValue(23).ToString();
    Te201.TextMode=System.Web.UI.WebControls.TextBoxMode.MultiLine;
    Te201.BackColor=System.Drawing.Color.Transparent;
    Te201.BorderStyle=System.Web.UI.WebControls.BorderStyle.None;
    Te201.ForeColor=System.Drawing.Color.White;
    Te201.Visible=true;
    Che201.Visible=false;
    if(Convert.ToInt32(dr.GetValue(22).ToString())==1)
    {
    Che21.Checked=true;
    Che22.Checked=false;
    }
    else
    {
    Che22.Checked=true;
    Che21.Checked=false;
    }
      

  3.   

    Che21.Enabled=false;
    Che22.Enabled=false; Che21.Visible=true;
    Che22.Visible=true;
    But02.Enabled=false;
    return;
    }
    else
    {
    Te201.Text="已批";
    Te201.TextMode=System.Web.UI.WebControls.TextBoxMode.SingleLine;

    Te201.Visible=true;
    Che201.Visible=false;
    Che21.Visible=false;
    Che22.Visible=false;
    But02.Enabled=false;
    return; }
    }
    else
    {
    Che21.Visible=false;
    Che22.Visible=false;
    Te201.Visible=true;
    Che201.Visible=true;
    L201.Text=Session["CNName"].ToString().Trim();
    But02.Enabled=true;
    return;
    }
    }
    catch
    {
    Che21.Visible=false;
    Che22.Visible=false;
    Te201.Visible=true;
    Che201.Visible=true;
    L201.Text=Session["CNName"].ToString().Trim();
    But02.Enabled=true;
    return;
    }
    }
    // Response.Write("<script>window.alert('3!');</script>");
    }
    else
    {
    //主管经理及以上级别
    //项目经理审批意见
    Te18.Text="";
    try 
    {
    if(Convert.ToInt32(dr.GetValue(18).ToString())==1)
    {
    Te18.Text="同意";
    }
    if(Convert.ToInt32(dr.GetValue(18).ToString())==2)
    {
    Te18.Text="不同意";
    }
    }
    catch
    {
    }

    //商务经理审批
    Te19.Text="";
    try 
    {
    if(Convert.ToInt32(dr.GetValue(19).ToString())==1)
    {
    Te19.Text="同意";
    }
    if(Convert.ToInt32(dr.GetValue(19).ToString())==2)
    {
    Te19.Text="不同意";
    }
    }
    catch
    {
    } //主管经理及以上人员审批
    Panel1.Visible=false;
    Panel2.Visible=false;
    Panel3.Visible=true;
    Panel4.Visible=true;
    But03.Visible=true;
    But03.Enabled=false;


    if(equas==3 || equas==4)
    {
    //主管经理审批
    Panel3.Visible=true;
    if(Session["CNName"].ToString().Trim()=="李建忠")
    {

    But03.Visible=true;
    ListButton11.Visible=false;
    // try

    try
    {
    if(Convert.ToInt32(dr.GetValue(24).ToString())==2 || Convert.ToInt32(dr.GetValue(24).ToString())==1)
    {
    //主管经理级已审批
    try
    {
    if(Convert.ToInt32(dr.GetValue(26).ToString())==2 || Convert.ToInt32(dr.GetValue(26).ToString())==1)
    {
    //总经理级审批
    Panel4.Visible=true;
    Te401.Text=dr.GetValue(27).ToString();
    Te401.TextMode=System.Web.UI.WebControls.TextBoxMode.MultiLine;
    Te401.BackColor=System.Drawing.Color.Transparent;
    Te401.BorderStyle=System.Web.UI.WebControls.BorderStyle.None;
    Te401.ForeColor=System.Drawing.Color.White;
    Te401.Visible=true;
    Che401.Visible=false; if(Convert.ToInt32(dr.GetValue(26).ToString())==1)
    {
    Che41.Checked=true;
    Che42.Checked=false;
    }
    else
    {
    Che42.Checked=true;
    Che41.Checked=false;
    }
    Che41.Enabled=false;
    Che42.Enabled=false;
    Che41.Visible=true;
    Che42.Visible=true;
    return;
    }
    else
    {
    Panel4.Visible=true;
    Che41.Visible=false;
    Che42.Visible=false;
    Te401.Visible=true;
    Che401.Visible=true;
    L401.Text=Session["CNName"].ToString().Trim();
    But03.Visible=false;
    But04.Visible=true;
    But04.Enabled=true;
    return;
    }
    }
    catch
    {

    Panel4.Visible=true;
    Che41.Visible=false;
    Che42.Visible=false;
    Te401.Visible=true;
    Che401.Visible=true;
    L401.Text=Session["CNName"].ToString().Trim();
    But03.Visible=false;
    But04.Visible=true;
    But04.Enabled=true;
    return;
    }
    }
    else
    {
    Panel4.Visible=false;
    Che31.Visible=false;
    Che32.Visible=false;
    Te301.Visible=true;
    Che301.Visible=true;
    Label3.Visible=true;
    // Label3.Text="尚未审批!";
    L301.Text=Session["CNName"].ToString().Trim();
    But03.Enabled=true;
    ListButton11.Visible=true;
    return;
    }
    }
    catch
    {
    Panel4.Visible=false;
    Che31.Visible=false;
    Che32.Visible=false;
    Te301.Visible=true;
    Che301.Visible=true;
    Label3.Visible=true;
    // Label3.Text="尚未审批!";
    L301.Text=Session["CNName"].ToString().Trim();
    But03.Enabled=true;
    ListButton11.Visible=true;
    return; }
    }
    else
    {

    Panel1.Visible=false;
    Panel2.Visible=false;
    Panel4.Visible=false;
    Panel3.Visible=true;
    But03.Visible=true;
    // Response.Write("<script>window.alert('主管经理审批!');</script>");
    try
    {
    if(Convert.ToInt32(dr.GetValue(24).ToString())==2 || Convert.ToInt32(dr.GetValue(24).ToString())==1)
    {
    Te301.Text=dr.GetValue(25).ToString();
    Te301.TextMode=System.Web.UI.WebControls.TextBoxMode.MultiLine;
    Te301.BackColor=System.Drawing.Color.Transparent;
    Te301.Visible=true;
    Che301.Visible=false;
    Te301.BorderStyle=System.Web.UI.WebControls.BorderStyle.None;
    Te301.ForeColor=System.Drawing.Color.White; if(Convert.ToInt32(dr.GetValue(24).ToString())==1)
    {
    Che31.Checked=true;
    Che32.Checked=false;
    }
    else
    {
    Che32.Checked=true;
    Che31.Checked=false;
    }
    Che31.Enabled=false;
    Che32.Enabled=false;
    Che31.Visible=true;
    Che32.Visible=true; But03.Enabled=false;
    return;
    }
    else
    {
    Che31.Visible=false;
    Che32.Visible=false;
    Te301.Visible=true;
    Che301.Visible=true;
    Label3.Visible=true;
    // Label3.Text="尚未审批!";
    Label3.ForeColor=System.Drawing.Color.Red;
    // Label3.Font.Bold=true;
    L301.Text=Session["CNName"].ToString().Trim();
    But03.Enabled=true;
    return;
    }
    }
    catch
    {
    Che31.Visible=false;
    Che32.Visible=false;
    Te301.Visible=true;
    Che301.Visible=true;
    Label3.Visible=true;
    // Label3.Text="尚未审批!";
    Label3.ForeColor=System.Drawing.Color.Red;
    // Label3.Font.Bold=true;
    L301.Text=Session["CNName"].ToString().Trim();
    But03.Enabled=true;
    return;
    }
    }
    }
    }
    }
    //备注字段

    }
    dr.Close();
    objCommand.Connection.Close();
    }