WFCheckPrjAccept.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:94k
源码类别:

.net编程

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using com.etong.Inform;
  12. using com.etong.BusinessRule.Zwf;
  13. using com.etong.Model;
  14. using com.etong.DBUtility;
  15. using com.etong.user;
  16. using com.etong.DAL;
  17. using com.etong.Utility;
  18. using DocMergerComponent;
  19. using com.etong.DAL.FC;
  20. public partial class Workflow_WFCheckPrjAccept : System.Web.UI.Page
  21. {
  22.     protected int userid = -1;
  23.     protected int wfid = -1;//当前工作流ID
  24.     protected int MustChooseItem = -1;//必选项
  25.     protected int ActivityID = -1;//活动ID
  26.     protected int WFInstanceID = -1;//工作流实例ID
  27.     //protected int actinstanceid = -1;//活动实例ID
  28.     protected int ActID = -1;//活动实例ID  
  29.     protected int iDepID = -1;
  30.     protected int iEmpID = -1; //当前员工ID
  31.     protected string sAccount = "";
  32.     protected string sEmpName = "";
  33.     protected int PrjID = -1;
  34.     protected string PrjChSort = "";
  35.     protected void Page_Load(object sender, EventArgs e)
  36.     {
  37.         if (!IsPostBack)
  38.         {
  39.             int year = Convert.ToInt32(DateTime.Now.Year.ToString());
  40.             ddl_nf.Items.Insert(0, new ListItem("--请选择--", "0"));
  41.             //nf.Items.Insert(0, new ListItem("--请选择--", "0"));
  42.             for (int i = 1; i <= 6; i++, year++)
  43.             {
  44.                 ddl_nf.Items.Insert(i, new ListItem((year.ToString() + "年"), year.ToString()));
  45.                 //nf.Items.Insert(i, new ListItem((year.ToString() + "年"), year.ToString()));
  46.             }
  47.             string path = Server.MapPath("doc").Replace("\", "\\");
  48.             this.BT_OpenDocument_JcCKName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('JcCKName').value,false);");
  49.             this.BT_OpenDocument_JcRKName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('JcRKName').value,false);");
  50.             this.BT_OpenDocument_CwTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('CwTransactor').value,false);");
  51.             this.BT_OpenDocument_WzTransatctor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('WzTransatctor').value,false);");
  52.             this.BT_OpenDocument_ZgTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('ZgTransactor').value,false);");
  53.             this.BT_OpenDocument_ZgGdTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('ZgGdTransactor').value,false);");
  54.             this.BT_OpenDocument_GcglTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('GcglFname').value,false);");
  55.             ArrayList alfp = EtongZwf.GetSFileNamePerm(iEmpID);        //授与编辑权限的文件集合
  56.             for (int i = 0; i < alfp.Count; i++)
  57.             {
  58.                 string[] str = alfp[i].ToString().Trim().Split(new Char[] { '.' });
  59.                 int JC = JcCKName.Text.IndexOf(str[0].Trim(), 0);
  60.                 int JR = JcRKName.Text.IndexOf(str[0].Trim(), 0);
  61.                 int CT = CwTransactor.Text.IndexOf(str[0].Trim(), 0);
  62.                 int WT = WzTransatctor.Text.IndexOf(str[0].Trim(), 0);
  63.                 int ZT = ZgTransactor.Text.IndexOf(str[0].Trim(), 0);
  64.                 int ZGT = ZgGdTransactor.Text.IndexOf(str[0].Trim(), 0);
  65.                 int GT = GcglFname.Text.IndexOf(str[0].Trim(), 0);
  66.                 
  67.                 if (JC >= 0)
  68.                 {
  69.                     this.BT_OpenDocument_JcCKName.Text = "打开电子文档";
  70.                     this.BT_OpenDocument_JcCKName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('JcCKName').value,true);");
  71.                 }
  72.                 if (JR >= 0)
  73.                 {
  74.                     this.BT_OpenDocument_JcRKName.Text = "打开电子文档";
  75.                     this.BT_OpenDocument_JcRKName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('JcRKName').value,true);");
  76.                 }
  77.                 if (CT >= 0)
  78.                 {
  79.                     this.BT_OpenDocument_CwTransactor.Text = "打开电子文档";
  80.                     this.BT_OpenDocument_CwTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('CwTransactor').value,true);");
  81.                 }
  82.                 if (WT >= 0)
  83.                 {
  84.                     this.BT_OpenDocument_WzTransatctor.Text = "打开电子文档";
  85.                     this.BT_OpenDocument_WzTransatctor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('WzTransatctor').value,true);");
  86.                 }
  87.                 if (ZT >= 0)
  88.                 {
  89.                     this.BT_OpenDocument_ZgTransactor.Text = "打开电子文档";
  90.                     this.BT_OpenDocument_ZgTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('ZgTransactor').value,true);");
  91.                 }
  92.                 if (ZGT >= 0)
  93.                 {
  94.                     this.BT_OpenDocument_ZgGdTransactor.Text = "打开电子文档";
  95.                     this.BT_OpenDocument_ZgGdTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('ZgGdTransactor').value,true);");
  96.                 }
  97.                 if (GT >= 0)
  98.                 {
  99.                     this.BT_OpenDocument_GcglTransactor.Text = "打开电子文档";
  100.                     this.BT_OpenDocument_GcglTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('GcglFname').value,true);");
  101.                 }
  102.             }
  103.         }
  104.         //this.ddl_nf.SelectedValue = "0";
  105.         //this.ddl_jd.SelectedValue = "0";
  106.         this.JcCKName.Enabled = false;
  107.         //this.JcHZName.Enabled = false;
  108.         //this.JcQDName.Enabled = false;
  109.         this.JcRKName.Enabled = false;
  110.         this.CwTransactor.Enabled = false;
  111.         this.WzTransatctor.Enabled = false;
  112.         this.ZgTransactor.Enabled = false;
  113.         this.ZgGdTransactor.Enabled = false;
  114.         this.zghuizong.Enabled = false;
  115.         this.GcglFname.Enabled = false;
  116.         huizong.Enabled = false;
  117.         //this.GcglTransactor.Enabled = false;        
  118.         try
  119.         {
  120.             CheckUserInfo RoInfo = (CheckUserInfo)Session["checkuserinfo"];
  121.             iDepID = RoInfo.OrgID;
  122.             userid = RoInfo.UserID;
  123.             iEmpID = RoInfo.EmpID;
  124.             sAccount = RoInfo.UserAccount;
  125.             sEmpName = RoInfo.EmpName;
  126.         }
  127.         catch
  128.         {
  129.             this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:您尚未登录或您登录已超时,请重新登录!');top.location.href='../login.aspx';", true);
  130.         }
  131.         try //徐秀梅加:Start
  132.         {
  133.             string projectid = Request.QueryString["ProjectID"].ToString().Trim();  //??
  134.             if (projectid != "")
  135.             {
  136.                 ddl_nf.Enabled = false;
  137.                 ddl_jd.Enabled = false;
  138.                 GcglTransactor.Enabled = false;
  139.                 PN_Button.Visible = false;               
  140.                 //GcglGdTransactor.Enabled = false;
  141.                // ZgGdTransactor.Enabled = false;             
  142.                ((HtmlInputHidden)this.FindControl("txt_ProjectID")).Value = projectid;
  143.                DataView dv = GetPrjchInfo(Convert.ToInt32(projectid));
  144.                if (dv != null && dv.Count > 0)
  145.                {
  146.                    this.TB_ConName.Text = dv[0]["PrjchName"].ToString();
  147.                    this.TB_ConName.Enabled = false;
  148.                    this.ddl_nf.SelectedValue = dv[0]["nf"].ToString();
  149.                    this.ddl_jd.SelectedValue = dv[0]["jd"].ToString();
  150.                    //this.BT_OpenDocument_JcCKName.Enabled = false;
  151.                    //this.BT_OpenDocument_JcRKName.Enabled = false;
  152.                    //this.BT_OpenDocument_CwTransactor.Enabled = false;
  153.                    //this.BT_OpenDocument_WzTransatctor.Enabled = false;
  154.                    //this.BT_OpenDocument_ZgTransactor.Enabled = false;
  155.                    //this.BT_OpenDocument_ZgGdTransactor.Enabled = false;                   
  156.                    this.GcglFname.Text = dv[0]["GcglFname"].ToString();
  157.                    //this.JcCKName.Text = dv[0]["JcCKName"].ToString();
  158.                    //this.JcRKName.Text = dv[0]["JcRKName"].ToString();
  159.                    //this.JcQDName.Text = dv[0]["JcQDName"].ToString();
  160.                    //this.JcHZName.Text = dv[0]["JcHZName"].ToString();
  161.                    this.CwTransactor.Text = dv[0]["CwFName"].ToString();
  162.                    this.WzTransatctor.Text = dv[0]["WzFName"].ToString();
  163.                    this.ZgTransactor.Text = dv[0]["ZgZlFName"].ToString();
  164.                    this.GcglTransactor.Text = dv[0]["GcglGdContect"].ToString();
  165.                    //this.GcglGdTransactor.Text = dv[0]["GcglGdContect"].ToString();
  166.                    this.ZgGdTransactor.Text = dv[0]["ZgGdContect"].ToString();
  167.                }              
  168.             }
  169.         } //徐秀梅加:End
  170.         catch
  171.         {
  172.             string MustChooseItemtxt = Request.QueryString["MustChooseItem"].ToString().Trim();
  173.             ((HtmlInputHidden)this.FindControl("txt_MustChooseItem")).Value = MustChooseItemtxt;
  174.             MustChooseItem = Convert.ToInt16(MustChooseItemtxt);
  175.             string ActivityIDtxt = Request.QueryString["ActivityID"].ToString().Trim();
  176.             string WFInstanceIDtxt = Request.QueryString["WFInstanceID"].ToString().Trim();
  177.             string WFIDtxt = Request.QueryString["WFID"].ToString().Trim();
  178.             wfid = Convert.ToInt16(WFIDtxt);
  179.             EtongZwf etongzwf = new EtongZwf();
  180.             ActivityID = Convert.ToInt32(ActivityIDtxt);
  181.             if (!IsPostBack)
  182.             {
  183.                 ((HtmlInputHidden)this.FindControl("txt_ProjectID")).Value = "-1";
  184.             }
  185.             if (Convert.ToInt32(WFInstanceIDtxt) != -1)
  186.             {
  187.                 ((HtmlInputHidden)this.FindControl("txt_WFInstanceID")).Value = WFInstanceIDtxt;
  188.                 WFInstanceID = Convert.ToInt32(WFInstanceIDtxt);
  189.                 DataView dvInstance = etongzwf.WFInstanceGetAll(WFInstanceID);
  190.                 ((HtmlInputHidden)this.FindControl("txt_ProjectID")).Value = dvInstance[0][9].ToString();
  191.                 this.wfid = Convert.ToInt32(dvInstance[0][8].ToString().Trim());
  192.                 this.PrjID = Convert.ToInt32(((HtmlInputHidden)this.FindControl("txt_ProjectID")).Value.ToString());
  193.             }
  194.             string path = Server.MapPath("doc").Replace("\", "\\");
  195.             BT_Pass.Attributes.Add("OnClientClick", "javascript:if(confirm('确定要退出吗?')) {window.close();return;} else {return;}");
  196.             ArrayList al = new ArrayList();
  197.             //Page.ClientScript.RegisterStartupScript(GetType(),"","<script>alert('"+ddl_nf.SelectedValue.ToString()+"');</script>");
  198.             //return;
  199.             switch (MustChooseItem)
  200.             {
  201.                 case 47:
  202.                     if (!this.Page.IsPostBack)
  203.                     {
  204.                         Application.Visible = false;
  205.                         Pn_CL_HZ.Visible = false;
  206.                         Pn_CW.Visible = false;
  207.                         Pn_JG_JC.Visible = false;
  208.                         Pn_WZ.Visible = false;
  209.                         Pn_ZG_GD.Visible = false;
  210.                     }
  211.                     break;
  212.                 case 40:                        //剩余材料上报
  213.                    // Pn_CL_GD.Visible = false;
  214.                     Application.Visible = true;
  215.                     Pn_CL_HZ.Visible = false;
  216.                     Pn_CW.Visible = false;
  217.                     Pn_JG_JC.Visible = false;
  218.                     Pn_WZ.Visible = false;
  219.                     Pn_ZG_GD.Visible = false;
  220.                     ddl_nf.Enabled = false;
  221.                     ddl_jd.Enabled = false;
  222.                     //this.BT_OpenDocument_JcCKName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('JcCKName').value);");
  223.                     //this.BT_OpenDocument_JcRKName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('JcRKName').value);");
  224.                     //this.BT_OpenDocument_JcQDName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('JcQDName').value);");
  225.                     //this.BT_OpenDocument_JcHZName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('JcHZName').value);");
  226.                     //PN_Button.Visible = false;                   
  227.                     //string YFname=GetFName()+".doc";             
  228.                     if (!this.Page.IsPostBack)
  229.                     {
  230.                         al = GetFName();
  231.                         if (al.Count > 0)
  232.                         {
  233.                             this.JcCKName.Text = al[0] + ".doc";
  234.                             //string fullpath = path + GetFName() + ".doc";                   
  235.                             string Fname = al[0].ToString() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
  236.                             if (!Util.Copyfile(path + "\" + this.JcCKName.Text, path + "\DocTemplateChe\" + Fname))
  237.                             {
  238.                                 Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
  239.                                 return;
  240.                             }
  241.                             this.JcCKName.Text = Fname;
  242.                             //this.JcHZName.Text = al[1] + ".doc";
  243.                             ////string fullpath = path + GetFName() + ".doc";                   
  244.                             //Fname = al[1].ToString() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
  245.                             //if (!Util.Filecopy(path + "\" + this.JcHZName.Text, path + "\DocTemplateChe\" + Fname))
  246.                             //{
  247.                             //    Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
  248.                             //    return;
  249.                             //}
  250.                             //this.JcHZName.Text = Fname;
  251.                             //this.JcQDName.Text = al[2] + ".doc";
  252.                             ////string fullpath = path + GetFName() + ".doc";                   
  253.                             //Fname = al[2].ToString() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
  254.                             //if (!Util.Filecopy(path + "\" + this.JcQDName.Text, path + "\DocTemplateChe\" + Fname))
  255.                             //{
  256.                             //    Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
  257.                             //    return;
  258.                             //}
  259.                             //this.JcQDName.Text = Fname;
  260.                             this.JcRKName.Text = al[1] + ".doc";
  261.                             //string fullpath = path + GetFName() + ".doc";                   
  262.                             Fname = al[1].ToString() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
  263.                             if (!Util.Copyfile(path + "\" + this.JcRKName.Text, path + "\DocTemplateChe\" + Fname))
  264.                             {
  265.                                 Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
  266.                                 return;
  267.                             }
  268.                             this.JcRKName.Text = Fname;
  269.                         }
  270.                     }  
  271.                     DataView dv = GetPrjchInfo(this.PrjID);
  272.                     if (dv != null && dv.Count > 0)
  273.                     {
  274.                         this.TB_ConName.Text = dv[0]["PrjchName"].ToString();
  275.                         this.TB_ConName.Enabled = false;
  276.                         this.ddl_nf.SelectedValue = dv[0]["nf"].ToString();
  277.                         this.ddl_jd.SelectedValue = dv[0]["jd"].ToString();
  278.                     }
  279.                     break;
  280.                 case 41:                        //财务进账                                               
  281.                     //Application.Visible = false;
  282.                     //Pn_CL_GD.Visible = false;
  283.                     Pn_CL_HZ.Visible = false;
  284.                     //Pn_CW.Visible = false;
  285.                     Pn_JG_JC.Visible = false;
  286.                     Pn_WZ.Visible = false;
  287.                     ddl_nf.Enabled = false;
  288.                     ddl_jd.Enabled = false;
  289.                     Pn_ZG_GD.Visible = false;
  290.                     //this.BT_OpenDocument_JcCKName.Text = "浏览电子文档";
  291.                     //this.BT_OpenDocument_JcCKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcCKName').value);");
  292.                     //this.BT_OpenDocument_JcRKName.Text = "浏览电子文档";
  293.                     //this.BT_OpenDocument_JcRKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcRKName').value);");
  294.                     //this.BT_OpenDocument_JcQDName.Text = "浏览电子文档";
  295.                     //this.BT_OpenDocument_JcQDName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcQDName').value);");
  296.                     //this.BT_OpenDocument_JcHZName.Text = "浏览电子文档";
  297.                     //this.BT_OpenDocument_JcHZName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcHZName').value);");
  298.                     //this.BT_OpenDocument_CwTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('CwTransactor').value);");
  299.                     dv = GetPrjchInfo(this.PrjID);
  300.                     if (dv != null && dv.Count > 0)
  301.                     {
  302.                         this.TB_ConName.Text = dv[0]["PrjchName"].ToString();
  303.                         this.TB_ConName.Enabled = false;
  304.                         this.JcCKName.Text = dv[0]["JcCKName"].ToString();
  305.                         this.JcRKName.Text = dv[0]["JcRKName"].ToString();
  306.                         //this.JcQDName.Text = dv[0]["JcQDName"].ToString();
  307.                         //this.JcHZName.Text = dv[0]["JcHZName"].ToString();
  308.                         this.ddl_nf.SelectedValue = dv[0]["nf"].ToString();
  309.                         this.ddl_jd.SelectedValue = dv[0]["jd"].ToString();
  310.                         this.ShowOperatorAndTime_CWjinzhang.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["JcTransactor"].ToString() + "</font></div>";
  311.                     }
  312.                     if (!this.Page.IsPostBack)
  313.                     {
  314.                         al = GetFName();
  315.                         if (al.Count > 0)
  316.                         {
  317.                             this.CwTransactor.Text = al[0].ToString() + ".xls";
  318.                             string Fname = al[0].ToString() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".xls";
  319.                             if (!Util.Copyfile(path + "\" + this.CwTransactor.Text, path + "\DocTemplateChe\" + Fname))
  320.                             {
  321.                                 Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
  322.                                 return;
  323.                             }
  324.                             this.CwTransactor.Text = Fname;
  325.                         }
  326.                     }
  327.                     
  328.                     //PN_Button.Visible = false;
  329.                     break;
  330.                 case 42:                        //物资管理上报
  331.                     //Application.Visible = false;
  332.                     //Pn_CL_GD.Visible = false;
  333.                     huizong.Enabled = true;
  334.                     Pn_CL_HZ.Visible = false;
  335.                     //Pn_CW.Visible = false;
  336.                     Pn_JG_JC.Visible = false;
  337.                     ddl_nf.Enabled = false;
  338.                     ddl_jd.Enabled = false;
  339.                     //Pn_WZ.Visible = false;
  340.                     Pn_ZG_GD.Visible = false;
  341.                     //PN_Button.Visible = false;             
  342.                     //this.BT_OpenDocument_JcCKName.Text = "浏览电子文档";
  343.                     //this.BT_OpenDocument_JcCKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcCKName').value);");
  344.                     //this.BT_OpenDocument_JcRKName.Text = "浏览电子文档";
  345.                     //this.BT_OpenDocument_JcRKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcRKName').value);");
  346.                     //this.BT_OpenDocument_JcQDName.Text = "浏览电子文档";
  347.                     //this.BT_OpenDocument_JcQDName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcQDName').value);");
  348.                     //this.BT_OpenDocument_JcHZName.Text = "浏览电子文档";
  349.                     //this.BT_OpenDocument_JcHZName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcHZName').value);");
  350.                     //this.BT_OpenDocument_CwTransactor.Text = "浏览电子文档";
  351.                     //this.BT_OpenDocument_CwTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('CwTransactor').value);");
  352.                    // this.BT_OpenDocument_WzTransatctor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('WzTransatctor').value);");
  353.                     dv = GetPrjchInfo(this.PrjID);
  354.                     if (dv != null && dv.Count > 0)
  355.                     {
  356.                         this.TB_ConName.Text = dv[0]["PrjchName"].ToString();
  357.                         this.TB_ConName.Enabled = false;
  358.                         this.JcCKName.Text = dv[0]["JcCKName"].ToString();
  359.                         this.JcRKName.Text = dv[0]["JcRKName"].ToString();
  360.                         //this.JcQDName.Text = dv[0]["JcQDName"].ToString();
  361.                         //this.JcHZName.Text = dv[0]["JcHZName"].ToString();
  362.                         this.CwTransactor.Text = dv[0]["CwFName"].ToString();
  363.                         this.ddl_nf.SelectedValue = dv[0]["nf"].ToString();
  364.                         this.ddl_jd.SelectedValue = dv[0]["jd"].ToString();
  365.                         this.ShowOperatorAndTime_CWjinzhang.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["JcTransactor"].ToString() + "</font></div>";
  366.                         this.ShowOperatorAndTime_WZmanager.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["CwTransactor"].ToString() + "</font></div>";
  367.                     }
  368.                     string year = ddl_nf.SelectedValue.ToString();
  369.                     string selectjd = ddl_jd.SelectedValue.ToString();
  370.                     /******************************************
  371.                     *                取名
  372.                     * *****************************************/
  373.                     al = GetFName();
  374.                     string hzname = "";
  375.                     if (al.Count > 0)
  376.                     {
  377.                         this.WzTransatctor.Text = al[0].ToString() + year + selectjd + ".doc";
  378.                         hzname = al[0].ToString() + ".doc";
  379.                     }
  380.                     //string path = Server.MapPath("doc").Replace("\", "\\") + "\\DocTemplateChe\\";
  381.                     //prjcheck = new PrjCheck();
  382.                     string filename = Server.MapPath("doc").Replace("\", "\\") + "\\DocTemplateChe\\" + this.WzTransatctor.Text;
  383.                     //Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + filename + "');</script>");
  384.                     //return;
  385.                     //判断文件名是否存在
  386.                     if (!System.IO.File.Exists(filename))
  387.                     {
  388.                         if (!Util.Copyfile(path + "\" + hzname, path + "\DocTemplateChe\" + this.WzTransatctor.Text))
  389.                         {
  390.                             Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
  391.                             return;
  392.                         }
  393.                     }                                 
  394.                     break;
  395.                 case 43:                        //竣工检查上报
  396.                     //Application.Visible = false;
  397.                     //Pn_CL_GD.Visible = false;                   
  398.                     Pn_CL_HZ.Visible = false;
  399.                     ddl_nf.Enabled = false;
  400.                     ddl_jd.Enabled = false;                    
  401.                     //Pn_CW.Visible = false;
  402.                     //Pn_JG_JC.Visible = false;
  403.                     //Pn_WZ.Visible = false;
  404.                     Pn_ZG_GD.Visible = false;
  405.                     //this.BT_OpenDocument_JcCKName.Text = "浏览电子文档";
  406.                     //this.BT_OpenDocument_JcCKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcCKName').value);");
  407.                     //this.BT_OpenDocument_JcRKName.Text = "浏览电子文档";
  408.                     //this.BT_OpenDocument_JcRKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcRKName').value);");
  409.                     //this.BT_OpenDocument_JcQDName.Text = "浏览电子文档";
  410.                     //this.BT_OpenDocument_JcQDName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcQDName').value);");
  411.                     //this.BT_OpenDocument_JcHZName.Text = "浏览电子文档";
  412.                     //this.BT_OpenDocument_JcHZName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcHZName').value);");
  413.                     //this.BT_OpenDocument_CwTransactor.Text = "浏览电子文档";
  414.                     //this.BT_OpenDocument_CwTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('CwTransactor').value);");
  415.                     //this.BT_OpenDocument_WzTransatctor.Text = "浏览电子文档";
  416.                     //this.BT_OpenDocument_WzTransatctor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('WzTransatctor').value);");
  417.                     //this.BT_OpenDocument_ZgTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('ZgTransactor').value);");
  418.                     dv = GetPrjchInfo(this.PrjID);
  419.                     if (dv != null && dv.Count > 0)
  420.                     {
  421.                         this.TB_ConName.Text = dv[0]["PrjchName"].ToString();
  422.                         this.TB_ConName.Enabled = false;
  423.                         this.JcCKName.Text = dv[0]["JcCKName"].ToString();
  424.                         this.JcRKName.Text = dv[0]["JcRKName"].ToString();
  425.                         //this.JcQDName.Text = dv[0]["JcQDName"].ToString();
  426.                         //this.JcHZName.Text = dv[0]["JcHZName"].ToString();
  427.                         this.CwTransactor.Text = dv[0]["CwFName"].ToString();
  428.                         this.WzTransatctor.Text = dv[0]["WzFName"].ToString();
  429.                         this.ddl_nf.SelectedValue = dv[0]["nf"].ToString();
  430.                         this.ddl_jd.SelectedValue = dv[0]["jd"].ToString();
  431.                         this.ShowOperatorAndTime_CWjinzhang.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["JcTransactor"].ToString() + "</font></div>";
  432.                         this.ShowOperatorAndTime_WZmanager.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["CwTransactor"].ToString() + "</font></div>";
  433.                         this.ShowOperatorAndTime_JGjiancha.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["WzTransatctor"].ToString() + "</font></div>";
  434.                     }
  435.                     if (!this.Page.IsPostBack)
  436.                     {
  437.                         ActID = Convert.ToInt32(Request.QueryString["ActID"].ToString());
  438.                         PrjCheck prjcheck=new PrjCheck ();
  439.                         dv = prjcheck.GetStatus(ActID);
  440.                         int Status =Convert.ToInt32(dv[0]["Status"].ToString());
  441.                         if (Status == 2)
  442.                         {
  443.                             path = Server.MapPath("doc").Replace("\", "\\") + "\\DocTemplateChe\\"; 
  444.                             EtongWord EWord = new EtongWord();
  445.                             EWord.sort = 0;
  446.                             EWord.opSort = prjcheck.GetEmpType(iEmpID);
  447.                             EWord.XmlNodesNames = "XMLrecord";
  448.                             dv = GetPrjchInfo(PrjID);
  449.                             if (dv.Count > 0)
  450.                             {
  451.                                 EWord.Address =path+ dv[0]["ZgZlFName"].ToString();
  452.                             }                           
  453.                             al = EWord.ReadXMLFName();
  454.                             EtongXml alfn = (EtongXml)al[0];
  455.                             string fname = alfn.DocFileName.ToString();
  456.                             this.ZgTransactor.Text = fname;
  457.                         }
  458.                         else
  459.                         {
  460.                             al = GetFName();
  461.                             if (al.Count > 0)
  462.                             {
  463.                                 this.ZgTransactor.Text = al[0].ToString() + ".doc";
  464.                                 string Fname = al[0].ToString() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
  465.                                 if (!Util.Copyfile(path + "\" + this.ZgTransactor.Text, path + "\DocTemplateChe\" + Fname))
  466.                                 {
  467.                                     Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
  468.                                     return;
  469.                                 }
  470.                                 this.ZgTransactor.Text = Fname;
  471.                             }
  472.                         }
  473.                     }                
  474.                     break;
  475.                 case 44:                        //工程管理办公室审核
  476.                     // Application.Visible = false;
  477.                     //Pn_CL_GD.Visible = false;
  478.                     zghuizong.Enabled = true;
  479.                     ddl_nf.Enabled = false;
  480.                     ddl_jd.Enabled = false;
  481.                     BT_Untread.Visible = true;
  482.                     Pn_CL_HZ.Visible = false;
  483.                     //Pn_CW.Visible = false;
  484.                     //Pn_JG_JC.Visible = false;
  485.                     //Pn_WZ.Visible = false;
  486.                     //Pn_ZG_GD.Visible = false;
  487.                     //this.BT_OpenDocument_JcCKName.Text = "浏览电子文档";
  488.                     //this.BT_OpenDocument_JcCKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcCKName').value);");
  489.                     //this.BT_OpenDocument_JcRKName.Text = "浏览电子文档";
  490.                     //this.BT_OpenDocument_JcRKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcRKName').value);");
  491.                     //this.BT_OpenDocument_JcQDName.Text = "浏览电子文档";
  492.                     //this.BT_OpenDocument_JcQDName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcQDName').value);");
  493.                     //this.BT_OpenDocument_JcHZName.Text = "浏览电子文档";
  494.                     //this.BT_OpenDocument_JcHZName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcHZName').value);");
  495.                     //this.BT_OpenDocument_CwTransactor.Text = "浏览电子文档";
  496.                     //this.BT_OpenDocument_CwTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('CwTransactor').value);");
  497.                     //this.BT_OpenDocument_WzTransatctor.Text = "浏览电子文档";
  498.                     //this.BT_OpenDocument_WzTransatctor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('WzTransatctor').value);");
  499.                     //this.BT_OpenDocument_ZgTransactor.Text = "浏览电子文档";
  500.                     //this.BT_OpenDocument_ZgTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('ZgTransactor').value);");
  501.                     //this.BT_OpenDocument_GcglTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('GcglTransactor').value);");
  502.                     dv = GetPrjchInfo(this.PrjID);
  503.                     if (dv != null && dv.Count > 0)
  504.                     {
  505.                         this.TB_ConName.Text = dv[0]["PrjchName"].ToString();
  506.                         this.TB_ConName.Enabled = false;
  507.                         this.JcCKName.Text = dv[0]["JcCKName"].ToString();
  508.                         this.JcRKName.Text = dv[0]["JcRKName"].ToString();
  509.                         //this.JcQDName.Text = dv[0]["JcQDName"].ToString();
  510.                         //this.JcHZName.Text = dv[0]["JcHZName"].ToString();
  511.                         this.CwTransactor.Text = dv[0]["CwFName"].ToString();
  512.                         this.WzTransatctor.Text = dv[0]["WzFName"].ToString();
  513.                         this.ZgTransactor.Text = dv[0]["ZgZlFName"].ToString();
  514.                         this.ddl_nf.SelectedValue = dv[0]["nf"].ToString();
  515.                         this.ddl_jd.SelectedValue = dv[0]["jd"].ToString();
  516.                         this.ShowOperatorAndTime_CWjinzhang.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["JcTransactor"].ToString() + "</font></div>";
  517.                         this.ShowOperatorAndTime_WZmanager.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["CwTransactor"].ToString() + "</font></div>";
  518.                         this.ShowOperatorAndTime_JGjiancha.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["WzTransatctor"].ToString() + "</font></div>";
  519.                         this.ShowOperatorAndTime_HZmaterial.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["ZgTransactor"].ToString() + "</font></div>";
  520.                     }
  521.                     //以前命名的方式
  522.                     //if (!this.Page.IsPostBack)
  523.                     //{
  524.                     //    ArrayList al = GetFName();
  525.                     //    if (al.Count > 0)
  526.                     //    {
  527.                     //        this.GcglTransactor.Text = al[0].ToString() + ".doc";
  528.                     //        string Fname = al[0].ToString() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
  529.                     //        if (!Util.Filecopy(path + "\" + this.GcglTransactor.Text, path + "\DocTemplateChe\" + Fname))
  530.                     //        {
  531.                     //            Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
  532.                     //            return;
  533.                     //        }
  534.                     //        this.GcglTransactor.Text = Fname;
  535.                     //    }
  536.                     //}
  537.                     
  538.                     //PN_Button.Visible = false;
  539.                     break;
  540.                 case 45:                        //主管材料汇总
  541.                     //Application.Visible = false;
  542.                     //Pn_CL_GD.Visible = false;
  543.                     //Pn_CL_HZ.Visible = false;
  544.                     //Pn_CW.Visible = false;
  545.                     //Pn_JG_JC.Visible = false;
  546.                     //Pn_WZ.Visible = false;
  547.                     //Pn_ZG_GD.Visible = false; 
  548.                     ddl_nf.Enabled = false;
  549.                     ddl_jd.Enabled = false;                                   
  550.                     GcglTransactor.Enabled = false;
  551.                     //this.BT_OpenDocument_JcCKName.Text = "浏览电子文档";
  552.                     //this.BT_OpenDocument_JcCKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateCheChe/'+document.all('JcCKName').value);");
  553.                     //this.BT_OpenDocument_JcRKName.Text = "浏览电子文档";
  554.                     //this.BT_OpenDocument_JcRKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcRKName').value);");
  555.                     ////this.BT_OpenDocument_JcQDName.Text = "浏览电子文档";
  556.                     ////this.BT_OpenDocument_JcQDName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcQDName').value);");
  557.                     ////this.BT_OpenDocument_JcHZName.Text = "浏览电子文档";
  558.                     ////this.BT_OpenDocument_JcHZName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcHZName').value);");
  559.                     //this.BT_OpenDocument_CwTransactor.Text = "浏览电子文档";
  560.                     //this.BT_OpenDocument_CwTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('CwTransactor').value);");
  561.                     //this.BT_OpenDocument_WzTransatctor.Text = "浏览电子文档";
  562.                     //this.BT_OpenDocument_WzTransatctor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('WzTransatctor').value);");
  563.                     //this.BT_OpenDocument_ZgTransactor.Text = "浏览电子文档";
  564.                     //this.BT_OpenDocument_ZgTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('ZgTransactor').value);");
  565.                     ////this.BT_OpenDocument_GcglTransactor.Text = "浏览电子文档";
  566.                     ////this.BT_OpenDocument_GcglTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('GcglTransactor').value);");
  567.                     //this.BT_OpenDocument_ZgGdTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('ZgGdTransactor').value);");
  568.                     dv = GetPrjchInfo(this.PrjID);
  569.                     if (dv != null && dv.Count > 0)
  570.                     {
  571.                         this.TB_ConName.Text = dv[0]["PrjchName"].ToString();
  572.                         this.TB_ConName.Enabled = false;
  573.                         this.JcCKName.Text = dv[0]["JcCKName"].ToString();
  574.                         this.JcRKName.Text = dv[0]["JcRKName"].ToString();
  575.                         //this.JcQDName.Text = dv[0]["JcQDName"].ToString();
  576.                         //this.JcHZName.Text = dv[0]["JcHZName"].ToString();
  577.                         this.CwTransactor.Text = dv[0]["CwFName"].ToString();
  578.                         this.WzTransatctor.Text = dv[0]["WzFName"].ToString();
  579.                         this.ZgTransactor.Text = dv[0]["ZgZlFName"].ToString();
  580.                         this.GcglTransactor.Text = dv[0]["GcglGdContect"].ToString();
  581.                         this.GcglFname.Text = dv[0]["GcglFname"].ToString();
  582.                         this.ddl_nf.SelectedValue = dv[0]["nf"].ToString();
  583.                         this.ddl_jd.SelectedValue = dv[0]["jd"].ToString();                        
  584.                         this.ShowOperatorAndTime_CWjinzhang.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["JcTransactor"].ToString() + "</font></div>";
  585.                         this.ShowOperatorAndTime_WZmanager.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["CwTransactor"].ToString() + "</font></div>";
  586.                         this.ShowOperatorAndTime_JGjiancha.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["WzTransatctor"].ToString() + "</font></div>";
  587.                         this.ShowOperatorAndTime_HZmaterial.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["ZgTransactor"].ToString() + "</font></div>";
  588.                         this.ShowOperatorAndTime_GCmanager.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["GcglTransactor"].ToString() + "</font></div>";
  589.                     }
  590.                     if (!this.Page.IsPostBack)
  591.                     {
  592.                         al = GetFName();
  593.                         if (al.Count > 0)
  594.                         {
  595.                             this.ZgGdTransactor.Text = al[0].ToString() + ".doc";
  596.                             string Fname = al[0].ToString() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
  597.                             if (!Util.Copyfile(path + "\" + this.ZgGdTransactor.Text, path + "\DocTemplateChe\" + Fname))
  598.                             {
  599.                                 Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
  600.                                 return;
  601.                             }
  602.                             this.ZgGdTransactor.Text = Fname;
  603.                         }
  604.                     }     
  605.                     //PN_Button.Visible = false;
  606.                     break;
  607.                 //case 46:                        //主管材料归档
  608.                 //    //Application.Visible = false;
  609.                 //    //Pn_CL_GD.Visible = false;
  610.                 //    //Pn_CL_HZ.Visible = false;
  611.                 //    //Pn_CW.Visible = false;
  612.                 //    //Pn_JG_JC.Visible = false;
  613.                 //    //Pn_WZ.Visible = false;
  614.                 //    //Pn_ZG_GD.Visible = false;
  615.                 //    //this.ZgGdTransactor.Text = GetFName() + ".doc";    
  616.                 //    //this.GcglGdTransactor.Enabled = false;
  617.                 //    ddl_nf.Enabled = false;
  618.                 //    ddl_jd.Enabled = false;
  619.                 //    this.BT_OpenDocument_JcCKName.Text = "浏览电子文档";
  620.                 //    this.BT_OpenDocument_JcCKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcCKName').value);");
  621.                 //    this.BT_OpenDocument_JcRKName.Text = "浏览电子文档";
  622.                 //    this.BT_OpenDocument_JcRKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcRKName').value);");
  623.                 //    this.BT_OpenDocument_JcQDName.Text = "浏览电子文档";
  624.                 //    this.BT_OpenDocument_JcQDName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcQDName').value);");
  625.                 //    this.BT_OpenDocument_JcHZName.Text = "浏览电子文档";
  626.                 //    this.BT_OpenDocument_JcHZName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcHZName').value);");
  627.                 //    this.BT_OpenDocument_CwTransactor.Text = "浏览电子文档";
  628.                 //    this.BT_OpenDocument_CwTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('CwTransactor').value);");
  629.                 //    this.BT_OpenDocument_WzTransatctor.Text = "浏览电子文档";
  630.                 //    this.BT_OpenDocument_WzTransatctor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('WzTransatctor').value);");
  631.                 //    this.BT_OpenDocument_ZgTransactor.Text = "浏览电子文档";
  632.                 //    this.BT_OpenDocument_ZgTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('ZgTransactor').value);");
  633.                 //    this.BT_OpenDocument_GcglTransactor.Text = "浏览电子文档";
  634.                 //    this.BT_OpenDocument_GcglTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('GcglTransactor').value);");
  635.                 //    //this.BT_OpenDocument_GcglGdTransactor.Text = "浏览电子文档";
  636.                 //    //this.BT_OpenDocument_GcglGdTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl(document.all('GcglGdTransactor').value);");
  637.                 //    //this.BT_OpenDocument_ZgGdTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl(document.all('ZgGdTransactor').value);");
  638.                 //    //if (!this.Page.IsPostBack)
  639.                 //    //{
  640.                 //    //    string Fname = GetFName() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
  641.                 //    //    if (!Util.Filecopy(path + "\" + this.ZgGdTransactor.Text, path + "\DocTemplate\" + Fname))
  642.                 //    //    {
  643.                 //    //        Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
  644.                 //    //        return;
  645.                 //    //    }
  646.                 //    //    this.ZgGdTransactor.Text = Fname;
  647.                 //    //}
  648.                 //    dv = GetPrjchInfo(this.PrjID);
  649.                 //    if (dv != null && dv.Count > 0)
  650.                 //    {
  651.                 //        this.TB_ConName.Text = dv[0]["PrjchName"].ToString();
  652.                 //        this.TB_ConName.Enabled = false;
  653.                 //        this.JcCKName.Text = dv[0]["JcCKName"].ToString();
  654.                 //        this.JcRKName.Text = dv[0]["JcRKName"].ToString();
  655.                 //        this.JcQDName.Text = dv[0]["JcQDName"].ToString();
  656.                 //        this.JcHZName.Text = dv[0]["JcHZName"].ToString();
  657.                 //        this.CwTransactor.Text = dv[0]["CwFName"].ToString();
  658.                 //        this.WzTransatctor.Text = dv[0]["WzFName"].ToString();
  659.                 //        this.ZgTransactor.Text = dv[0]["ZgZlFName"].ToString();
  660.                 //        this.GcglTransactor.Text = dv[0]["GcglFName"].ToString();
  661.                 //        this.ddl_nf.SelectedValue = dv[0]["nf"].ToString();
  662.                 //        this.ddl_jd.SelectedValue = dv[0]["jd"].ToString();
  663.                 //        //this.GcglGdTransactor.Text = dv[0]["GcglGdContect"].ToString();
  664.                 //        this.ShowOperatorAndTime_CWjinzhang.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["JcTransactor"].ToString() + "</font></div>";
  665.                 //        this.ShowOperatorAndTime_WZmanager.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["CwTransactor"].ToString() + "</font></div>";
  666.                 //        this.ShowOperatorAndTime_JGjiancha.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["WzTransatctor"].ToString() + "</font></div>";
  667.                 //        this.ShowOperatorAndTime_HZmaterial.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["ZgTransactor"].ToString() + "</font></div>";
  668.                 //        this.ShowOperatorAndTime_GDmaterial.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["GcglTransactor"].ToString() + "</font></div>";
  669.                 //        //this.ShowOperatorAndTime_GCmanager.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;" + dv[0]["GcglGdTransactor"].ToString() + "</font></div>";
  670.                 //    }
  671.                 //    //PN_Button.Visible = false;
  672.                 //    break;
  673.             }           
  674.         }
  675.     }
  676.     protected DataView GetPrjchInfo(int PrjID)
  677.     {
  678.         string sql = "select * from TB_PrjCheck where [PrjChID]=" + PrjID;
  679.         DataView dv = SqlServer.GetDataView(sql);
  680.         return dv;
  681.     }
  682.     protected DataView GetPrj(string PrjChName)
  683.     {
  684.         string sql = "select * from TB_PrjCheck where PrjChName='"+PrjChName+"'";
  685.         DataView dv = SqlServer.GetDataView(sql);
  686.         return dv;
  687.     }  
  688.     /*==============================================================================================
  689.           * 
  690.           *                                    审核操作
  691.           * 
  692.           *=============================================================================================*/
  693.     protected void BT_Pass_Click(object sender, ImageClickEventArgs e)
  694.     {
  695.         int startEnd = 1;//一般任务
  696.         PrjCheck prjcheck = new PrjCheck();
  697.         PrjChSort = prjcheck.GetEmpType(iEmpID);
  698.         string path = Server.MapPath("doc").Replace("\", "\\");      //获取项目所在路径 
  699.         //******************************************************启动活动*************************************************************
  700.         if (MustChooseItem == 47)
  701.         {
  702.             EtongZwf etongzwf = new EtongZwf();
  703.             string Prjchname = this.TB_ConName.Text.Trim();
  704.             DataView dv = GetPrj(Prjchname);
  705.             if (dv.Count > 0)
  706.             {
  707.                 Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('该项目名称已经存在!');</script>");
  708.                 return;
  709.             }
  710.             string year = "";
  711.             string jd = "";
  712.             if (ddl_nf.SelectedValue == "0")
  713.             {
  714.                 Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请选择年份!');</script>");
  715.                 return;
  716.             }
  717.             else
  718.             {
  719.                 year = ddl_nf.SelectedValue.ToString();
  720.             }
  721.             if (ddl_jd.SelectedValue == "0")
  722.             {
  723.                 Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请选择季度!');</script>");
  724.                 return;
  725.             }
  726.             else
  727.             {
  728.                 jd = ddl_jd.SelectedValue.ToString();
  729.             }
  730.             PrjCheckInfo prjcheckinfo = new PrjCheckInfo(PrjID, Prjchname, PrjChSort, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 1, year, jd, "1");
  731.             int PrjChID = prjcheck.AddPrjCheck(prjcheckinfo);
  732.             int constructid = PrjChID;
  733.             DateTime SuccessDate = Convert.ToDateTime(DateTime.Now.ToShortDateString().Trim());
  734.             WFInstanceInfo wfinstanceinfo = new WFInstanceInfo(-1, Convert.ToDateTime(DateTime.Now.ToShortDateString()),
  735.                             userid, -1, -1, DateTime.Now, 3, SuccessDate, wfid, constructid);
  736.             WFInstanceID = etongzwf.WFInstanceADD(wfinstanceinfo);
  737.             dv = etongzwf.ColonyUserGetByActId(ActivityID);
  738.             int CurrentRoleID = -1;
  739.             if (dv.Count > 0)
  740.             {
  741.                 CurrentRoleID = Convert.ToInt32(dv[0]["CurrentRoleID"].ToString().Trim());
  742.             }
  743.             WFActInsInfo wfactinsinfo = new WFActInsInfo(-1, ActivityID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
  744.                                                                  1, SuccessDate, WFInstanceID, "99", userid, CurrentRoleID);
  745.             int j = etongzwf.WFActInsADD(wfactinsinfo);
  746.             if (PrjChID > 0)
  747.             {
  748.                 //WorkFlowOperation(PrjChID);
  749.                 WorkFlowOperation(PrjChID);
  750.             }
  751.             else
  752.             {
  753.                 Common.RunScript(this.Page, "操作失败,请检查数据!");
  754.             }
  755.         }       
  756.         //******************************************************基本单位剩余材料上报*************************************************************
  757.         if (MustChooseItem == 40)
  758.         {
  759.             Application.Visible = true;
  760.             EtongZwf etongzwf = new EtongZwf();
  761.             //string JcTransactor = sEmpName + "   " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
  762.             string JcCKName = this.JcCKName.Text;     //GetFName() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";//基层单位上报物资部门报表(电子文档名称) -----待续
  763.             string JcRKName = this.JcRKName.Text;
  764.             string xmlname = "PrjChXML";
  765.             string Fname="";
  766.             //al = GetFName();
  767.             //if (al.Count > 0)
  768.             //{
  769.             DataView dv=GetPrjchInfo(PrjID);
  770.             if (dv.Count > 0)
  771.             {
  772.                 Fname = dv[0]["JcCKName"].ToString();
  773.                 if (Fname == "")
  774.                 {
  775.                     string xmlname1 = xmlname + ".xml";//al[0].ToString() + ".xml";
  776.                     Fname = xmlname + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".xml";
  777.                     if (!Util.Copyfile(path + "\" + xmlname1, path + "\DocTemplateChe\" + Fname))
  778.                     {
  779.                         Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
  780.                         return;
  781.                     }
  782.                 }
  783.             }  
  784.            
  785.             string JCXMLFName = path + "\DocTemplateChe\" + Fname;
  786.             //}
  787.             //写入XML文档
  788.             etongzwf.WriteXML(JCXMLFName, JcCKName, sEmpName, PrjChSort, DateTime.Now.ToShortDateString());
  789.             etongzwf.WriteXML(JCXMLFName, JcRKName, sEmpName, PrjChSort, DateTime.Now.ToShortDateString());
  790.             string sql = "update [tb_PrjCheck] set [JcCKName]='" + Fname +"' where [PrjChID]=" + this.PrjID;
  791.             if (SqlServer.RunSql(sql))
  792.             {
  793.                 dv = prjcheck.GetActinsid(PrjID, ActivityID);
  794.                 if (dv.Count > 0)
  795.                 {
  796.                     WfUpdate();
  797.                 }
  798.                 else
  799.                     WorkFlowOperation(PrjID);
  800.             }
  801.             else
  802.             {
  803.                 Common.RunScript(this.Page, "操作失败,请检查数据!");
  804.             }
  805.         }
  806.         //******************************************************财务报表上报*************************************************************
  807.         if (MustChooseItem == 41)
  808.         {
  809.             //PrjCheck prjcheck = new PrjCheck();
  810.             //int Status = -1;
  811.             ActID = Convert.ToInt32(Request.QueryString["ActID"].ToString());
  812.             EtongZwf etongzwf = new EtongZwf();
  813.             bool flag = true;
  814.             DataView dv = prjcheck.GetParentStatus(this.PrjID, this.ActivityID).DefaultView;
  815.             if (dv.Count > 0)
  816.             {
  817.                 for (int i = 0; i < dv.Count; i++)
  818.                 {
  819.                     string status = dv[i]["Status"].ToString();
  820.                     if (status != "1")
  821.                     {
  822.                         flag = false;
  823.                     }
  824.                 }
  825.             }
  826.             if (flag)
  827.             {
  828.                 //string Prjchname = this.TB_ConName.Text.Trim();
  829.                 string CwTransactor = sEmpName + "   " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
  830.                 string CwFName = this.CwTransactor.Text;// GetFName() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";//财务部门调整资金使用报表(电子文档名称) -----待续
  831.                 //PrjCheckInfo prjcheckinfo = new PrjCheckInfo(PrjID, Prjchname, "", JcTransactor, "", JcWFName, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 1);
  832.                 string sql = "update [tb_PrjCheck] set [CwTransactor]='" + CwTransactor + "',[CwFName]='" + CwFName + "' where [PrjChID]=" + this.PrjID;
  833.                 if (SqlServer.RunSql(sql))
  834.                 {
  835.                     dv = prjcheck.GetActinsid(PrjID, ActivityID);
  836.                     if (dv.Count > 0)
  837.                     {
  838.                         WfUpdate();
  839.                     }
  840.                     else
  841.                         WorkFlowOperation(PrjID);
  842.                 }
  843.                 else
  844.                 {
  845.                     Common.RunScript(this.Page, "操作失败,请检查数据!");
  846.                 }
  847.             }
  848.             else
  849.                 Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('上级任务还未完成,不能进行下级任务!')</script>");
  850.         }
  851.         //******************************************************物资管理上报*************************************************************
  852.         if (MustChooseItem == 42)
  853.         {
  854.             
  855.             DataView dv = GetPrjchInfo(PrjID);
  856.             if (dv.Count > 0)
  857.             {
  858.                 string hzvalue=dv[0]["hz"].ToString();
  859.                 if ( hzvalue== "2")
  860.                 {
  861.                     string WzTransatctor = sEmpName + "   " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
  862.                     string WzFName = this.WzTransatctor.Text; //GetFName() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";  //物资部门物资调整报表(电子文档名称) -----待续           
  863.                     string sql = "update [tb_PrjCheck] set [WzTransatctor]='" + WzTransatctor + "',[WzFName]='" + WzFName + "' where [PrjChID]=" + this.PrjID;
  864.                     if (SqlServer.RunSql(sql))
  865.                     {
  866.                         dv = prjcheck.GetActinsid(PrjID, ActivityID);
  867.                         if (dv.Count > 0)
  868.                         {
  869.                             WfUpdate();
  870.                         }
  871.                         else
  872.                             WorkFlowOperation(PrjID);
  873.                     }
  874.                     else
  875.                     {
  876.                         Common.RunScript(this.Page, "操作失败,请检查数据!");
  877.                     }
  878.                 }
  879.                 else
  880.                 {
  881.                     Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('系统提示:您尚未汇总,不能审核通过!');</script>");
  882.                     return;
  883.                 }
  884.             }
  885.             
  886.         }
  887.         //******************************************************竣工检查上报*************************************************************
  888.         if (MustChooseItem == 43)
  889.         {
  890.             //DataView dv=new DataView ();
  891.             //int Status = -1;
  892.             //if (Status == 2)
  893.             //{
  894.             //    EtongWord EWord = new EtongWord();
  895.             //    EWord.sort = 0;
  896.             //    EWord.opSort = prjcheck.GetEmpType(iEmpID);                
  897.             //    EWord.XmlNodesNames = "XMLrecord";
  898.             //    dv= GetPrjchInfo(PrjID);  
  899.             //    if(dv.Count>0)
  900.             //    {
  901.             //        EWord.Address = dv[0]["ZgZlFName"].ToString();
  902.             //    }               
  903.             //    ArrayList al = new ArrayList();
  904.             //    al = EWord.ReadXMLFName();
  905.             //    EtongXml alfn = (EtongXml)al[0];
  906.             //    string fname = alfn.DocFileName.ToString();
  907.             //    this.ZgTransactor.Text = fname;
  908.             //}
  909.             //else
  910.             //{
  911.             ActID = Convert.ToInt32(Request.QueryString["ActID"].ToString());
  912.             DataView dv = prjcheck.GetStatus(ActID);
  913.             int  Status = Convert.ToInt32(dv[0]["Status"].ToString());
  914.             if (Status == 2)
  915.             {
  916.                 WorkFlowOperation(PrjID, "您已审核通过!");
  917.             }
  918.             else
  919.             {
  920.                 ActID = Convert.ToInt32(Request.QueryString["ActID"].ToString());
  921.                 EtongZwf etongzwf = new EtongZwf();
  922.                 bool flag = true;
  923.                 dv = prjcheck.GetParentStatus(this.PrjID, this.ActivityID).DefaultView;
  924.                 if (dv.Count > 0)
  925.                 {
  926.                     for (int i = 0; i < dv.Count; i++)
  927.                     {
  928.                         string status = dv[i]["Status"].ToString();
  929.                         if (status != "1")
  930.                         {
  931.                             flag = false;
  932.                         }
  933.                     }
  934.                 }
  935.                 if (flag)
  936.                 {
  937.                     string ZgTransactor = sEmpName + "   " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
  938.                     string ZgZlFName = this.ZgTransactor.Text;
  939.                     string xmlname = "PrjChZGXML";
  940.                     string Fname = "";
  941.                     dv = GetPrjchInfo(PrjID);//判断文件是否存在
  942.                     if (dv.Count > 0)
  943.                     {
  944.                         Fname = dv[0]["ZgZlFName"].ToString();
  945.                         if (Fname == "")
  946.                         {
  947.                             string xmlname1 = xmlname + ".xml";//al[0].ToString() + ".xml";
  948.                             Fname = xmlname + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".xml";
  949.                             if (!Util.Copyfile(path + "\" + xmlname1, path + "\DocTemplateChe\" + Fname))
  950.                             {
  951.                                 Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
  952.                                 return;
  953.                             }
  954.                         }
  955.                     }
  956.                     string ZGXMLFName = path + "\DocTemplateChe\" + Fname;
  957.                     //写入XML文档
  958.                     etongzwf.WriteXML(ZGXMLFName, ZgZlFName, sEmpName, PrjChSort, DateTime.Now.ToShortDateString());
  959.                     string sql = "update [tb_PrjCheck] set [ZgZlFName]='" + Fname + "' where [PrjChID]=" + this.PrjID;
  960.                     if (SqlServer.RunSql(sql))
  961.                     {
  962.                         dv = prjcheck.GetActinsid(PrjID, ActivityID);
  963.                         if (dv.Count > 0)
  964.                         {
  965.                             WfUpdate();
  966.                         }
  967.                         else
  968.                             WorkFlowOperation(PrjID, "您已审核通过!");
  969.                     }
  970.                     else
  971.                     {
  972.                         Common.RunScript(this.Page, "操作失败,请检查数据!");
  973.                     }
  974.                 }
  975.                 else
  976.                     Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('上级任务还未完成,不能进行下级任务!')</script>");
  977.             }
  978.         }
  979.         //******************************************************工程管理办公室材料归档*************************************************************
  980.         if (MustChooseItem == 44)
  981.         {          
  982.             if (this.GcglFname.Text == "")
  983.             {
  984.                 Page.ClientScript.RegisterStartupScript(GetType(),"","<script>alert('请先汇总!');</script>");
  985.                 return;
  986.             }
  987.             //string Prjchname = this.TB_ConName.Text.Trim();
  988.             string GcglTransactor = sEmpName + "   " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
  989.             string GcglContect = this.GcglTransactor.Text.Trim().ToString();
  990.             string gcglfname = this.GcglFname.Text.Trim().ToString();
  991.             //string GcglGdContect = GetFName() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";  //工程管理办公室材料报表汇总(电子文档名称) -----待续           
  992.             string sql = "update [tb_PrjCheck] set [GcglTransactor]='" + GcglTransactor + "',[GcglFName]='" + gcglfname + "',[GcglGdContect]='" + GcglContect + "' where [PrjChID]=" + this.PrjID;
  993.             if (SqlServer.RunSql(sql))
  994.             {
  995.                 WorkFlowOperation(PrjID);
  996.             }
  997.             else
  998.             {
  999.                 Common.RunScript(this.Page, "操作失败,请检查数据!");
  1000.             }
  1001.         }      
  1002.         //******************************************************主管材料报表汇总*************************************************************
  1003.         if (MustChooseItem == 45)
  1004.         {
  1005.             EtongFlyChouWFPrj flywfprj = new EtongFlyChouWFPrj();
  1006.             EtongZwf etongzwf = new EtongZwf();
  1007.             string ZgGdTransactor = sEmpName + "   " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
  1008.             string ZgGdContect = this.ZgGdTransactor.Text;
  1009.             string xmlname = "PrjChZGHZXML";
  1010.             string Fname = "";
  1011.             DataView dv = GetPrjchInfo(PrjID);//判断文件是否存在
  1012.             if (dv.Count > 0)
  1013.             {
  1014.                 Fname = dv[0]["ZgGdContect"].ToString();
  1015.                 if (Fname == "")
  1016.                 {
  1017.                     string xmlname1 = xmlname + ".xml";//al[0].ToString() + ".xml";
  1018.                     Fname = xmlname + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".xml";
  1019.                     if (!Util.Copyfile(path + "\" + xmlname1, path + "\DocTemplateChe\" + Fname))
  1020.                     {
  1021.                         Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
  1022.                         return;
  1023.                     }
  1024.                 }
  1025.             }
  1026.             string ZGHZXMLFName = path + "\DocTemplateChe\" + Fname;
  1027.             //写入XML文档
  1028.             etongzwf.WriteXML(ZGHZXMLFName, ZgGdContect, sEmpName, PrjChSort, DateTime.Now.ToShortDateString());
  1029.             string sql = "update [tb_PrjCheck] set [ZgGdContect]='" + Fname + "' where [PrjChID]=" + this.PrjID;
  1030.             
  1031.             if (SqlServer.RunSql(sql))
  1032.             {               
  1033.                 sql = "select [StartEnd] from [tb_WF_Activity] where [ActivityID]=" + ActivityID;
  1034.                 dv = SqlServer.GetDataView(sql);
  1035.                 if (dv.Count > 0)
  1036.                 {
  1037.                     startEnd = Convert.ToInt32(dv[0]["StartEnd"].ToString());
  1038.                     if (startEnd == 2)//最终任务
  1039.                     {
  1040.                         WorkFolw workflow = new WorkFolw();
  1041.                         string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
  1042.                         ActID = Convert.ToInt32(ActIDtxt);
  1043.                         bool returnvalue2 = workflow.WFActInsUpdata(ActID, 1, userid);
  1044.                         flywfprj.sID = ActID;
  1045.                         flywfprj.PrjID = PrjID;
  1046.                         flywfprj.wID = wfid;
  1047.                         flywfprj.iStatus = 3;
  1048.                         bool returnvalue = flywfprj.CheckUpActComplete();
  1049.                         if (returnvalue)
  1050.                         {
  1051.                             bool returnvalue3 = prjcheck.UpDatePrjch(PrjID);
  1052.                             string script = "<script language='javascript'>alert('系统提示:您已审核通过,本工程项目验收流程结束!');top.location.href='../Main.aspx';</script>";
  1053.                             Common.RunScriptString(this.Page, script); 
  1054.                         }
  1055.                         else
  1056.                         {
  1057.                             string script = "<script language='javascript'>alert('系统提示:您已审核通过!');top.location.href='../Main.aspx';</script>";
  1058.                             Common.RunScriptString(this.Page, script);
  1059.                         }
  1060.                     }
  1061.                 }
  1062.                 else
  1063.                 {
  1064.                     WorkFlowOperation(PrjID, "您已审核通过!");
  1065.                 }
  1066.             }
  1067.             else
  1068.             {
  1069.                 Common.RunScript(this.Page, "操作失败,请检查数据!");
  1070.             }
  1071.         }       
  1072.         //if (MustChooseItem == 46)
  1073.         //{
  1074.         //    string ZgGdTransactor = sEmpName + "   " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
  1075.         //    string ZgGdContect = this.ZgGdTransactor.Text.Trim().ToString();
  1076.         //    //string ZgGdContect = GetFName() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";  //工程管理办公室材料报表汇总(电子文档名称) -----待续           
  1077.         //    string sql = "update [tb_PrjCheck] set [ZgGdTransactor]='" + ZgGdTransactor + "',[ZgGdContect]='" + ZgGdContect + "' where [PrjChID]=" + this.PrjID;
  1078.         //    if (SqlServer.RunSql(sql))
  1079.         //    {
  1080.         //        sql = "select [StartEnd] from [tb_WF_Activity] where [ActivityID]=" + ActivityID;
  1081.         //        DataView dv = SqlServer.GetDataView(sql);
  1082.         //        if (dv.Count > 0)
  1083.         //        {
  1084.         //            startEnd = Convert.ToInt32(dv[0]["StartEnd"].ToString());
  1085.         //            if (startEnd == 2)//最终任务
  1086.         //            {
  1087.         //                WorkFolw workflow = new WorkFolw();
  1088.         //                string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
  1089.         //                ActID = Convert.ToInt32(ActIDtxt);
  1090.         //                bool returnvalue = workflow.WFActInsUpdata(ActID, 1, userid);
  1091.         //                bool returnvalue2 = prjcheck.UpDatePrjch(PrjID);
  1092.         //                string script = "<script language='javascript'>alert('系统提示:您已审核通过,本工程项目验收流程结束!');top.location.href='../Main.aspx';</script>";
  1093.         //                Common.RunScriptString(this.Page, script);
  1094.         //            }
  1095.         //        }
  1096.         //        else
  1097.         //        {
  1098.         //            WorkFlowOperation(PrjID, "您已审核通过,本工程项目验收流程结束!");
  1099.         //        }
  1100.         //    }
  1101.         //    else
  1102.         //    {
  1103.         //        Common.RunScript(this.Page, "操作失败,请检查数据!");
  1104.         //    }
  1105.         //}
  1106.     }
  1107.     /*==============================================================================================
  1108.           * 
  1109.           *                                    回退操作
  1110.           * 
  1111.           *=============================================================================================*/
  1112.     protected void BT_Untread_Click(object sender, ImageClickEventArgs e)
  1113.     {
  1114.         string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
  1115.         ActID = Convert.ToInt32(ActIDtxt);
  1116.         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>UserDialog('" + ActID + "','" + WFInstanceID + "','" + userid + "','" + PrjID+"');</script>");
  1117.         return;
  1118.             
  1119.         //EtongZwf etongzwf = new EtongZwf();
  1120.         //PrjCheck prjcheck = new PrjCheck();
  1121.         //bool ReActInsValue = false;
  1122.         //ReActInsValue = etongzwf.WFActInsUpdata(ActID, userid, 3);
  1123.         //if (ReActInsValue == true)
  1124.         //{
  1125.         //    //产生回退活动事例
  1126.         //    // 注:Status状态(0、正常;1、完成;2、回退;3、回退并完成;4、作废)
  1127.         //    int ReActInsValue2 = 0;
  1128.         //    DataView dvAct = prjcheck.GetByActInsId(ActID,PrjID);
  1129.         //    // DataView dvAct = etongzwf.ColonyUserGetByAct(ActivityID);    
  1130.         //    int PreviousActID = -1;
  1131.         //    int PreviousUserID = -1;
  1132.         //    int PreviousRoleID = -1;
  1133.         //    if (dvAct != null)
  1134.         //    {
  1135.         //        PreviousActID = Convert.ToInt16(dvAct[0]["PreviousActID"].ToString().Trim());
  1136.         //        PreviousUserID = Convert.ToInt16(dvAct[0]["PreviousUserID"].ToString().Trim());
  1137.         //        PreviousRoleID = Convert.ToInt16(dvAct[0]["PreviousRoleID"].ToString().Trim());
  1138.         //    }
  1139.         //    WFActInsInfo wfactinsinfo2 = new WFActInsInfo(-1, PreviousActID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
  1140.         //                                                        2, Convert.ToDateTime(DateTime.Now.ToShortDateString()), WFInstanceID, "", PreviousUserID, PreviousRoleID);
  1141.         //    ReActInsValue2 = etongzwf.WFActInsADD(wfactinsinfo2);
  1142.         //    if (ReActInsValue2 != 0)
  1143.         //        ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:回退成功!');top.location.href='../Main.aspx';</script>");
  1144.         //    else
  1145.         //        ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:回退失败!');top.location.href='../Main.aspx';</script>");
  1146.         //}
  1147.     }
  1148.     /*==============================================================================================
  1149.           * 
  1150.           *                                    作废操作
  1151.           * 
  1152.           *=============================================================================================*/
  1153.     protected void BT_Revoke_Click(object sender, ImageClickEventArgs e)
  1154.     {
  1155.     }
  1156.     /*=====================================================================================================
  1157.     * 
  1158.     *                                    工作流操作,分3步 
  1159.     * 1.产生工作流实例纪录,注意constructid必须真实存在 
  1160.     * 2.更新当前活动实例状态 由WFInstADD中的WFActInsUpdata执行
  1161.     * 3.产生新的工作流实例纪录,即产生下一个活动实例并提交到下一个部门的用户申核,由NextColonyRole操作完成                                
  1162.     * 
  1163.     *====================================================================================================*/
  1164.     protected void WorkFlowOperation(int constructid, string showmessage)
  1165.     {
  1166.         EtongZwf etongzwf = new EtongZwf();
  1167.         ProjectImplment projectImplment = new ProjectImplment();
  1168.         PrjCheck prjcheck = new PrjCheck();
  1169.         WorkFolw workflow = new WorkFolw();
  1170.         int CurrentRoleID = -1;
  1171.         int ParentActID = -1;
  1172.         int ParentRoleID = -1;
  1173.         DataView dv = etongzwf.ColonyUserGetByActId(ActivityID);//根据当前活动id获取当前部门与上级角色 
  1174.         //if (dv.Count > 0)
  1175.         //{
  1176.         //    ParentRoleID = Convert.ToInt32(dv[0]["ParentRoleID"].ToString().Trim());
  1177.         //    ////DataView dvRoleName = etongzwf.RoleGetName(ParentRoleID);
  1178.         //    //DataTable dt = prjcheck.GetOpid(ParentRoleID);
  1179.         //    //if (dt.Rows.Count == 0)
  1180.         //    //{
  1181.         //    //    ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:项目验收停滞,没有上级申核人!(请联系相关部门或系统管理员)');</script>");
  1182.         //    //    return;
  1183.         //    //}
  1184.         //}
  1185.         DateTime SuccessDate = Convert.ToDateTime(DateTime.Now.ToShortDateString().Trim());
  1186.         ////添加工作流实例 (将添加成功的constructid添加到工作流实例表里,注意是加到该表的PrjID字段中)
  1187.         //WFInstanceInfo wfinstanceinfo = new WFInstanceInfo(-1, Convert.ToDateTime(DateTime.Now.ToShortDateString()),
  1188.         // userid, -1, -1, DateTime.Now, 3, SuccessDate, wfid, constructid);
  1189.         //int ReInstanceValue = etongzwf.WFInstanceADD(wfinstanceinfo);
  1190.         ////产生当前工作流实例ID
  1191.         //WFInstanceID = ReInstanceValue;
  1192.         //if (WFInstanceID > 0)
  1193.         //{            
  1194.             string nextCheckDepartment = null;
  1195.             if (dv.Count > 0)
  1196.             {
  1197.                 CurrentRoleID = Convert.ToInt32(dv[0]["CurrentRoleID"].ToString().Trim());
  1198.                 ParentActID = Convert.ToInt32(dv[0]["ParentActID"].ToString().Trim());
  1199.                 ParentRoleID = Convert.ToInt32(dv[0]["ParentRoleID"].ToString().Trim());
  1200.             }
  1201.             //产生当前活动实例  如果是不是第一个活动,只需 修改 UserID 和 Status
  1202.             int ReActInsValue = 0;
  1203.             if (MustChooseItem == 40)//对起始活动的操作
  1204.             {
  1205.                 WFActInsInfo wfactinsinfo = new WFActInsInfo(-1, ActivityID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
  1206.                                                                  1, SuccessDate, WFInstanceID, "", userid, CurrentRoleID);
  1207.                 ReActInsValue = etongzwf.WFActInsADD(wfactinsinfo);               
  1208.                 DataTable dt = prjcheck.GetOpid(ParentRoleID);
  1209.                 if (dt.Rows.Count > 0)
  1210.                 {
  1211.                     nextCheckDepartment = dt.Rows[0]["OpName"].ToString();                   
  1212.                 }
  1213.                 NextColonyRole(ParentActID, ParentRoleID, showmessage, nextCheckDepartment, 0);//提交给下一部门用户审核
  1214.             }
  1215.             else//对不是起始活动的操作
  1216.             {
  1217.                 string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
  1218.                 ActID = Convert.ToInt32(ActIDtxt);
  1219.                 bool returnvalue = false;               
  1220.                 returnvalue = workflow.WFActInsUpdata(ActID, 1, userid);
  1221.                 if (returnvalue == true)
  1222.                     ReActInsValue = ActID;
  1223.                 if (ReActInsValue > 0)
  1224.                 {
  1225.                     if (ParentActID != -1)
  1226.                     {              
  1227.                         DataTable dt = prjcheck.GetOpid(ParentRoleID);
  1228.                         nextCheckDepartment = dt.Rows[0]["OpName"].ToString();
  1229.                         NextColonyRole(ParentActID, ParentRoleID, showmessage, nextCheckDepartment, 0);  //(ReActInsValue);     //产生下一个活动实例并提交到下一个角色的用户申核
  1230.                     }
  1231.                     else   // 不存在上级活动,将 活动状态(Status) 改为 "完成"   注:Status状态(0、正常;1、完成;2、回退;3、回退并完成;4、作废)
  1232.                     {
  1233.                         bool ReValueAIUpdata = false;
  1234.                         //ReValueAIUpdata = etongzwf.WFActInsUpdata(ReActInsValue, userid, 1);
  1235.                         ReValueAIUpdata = workflow.WFActInsUpdata(ReActInsValue, 1, userid);
  1236.                         if (ReValueAIUpdata == true)
  1237.                         {
  1238.                             ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:项目验收完成!');top.location.href='../Main.aspx';</script>");
  1239.                         }
  1240.                         else
  1241.                         {
  1242.                             ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:操作失败!');top.location.href='../Main.aspx';</script>");
  1243.                         }
  1244.                     }
  1245.                 }
  1246.             }
  1247.         //}
  1248.     }
  1249.     /// <summary>
  1250.     /// 提交到上级部门用户申核
  1251.     /// </summary>
  1252.     protected void NextColonyRole(int ParentActID, int ParentRoleID, string showMessage, string nextCheckDepartment, int count)
  1253.     {
  1254.         EtongZwf etongzwf = new EtongZwf();
  1255.         string orgsort = EtongZwf.GetOpRole(ParentRoleID);
  1256.         //Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + orgsort + "');</script>");
  1257.         //return;
  1258.         //if (MustChooseItem == 41 || MustChooseItem == 42)
  1259.         //{
  1260.         WFActInsInfo wfactinsinfo = new WFActInsInfo(-1, ParentActID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
  1261.                                                                  0, Convert.ToDateTime(DateTime.Now.ToShortDateString()), WFInstanceID, orgsort, -1, ParentRoleID);
  1262.         int ReActInsValue = etongzwf.WFActInsADD(wfactinsinfo);
  1263.         string returnvalue = this.txt_LDid.Value + nextCheckDepartment + ",";
  1264.         this.txt_LDid.Value = returnvalue;
  1265.         if (count == 0)
  1266.         {
  1267.             if (ReActInsValue > 0)
  1268.             {
  1269.                 ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:" + showMessage + ",转到『" + this.txt_LDid.Value + "』申核处理!');top.location.href='../Main.aspx';</script>");
  1270.             }
  1271.             else
  1272.                 ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:操作失败!');top.location.href='../Main.aspx';</script>");
  1273.         }
  1274.     }
  1275.     /*==========================================对并发活动的特殊处理=======================================
  1276.    * 
  1277.    *                                    工作流操作,分3步
  1278.    * 1.产生工作流实例纪录,注意constructid必须真实存在 
  1279.    * 2.更新当前活动实例状态 由WFInstADD中的WFActInsUpdata执行
  1280.    * 3.产生新的工作流实例纪录,即产生下一个活动实例并提交到下一个部门的用户申核,由NextColonyRole操作完成                                
  1281.    * 
  1282.    *====================================================================================================*/
  1283.     protected void WorkFlowOperation(int constructid)
  1284.     {
  1285.         EtongZwf etongzwf = new EtongZwf();
  1286.         ProjectImplment projectImplment = new ProjectImplment();
  1287.         PrjCheck prjcheck = new PrjCheck();
  1288.         DateTime SuccessDate = Convert.ToDateTime(DateTime.Now.ToShortDateString().Trim());
  1289.         DataView dv = etongzwf.ColonyUserGetByActId(ActivityID);
  1290.         if (dv.Count > 0)
  1291.         {           
  1292.             SuccessDate = Convert.ToDateTime(DateTime.Now.ToShortDateString().Trim());
  1293.             for (int i = 0,j=dv.Count-1; i < dv.Count; i++,j--)//并行循环
  1294.             {                
  1295.                 int CurrentRoleID = Convert.ToInt32(dv[i]["CurrentRoleID"].ToString().Trim());
  1296.                 int ParentActID = Convert.ToInt32(dv[i]["ParentActID"].ToString().Trim());
  1297.                 int ParentRoleID = Convert.ToInt32(dv[i]["ParentRoleID"].ToString().Trim());              
  1298.                 if (WFInstanceID > 0)
  1299.                 {
  1300.                     WorkFolw workflow = new WorkFolw();
  1301.                     string ActIDtxt="";
  1302.                     try
  1303.                     {
  1304.                        ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
  1305.                     }
  1306.                     catch
  1307.                     {
  1308.                         ActIDtxt = Request.QueryString["ActivityID"].ToString().Trim();
  1309.                     }
  1310.                     ActID = Convert.ToInt32(ActIDtxt);
  1311.                     bool returnvalue = false;
  1312.                     //产生当前活动实例  如果是不是第一个活动,只需 修改 UserID 和 Status
  1313.                     int ReActInsValue = 0;
  1314.                     string nextCheckDepartment = null;
  1315.                     //returnvalue = etongzwf.WFActInsUpdata(ActID, userid, 1);
  1316.                     returnvalue = workflow.WFActInsUpdata(ActID, 1, userid);
  1317.                     if (returnvalue == true)
  1318.                         ReActInsValue = ActID;
  1319.                     if (ReActInsValue > 0)
  1320.                     {
  1321.                         if (ParentActID != -1)
  1322.                         {
  1323.                             ProjectImplment pi = new ProjectImplment();
  1324.                             // PrjCheck prjcheck = new PrjCheck();
  1325.                             DataTable dt = prjcheck.GetOpid(ParentRoleID);
  1326.                             nextCheckDepartment =dt.Rows[0]["OpName"].ToString();
  1327.                             NextColonyRole(ParentActID, ParentRoleID, "您已审核通过", nextCheckDepartment, j);  //(ReActInsValue);     //产生下一个活动实例并提交到下一个角色的用户申核
  1328.                         }
  1329.                         else   // 不存在上级活动,将 活动状态(Status) 改为 "完成"   注:Status状态(0、正常;1、完成;2、回退;3、回退并完成;4、作废)
  1330.                         {
  1331.                             bool ReValueAIUpdata = false;
  1332.                             //ReValueAIUpdata = etongzwf.WFActInsUpdata(ReActInsValue, userid, 1);
  1333.                             ReValueAIUpdata = workflow.WFActInsUpdata(ReActInsValue, 1, userid);
  1334.                             if (ReValueAIUpdata == true)
  1335.                             {
  1336.                                 ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:项目验收完成!');top.location.href='../Main.aspx';</script>");
  1337.                                 return;
  1338.                             }
  1339.                             else
  1340.                             {
  1341.                                 ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:操作失败!');top.location.href='../Main.aspx';</script>");
  1342.                                 return;
  1343.                             }
  1344.                         }
  1345.                     }
  1346.                 }
  1347.             }
  1348.             //NextColonyRole(ParentActID, ParentRoleID, "您已审核通过", nextCheckDepartment);  //(ReActInsValue);     //产生下一个活动实例并提交到下一个角色的用户申核
  1349.         }
  1350.     }
  1351.     /*=====================================================================================================
  1352.   * 
  1353.   *                                    并行下的活动 
  1354.   * 1.产生工作流实例纪录,注意constructid必须真实存在 
  1355.   * 2.更新当前活动实例状态 由WFInstADD中的WFActInsUpdata执行(不产生新的活动)                                              
  1356.   * 
  1357.   *====================================================================================================*/
  1358.     public void WfUpdate()
  1359.     {
  1360.         string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
  1361.         ActID = Convert.ToInt32(ActIDtxt);
  1362.         WorkFolw workflow = new WorkFolw();
  1363.         EtongZwf etongzwf = new EtongZwf();
  1364.         PrjCheck prjcheck = new PrjCheck();
  1365.         string nextCheckDepartment = "";
  1366.         bool returnvalue=workflow.WFActInsUpdata(ActID, 1, userid);//修改actins 表
  1367.         if (returnvalue)
  1368.         {
  1369.             int ActivityID = Convert.ToInt32(Request.QueryString["ActivityID"].ToString().Trim());
  1370.             DataView dv = etongzwf.ColonyUserGetByActId(ActivityID);
  1371.             if (dv.Count > 0)
  1372.             {
  1373.                 for (int i = 0; i < dv.Count; i++)
  1374.                 {
  1375.                     int ParentRoleID = Convert.ToInt32(dv[i]["ParentRoleID"].ToString().Trim());
  1376.                     DataTable dt = prjcheck.GetOpid(ParentRoleID);
  1377.                     if (dt.Rows.Count > 0)
  1378.                     {
  1379.                         nextCheckDepartment += dt.Rows[0]["OpName"].ToString()+",";
  1380.                     }
  1381.                 }
  1382.             }
  1383.             ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:您已经通过审核,转到『" + nextCheckDepartment + "』申核处理!');top.location.href='../Main.aspx';</script>");
  1384.         }
  1385.     }
  1386.        /*=====================================================================================================
  1387.   * 
  1388.                     *取相关文档名称                                        
  1389.   * 
  1390.   *====================================================================================================*/
  1391.     protected ArrayList GetFName()
  1392.     {
  1393.         PrjCheck prjcheck = new PrjCheck();
  1394.         DataView dvFN = prjcheck.GetSFileName(ActivityID);
  1395.         ArrayList cklist=new ArrayList ();
  1396.         int starti;
  1397.         if (dvFN.Count > 0)
  1398.         {
  1399.             for (int i = 0; i < dvFN.Count; i++)
  1400.             {
  1401.                 string JcFName = dvFN[i]["FName"].ToString().Trim();            //工程项目预算表(电子文档)
  1402.                 starti = JcFName.Length - (JcFName.Split('\').GetValue(JcFName.Split('\').Length - 1)).ToString().Length;
  1403.                 JcFName = JcFName.Substring(starti, JcFName.Length - starti - 4);
  1404.                 cklist.Add(JcFName);               
  1405.             }
  1406.         }
  1407.         return cklist;
  1408.     }
  1409.     protected void huizong_Click(object sender, EventArgs e)
  1410.     {
  1411.         int Status = -1;
  1412.         ActID = Convert.ToInt32(Request.QueryString["ActID"].ToString());
  1413.         EtongZwf etongzwf = new EtongZwf();
  1414.         bool flag = true;
  1415.         PrjCheck prjcheck = new PrjCheck();
  1416.         DataView dv = prjcheck.GetParentStatus(this.PrjID, this.ActivityID).DefaultView;
  1417.         if (dv.Count > 0)
  1418.         {
  1419.             for (int i = 0; i < dv.Count; i++)
  1420.             {
  1421.                 string status = dv[i]["Status"].ToString();
  1422.                 if (status != "1")
  1423.                 {
  1424.                     flag = false;
  1425.                 }
  1426.             }
  1427.         }
  1428.         if (flag)
  1429.         {
  1430.             string path = Server.MapPath("doc").Replace("\", "\\") + "\\DocTemplateChe\\";           
  1431.             string filename = path + this.WzTransatctor.Text;
  1432.             MyDocMerger objMerger = new MyDocMerger();
  1433.             dv = prjcheck.GetWord(PrjID);
  1434.             if (dv.Count > 0)
  1435.             {
  1436.                 EtongWord EWord = new EtongWord();
  1437.                 EWord.sort = -1;
  1438.                 EWord.opSort = "99";
  1439.                 EWord.XmlNodesNames = "XMLrecord";
  1440.                 EWord.Address = path + dv[0]["JcCKName"].ToString();
  1441.                 ArrayList al = new ArrayList();
  1442.                 al = EWord.ReadXMLFName();
  1443.                 if (al.Count > 0)
  1444.                 {
  1445.                     string[] afile = new string[al.Count / 2];
  1446.                     //afile[0] = path + dv[0]["JcCKName"].ToString();            
  1447.                     for (int i = 1, j = 0; i < al.Count; i = i + 2, j++)
  1448.                     {
  1449.                         EtongXml alfn = (EtongXml)al[i];
  1450.                         afile[j] = path + alfn.DocFileName.ToString();
  1451.                         if (!System.IO.File.Exists(afile[j]))
  1452.                         {
  1453.                             Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('相关文件不存在!');</script>");
  1454.                             return;
  1455.                         }
  1456.                     }
  1457.                     objMerger.MergeDocArray(filename, afile, filename);
  1458.                 }
  1459.                 //al.Clear();
  1460.                 int returnvalue1 = prjcheck.UpdateHZ(Convert.ToInt32(dv[0]["PrjChID"].ToString()));
  1461.                 if (returnvalue1 == -1)
  1462.                 {
  1463.                     Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('系统提示:汇总失败!');</script>");
  1464.                     return;
  1465.                 }
  1466.                 else
  1467.                 {
  1468.                     Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('系统提示:汇总成功!');</script>");
  1469.                     return;
  1470.                 }
  1471.             }
  1472.             else
  1473.             {
  1474.                 Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('系统提示:此项已经汇总!');</script>");
  1475.                 return;
  1476.             }
  1477.         }
  1478.         else
  1479.             Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('上级任务还未完成,不能进行下级任务!')</script>");
  1480.     }
  1481.     protected void zghuizong_Click(object sender, EventArgs e)
  1482.     {
  1483.         ActID = Convert.ToInt32(Request.QueryString["ActID"].ToString().Trim());
  1484.         EtongFlyChouWFPrj flywfprj = new EtongFlyChouWFPrj();
  1485.         flywfprj.sID = ActID;      
  1486.         flywfprj.PrjID = this.PrjID;
  1487.         flywfprj.wID = wfid;
  1488.         flywfprj.iStatus= 3;
  1489.         bool returnvalue = flywfprj.CheckUpActComplete();
  1490.         if (!returnvalue)
  1491.         {
  1492.             Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('上级任务还未完成,不能进行文档汇总!')</script>");
  1493.             return;
  1494.         }
  1495.         string path = Server.MapPath("doc").Replace("\", "\\");
  1496.         ArrayList al = GetFName();
  1497.         if (al.Count > 0)
  1498.         {
  1499.             this.GcglFname.Text = al[0].ToString() + ".doc";
  1500.             string Fname = al[0].ToString() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
  1501.             if (!Util.Copyfile(path + "\" + this.GcglFname.Text, path + "\DocTemplateChe\" + Fname))
  1502.             {
  1503.                 Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
  1504.                 return;
  1505.             }
  1506.             this.GcglFname.Text = Fname;
  1507.         }             
  1508.         path = Server.MapPath("doc").Replace("\", "\\") + "\\DocTemplateChe\\";
  1509.         PrjCheck prjcheck = new PrjCheck();
  1510.         string filename = path + this.GcglFname.Text;
  1511.         MyDocMerger objMerger = new MyDocMerger();
  1512.         DataView dv = GetPrjchInfo(PrjID);
  1513.         if (dv.Count > 0)
  1514.         {
  1515.             EtongWord EWord = new EtongWord();
  1516.             EWord.sort = -1;
  1517.             EWord.opSort = "99";
  1518.             EWord.XmlNodesNames = "XMLrecord";
  1519.             EWord.Address = path + dv[0]["ZgZlFName"].ToString();
  1520.             al = EWord.ReadXMLFName();
  1521.             if (al.Count > 0)
  1522.             {
  1523.                 string[] afile = new string[al.Count];
  1524.                 //afile[0] = path + dv[0]["JcCKName"].ToString();            
  1525.                 for (int i = 0; i < al.Count; i++)
  1526.                 {
  1527.                     EtongXml alfn = (EtongXml)al[i];
  1528.                     afile[i] = path + alfn.DocFileName.ToString();
  1529.                     if (!System.IO.File.Exists(afile[i]))
  1530.                     {
  1531.                         Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('相关文件不存在!');</script>");
  1532.                         return;
  1533.                     }
  1534.                 }
  1535.                 objMerger.MergeDocArray(filename, afile, filename);
  1536.                 Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('系统提示:汇总成功!');</script>");
  1537.                 return;
  1538.             }
  1539.         }
  1540.         else
  1541.         {
  1542.             Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('系统提示:汇总失败!');</script>");
  1543.             return;
  1544.         }
  1545.     }
  1546. }