/// <summary> /// 加载发起部门及相关控件 /// </summary> private void InitFormData() { try { SystemDispatchInfo formDataInfo = SystemDispatch.GetSystemDispatchInfo(FormId); ListItem item = ddlDepartName.Items.FindByValue(formDataInfo.StartDeptId); if (item != null) { ddlDepartName.SelectedIndex = ddlDepartName.Items.IndexOf(item); } ListItem departItem = ddlDepartName.Items.FindByValue(formDataInfo.StartDeptId); if (departItem == null) { ExceptionHander.GoToErrorPage(); return; } departItem.Selected = true; Countersign1.CounterSignDeptId = formDataInfo.StartDeptId; } catch (Exception ex) { throw ex; } }
private void InitForm() { if (!string.IsNullOrEmpty(Request.QueryString["id"])) { SystemDispatchInfo info = SystemDispatch.GetSystemDispatchInfo(FormId); cblSecurityLevel.SelectedIndex = Convert.ToInt32(info.SecurityLevel); cblUrgenLevel.SelectedIndex = Convert.ToInt32(info.UrgenLevel); UpdatedTextBox.Value = info.DateTime; tbDateTime.Text = info.DateTime; tbUserName.Text = info.UserName; tbMobile.Text = info.Mobile; tbTitle.Text = info.Title; tbContent.Text = info.Content; cblRedHeadDocument.SelectedIndex = int.Parse(info.RedHeadDocument); cblIsPublish.SelectedIndex = int.Parse(info.IsPublish); cblSecurityLevel.SelectedIndex = int.Parse(info.SecurityLevel); cblUrgenLevel.SelectedIndex = int.Parse(info.UrgenLevel); tbReportCode.Text = info.FormId; } else { tbUserName.Text = _BPMContext.CurrentPWordUser.EmployeeName; tbMobile.Text = _BPMContext.CurrentPWordUser.MobilePhone; UpdatedTextBox.Value = DateTime.Now.ToString("yyyy/MM/dd"); } }
/// <summary> /// 加载表单 /// </summary> private void InitFormData() { try { if (!string.IsNullOrEmpty(Request.QueryString["id"])) { SystemDispatchInfo info = SystemDispatch.GetSystemDispatchInfo(FormId); cblSecurityLevel.SelectedIndex = Convert.ToInt32(info.SecurityLevel); cblUrgenLevel.SelectedIndex = Convert.ToInt32(info.UrgenLevel); tbDepartName.Text = info.DeptName; tbDateTime.Text = info.DateTime; tbDateTime.Text = info.DateTime; tbUserName.Text = info.UserName; tbMobile.Text = info.Mobile; tbTitle.Text = info.Title; tbContent.Text = info.Content; cblRedHeadDocument.SelectedIndex = int.Parse(info.RedHeadDocument); cblIsPublish.SelectedIndex = int.Parse(info.IsPublish); cblSecurityLevel.SelectedIndex = int.Parse(info.SecurityLevel); cblUrgenLevel.SelectedIndex = int.Parse(info.UrgenLevel); tbReportCode.Text = info.FormId; } } catch (Exception ex) { throw ex; } }
/// <summary> /// 初始化总办会成员复选框和董事长勾选框 /// </summary> private void InitCheckBoxList() { BFPmsUserRoleDepartment bfurd = new BFPmsUserRoleDepartment(); DataTable dtLeaders = bfurd.GetSelectRoleUser(PKURGICode, "总办会成员"); string strLeaders = GetRoleUsers(PKURGICode, "总办会成员"); foreach (DataRow user in dtLeaders.Rows) { ListItem li = new ListItem(); li.Value = "K2:Founder\\" + user["LoginName"].ToString(); li.Text = user["EmployeeName"].ToString(); if (!cblTopLeaders.Items.Contains(li)) { cblTopLeaders.Items.Add(li); } } if (!string.IsNullOrEmpty(Request.QueryString["id"])) { XmlDocument xmldoc = new XmlDocument(); SystemDispatchInfo formDataInfo = SystemDispatch.GetSystemDispatchInfo(FormId); if (!string.IsNullOrEmpty(formDataInfo.LeadersSelected)) { xmldoc.LoadXml(formDataInfo.LeadersSelected); } XmlNode NodeLeaders = xmldoc.SelectSingleNode("//TopLeaders"); if (NodeLeaders != null && NodeLeaders.Attributes["ID"].Value.Length > 0) { foreach (string UserGuid in NodeLeaders.Attributes["ID"].Value.Split(',')) { for (int i = 0; i < cblTopLeaders.Items.Count; i++) { if (cblTopLeaders.Items[i].Value == UserGuid) { cblTopLeaders.Items[i].Selected = true; } } } } XmlNode NodeChairman = xmldoc.SelectSingleNode("//Chairman"); if (NodeChairman != null && NodeChairman.Attributes["ID"].Value != "noapprovers") { cbChairman.Checked = true; } } else { for (int i = 0; i < cblTopLeaders.Items.Count; i++) { cblTopLeaders.Items[i].Selected = true; } } }
private void InintData() { string methodName = "InintData"; try { WorkFlowInstance Instance = wf_WorkFlowInstance.GetWorkFlowInstanceById(ViewState["InstanceID"].ToString()); SystemDispatchInfo info = SystemDispatch.GetSystemDispatchInfoByInstanceId(ViewState["InstanceID"].ToString()); if (info != null) { cblSecurityLevel.SelectedIndex = Convert.ToInt32(info.SecurityLevel); cblUrgenLevel.SelectedIndex = Convert.ToInt32(info.UrgenLevel); tbDepartName.Text = info.DeptName; tbDateTime.Text = info.DateTime; tbDateTime.Text = info.DateTime; tbUserName.Text = info.UserName; tbMobile.Text = info.Mobile; tbTitle.Text = info.Title; tbContent.Text = info.Content.Replace(" ", " ").Replace("\n", "<br/>"); cblRedHeadDocument.SelectedIndex = int.Parse(info.RedHeadDocument); cblIsPublish.SelectedIndex = int.Parse(info.IsPublish); cblSecurityLevel.SelectedIndex = int.Parse(info.SecurityLevel); cblUrgenLevel.SelectedIndex = int.Parse(info.UrgenLevel); tbReportCode.Text = info.FormId; } FlowRelated1.ProcId = ViewState["InstanceID"].ToString(); Countersign1.ProcId = ViewState["InstanceID"].ToString(); UploadAttachments1.ProcId = ViewState["InstanceID"].ToString(); OpinionDeptleader.InstanceId = ViewState["InstanceID"].ToString(); OpinionRealateDept.InstanceId = ViewState["InstanceID"].ToString(); OpinionTopLeaders.InstanceId = ViewState["InstanceID"].ToString(); OpinionCEO.InstanceId = ViewState["InstanceID"].ToString(); OpinionChairman.InstanceId = ViewState["InstanceID"].ToString(); } catch (Exception ex) { Logger.Write(this.GetType(), EnumLogLevel.Fatal, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.Exception + ":" + string.Format("Exception={0}", ex)); throw ex; } Logger.Write(this.GetType(), EnumLogLevel.Info, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.OUT); }
protected void Save_Click(object sender, EventArgs e) { SaveWFParams(); NameValueCollection dataFields = SetWFParams();//工作流参数 SystemDispatchInfo dataInfo = SaveFormData(); if (dataInfo != null) { UploadAttachments1.SaveAttachment(FormId); if (SaveWorkFlowInstance("0", null, "")) { Alert("保存完成"); } } else { Alert("保存失败"); } }
public static void InsertSystemDispatchInfo(SystemDispatchInfo info) { DataProvider dataProvider = new DataProvider(); dataProvider.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["BPMConnectionString"].ConnectionString; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@FormID", System.Data.SqlDbType.NVarChar, 100), new SqlParameter("@SecurityLevel", System.Data.SqlDbType.NVarChar, 100), new SqlParameter("@UrgenLevel", System.Data.SqlDbType.NVarChar, 100), new SqlParameter("@StartDeptId", System.Data.SqlDbType.NVarChar, 100), new SqlParameter("@DeptName", System.Data.SqlDbType.NVarChar, 100), new SqlParameter("@UserName", System.Data.SqlDbType.NVarChar, 100), new SqlParameter("@Mobile", System.Data.SqlDbType.NVarChar, 100), new SqlParameter("@DateTime", System.Data.SqlDbType.NVarChar, 100), new SqlParameter("@RedHeadDocument", System.Data.SqlDbType.NVarChar, 100), new SqlParameter("@IsPublish", System.Data.SqlDbType.NVarChar, 100), new SqlParameter("@Title", System.Data.SqlDbType.NVarChar, 200), new SqlParameter("@Content", System.Data.SqlDbType.NVarChar, 2000), new SqlParameter("@LeadersSelected", System.Data.SqlDbType.NVarChar, 2000), new SqlParameter("@ApproveResult", System.Data.SqlDbType.NVarChar, 100), }; parameters[0].Value = info.FormId; parameters[1].Value = info.SecurityLevel; parameters[2].Value = info.UrgenLevel; parameters[3].Value = info.StartDeptId; parameters[4].Value = info.DeptName; parameters[5].Value = info.UserName; parameters[6].Value = info.Mobile; parameters[7].Value = info.DateTime; parameters[8].Value = info.RedHeadDocument; parameters[9].Value = info.IsPublish; parameters[10].Value = info.Title; parameters[11].Value = info.Content; parameters[12].Value = info.LeadersSelected; parameters[13].Value = info.ApproveResult; DataTable dataTable = dataProvider.ExecutedProcedure("Biz.OA_SystemDispatch_Insert", parameters); }
protected void Submit_Click(object sender, EventArgs e) { int wfInstanceId = 0; //process instance id string id = ViewState["FormID"].ToString(); SystemDispatchInfo dataInfo = SaveFormData(); Countersign1.SaveData(true);//会签数据保存 if (dataInfo != null) { UploadAttachments1.SaveAttachment(FormId); Countersign1.SaveAndSubmit(); //会签数据保存 NameValueCollection dataFields = SetWFParams(); //工作流参数 if (dataFields == null) { return; } WorkflowHelper.CurrentUser = "******" + _BPMContext.CurrentUser.LoginId; WorkflowHelper.StartProcess(@"K2Workflow\OA_SystemDispatch", FormId, dataFields, ref wfInstanceId); if (wfInstanceId > 0) { if (SaveWorkFlowInstance("1", DateTime.Now, wfInstanceId.ToString())) { SaveWorkItem(); DisplayMessage.ExecuteJs("alert('提交成功');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ajax", " window.opener=null; window.open('', '_self', '');window.close();", true); return; } } } Alert("提交失败"); }
/// <summary> /// 保存表单 /// </summary> /// <returns></returns> private SystemDispatchInfo SaveFormData() { bool isEdit = false; SystemDispatchInfo info = null; try { info = SystemDispatch.GetSystemDispatchInfo(FormId); if (info == null) { info = new SystemDispatchInfo(); info.FormId = FormId; info.StartDeptId = ddlDepartName.SelectedItem.Value; info.DeptName = ddlDepartName.SelectedItem.Text; info.SecurityLevel = cblSecurityLevel.SelectedIndex.ToString(); info.UrgenLevel = cblUrgenLevel.SelectedIndex.ToString(); FormId = BPMHelp.GetSerialNumber("OA_ZD_"); info.FormId = FormId; info.DateTime = UpdatedTextBox.Value; info.UserName = tbUserName.Text; info.Mobile = tbMobile.Text; info.Title = tbTitle.Text; info.IsPublish = cblIsPublish.SelectedIndex.ToString(); info.RedHeadDocument = cblRedHeadDocument.SelectedIndex.ToString(); info.Content = tbContent.Text; info.LeadersSelected = strApprovers; } else { isEdit = true; info.FormId = FormId; info.StartDeptId = ddlDepartName.SelectedItem.Value; info.DeptName = ddlDepartName.SelectedItem.Text; info.SecurityLevel = cblSecurityLevel.SelectedIndex.ToString(); info.UrgenLevel = cblUrgenLevel.SelectedIndex.ToString(); info.FormId = tbReportCode.Text; info.DateTime = UpdatedTextBox.Value; info.UserName = tbUserName.Text; info.Mobile = tbMobile.Text; info.Title = tbTitle.Text; info.IsPublish = cblIsPublish.SelectedIndex.ToString(); info.RedHeadDocument = cblRedHeadDocument.SelectedIndex.ToString(); info.Content = tbContent.Text; info.LeadersSelected = strApprovers; } if (!isEdit) { SystemDispatch.InsertSystemDispatchInfo(info); } else { SystemDispatch.UpdateSystemDispatch(info); } } catch (Exception ex) { throw ex; } return(info); }
public static SystemDispatchInfo GetSystemDispatchInfoByWfId(string wfId) { SystemDispatchInfo info = null; DataProvider dataProvider = new DataProvider(); dataProvider.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["BPMConnectionString"].ConnectionString; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@WFInstanceId", System.Data.SqlDbType.NVarChar, 100), }; parameters[0].Value = wfId; DataTable dataTable = dataProvider.ExecutedProcedure("Biz.OA_SystemDispatch_GetByWfId", parameters); ///给实体赋值 if (dataTable != null && dataTable.Rows.Count > 0) { info = new SystemDispatchInfo(); if (dataTable.Rows[0]["FormId"] != null && dataTable.Rows[0]["FormId"].ToString() != "") { info.FormId = dataTable.Rows[0]["FormId"].ToString(); } if (dataTable.Rows[0]["SecurityLevel"] != null && dataTable.Rows[0]["SecurityLevel"].ToString() != "") { info.SecurityLevel = dataTable.Rows[0]["SecurityLevel"].ToString(); } if (dataTable.Rows[0]["UrgenLevel"] != null && dataTable.Rows[0]["UrgenLevel"].ToString() != "") { info.UrgenLevel = dataTable.Rows[0]["UrgenLevel"].ToString(); } if (dataTable.Rows[0]["StartDeptId"] != null && dataTable.Rows[0]["StartDeptId"].ToString() != "") { info.StartDeptId = dataTable.Rows[0]["StartDeptId"].ToString(); } if (dataTable.Rows[0]["DeptName"] != null && dataTable.Rows[0]["DeptName"].ToString() != "") { info.DeptName = dataTable.Rows[0]["DeptName"].ToString(); } if (dataTable.Rows[0]["UserName"] != null && dataTable.Rows[0]["UserName"].ToString() != "") { info.UserName = dataTable.Rows[0]["UserName"].ToString(); } if (dataTable.Rows[0]["Mobile"] != null && dataTable.Rows[0]["Mobile"].ToString() != "") { info.Mobile = dataTable.Rows[0]["Mobile"].ToString(); } if (dataTable.Rows[0]["DateTime"] != null && dataTable.Rows[0]["DateTime"].ToString() != "") { info.DateTime = dataTable.Rows[0]["DateTime"].ToString(); } if (dataTable.Rows[0]["RedHeadDocument"] != null && dataTable.Rows[0]["RedHeadDocument"].ToString() != "") { info.RedHeadDocument = dataTable.Rows[0]["RedHeadDocument"].ToString(); } if (dataTable.Rows[0]["IsPublish"] != null && dataTable.Rows[0]["IsPublish"].ToString() != "") { info.IsPublish = dataTable.Rows[0]["IsPublish"].ToString(); } if (dataTable.Rows[0]["Title"] != null && dataTable.Rows[0]["Title"].ToString() != "") { info.Title = dataTable.Rows[0]["Title"].ToString(); } if (dataTable.Rows[0]["Content"] != null && dataTable.Rows[0]["Content"].ToString() != "") { info.Content = dataTable.Rows[0]["Content"].ToString(); } if (dataTable.Rows[0]["LeadersSelected"] != null && dataTable.Rows[0]["LeadersSelected"].ToString() != "") { info.LeadersSelected = dataTable.Rows[0]["LeadersSelected"].ToString(); } if (dataTable.Rows[0]["ApproveResult"] != null && dataTable.Rows[0]["ApproveResult"].ToString() != "") { info.ApproveResult = dataTable.Rows[0]["ApproveResult"].ToString(); } } return(info); }