WFTaskBrowse.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:63k
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using com.etong.Inform;
- using com.etong.BusinessRule.Zwf;
- using com.etong.Model;
- using com.etong.DAL.FC;
- using System.IO;
- using com.etong.Utility;
- using com.etong.DBUtility;
- using com.etong.DAL;
- using DocMergerComponent;
- using com.etong.Excel;
- public partial class Workflow_WFTaskBrowse : System.Web.UI.Page
- {
- protected int userid = -1;
- protected int wfid=-1;
- protected int MustChooseItem = -1;
- protected int ActivityID = -1;
- protected int WFInstanceID = -1;
- protected int ActID = -1; //活动实例ID
- protected int iDepID=-1;
- protected int iEmpID = -1; //当前员工ID
- protected string sAccount = "";
- protected string sEmpName = "";
-
- protected void Page_Load(object sender, EventArgs e)
- {
- try
- {
- CheckUserInfo RoInfo = (CheckUserInfo)Session["checkuserinfo"];
- iDepID = RoInfo.OrgID;
- userid = RoInfo.UserID;
- iEmpID = RoInfo.EmpID;
- sAccount = RoInfo.UserAccount;
- sEmpName = RoInfo.EmpName;
- ((HtmlInputHidden)this.FindControl("txt_sEmpName")).Value = sEmpName;
- }
- catch
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:您尚未登录或您登录已超时,请重新登录!');top.location.href='../login.aspx';", true);
- }
- try
- {
- string projectid = Request.QueryString["ProjectID"].ToString().Trim();
- if (projectid != "")
- {
- ((HtmlInputHidden)this.FindControl("txt_ProjectID")).Value = projectid;
- BT_Confirm.Visible = false;
- PN_Button.Visible = false;
- TB_ProjectName.Enabled = false;
- BtWord_JC.Visible = false;
- BT_View_JC.Visible = true;
- BtWord_JC2.Visible = false;
- BT_View_JC2.Visible = true;
- BT_ZG.Visible = false;
- BT_View_ZG.Visible = true;
- BT_Jqb_HZ.Visible = false;
- BT_View_Jqb_HZ.Visible = true;
- // BT_Gcgl_XF.Visible = false;
- BT_View_Gcgl_XF.Visible = true;
- BT_Jqb_BX.Visible = false;
- BT_View_Jqb_BX.Visible = true;
- BT_HS.Visible = false;
- BT_View_HS.Visible = true;
- BT_Jqb_FW.Visible = false;
- BT_View_Jqb_FW.Visible = true;
- Application.Visible = false;
- Pn_ZG.Visible = false;
- Pn_Jqb_HZ.Visible = false;
- PrjGetAll();
- }
- }
- catch
- {
- string MustChooseItemtxt = Request.QueryString["MustChooseItem"].ToString().Trim();
- ((HtmlInputHidden)this.FindControl("txt_MustChooseItem")).Value = MustChooseItemtxt;
- MustChooseItem = Convert.ToInt16(MustChooseItemtxt);
- string ActivityIDtxt = Request.QueryString["ActivityID"].ToString().Trim();
- string WFInstanceIDtxt = Request.QueryString["WFInstanceID"].ToString().Trim();
- string WFIDtxt = Request.QueryString["WFID"].ToString().Trim();
- wfid = Convert.ToInt16(WFIDtxt);
- EtongZwf etongzwf = new EtongZwf();
- ActivityID = Convert.ToInt32(ActivityIDtxt);
-
- if (!IsPostBack)
- {
- ((HtmlInputHidden)this.FindControl("txt_ProjectID")).Value = "-1";
- }
- if(Convert.ToInt32(WFInstanceIDtxt) != -1)
- {
- ((HtmlInputHidden)this.FindControl("txt_WFInstanceID")).Value = WFInstanceIDtxt;
- WFInstanceID = Convert.ToInt32(WFInstanceIDtxt);
- DataView dvInstance = etongzwf.WFInstanceGetAll(WFInstanceID);
- ((HtmlInputHidden)this.FindControl("txt_ProjectID")).Value = dvInstance[0][9].ToString();
- wfid = Convert.ToInt32(dvInstance[0][8].ToString().Trim());
- }
- //清除未提交申请
- if (!IsPostBack)
- {
- int actid = EtongZwf.ActivityIDGetByWFID(wfid); //.ActivityIDGetByWFID(wfid);
- etongzwf.ProInit(actid);
- PrjGetAll();
- }
- string Status = "";
- try
- {
- string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
- ActID = Convert.ToInt32(ActIDtxt);
- ((HtmlInputHidden)this.FindControl("txt_ActID")).Value = ActIDtxt;
- Status= EtongZwf.GetStatus(ActID);
- }
- catch {
- // ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:工作流启动失败,请重试!');</script>");
- }
- string path = Server.MapPath("doc").Replace("\", "\\"); //获取项目所在路径
- ArrayList al =EtongZwf.GetDocumentFileName(this.ActivityID);
- switch (MustChooseItem)
- {
- case 0: //启动
- Pn_ZG.Visible = false; //主管部门项目汇总
- Application.Visible = false;
- Pn_Jqb_HZ.Visible = false; //计企部项目汇总
- Pn_Gcgl_XF.Visible = false; //工程管理办公室项目分析
- Pn_Jqb_BX.Visible = false; //计企部编写工程计划清单
- Pn_Fg.Visible = false; //分管领导批示(审核)
- Pn_Gc.Visible = false; //工程预算委员会审批
- Pn_Gs.Visible = false; //公司领导审批
- Pn_HS.Visible = false; //工程管理办公室
- Jqb_FW.Visible = false; //计企部正式发文
- PN_Button.Visible = false;
- break;
- case 11: //基层单位申请
- Pn_ZG.Visible = false;
- TB_ProjectName.Enabled = false;
- Pn_Jqb_HZ.Visible = false;
- Pn_Gcgl_XF.Visible = false;
- Pn_Jqb_BX.Visible = false;
- Pn_Fg.Visible = false;
- Pn_Gc.Visible = false;
- Pn_Gs.Visible = false;
- Pn_HS.Visible = false;
- Jqb_FW.Visible = false;
- BT_Pass.Visible = true;
- BT_Confirm.Visible = false;
- BT_Untread.Visible = false;
- BT_Revoke.Visible = false;
- TB_JcTransactor.Text = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
- this.BtWord_JC.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('LB_JC').value,false);");
- this.BtWord_JC2.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_JC2').value,false);");
- if (!IsPostBack)
- {
- if (Status == "2") //判断是否是退回的活动
- {
- TB_ProjectName.Enabled = false;
- PrjGetAll();
- }
- else
- {
- string FileName_JC = "";
- string FileName_JC2 = "";
- if (al.Count > 0)
- {
- FileName_JC = al[0].ToString();
- FileName_JC2 = al[1].ToString();
- }
- LB_JC.Text = EtongZwf.MakeNewFileNameWithDate(FileName_JC);
- TB_JC2.Text = EtongZwf.MakeNewFileNameWithDate(FileName_JC2);
- if ((!Util.Copyfile(path + "\" + FileName_JC, path + "\DocTemplate\" + this.LB_JC.Text)) || (!Util.Copyfile(path + "\" + FileName_JC2, path + "\DocTemplate\" + this.TB_JC2.Text)))
- {
- Common.RunScript(this.Page, "打开模板失败,请检查相关设置!");
- return;
- }
- }
- }
- break;
- case 1: //主管审核
- BT_Untread.Visible = false;
- BT_Confirm.Visible = false;
- Application.Visible = false;
- TB_ProjectName.Enabled = false;
- Pn_Jqb_HZ.Visible=false;
- Pn_Gcgl_XF.Visible=false;
- Pn_Jqb_BX.Visible=false;
- Pn_Fg.Visible=false;
- Pn_Gc.Visible=false;
- Pn_Gs.Visible=false;
- Pn_HS.Visible=false;
- Jqb_FW.Visible = false;
- BT_ZG2.Visible = false;
- BT_View_ZG2.Visible = true;
- IB_Collect.Visible = true;
- BT_ZG.Visible = false;
- BT_View_ZG.Visible = true;
- BT_Pass.Attributes.Add("OnClientClick", "javascript:if(confirm('确定要退出吗?')) {window.close();return;} else {return;}");
- this.BT_View_ZG.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_ZG').value,false);");
- this.BT_View_ZG2.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_ZG2').value,false);");
-
- if (!IsPostBack)
- {
- TB_ZgTransactor.Text = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
- }
- break;
- case 2: //计企部汇总
- BT_Untread.Visible = false;
- BT_Confirm.Visible = false;
- TB_ProjectName.Enabled = false;
- Pn_Gcgl_XF.Visible = false;
- Pn_Jqb_BX.Visible = false;
- Pn_Fg.Visible = false;
- Pn_Gc.Visible = false;
- Pn_Gs.Visible = false;
- Pn_HS.Visible = false;
- Jqb_FW.Visible = false;
- IB_Collect.Visible = true;
- Application.Visible = false;
- Pn_ZG.Visible = false;
- BT_Jqb_HZ.Visible = false;
- BT_View_Jqb_HZ.Visible = true;
- BT_Jqb_HZ2.Visible = false;
- BT_View_Jqb_HZ2.Visible = true;
- //this.BT_Jqb_HZ.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Jqb_HZ').value);");
- this.BT_View_Jqb_HZ.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Jqb_HZ').value);");
- this.BT_View_Jqb_HZ2.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Jqb_HZ2').value);");
- TB_JqbXTransactor.Text = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
- break;
- case 3: //工程管理分析
- BT_Untread.Visible = false;
- BT_Confirm.Visible = false;
- TB_ProjectName.Enabled = false;
- Pn_Jqb_BX.Visible = false;
- Pn_Fg.Visible = false;
- Pn_Gc.Visible = false;
- Pn_Gs.Visible = false;
- Pn_HS.Visible = false;
- Jqb_FW.Visible = false;
- Application.Visible = false;
- Pn_ZG.Visible = false;
- Pn_Jqb_HZ.Visible = false;
- // BT_Gcgl_XF.Visible = false;
- BT_View_Gcgl_XF.Visible = true;
- // this.BT_Gcgl_XF.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Gcgl_XF').value);");
- this.BT_View_Gcgl_XF2.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Gcgl_XF2').value);");
- // string FileName_Gcgl_XF = al[0].ToString().Trim();
- if (!IsPostBack)
- {
- if (Status == "2") //判断是否是退回的活动
- {
- PrjGetAll();
- }
- else
- {
- PrjGetAll();
- //TB_Gcgl_XF.Text =EtongZwf.MakeNewFileNameWithDate(FileName_Gcgl_XF);
- //if (!Util.Copyfile(path + "\" + FileName_Gcgl_XF, path + "\DocTemplate\" + this.TB_Gcgl_XF.Text))
- //{
- // Common.RunScript(this.Page, "文件拷贝失败,请检查相关设置!");
- // return;
- //}
- }
- }
- TB_GcglXTransactor.Text = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
- break;
- case 6: //分管领导审批
- BT_Untread.Visible = false;
- BT_Confirm.Visible = false;
- BT_NoPass.Visible = true;
- TB_ProjectName.Enabled = false;
- Pn_Jqb_BX.Visible = false;
- Pn_Gc.Visible = false;
- Pn_Gs.Visible = false;
- Pn_HS.Visible = false;
- Jqb_FW.Visible = false;
- Application.Visible = false;
- Pn_ZG.Visible = false;
- Pn_Jqb_HZ.Visible = false;
- BT_View_Gcgl_XF.Visible = true;
- break;
- case 4: //计企部计划清单
- BT_Untread.Visible = true;
- BT_Confirm.Visible = false;
- TB_ProjectName.Enabled = false;
- // BT_Gcgl_XF.Visible = false;
- BT_View_Gcgl_XF.Visible = true;
- Pn_Fg.Enabled = false;
- Pn_Gc.Visible = false;
- Pn_Gs.Visible = false;
- Pn_HS.Visible = false;
- Jqb_FW.Visible = false;
- Application.Visible = false;
- Pn_ZG.Visible = false;
- Pn_Jqb_HZ.Visible = false;
- BT_Jqb_BX.Visible = false;
- BT_View_Jqb_BX.Visible = true;
- //this.BT_Jqb_BX.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Jqb_BX').value);");
- //string FileName_Jqb_BX = al[0].ToString().Trim();
- if (!IsPostBack)
- {
- if (Status == "2") //判断是否是退回的活动
- {
- PrjGetAll();
- }
- else
- {
- PrjGetAll();
- //TB_Jqb_BX.Text =EtongZwf.MakeNewFileNameWithDate(FileName_Jqb_BX);
- //if (!Util.Copyfile(path + "\" + FileName_Jqb_BX, path + "\DocTemplate\" + this.TB_Jqb_BX.Text))
- //{
- // Common.RunScript(this.Page, "文件拷贝失败,请检查相关设置!");
- // return;
- //}
- }
- }
- TB_JqbBTransactor.Text = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
- break;
- case 7: //工程预算委员会审批
- BT_Untread.Visible = false;
- BT_Confirm.Visible = false;
- TB_ProjectName.Enabled = false;
- // BT_Gcgl_XF.Visible = false;
- BT_View_Gcgl_XF.Visible = true;
- BT_Jqb_BX.Visible = false;
- BT_View_Jqb_BX.Visible = true;
- Pn_Fg.Enabled = false;
- Pn_Gs.Visible = false;
- Pn_HS.Visible = false;
- Jqb_FW.Visible = false;
- BT_NoPass.Visible = true;
- Application.Visible = false;
- Pn_ZG.Visible = false;
- Pn_Jqb_HZ.Visible = false;
- break;
- case 9: //工程办公室审批
- BT_Untread.Visible = true;
- BT_Confirm.Visible = false;
- TB_ProjectName.Enabled = false;
- // BT_Gcgl_XF.Visible = false;
- BT_View_Gcgl_XF.Visible = true;
- BT_Jqb_BX.Visible = false;
- BT_View_Jqb_BX.Visible = true;
- Pn_Fg.Enabled = false;
- Pn_Gc.Enabled = false;
- Pn_Gs.Visible= false;
- Jqb_FW.Visible = false;
- Application.Visible = false;
- Pn_ZG.Visible = false;
- Pn_Jqb_HZ.Visible = false;
- BT_HS.Visible = false;
- BT_View_HS.Visible = true;
- //this.BT_HS.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_HS').value);");
- // string FileName_HS = al[0].ToString().Trim();
- if (!IsPostBack)
- {
- if (Status == "2") //判断是否是退回的活动
- {
- PrjGetAll();
- }
- else
- {
- PrjGetAll();
- //TB_HS.Text =EtongZwf.MakeNewFileNameWithDate(FileName_HS);
- //if (!Util.Copyfile(path + "\" + FileName_HS, path + "\DocTemplate\" + this.TB_HS.Text))
- //{
- // Common.RunScript(this.Page, "文件拷贝失败,请检查相关设置!");
- // return;
- //}
- }
- }
- TB_HSTransactor.Text = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
- break;
- case 8: //公司领导审批
- BT_Untread.Visible = true;
- BT_Confirm.Visible = false;
- TB_ProjectName.Enabled = false;
- // BT_Gcgl_XF.Visible = false;
- BT_View_Gcgl_XF.Visible = true;
- BT_Jqb_BX.Visible = false;
- BT_View_Jqb_BX.Visible = true;
- Pn_Fg.Enabled = false;
- Pn_Gc.Enabled = false;
- BT_HS.Visible = false;
- BT_View_HS.Visible = true;
- Jqb_FW.Visible = false;
- Application.Visible = false;
- Pn_ZG.Visible = false;
- Pn_Jqb_HZ.Visible = false;
- break;
- case 10: //计企部正式发文
- BT_Untread.Visible = true;
- BT_Confirm.Visible = false;
- TB_ProjectName.Enabled = false;
- //BT_Gcgl_XF.Visible = false;
- BT_View_Gcgl_XF.Visible = true;
- BT_Jqb_BX.Visible = false;
- BT_View_Jqb_BX.Visible = true;
- Pn_Fg.Enabled = false;
- Pn_Gc.Enabled = false;
- Pn_Gs.Enabled = false;
- BT_HS.Visible=false;
- BT_View_HS.Visible = true;
- Application.Visible = false;
- Pn_ZG.Visible = false;
- Pn_Jqb_HZ.Visible = false;
- BT_Jqb_FW.Visible = false;
- BT_View_Jqb_FW.Visible = true;
- TB_JqbZTransactor.Text = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
- // this.BT_Jqb_FW.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Jqb_FW').value);");
- break;
- }
- if (!IsPostBack)
- {
- this.BtWord_JC.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('LB_JC').value,false);");
- this.BtWord_JC2.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_JC2').value,false);");
- this.BT_View_JC.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('LB_JC').value,false);");
- this.BT_View_JC2.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_JC2').value,false);");
- this.BT_View_ZG.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_ZG').value,false);");
- this.BT_ZG.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_ZG').value,false);");
- this.BT_View_ZG2.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_ZG2').value,false);");
- this.BT_ZG2.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_ZG2').value,false);");
- this.BT_Jqb_HZ.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Jqb_HZ').value,false);");
- this.BT_View_Jqb_HZ.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Jqb_HZ').value,false);");
- // this.BT_Gcgl_XF.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Gcgl_XF').value,false);");
- this.BT_View_Gcgl_XF.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Gcgl_XF').value,false);");
- this.BT_View_Gcgl_XF2.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Gcgl_XF2').value,false);");
- // this.BT_Jqb_BX.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Jqb_BX').value,false);");
- this.BT_View_Jqb_BX.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Jqb_BX').value,false);");
- this.BT_View_Jqb_BX2.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Jqb_BX2').value,false);");
- // this.BT_HS.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_HS').value,false);");
- this.BT_View_HS.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_HS').value,false);");
- this.BT_View_HS2.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_HS2').value,false);");
- // this.BT_Jqb_FW.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Jqb_FW').value,false);");
- this.BT_View_Jqb_FW.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Jqb_FW').value,false);");
- this.BT_View_Jqb_FW2.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Jqb_FW2').value,false);");
- ArrayList alfp = EtongZwf.GetSFileNamePerm(iEmpID); //授与编辑权限的文件集合
- for (int i = 0; i < alfp.Count; i++)
- {
- string[] str = alfp[i].ToString().Trim().Split(new Char[] { '.' });
- int JC = LB_JC.Text.IndexOf(str[0].Trim(), 0);
- int JC2 = TB_JC2.Text.IndexOf(str[0].Trim(), 0);
- int ZG = TB_ZG.Text.IndexOf(str[0].Trim(), 0);
- int Jqb_HZ = TB_Jqb_HZ.Text.IndexOf(str[0].Trim(), 0);
- int Gcgl_XF = TB_Gcgl_XF.Text.IndexOf(str[0].Trim(), 0);
- int Jqb_BX = TB_Jqb_BX.Text.IndexOf(str[0].Trim(), 0);
- int HS = TB_HS.Text.IndexOf(str[0].Trim(), 0);
- int Jqb_FW = TB_Jqb_FW.Text.IndexOf(str[0].Trim(), 0);
- if (JC >= 0)
- {
- this.BtWord_JC.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('LB_JC').value,true);");
- this.BT_View_JC.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('LB_JC').value,true);");
- }
- if (JC2 >= 0)
- {
- this.BtWord_JC2.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_JC2').value,true);");
- this.BT_View_JC2.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_JC2').value,true);");
- }
- if (ZG >= 0)
- {
- this.BT_View_ZG.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_ZG').value,true);");
- this.BT_ZG.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_ZG').value,true);");
- }
- if (Jqb_HZ >= 0)
- {
- this.BT_Jqb_HZ.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Jqb_HZ').value,true);");
- this.BT_View_Jqb_HZ.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Jqb_HZ').value,true);");
- }
- if (Gcgl_XF >= 0)
- {
- // this.BT_Gcgl_XF.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Gcgl_XF').value,true);");
- this.BT_View_Gcgl_XF.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Gcgl_XF').value,true);");
- }
- if (Jqb_BX >= 0)
- {
- this.BT_Jqb_BX.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Jqb_BX').value,true);");
- this.BT_View_Jqb_BX.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Jqb_BX').value,true);");
- }
- if (HS >= 0)
- {
- this.BT_HS.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_HS').value,true);");
- this.BT_View_HS.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_HS').value,true);");
- }
- if (Jqb_FW >= 0)
- {
- this.BT_Jqb_FW.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Jqb_FW').value,true);");
- this.BT_View_Jqb_FW.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplate/'+document.all('TB_Jqb_FW').value,true);");
- }
- }
- }
- }
- }
-
- /// <summary>
- /// 获取当前项目内容
- /// </summary>
- protected void PrjGetAll()
- {
- EtongZwf etongzwf = new EtongZwf();
- int prjid = Convert.ToInt32(txt_ProjectID.Value.Trim());
- DataView dvPrjGetAll = etongzwf.ProjectGetAll(prjid);
- if (dvPrjGetAll.Count == 0)
- {
- return;
- }
- TB_ProjectName.Text = dvPrjGetAll[0]["ProjectName"].ToString();
- TB_JcTransactor.Text = dvPrjGetAll[0]["JcTransactor"].ToString();
- string[] JCFName = dvPrjGetAll[0]["JcFName"].ToString().Trim().Split(new Char[] { '\' });
- LB_JC.Text = JCFName[JCFName.Length - 1].ToString();
- //this.BT_View_JC.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplate/'+document.all('LB_JC').value);");
- string[] JCFName2 = dvPrjGetAll[0]["QuestOrg"].ToString().Trim().Split(new Char[] { '\' });
- TB_JC2.Text = JCFName2[JCFName2.Length - 1].ToString();
- // this.BT_View_JC2.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplate/'+document.all('TB_JC2').value);");
-
- string[] ZgFName = dvPrjGetAll[0]["ZgFName"].ToString().Trim().Split(new Char[] { '\' });
- //TB_ZG.Text = ZgFName[ZgFName.Length - 1].ToString();
- this.BT_View_ZG.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplate/'+document.all('TB_ZG').value);");
- TB_ZgTransactor.Text = dvPrjGetAll[0]["ZgTransactor"].ToString();
-
- string[] Jqb_HZ = dvPrjGetAll[0]["JqbXFName"].ToString().Trim().Split(new Char[] { '\' });
- // TB_Jqb_HZ.Text = Jqb_HZ[Jqb_HZ.Length - 1].ToString();
- //this.BT_View_Jqb_HZ.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplate/'+document.all('TB_Jqb_HZ').value);");
- TB_JqbXTransactor.Text = dvPrjGetAll[0]["JqbXTransactor"].ToString();
-
- string[] Gcgl_XF = dvPrjGetAll[0]["GcglXFName"].ToString().Trim().Split(new Char[] { '\' });
- // TB_Gcgl_XF.Text = Jqb_HZ[Jqb_HZ.Length - 1].ToString(); // Gcgl_XF[Gcgl_XF.Length - 1].ToString();
- EtongWord EWord = new EtongWord();
- EWord.sort = -1;
- // EWord.opSort = "99";
- EWord.XmlNodesNames = "XMLrecord";
- string path= Server.MapPath("doc").Replace("\", "\\");
- EWord.Address = path +"\\DocTemplate\\" + Jqb_HZ[Jqb_HZ.Length - 1].ToString();
- ArrayList alfn = new ArrayList();
- EtongXml alfn1 = new EtongXml();
- try
- {
- alfn = EWord.ReadXMLFName();
- //alfn1 = alfn[0] as EtongXml;
- TB_Gcgl_XF.Text = ((EtongXml)alfn[0]).DocFileName.ToString();
- TB_Gcgl_XF2.Text = ((EtongXml)alfn[1]).DocFileName.ToString();
- TB_Jqb_BX.Text = ((EtongXml)alfn[0]).DocFileName.ToString();
- TB_Jqb_BX2.Text = ((EtongXml)alfn[1]).DocFileName.ToString();
- TB_HS.Text = ((EtongXml)alfn[0]).DocFileName.ToString();
- TB_HS2.Text = ((EtongXml)alfn[1]).DocFileName.ToString();
- TB_Jqb_FW.Text = ((EtongXml)alfn[0]).DocFileName.ToString();
- TB_Jqb_FW2.Text = ((EtongXml)alfn[1]).DocFileName.ToString();
- }
- catch
- {
- // Common.RunScript(this.Page, EWord.Address.ToString()); //"操作失败:未能找到文件!");
- // return;
- }
- TB_GcglXTransactor.Text = dvPrjGetAll[0]["GcglXTransactor"].ToString();
- string[] Jqb_BX = dvPrjGetAll[0]["JqbBFName"].ToString().Trim().Split(new Char[] { '\' });
- TB_JqbBTransactor.Text = dvPrjGetAll[0]["JqbBTransactor"].ToString();
-
- if (MustChooseItem != 6)
- {
- TB_FgIdea.Text = dvPrjGetAll[0]["FgIdea"].ToString();
- }
- if (MustChooseItem != 7)
- {
- TB_ZjwyhIdea.Text = dvPrjGetAll[0]["ZjwyhIdea"].ToString();
- }
- if (MustChooseItem != 8)
- {
- TB_GsIdea.Text = dvPrjGetAll[0]["GsIdea"].ToString();
- }
- string[] GcglQIdea = dvPrjGetAll[0]["GcglQIdea"].ToString().Trim().Split(new Char[] { '\' });
- TB_HSTransactor.Text = dvPrjGetAll[0]["GcglQTransactor"].ToString();
- TB_JqbZTransactor.Text = dvPrjGetAll[0]["JqbZTransactor"].ToString();
- }
-
- protected void BT_Confirm_Click(object sender, ImageClickEventArgs e) //基层单位提交
- {
- string Status = "";
- try{
- ActID=Convert.ToInt32(((HtmlInputHidden)this.FindControl("txt_ActID")).Value.Trim());
- Status =EtongZwf.GetStatus(ActID);
- }
- catch{
- Status = "";
- }
- if (Status == "2") //if(退回)
- { WFInstADD(); }
- else
- {
- string ProjectName = TB_ProjectName.Text.Trim();
- EtongZwf etongzwf = new EtongZwf();
- //******************************************************申报人提交*************************************************************
- ProjectInfo projectinfo = new ProjectInfo(-1, ProjectName, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 0);
- int ReProjectValue = etongzwf.WFProjectAdd(projectinfo);
- ((HtmlInputHidden)this.FindControl("txt_ProjectID")).Value = ReProjectValue.ToString();
- if (ReProjectValue != 0)
- {
- //产生工作流实例
- WFInstanceInfo wfinstanceinfo = new WFInstanceInfo(-1, Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- userid, -1, -1, DateTime.Now, 1, Convert.ToDateTime(DateTime.Now.ToShortDateString()), wfid, ReProjectValue);
- int ReInstanceValue = etongzwf.WFInstanceADD(wfinstanceinfo);
- WFInstanceID = ReInstanceValue;
- ((HtmlInputHidden)this.FindControl("txt_WFInstanceID")).Value = WFInstanceID.ToString();
- //产生当前活动实例
- DataView dvActID = etongzwf.GetActivityByWFID(wfid); //获取当前工作流启始活动
- ActivityID = Convert.ToInt32(dvActID[0][0].ToString().Trim());
- DataView dv = etongzwf.ColonyUserGetByActId(ActivityID);
- int CurrentRoleID = Convert.ToInt16(dv[0]["CurrentRoleID"].ToString().Trim());
- WFActInsInfo wfactinsinfo = new WFActInsInfo(-1, ActivityID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- 0, Convert.ToDateTime(DateTime.Now.ToShortDateString()), WFInstanceID,"99", userid, CurrentRoleID);
- ActID = etongzwf.WFActInsADD(wfactinsinfo);
- ((HtmlInputHidden)this.FindControl("txt_ActID")).Value = ActID.ToString();
- WFInstADD();
- }
- }
- }
- /// <summary>
- /// 提交到上级部门用户申核
- /// </summary>
- protected string NextColonyRole(int ParentActID, int ParentRoleID, int ParentEmp,int WFInsID)
- {
- string ReValue="";
- //获取某业务角色对应的类型
- EtongZwf etongzwf = new EtongZwf();
- string Opsort;
- if(MustChooseItem==11) //是否提交到主管
- Opsort = etongzwf.GetEmpType(iEmpID);
- else
- Opsort=EtongZwf.GetOpRole(ParentRoleID);
- WFActInsInfo wfactinsinfo = new WFActInsInfo(-1, ParentActID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- 0, Convert.ToDateTime(DateTime.Now.ToShortDateString()), WFInsID, Opsort, ParentEmp, ParentRoleID);
- int ReActInsValue = etongzwf.WFActInsADD(wfactinsinfo);
- if (ReActInsValue > 0)
- {
- DataView dvRoleName = etongzwf.GetOrgzation(ParentRoleID);
- if (dvRoleName.Count != 0)
- {
- ReValue = dvRoleName[0][0].ToString();
- }
- }
- else
- ReValue = "";
- return ReValue;
- }
- /// <summary>
- /// 改变工作流活动实例状态
- /// </summary>
- protected void WFInstADD()
- {
- if (WFInstanceID > 0)
- {
- //int ReActInsValue = 0;
- if (MustChooseItem == 0) //标记起始活动实例
- {
- ActID = Convert.ToInt16(((HtmlInputHidden)this.FindControl("txt_ActID")).Value.Trim()); //活动实例
- }
- else
- {
- string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
- ActID = Convert.ToInt32(ActIDtxt);
- }
- EtongZwf etongzwf = new EtongZwf();
- DataView dv= etongzwf.ColonyUserGetByActId(ActivityID);
- int CurrentRoleID = -1;
- int ParentActID = -1;
- int ParentRoleID = -1;
- string ReValueRole = "";
- if (dv.Count > 0)
- {
- for (int i = 0; i <= dv.Count-1; i++)
- {
- string shuntflag = dv[i]["shuntflag"].ToString().Trim();
- if (shuntflag != "2" || MustChooseItem == 1) // "0" || (MustChooseItem == 6 && shuntflag=="1"))
- {
- CurrentRoleID = Convert.ToInt16(dv[i]["CurrentRoleID"].ToString().Trim());
- ParentActID = Convert.ToInt16(dv[i]["ParentActID"].ToString().Trim());
- ParentRoleID = Convert.ToInt16(dv[i]["ParentRoleID"].ToString().Trim()); //提交到下一活动 的 角色ID
- if (ParentActID != -1)
- {
- //产生下一个活动实例并提交到下一个角色的用户申核
- ReValueRole = ReValueRole + NextColonyRole(ParentActID, ParentRoleID, -1, WFInstanceID) + ",";
- }
- else
- { //工作流任务完成
- etongzwf.WFActInsUpdata(ActID, userid, 1);
- string projectid = ((HtmlInputHidden)this.FindControl("txt_ProjectID")).Value;
- bool re = etongzwf.WF_End("", "", -1, -1, wfid, 1, Convert.ToInt32(projectid.Trim()));
- if (re == true)
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:项目申报完成!');top.location.href='../Main.aspx';</script>");
- return;
- }
- }
- }
- }
- bool returnvalue = false;
- //更新当前活动实例状态
- etongzwf.WFActInsUpdata(ActID, userid, 1);
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:操作成功,转到: " + ReValueRole + " 申核处理!');top.location.href='../Main.aspx';</script>");
- }
- }
- }
-
- protected void BT_Pass_Click(object sender, ImageClickEventArgs e) //申核
- {
- int projectid = Convert.ToInt32(((HtmlInputHidden)this.FindControl("txt_ProjectID")).Value.Trim());
- EtongZwf etongzwf = new EtongZwf();
- string path = Server.MapPath("doc").Replace("\", "\\"); //获取项目所在路径
- //******************************************************基层部门*************************************************************
- if (MustChooseItem == 11)
- {
- string JCFName = LB_JC.Text;
- string JCFName2 = TB_JC2.Text;
- //判断上级活动实例是否产生
- string JCXMLFName = path + "\DocTemplate\";
- DataView dv = etongzwf.ColonyUserGetByActId(ActivityID);
- int CurrentRoleID = Convert.ToInt16(dv[0]["CurrentRoleID"].ToString().Trim());
- string Opsort = EtongZwf.GetOpRole(CurrentRoleID);
- bool bl = true;
- bl= etongzwf.CheckUpActCompleteActIns(ActivityID, WFInstanceID,false,"");
- if (bl == false)
- {
- string NewFName = "";
- try
- {
- NewFName = etongzwf.ProjectGetAll(projectid)[0]["JcFName"].ToString().Trim();
-
- }
- catch {NewFName = ""; }
- if (NewFName == "" || NewFName == null)
- {
- NewFName = EtongZwf.MakeNewFileNameWithDate("XML.xml");
- if (!Util.Copyfile(path + "\" + "XML.xml", path + "\DocTemplate\" + NewFName))
- {
- Common.RunScript(this.Page, "操作失败,请重试!");
- return;
- }
- etongzwf.Project_JC(projectid, NewFName, 0);
- }
- JCXMLFName = JCXMLFName + NewFName;
- WFInstADD();
- }
- else
- {
- DataView dvPrjGetAll = etongzwf.ProjectGetAll(projectid);
- JCXMLFName = JCXMLFName + dvPrjGetAll[0]["JcFName"].ToString();
-
- //同类型的上级活动是否产生
- bool bOpsort = true;
- bOpsort = etongzwf.CheckUpActCompleteActIns(ActivityID, WFInstanceID,true,Opsort);
- if(bOpsort==false)
- WFInstADD();
- else
- //改变当前活动实例状态
- etongzwf.WFActInsUpdata(ActID, userid, 1);
-
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:操作成功,转到 主管部门 处理!');top.location.href='../Main.aspx';</script>");
-
- }
-
- //写入XML文档
- etongzwf.WriteXML(JCXMLFName, JCFName, sEmpName, Opsort, DateTime.Now.ToShortDateString());
- etongzwf.WriteXML(JCXMLFName, JCFName2, sEmpName, Opsort, DateTime.Now.ToShortDateString());
- }
- //******************************************************业务主管审定*************************************************************
- if (MustChooseItem == 1)
- {
- string ZgFName = ((HtmlInputHidden)this.FindControl("txt_ZgFname")).Value; // TB_ZG.Text;
- if (ZgFName == "" || ZgFName == null)
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:请先汇总!');</script>");
- return;
- }
- etongzwf.Project_Zg(projectid, "", ZgFName, 0);
- bool bl = true;
- bl= etongzwf.CheckUpActCompleteActIns(ActivityID, WFInstanceID,false,"");
- if (bl == false)
- {
- WFInstADD();
- }
- else
- {
- etongzwf.WFActInsUpdata(ActID, userid, 1);
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:操作成功,转到 计企部汇总!');top.location.href='../Main.aspx';</script>");
- }
- }
- //******************************************************计企部*************************************************************
- if (MustChooseItem == 2)
- {
- //判断是否汇总过
- string JqbXFName = ((HtmlInputHidden)this.FindControl("txt_FName")).Value; //TB_Jqb_HZ.Text;
- if (JqbXFName == "" || JqbXFName == null)
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:请先汇总!');</script>");
- return;
- }
-
- bool ReValue_JqbX = false;
- ReValue_JqbX = etongzwf.Project_JqbX(projectid, "", JqbXFName, 0);
- if (ReValue_JqbX == true)
- WFInstADD();
- }
- //******************************************************工程管理办公室**************************************************************
- if (MustChooseItem == 3)
- {
- string GcglXTransactor = sEmpName + "【" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "】";
- string GcglXFName = TB_Gcgl_XF.Text;
- bool ReValue_Jqb_GcglX = false;
- ReValue_Jqb_GcglX = etongzwf.Project_JQP_GcglX(projectid, GcglXTransactor, GcglXFName, 0);
- if (ReValue_Jqb_GcglX == true)
- WFInstADD();
- }
- // ******************************************************计企部计划清单**************************************************************
- if (MustChooseItem == 4)
- {
- string JqbBTransactor = sEmpName + "【" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "】";
- string JqbBFName = TB_Jqb_BX.Text;
- bool ReValue_JqbB = false;
- ReValue_JqbB = etongzwf.Project_JqbB(projectid, JqbBTransactor, JqbBFName, 0);
- if (ReValue_JqbB == true)
- WFInstADD();
- }
- //******************************************************分管领导审批**************************************************************
- if (MustChooseItem == 6)
- {
- string FgIdea = TB_FgIdea.Text.Trim() + "【" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "】"; //分管领导审核意见和审核时间
- string FgTransactor = sEmpName; //分管领导签字
- if (FgIdea == "")
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:意见不可为空!');</script>");
- return;
- }
- bool ReValue_Fg = false;
- ReValue_Fg = etongzwf.Project_Fg(projectid, FgTransactor, FgIdea, 0);
- if (ReValue_Fg == true)
- WFInstADD();
- }
- //******************************************************工程预算委员会审批**************************************************************
- if (MustChooseItem == 7)
- {
- string ZjwyhIdea = TB_ZjwyhIdea.Text.Trim() + "【" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "】";
- string ZjwyhTransactor = sEmpName;
- if (ZjwyhIdea == "")
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:意见不可为空!');</script>");
- return;
- }
- bool ReValue_Zjwyh = false;
- ReValue_Zjwyh = etongzwf.Project_Zjwyh(projectid,ZjwyhTransactor,ZjwyhIdea,0);
- if (ReValue_Zjwyh == true)
- WFInstADD();
- }
- //******************************************************公司领导审批******************************************************************
- if (MustChooseItem == 8)
- {
- string GsIdea = TB_GsIdea.Text.Trim() + "【" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "】"; //公司领导审核意见和审核时间
- string GsTransactor = sEmpName; //公司领导签字
- if (GsIdea == "")
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:意见不可为空!');</script>");
- return;
- }
- bool ReValue_Gs = false;
- ReValue_Gs = etongzwf.Project_Gs(projectid, GsTransactor, GsIdea, 0);
- if (ReValue_Gs == true)
- WFInstADD();
- }
- //******************************************************总经济师核算******************************************************************
- if (MustChooseItem == 9)
- {
- string HSTransactor = sEmpName + "【" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "】"; //主管部门提交人和时间
- string JqbBFName = TB_HS.Text;
- bool ReValue_JqbB = false;
- ReValue_JqbB = etongzwf.Project_GcglQ(projectid, HSTransactor, JqbBFName, 0);
- if (ReValue_JqbB == true)
- WFInstADD();
- }
- //******************************************************计企部正式发文******************************************************************
- if (MustChooseItem == 10)
- {
- string JqbZTransactor = sEmpName + "【" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "】"; //计企部正式发文提交人和时间
- string JqbZFName = TB_Jqb_FW.Text;
- string ProjectName = TB_ProjectName.Text;
- bool ReValue_JqbZ = false;
- ReValue_JqbZ = etongzwf.Project_JqbZ(projectid, JqbZTransactor, JqbZFName, 1);
- if (ReValue_JqbZ == true)
- WFInstADD();
- //转到 工程项目实施流程
- // DataView dvprj=etongzwf.GetProject(WFInstanceID);
- //string prjsort = "99"; //dvprj[0]["PrjSort"].ToString();
- //ConstructInfo constructinfo = new ConstructInfo(ProjectName, prjsort, "", "",JqbZFName, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 1);
- //ProjectImplment projectimplment = new ProjectImplment();
- //int revalue = 0;
- //revalue = projectimplment.AddConstruct(constructinfo);
- //string ReValueRole = "";
- //if (revalue != 0)
- //{
- // int WorkFlowID = -1;
- // WorkFlowID = etongzwf.GetConWfID();
- // WFInstanceInfo wfinstanceinfo = new WFInstanceInfo(-1, Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- // userid, -1, -1, DateTime.Now, 2, Convert.ToDateTime(DateTime.Now.ToShortDateString()), WorkFlowID, revalue);
- // int ReInstanceValue = etongzwf.WFInstanceADD(wfinstanceinfo);
- // //产生下一活动实例
- // if (ReInstanceValue != 0)
- // {
- // WFInstADD();
- // DataView dvCU = etongzwf.ActivityColony_User(4);
- // int actid = Convert.ToInt16(dvCU[0]["ActivityID"].ToString().Trim());
- // int roleid = Convert.ToInt16(dvCU[0]["RoleID"].ToString().Trim());
- // ReValueRole = ReValueRole + NextColonyRole(actid, roleid, -1, ReInstanceValue) + ","; //转到 项目实施
- //}
- //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:操作成功,转到: " + ReValueRole + " 申核处理!');top.location.href='../Main.aspx';</script>");
- // }
- }
- }
- protected void BT_Untread_Click(object sender, ImageClickEventArgs e) //回退
- {
- EtongZwf etongzwf = new EtongZwf();
-
- bool ReActInsValue = false;
- string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
- ActID = Convert.ToInt32(ActIDtxt);
- ReActInsValue = etongzwf.WFActInsUpdata(ActID, userid, 3);
- if (ReActInsValue ==true)
- {
- //产生回退活动事例
- // 注:Status状态(0、正常;1、完成;2、回退;3、回退并完成;4、作废)
- int ReActInsValue2 = 0;
- DataView dvAct = etongzwf.ActivityGetByActInsId(ActID);
- // DataView dvAct = etongzwf.ColonyUserGetByAct(ActivityID);
- int PreviousActID = -1;
- int PreviousUserID = -1;
- int PreviousRoleID = -1;
- if (dvAct!= null)
- {
- PreviousActID = Convert.ToInt16(dvAct[0]["PreviousActID"].ToString().Trim());
- PreviousUserID = Convert.ToInt16(dvAct[0]["PreviousUserID"].ToString().Trim());
- PreviousRoleID = Convert.ToInt16(dvAct[0]["PreviousRoleID"].ToString().Trim());
- }
-
- WFActInsInfo wfactinsinfo2 = new WFActInsInfo(-1, PreviousActID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- 2, Convert.ToDateTime(DateTime.Now.ToShortDateString()), WFInstanceID, "", PreviousUserID, PreviousRoleID);
- ReActInsValue2 = etongzwf.WFActInsADD(wfactinsinfo2);
-
- if (ReActInsValue2 != 0)
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:回退成功!');top.location.href='../Main.aspx';</script>");
- else
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:回退失败!');top.location.href='../Main.aspx';</script>");
- }
- }
- protected void BT_Revoke_Click(object sender, ImageClickEventArgs e) //作废
- {
- EtongZwf etongzwf = new EtongZwf();
- int projectid = Convert.ToInt32(((HtmlInputHidden)this.FindControl("txt_ProjectID")).Value.Trim());
- if (projectid != -1)
- etongzwf.Project_Untread(projectid, 2);//改变当前项目状态
- else
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:回退操作失败!');top.location.href='../Main.aspx';</script>");
- return;
- }
- bool ActInsStatus = false;
- ActInsStatus = etongzwf.ActInsStatusChange(WFInstanceID, ActivityID, 4);
- if (ActInsStatus == true)
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:作废操作成功!');top.location.href='../Main.aspx';</script>");
- else
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:作废操作失败!');top.location.href='../Main.aspx';</script>");
- }
- protected void IB_chakan_Click(object sender, ImageClickEventArgs e) //查看
- {
- string ProjectID = ((HtmlInputHidden)this.FindControl("txt_ProjectID")).Value.Trim();
- string sURL = "WFLog.aspx?ProjectID=" + ProjectID;
- Response.Redirect(sURL);
- }
- protected void IB_quxiao_Click(object sender, ImageClickEventArgs e) //取消
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>if (confirm('系统提示:确认取消本次申请吗?')){top.mainFrame.location.href='../SpacePage.aspx';}</script>");
-
- }
- protected void BT_NoPass_Click(object sender, ImageClickEventArgs e) //不通过
- {
- //工程预算委员会 不通过
- // DataView dv = etongzwf.ColonyUserGetByActId(ActivityID);
- int PreviousRoleID = -1;
- int PreviousActID = -1;
- int PreviousUserID = -1;
- EtongZwf etongzwf = new EtongZwf();
- bool ReActInsValue = false;
- string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
- ActID = Convert.ToInt32(ActIDtxt);
- ReActInsValue = etongzwf.WFActInsUpdata(ActID, userid, 3);
- DataView dvAct = etongzwf.ActivityGetByActInsId(ActID);
- if (dvAct != null)
- {
- PreviousActID = Convert.ToInt16(dvAct[0]["PreviousActID"].ToString().Trim());
- PreviousUserID = Convert.ToInt16(dvAct[0]["PreviousUserID"].ToString().Trim());
- PreviousRoleID = Convert.ToInt16(dvAct[0]["PreviousRoleID"].ToString().Trim());
- }
- if (MustChooseItem == 6) // 分管领导不通时,返回至下下级
- {
- int PreviousActInsID = -1;
- PreviousActInsID = Convert.ToInt16(dvAct[0]["PreviousActInsID"].ToString().Trim());
- DataView dv = etongzwf.ActivityGetByActInsId(PreviousActInsID);
- if (dvAct != null)
- {
- PreviousActID = Convert.ToInt16(dv[0]["PreviousActID"].ToString().Trim());
- PreviousUserID = Convert.ToInt16(dv[0]["PreviousUserID"].ToString().Trim());
- PreviousRoleID = Convert.ToInt16(dv[0]["PreviousRoleID"].ToString().Trim());
- }
-
- }
- WFActInsInfo wfactinsinfo2 = new WFActInsInfo(-1, PreviousActID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- 2, Convert.ToDateTime(DateTime.Now.ToShortDateString()), WFInstanceID, "", PreviousUserID, PreviousRoleID);
- int ReActInsValue2 = 0;
- ReActInsValue2 = etongzwf.WFActInsADD(wfactinsinfo2);
- if (ReActInsValue2 != 0 && ReActInsValue==true)
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:操作成功!');top.location.href='../Main.aspx';</script>");
- else
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:操作失败!');top.location.href='../Main.aspx';</script>");
- }
- protected void IB_Collect_Click(object sender, ImageClickEventArgs e) //汇总
- {
- MyDocMerger objMerger = new MyDocMerger();
- DocMerger docmerger = new DocMerger();
- EtongWord EWord = new EtongWord();
- EtongZwf etongzwf = new EtongZwf();
- string path = Server.MapPath("doc").Replace("\", "\\"); //获取项目所在路径
- int prjid = Convert.ToInt32(txt_ProjectID.Value.Trim());
- DataView dvprj = etongzwf.ProjectGetAll(prjid);
- string FName = "";
- string FName1 = "";
- string FName2="";
- //string opsort = etongzwf.ActInsSort(ActID)[0]["BlockReason"].ToString(); //类型
- string opsort = etongzwf.GetEmpType(iEmpID);
- //新建要存储汇总文件的XML文档
- FName1 = EtongZwf.MakeNewFileNameWithDate("项目预算表.doc");
- FName2 = EtongZwf.MakeNewFileNameWithDate("项目计划汇总表.xls");
- string JCXMLFName ="";
- string NewFName = "";
- //JCXMLFName = JCXMLFName + NewFName;
- EtongFlyChouWFPrj etongflychouwfprj = new EtongFlyChouWFPrj();
- etongflychouwfprj.sID = ActID;
- etongflychouwfprj.iStatus = 1;
- etongflychouwfprj.sBlockReason = etongzwf.GetEmpType(iEmpID);
- etongflychouwfprj.PrjID = prjid;
- etongflychouwfprj.wID = wfid;
- if (MustChooseItem == 1) //主管汇总
- {
- EWord.opSort = opsort;
- FName = path + "\DocTemplate\" + dvprj[0]["JcFName"].ToString(); //+ "XML2007811142752.xml";
- //判断同类型的所有活动是否走完
- bool re = etongflychouwfprj.CheckUpActCompleteSort();
- if (re == false)
- {
- Common.RunScript(this.Page, "系统提示:基层单位同类型电子文档未全部提交,不能汇总!");
- return;
- }
- TB_ZG.Text = FName1;
- TB_ZG2.Text = FName2;
- try
- {
- NewFName = etongzwf.ProjectGetAll(prjid)[0]["ZgFName"].ToString().Trim();
- }
- catch { NewFName = ""; }
- if (NewFName == "" || NewFName == null)
- {
- NewFName = EtongZwf.MakeNewFileNameWithDate("XML.xml");
-
- if (!Util.Copyfile(path + "\" + "XML.xml", path + "\DocTemplate\" + NewFName))
- {
- Common.RunScript(this.Page, "操作失败,请重试!");
- return;
- }
- }
- ((HtmlInputHidden)this.FindControl("txt_ZgFname")).Value = NewFName;
- }
- if (MustChooseItem == 2) //计企部汇总
- {
- //判断所有活动是否走完
- bool re = etongflychouwfprj.CheckUpActComplete();
- if (re == false)
- {
- Common.RunScript(this.Page, "系统提示:主管部门电子文档未全部提交,不能汇总!");
- return;
- }
- FName = path + "\DocTemplate\" + dvprj[0]["ZgFName"].ToString();
- EWord.sort = -1;
- TB_Jqb_HZ.Text = FName1;
- TB_Jqb_HZ2.Text = FName2;
- NewFName = EtongZwf.MakeNewFileNameWithDate("XML.xml");
- ((HtmlInputHidden)this.FindControl("txt_FName")).Value = NewFName;
- if (!Util.Copyfile(path + "\" + "XML.xml", path + "\DocTemplate\" + NewFName))
- {
- Common.RunScript(this.Page, "操作失败,请重试!");
- return;
- }
- }
- EWord.XmlNodesNames = "XMLrecord";
- EWord.Address = FName;
- ArrayList alfn = new ArrayList();
- try
- {
- alfn = EWord.ReadXMLFName();
- }
- catch
- {
- Common.RunScript(this.Page, "操作失败:未能找到文件!");
- return;
- }
- int count = alfn.Count;
- string[] fname=new string[count];
- ArrayList aldoc = new ArrayList();
- ArrayList alxls = new ArrayList();
- for (int k = 0; k < count; k++)
- {
- EtongXml alfn1 = new EtongXml();
- alfn1 = alfn[k] as EtongXml;
- fname[k] = path +"\\DocTemplate\\" + alfn1.DocFileName.ToString();
- string[] a = fname[k].ToString().Split('.');
- if (a[1].ToString().Trim() == "doc")
- aldoc.Add(fname[k]);
- if (a[1].ToString().Trim() == "xls")
- alxls.Add(fname[k]);
- }
- int count_doc= aldoc.Count;
- string[] Docfname = new string[count_doc];
- for (int i = 0; i < count_doc; i++)
- Docfname[i] = aldoc[i].ToString().Trim();
- if (!Util.Copyfile(path + "\" + "项目预算表.doc", path + "\DocTemplate\" + FName1))
- {
- Common.RunScript(this.Page, "文件拷贝失败,请检查相关设置!");
- return;
- }
- string filename = path + "\\DocTemplate\\" + FName1;
- JCXMLFName = path + "\DocTemplate\" + NewFName;
- try
- {
- objMerger.MergeDocArray(filename, Docfname, filename); //汇总Doc文档
- EtongExcel EExcel = new EtongExcel(Server.MapPath("doc\\项目计划汇总表.xls"), Server.MapPath("doc\\DocTemplate\\") + FName2);
- EExcel.RangeCellSet(alxls, 3, 10);
- EExcel.SaveAsFile();
- //将汇总的文件写入XML文档中
- etongzwf.WriteXML(JCXMLFName, FName1, sEmpName, opsort, DateTime.Now.ToShortDateString());
- etongzwf.WriteXML(JCXMLFName, FName2, sEmpName, opsort, DateTime.Now.ToShortDateString());
- Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('系统提示:汇总成功!');</script>");
- }
- catch (Exception ex)
- {
- ClientScript.RegisterStartupScript(this.GetType(), "errorMessage", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "") + "');</script>");
- }
-
- }
- }