protected void bt_Save_Click(object sender, EventArgs e) { if ((Guid)ViewState["ProcessID"] != Guid.Empty)//修改 { EWF_Flow_ProcessBLL bll = new EWF_Flow_ProcessBLL((Guid)ViewState["ProcessID"]); bll.Model.App = (Guid)ViewState["AppID"]; bll.Model.DefaultNextProcess = new Guid(ddl_DefaultNextProcess.SelectedValue); bll.Model.Description = tbx_Description.Text; bll.Model.Name = tbx_Name.Text; bll.Model.Sort = int.Parse(tbx_Sort.Text); bll.Update(); } else//新增 { EWF_Flow_ProcessBLL bll = new EWF_Flow_ProcessBLL(); bll.Model.App = (Guid)ViewState["AppID"]; bll.Model.DefaultNextProcess = new Guid(ddl_DefaultNextProcess.SelectedValue.Trim()); bll.Model.Description = tbx_Description.Text; bll.Model.Name = tbx_Name.Text; bll.Model.Type = int.Parse(ddl_Type.SelectedValue); bll.Model.Sort = int.Parse(tbx_Sort.Text); bll.Add(); } Response.Redirect("FlowProcessList.aspx?AppID=" + ViewState["AppID"].ToString()); }
private void BindData() { this.lb_ID.Text = ViewState["ProcessID"].ToString(); EWF_Flow_ProcessBLL bll = new EWF_Flow_ProcessBLL((Guid)ViewState["ProcessID"]); #region 绑定基本信息 tbx_Name.Text = bll.Model.Name; tbx_Description.Text = bll.Model.Description; ddl_DefaultNextProcess.SelectedValue = bll.Model.DefaultNextProcess.ToString(); ddl_Type.SelectedValue = bll.Model.Type.ToString(); tbx_Sort.Text = bll.Model.Sort.ToString(); #endregion }
protected void gv_List_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { Guid ID = (Guid)this.gv_List.DataKeys[e.NewSelectedIndex]["ID"]; EWF_Flow_ProcessBLL bll = new EWF_Flow_ProcessBLL(ID); switch (bll.Model.Type) { case 1: Response.Redirect("FlowProcessStartDetail.aspx?ProcessID=" + bll.Model.ID.ToString() + "&AppID=" + ViewState["AppID"].ToString()); break; case 2: Response.Redirect("FlowProcessFinishDetail.aspx?ProcessID=" + bll.Model.ID.ToString() + "&AppID=" + ViewState["AppID"].ToString()); break; case 3: Response.Redirect("FlowProcessDecisionDetail.aspx?ProcessID=" + bll.Model.ID.ToString() + "&AppID=" + ViewState["AppID"].ToString()); break; case 4: Response.Redirect("FlowProcessConditionDetail.aspx?ProcessID=" + bll.Model.ID.ToString() + "&AppID=" + ViewState["AppID"].ToString()); break; case 5: Response.Redirect("FlowProcessDataBaseDetail.aspx?ProcessID=" + bll.Model.ID.ToString() + "&AppID=" + ViewState["AppID"].ToString()); break; case 6: Response.Redirect("FlowProcessEmailDetail.aspx?ProcessID=" + bll.Model.ID.ToString() + "&AppID=" + ViewState["AppID"].ToString()); break; case 7: Response.Redirect("FlowProcessGetPositionDetail.aspx?ProcessID=" + bll.Model.ID.ToString() + "&AppID=" + ViewState["AppID"].ToString()); break; case 8: Response.Redirect("FlowProcessGetOrganizeCityDetail.aspx?ProcessID=" + bll.Model.ID.ToString() + "&AppID=" + ViewState["AppID"].ToString()); break; case 9: Response.Redirect("FlowProcessCCDetail.aspx?ProcessID=" + bll.Model.ID.ToString() + "&AppID=" + ViewState["AppID"].ToString()); break; case 10: Response.Redirect("FlowProcessJointDecisionDetail.aspx?ProcessID=" + bll.Model.ID.ToString() + "&AppID=" + ViewState["AppID"].ToString()); break; } }
//选择某个Job,查看详细信息 protected void gv_List_JobList_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { int JobID = (int)this.gv_List_JobList.DataKeys[e.NewSelectedIndex]["ID"]; EWF_Task_JobBLL job = new EWF_Task_JobBLL(JobID); EWF_Flow_ProcessBLL process = new EWF_Flow_ProcessBLL(job.Model.CurrentProcess); this.tr_RecipientProcess.Visible = false; this.tr_ConditionProcess.Visible = false; this.tr_DataBaseProcess.Visible = false; this.tr_SendMailProcess.Visible = false; this.tr_CCProcess.Visible = false; switch (process.Model.Type) { case 1: //开始环节 break; case 2: //结束环节 break; case 3: //人员审批环节 case 10: //人员会审环节 this.tr_RecipientProcess.Visible = true; BindRecipientProcessInfo(JobID); break; case 4: //条件判断环节 this.tr_ConditionProcess.Visible = true; BindConditionProcessInfo(JobID); break; case 5: //执行数据库环节 this.tr_DataBaseProcess.Visible = true; BindDataBaseProcessInfo(JobID); break; case 6: //发送邮件环节 this.tr_SendMailProcess.Visible = true; BindSendMailProcessInfo(JobID); break; case 9: //抄送环节 tr_CCProcess.Visible = true; BindCCProcessInfo(JobID); break; } }
protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { EWF_Task_Job Job = new EWF_Task_JobBLL((int)gv_List.DataKeys[e.Row.RowIndex]["CurrentJobID"]).Model; if (Job == null) { return; } EWF_Flow_Process p = new EWF_Flow_ProcessBLL(Job.CurrentProcess).Model; if (p == null) { return; } if (p.Type == 3) { EWF_Flow_ProcessDecision Process = new EWF_Flow_ProcessDecisionBLL(Job.CurrentProcess).Model; if (Process == null) { return; } if (Process.CanBatchApprove == "N") { CheckBox cb_Check = (CheckBox)e.Row.FindControl("cb_Check"); if (cb_Check != null) { cb_Check.Checked = false; cb_Check.Visible = false; } } } } }
//绑定开始环节详细信息 private void BindTaskInfo() { EWF_TaskBLL task = new EWF_TaskBLL((int)ViewState["TaskID"]); #region 如果任务在待审批状态,且正好是待当前人审批,则直接切换到审批页面 if (task.Model.Status == 3) { int job = EWF_TaskBLL.StaffCanApproveTask(task.Model.ID, (int)Session["UserID"]); if (job > 0) { Response.Redirect("Recipient.aspx?CurrentJobID=" + job.ToString() + "&TaskID=" + task.Model.ID.ToString()); } } #endregion EWF_Flow_App app = new EWF_Flow_AppBLL(task.Model.App).Model; #region 绑定流程信息 lbl_ID.Text = task.Model.ID.ToString(); lbl_Applyer.Text = new Org_StaffBLL(task.Model.Initiator).Model.RealName; lbl_AppName.Text = app.Name; lbl_Applyer_Position.Text = new Org_PositionBLL(new Org_StaffBLL(task.Model.Initiator).Model.Position).Model.Name; lbl_Title.Text = task.Model.Title; lb_Status.Text = DictionaryBLL.GetDicCollections("EWF_Task_TaskStatus")[task.Model.Status.ToString()].Name; lb_StartTime.Text = task.Model.StartTime.ToString(); if (task.Model.EndTime != new DateTime(1900, 1, 1)) { lb_EndTime.Text = task.Model.EndTime.ToString(); } else { lb_EndTime.Text = "未结束"; } lt_Remark.Text = task.Model.Remark; #region 绑定流程当前环节信息 if (task.Model.Status < 5) { IList <EWF_Task_Job> jobs = EWF_Task_JobBLL.GetModelList("Task=" + task.Model.ID.ToString() + " ORDER BY StartTime DESC"); if (jobs.Count > 0) { EWF_Flow_Process process = new EWF_Flow_ProcessBLL(jobs[0].CurrentProcess).Model; if (process != null) { lb_CurrentJobInfo.Text = process.Name; if (process.Type == 3) { lb_CurrentJobInfo.Text += " 等待审批人:"; foreach (EWF_Task_JobDecision decision in EWF_Task_JobDecisionBLL.GetModelList("Job=" + jobs[0].ID.ToString())) { MCSFramework.Model.Org_Staff staff = new Org_StaffBLL(decision.RecipientStaff).Model; if (staff != null) { lb_CurrentJobInfo.Text += staff.RealName + " "; } } } } } } else { tr_CurrentProcessInfo.Visible = false; } #endregion #endregion #region 控制流程状态 if (task.Model.Initiator == (int)Session["UserID"]) { //只有流程发起的本人,才可控制流程状态 if (task.Model.Status == 6) { MessageBox.Show(this, "您的流程因故停止流转,请尽快联系系统管理员排查原因,或点击“继续执行”按钮以重新启动流程的流转!"); bt_Restart.Visible = true; } if (task.Model.Status == 4) { MessageBox.Show(this, "您的流程被最后一审批人设为了待处理状态,请补充相关信息附件后,或点击“继续执行”按钮以重新启动流程的流转!"); bt_Restart.Visible = true; } if (task.Model.Status == 1) { MessageBox.Show(this, "您的流程还没正式发起申请,请尽快点击“确定发起”按钮以发起流程!"); btn_Start.Visible = true; } if (task.Model.Status != 5) { //未完成 if (app.RelateBusiness == "N") { bt_Cancel.Visible = true; } tr_UploadAtt.Visible = true; } } #endregion #region 显示申请详细信息IFrame //显示申请详细信息IFrame if (!string.IsNullOrEmpty(task.Model.RelateURL)) { hyl_RelateURL.NavigateUrl = task.Model.RelateURL; tr_RelateUrl.Visible = true; string url = this.ResolveClientUrl(task.Model.RelateURL); if (url.IndexOf('?') >= 0) { url += "&ViewFramework=False"; } else { url += "?ViewFramework=False"; } frame_relateurl.Attributes.Add("src", url); } else { tr_RelateUrl.Visible = false; hyl_RelateURL.Visible = false; } #endregion //Bind the dataobject info pl_dataobjectinfo.BindData(task.Model.DataObjectValues); if (task.Model.Status > 1) { pl_dataobjectinfo.SetPanelEnable(false); TextBox tbx_ReMark = pl_dataobjectinfo.FindControl("C_Remark") != null ? (TextBox)pl_dataobjectinfo.FindControl("C_Remark") : null; if (tbx_ReMark != null) { tbx_ReMark.Enabled = true; tbx_ReMark.ReadOnly = true; } } //绑定环节列表 gv_List_JobList.BindGrid <EWF_Task_Job>(task.GetJobList()); }
protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { EWF_Task_Job Job = new EWF_Task_JobBLL((int)gv_List.DataKeys[e.Row.RowIndex]["CurrentJobID"]).Model; if (Job == null) return; EWF_Flow_Process p = new EWF_Flow_ProcessBLL(Job.CurrentProcess).Model; if (p == null) return; if (p.Type == 3) { EWF_Flow_ProcessDecision Process = new EWF_Flow_ProcessDecisionBLL(Job.CurrentProcess).Model; if (Process == null) return; if (Process.CanBatchApprove == "N") { CheckBox cb_Check = (CheckBox)e.Row.FindControl("cb_Check"); if (cb_Check != null) { cb_Check.Checked = false; cb_Check.Visible = false; } } } } }
//绑定开始环节详细信息 private void BindTaskInfo() { EWF_TaskBLL task = new EWF_TaskBLL((int)ViewState["TaskID"]); #region 如果任务在待审批状态,且正好是待当前人审批,则直接切换到审批页面 if (task.Model.Status == 3) { int job = EWF_TaskBLL.StaffCanApproveTask(task.Model.ID, (int)Session["UserID"]); if (job > 0) Response.Redirect("Recipient.aspx?CurrentJobID=" + job.ToString() + "&TaskID=" + task.Model.ID.ToString()); } #endregion EWF_Flow_App app = new EWF_Flow_AppBLL(task.Model.App).Model; #region 绑定流程信息 lbl_ID.Text = task.Model.ID.ToString(); lbl_Applyer.Text = new Org_StaffBLL(task.Model.Initiator).Model.RealName; lbl_AppName.Text = app.Name; lbl_Applyer_Position.Text = new Org_PositionBLL(new Org_StaffBLL(task.Model.Initiator).Model.Position).Model.Name; lbl_Title.Text = task.Model.Title; lb_Status.Text = DictionaryBLL.GetDicCollections("EWF_Task_TaskStatus")[task.Model.Status.ToString()].Name; lb_StartTime.Text = task.Model.StartTime.ToString(); if (task.Model.EndTime != new DateTime(1900, 1, 1)) lb_EndTime.Text = task.Model.EndTime.ToString(); else lb_EndTime.Text = "未结束"; lt_Remark.Text = task.Model.Remark; #region 绑定流程当前环节信息 if (task.Model.Status < 5) { IList<EWF_Task_Job> jobs = EWF_Task_JobBLL.GetModelList("Task=" + task.Model.ID.ToString() + " ORDER BY StartTime DESC"); if (jobs.Count > 0) { EWF_Flow_Process process = new EWF_Flow_ProcessBLL(jobs[0].CurrentProcess).Model; if (process != null) { lb_CurrentJobInfo.Text = process.Name; if (process.Type == 3) { lb_CurrentJobInfo.Text += " 等待审批人:"; foreach (EWF_Task_JobDecision decision in EWF_Task_JobDecisionBLL.GetModelList("Job=" + jobs[0].ID.ToString())) { MCSFramework.Model.Org_Staff staff = new Org_StaffBLL(decision.RecipientStaff).Model; if (staff != null) lb_CurrentJobInfo.Text += staff.RealName + " "; } } } } } else tr_CurrentProcessInfo.Visible = false; #endregion #endregion #region 控制流程状态 if (task.Model.Initiator == (int)Session["UserID"]) { //只有流程发起的本人,才可控制流程状态 if (task.Model.Status == 6) { MessageBox.Show(this, "您的流程因故停止流转,请尽快联系系统管理员排查原因,或点击“继续执行”按钮以重新启动流程的流转!"); bt_Restart.Visible = true; } if (task.Model.Status == 4) { MessageBox.Show(this, "您的流程被最后一审批人设为了待处理状态,请补充相关信息附件后,或点击“继续执行”按钮以重新启动流程的流转!"); bt_Restart.Visible = true; } if (task.Model.Status == 1) { MessageBox.Show(this, "您的流程还没正式发起申请,请尽快点击“确定发起”按钮以发起流程!"); btn_Start.Visible = true; } if (task.Model.Status != 5) { //未完成 if (app.RelateBusiness == "N") bt_Cancel.Visible = true; tr_UploadAtt.Visible = true; } } #endregion #region 显示申请详细信息IFrame //显示申请详细信息IFrame if (!string.IsNullOrEmpty(task.Model.RelateURL)) { hyl_RelateURL.NavigateUrl = task.Model.RelateURL; tr_RelateUrl.Visible = true; string url = this.ResolveClientUrl(task.Model.RelateURL); if (url.IndexOf('?') >= 0) url += "&ViewFramework=False"; else url += "?ViewFramework=False"; frame_relateurl.Attributes.Add("src", url); } else { tr_RelateUrl.Visible = false; hyl_RelateURL.Visible = false; } #endregion //Bind the dataobject info pl_dataobjectinfo.BindData(task.Model.DataObjectValues); if (task.Model.Status > 1) { pl_dataobjectinfo.SetPanelEnable(false); TextBox tbx_ReMark = pl_dataobjectinfo.FindControl("C_Remark") != null ? (TextBox)pl_dataobjectinfo.FindControl("C_Remark") : null; if (tbx_ReMark != null) { tbx_ReMark.Enabled = true; tbx_ReMark.ReadOnly = true; } } //绑定环节列表 gv_List_JobList.BindGrid<EWF_Task_Job>(task.GetJobList()); }
//选择某个Job,查看详细信息 protected void gv_List_JobList_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { int JobID = (int)this.gv_List_JobList.DataKeys[e.NewSelectedIndex]["ID"]; EWF_Task_JobBLL job = new EWF_Task_JobBLL(JobID); EWF_Flow_ProcessBLL process = new EWF_Flow_ProcessBLL(job.Model.CurrentProcess); this.tr_RecipientProcess.Visible = false; this.tr_ConditionProcess.Visible = false; this.tr_DataBaseProcess.Visible = false; this.tr_SendMailProcess.Visible = false; this.tr_CCProcess.Visible = false; switch (process.Model.Type) { case 1://开始环节 break; case 2://结束环节 break; case 3://人员审批环节 case 10: //人员会审环节 this.tr_RecipientProcess.Visible = true; BindRecipientProcessInfo(JobID); break; case 4://条件判断环节 this.tr_ConditionProcess.Visible = true; BindConditionProcessInfo(JobID); break; case 5://执行数据库环节 this.tr_DataBaseProcess.Visible = true; BindDataBaseProcessInfo(JobID); break; case 6://发送邮件环节 this.tr_SendMailProcess.Visible = true; BindSendMailProcessInfo(JobID); break; case 9: //抄送环节 tr_CCProcess.Visible = true; BindCCProcessInfo(JobID); break; } }
//绑定基本信息 private void BindTaskData() { #region 绑定当前工作项 EWF_Task_JobBLL job = new EWF_Task_JobBLL((int)ViewState["CurrentJobID"]); int decisionid = job.StaffCanDecide((int)Session["UserID"]); if (decisionid <= 0) { MessageBox.ShowAndRedirect(this, "对不起,你无权审批当前工作流申请!", "../desktop.aspx"); return; } ViewState["DecisionID"] = decisionid; ViewState["TaskID"] = job.Model.Task; //绑定当前审批人相关信息 EWF_Flow_Process _CurrentProcess = new EWF_Flow_ProcessBLL(job.Model.CurrentProcess).Model; lbl_CurrentJobName.Text = _CurrentProcess.Name; if (_CurrentProcess.Type == 10) { //人员会审环节 无待处理选项 btn_WaitProcess.Visible = false; } EWF_Task_JobDecisionBLL decision = new EWF_Task_JobDecisionBLL(decisionid); if (decision.Model.ReadFlag != "Y") { decision.SetReadFlag("Y"); } lb_DecisionComment.Text = decision.Model.DecisionComment; this.lbl_RecipientStaff.Text = new Org_StaffBLL(decision.Model.RecipientStaff).Model.RealName; this.lbl_RecipientTime.Text = DateTime.Now.ToString(); if (decision.Model.RecipientStaff != (int)Session["UserID"]) { ViewState["PrincipalStaff"] = lbl_RecipientStaff.Text; MessageBox.Show(this, "请注意,当前申请是由【" + lbl_RecipientStaff.Text + "】授权您来批复!"); } #endregion #region 绑定流程信息 EWF_TaskBLL task = new EWF_TaskBLL((int)ViewState["TaskID"]); if (task.Model.Status == 5) { Response.Redirect("TaskDetail.aspx?TaskID=" + task.Model.ID.ToString()); return; } ViewState["Initiator"] = task.Model.Initiator; //绑定流程信息 lbl_Applyer.Text = new Org_StaffBLL(task.Model.Initiator).Model.RealName; lbl_AppName.Text = new EWF_Flow_AppBLL(task.Model.App).Model.Name; lbl_Title.Text = task.Model.Title; hyl_RelateURL.NavigateUrl = task.Model.RelateURL; lb_Status.Text = DictionaryBLL.GetDicCollections("EWF_Task_TaskStatus")[task.Model.Status.ToString()].Name; lb_StartTime.Text = task.Model.StartTime.ToString(); if (task.Model.EndTime != new DateTime(1900, 1, 1)) { lb_EndTime.Text = task.Model.EndTime.ToString(); } else { lb_EndTime.Text = "未结束"; } lt_Remark.Text = task.Model.Remark; //显示申请详细信息IFrame if (!string.IsNullOrEmpty(task.Model.RelateURL)) { tr_RelateUrl.Visible = true; string url = this.ResolveClientUrl(task.Model.RelateURL); if (url.IndexOf('?') >= 0) { url += "&ViewFramework=false&Decision=Y"; } else { url += "?ViewFramework=false&Decision=Y"; } frame_relateurl.Attributes.Add("src", url); } else { tr_RelateUrl.Visible = false; } //Bind the dataobject info NameValueCollection dataobjects = task.GetDataObjectValue(); pl_dataobjectinfo.BindData(dataobjects); pl_dataobjectinfo.SetPanelEnable(false); TextBox tbx_ReMark = pl_dataobjectinfo.FindControl("C_Remark") != null ? (TextBox)pl_dataobjectinfo.FindControl("C_Remark") : null; if (tbx_ReMark != null) { tbx_ReMark.Enabled = true; tbx_ReMark.ReadOnly = true; } //绑定审批历史 this.gv_List_DecisionHistory.DataSource = task.GetDecisionHistory(); this.gv_List_DecisionHistory.DataBind(); //绑定附件 gv_List_Attachment.BindGrid <EWF_Task_Attachment>(task.GetAttachmentsList()); #endregion ddl_App.SelectedValue = task.Model.App.ToString(); ViewState["PageIndex"] = 0; BindGrid_OtherTask(); BindGrid_InviteConsult(); }