protected void Save_Click(object sender, EventArgs e) { string id = ViewState["FormID"].ToString(); BP_LeaseContractInfo obj = SaveData(id, "00"); if (obj != null) { if (SaveWorkFlowInstance(obj, "0", null, "")) { Alert(Page, "保存成功!"); } } else { Alert(Page, "保存失败"); } }
private void BindFormData() { string methodName = "BindFormData"; Logger.Write(this.GetType(), EnumLogLevel.Info, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.IN); try { BP_LeaseContractInfo obj = lc.GetLeaseContract(ViewState["FormID"].ToString()); if (obj != null) { cblSecurityLevel.SelectedValue = obj.SecurityLevel != null ? obj.SecurityLevel.ToString() : "-1"; cblUrgentLevel.SelectedValue = obj.UrgenLevel != null ? obj.UrgenLevel.ToString() : "-1"; tbData.Text = ((DateTime)obj.Date).ToString("yyyy-MM-dd"); tbPerson.Text = obj.UserName; tbDepartName.Text = obj.DeptName; tbPhone.Text = obj.Mobile; tbTitle.Text = obj.ReportTitle; tbContent.Text = obj.Url; tbReportCode.Text = obj.ReportCode; tbReason.Text = obj.Reason; tbRemark.Text = obj.Remark; cblDecorationContract.SelectedValue = obj.DecorationContract != null ? obj.DecorationContract.ToString() : "-1"; cblServiceContract.SelectedValue = obj.ServiceContract != null ? obj.ServiceContract.ToString() : "-1"; cblCompensationContract.SelectedValue = obj.CompensationContract != null ? obj.CompensationContract.ToString() : "-1"; cblModificationContract.SelectedValue = obj.ModificationContract != null ? obj.ModificationContract.ToString() : "-1"; cblSupplementContract.SelectedValue = obj.SupplementContract != null ? obj.SupplementContract.ToString() : "-1"; cblLesseeContract.SelectedValue = obj.LesseeContract != null ? obj.LesseeContract.ToString() : "-1"; hf_biz_type.Value = obj.BizType.ToString(); hf_biz_id.Value = obj.BizID.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); }
private void BindFormData() { string methodName = "BindFormData"; try { WorkFlowInstance Instance = wf_WorkFlowInstance.GetWorkFlowInstanceById(ViewState["InstanceID"].ToString()); if (Instance == null) { ExceptionHander.GoToErrorPage("记录不存在"); } BP_LeaseContractInfo item = lc.GetLeaseContract(Instance.FormId.ToString()); if (item == null) { ExceptionHander.GoToErrorPage("记录不存在"); } if (item != null) { cblSecurityLevel.SelectedValue = item.SecurityLevel != null?item.SecurityLevel.ToString() : "-1"; cblUrgentLevel.SelectedValue = item.UrgenLevel != null?item.UrgenLevel.ToString() : "-1"; tbData.Text = ((DateTime)item.Date).ToString("yyyy-MM-dd"); tbPerson.Text = item.UserName; tbDepartName.Text = item.DeptName; tbPhone.Text = item.Mobile; tbTitle.Text = item.ReportTitle; tbContent.Text = item.Url; tbReportCode.Text = item.ReportCode; tbReason.Text = item.Reason; tbRemark.Text = item.Remark; cblDecorationContract.SelectedValue = item.DecorationContract != null?item.DecorationContract.ToString() : "-1"; cblServiceContract.SelectedValue = item.ServiceContract != null?item.ServiceContract.ToString() : "-1"; cblCompensationContract.SelectedValue = item.CompensationContract != null?item.CompensationContract.ToString() : "-1"; cblModificationContract.SelectedValue = item.ModificationContract != null?item.ModificationContract.ToString() : "-1"; cblSupplementContract.SelectedValue = item.SupplementContract != null?item.SupplementContract.ToString() : "-1"; cblLesseeContract.SelectedValue = item.LesseeContract != null?item.LesseeContract.ToString() : "-1"; } #region 审批意见框 ApproveOpinionUC1.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC2.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC3.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC4.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC5.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC6.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC7.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC8.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC9.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC10.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC11.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC12.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC13.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC14.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC13.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC16.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC17.InstanceId = ViewState["InstanceID"].ToString(); ApproveOpinionUC18.InstanceId = ViewState["InstanceID"].ToString(); #endregion } 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 Submit_Click(object sender, EventArgs e) { #region 工作流参数 NameValueCollection dataFields = SetWFParams(); if (dataFields == null) { return; } #endregion int wfInstanceId = 0; //process instance id string id = ViewState["FormID"].ToString(); BP_LeaseContractInfo obj = SaveData(id, "02"); if (obj != null) { //开启流程 WorkflowHelper.CurrentUser = "******" + _BPMContext.CurrentUser.LoginId; WorkflowHelper.StartProcess(@"K2Workflow\BP_LeaseContract", id, dataFields, ref wfInstanceId); if (wfInstanceId > 0) { if (SaveWorkFlowInstance(obj, "1", DateTime.Now, wfInstanceId.ToString())) { if (lc.UpdateStatus(id, "02")) { string Opinion = ""; string ApproveResult = "同意"; string OpinionType = ""; string IsSign = "0"; string DelegateUserName = ""; string DelegateUserCode = ""; WorkFlowInstance workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(obj.FormID); //通知系统 string instanceID = workFlowInstance.InstanceId; string url = "http://" + Request.Url.Authority + "/Workflow/ViewPage/V_BP_LeaseContract.aspx?ID=" + instanceID; try { ContractClass.SubmitWorkFlow(url, Convert.ToInt16(tbBizType.Text.ToString()), Convert.ToInt16(tbBizID.Text.ToString())); } catch { } var appRecord = new Pkurg.PWorldBPM.Business.Sys.WF_Approval_Record() { ApprovalID = Guid.NewGuid().ToString(), FormID = id, InstanceID = workFlowInstance.InstanceId, Opinion = Opinion, ApproveAtTime = DateTime.Now, ApproveByUserCode = CurrentEmployee.EmployeeCode, ApproveByUserName = CurrentEmployee.EmployeeName, ApproveResult = ApproveResult, OpinionType = OpinionType, CurrentActiveName = "拟稿", ISSign = IsSign, DelegateUserName = DelegateUserName, DelegateUserCode = DelegateUserCode, CreateAtTime = DateTime.Now, CreateByUserCode = CurrentEmployee.EmployeeCode, CreateByUserName = CurrentEmployee.EmployeeName, UpdateAtTime = DateTime.Now, UpdateByUserCode = CurrentEmployee.EmployeeCode, UpdateByUserName = CurrentEmployee.EmployeeName, FinishedTime = DateTime.Now }; BFApprovalRecord bfApproval = new BFApprovalRecord(); bfApproval.AddApprovalRecord(appRecord); } } } } ScriptManager.RegisterClientScriptBlock(this, typeof(string), "1", "alert('提交成功');", true); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ajax", " window.opener=null; window.open('', '_self', '');window.close();", true); }
private bool SaveWorkFlowInstance(BP_LeaseContractInfo obj, string WfStatus, DateTime?SumitTime, string WfInstanceId) { string methodName = "SaveWorkFlowInstance"; Logger.Write(this.GetType(), EnumLogLevel.Info, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.IN); bool result = false; WorkFlowInstance workFlowInstance = null; try { workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(obj.FormID); bool isEdit = false; if (workFlowInstance == null) { workFlowInstance = new WorkFlowInstance(); workFlowInstance.InstanceId = Guid.NewGuid().ToString(); workFlowInstance.CreateDeptCode = CurrentEmployee.DepartCode; workFlowInstance.CreateDeptName = CurrentEmployee.DepartName; workFlowInstance.CreateAtTime = DateTime.Now; workFlowInstance.CreateByUserCode = CurrentEmployee.EmployeeCode; workFlowInstance.CreateByUserName = CurrentEmployee.EmployeeName; workFlowInstance.AppId = "2001"; } else { workFlowInstance.CreateAtTime = DateTime.Now; workFlowInstance.UpdateByUserCode = CurrentEmployee.EmployeeCode; workFlowInstance.UpdateByUserName = CurrentEmployee.EmployeeName; isEdit = true; } workFlowInstance.FormId = obj.FormID; workFlowInstance.FormTitle = obj.ReportTitle; workFlowInstance.WfStatus = WfStatus; if (SumitTime != null) { workFlowInstance.SumitTime = SumitTime; } if (WfInstanceId != "") { workFlowInstance.WfInstanceId = WfInstanceId; } if (!isEdit) { result = wf_WorkFlowInstance.AddWorkFlowInstance(workFlowInstance); } else { result = wf_WorkFlowInstance.UpdateWorkFlowInstance(workFlowInstance); } } 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); return(result); }
private BP_LeaseContractInfo SaveData(string ID, string wfStatus) { string methodName = "SaveData"; Logger.Write(this.GetType(), EnumLogLevel.Info, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.IN); BP_LeaseContractInfo obj = null; try { obj = lc.GetLeaseContract(ID); bool isEdit = false; if (obj == null) { obj = new BP_LeaseContractInfo(); obj.FormID = ViewState["FormID"].ToString(); obj.ReportCode = ViewState["FormID"].ToString(); obj.ApproveStatus = wfStatus; obj.CreateByUserCode = CurrentEmployee.EmployeeCode; obj.CreateAtTime = DateTime.Now; obj.CreateByUserName = CurrentEmployee.EmployeeName; } else { isEdit = true; obj.FormID = ViewState["FormID"].ToString(); obj.ApproveStatus = wfStatus; } obj.UpdateByUserCode = CurrentEmployee.EmployeeCode; obj.UpdateByUserName = CurrentEmployee.EmployeeName; if (cblSecurityLevel.SelectedIndex != -1) { obj.SecurityLevel = short.Parse(cblSecurityLevel.SelectedValue); } if (cblUrgentLevel.SelectedIndex != -1) { obj.UrgenLevel = short.Parse(cblUrgentLevel.SelectedValue); } if (cblModificationContract.SelectedIndex != -1) { obj.ModificationContract = short.Parse(cblModificationContract.SelectedValue); } if (cblSupplementContract.SelectedIndex != -1) { obj.SupplementContract = short.Parse(cblSupplementContract.SelectedValue); } if (cblLesseeContract.SelectedIndex != -1) { obj.LesseeContract = short.Parse(cblLesseeContract.SelectedValue); } if (cblDecorationContract.SelectedIndex != -1) { obj.DecorationContract = short.Parse(cblDecorationContract.SelectedValue); } if (cblServiceContract.SelectedIndex != -1) { obj.ServiceContract = short.Parse(cblServiceContract.SelectedValue); } if (cblDecorationContract.SelectedIndex != -1) { obj.CompensationContract = short.Parse(cblDecorationContract.SelectedValue); } DateTime date; bool flag1 = DateTime.TryParse(UpdatedTextBox.Value, out date); if (flag1) { obj.Date = date; } obj.UserName = tbPerson.Text; obj.StartDeptCode = ddlDepartName.SelectedItem.Value.ToString(); obj.DeptName = ddlDepartName.SelectedItem.Text; obj.Mobile = tbPhone.Text; obj.ReportTitle = tbTitle.Text; obj.Reason = tbReason.Text; obj.Remark = tbRemark.Text; if (tbBizType.Text.ToString() != "") { obj.BizType = int.Parse(tbBizType.Text.ToString()); } if (tbBizID.Text.ToString() != "") { obj.BizID = int.Parse(tbBizID.Text.ToString()); } if (tbApproveFlag.Text.ToString() != "") { obj.ApproveFlag = short.Parse(tbApproveFlag.Text.ToString()); } if (tbContent.Text.ToString() != "") { obj.Url = tbContent.Text.ToString(); } else { obj.Url = ""; } if (!isEdit) { lc.InsertLeaseContract(obj); } else { lc.UpdateLeaseContract(obj); } } 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); return(obj); }
private void BindFormData() { string methodName = "BindFormData"; Logger.Write(this.GetType(), EnumLogLevel.Info, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.IN); try { BP_LeaseContractInfo obj = lc.GetLeaseContract(ViewState["FormID"].ToString()); cblSecurityLevel.SelectedValue = obj.SecurityLevel != null?obj.SecurityLevel.ToString() : "-1"; cblUrgentLevel.SelectedValue = obj.UrgenLevel != null?obj.UrgenLevel.ToString() : "-1"; ListItem item = ddlDepartName.Items.FindByValue(obj.StartDeptCode); if (item != null) { ddlDepartName.SelectedIndex = ddlDepartName.Items.IndexOf(item); } UpdatedTextBox.Value = ((DateTime)obj.Date).ToString("yyyy-MM-dd"); tbPerson.Text = obj.UserName; tbPhone.Text = obj.Mobile; tbTitle.Text = obj.ReportTitle; tbReportCode.Text = obj.ReportCode; tbReason.Text = obj.Reason; tbContent.Text = obj.Url; tbRemark.Text = obj.Remark; cblDecorationContract.SelectedValue = obj.DecorationContract != null?obj.DecorationContract.ToString() : "-1"; cblServiceContract.SelectedValue = obj.ServiceContract != null?obj.ServiceContract.ToString() : "-1"; cblCompensationContract.SelectedValue = obj.CompensationContract != null?obj.CompensationContract.ToString() : "-1"; cblModificationContract.SelectedValue = obj.ModificationContract != null?obj.ModificationContract.ToString() : "-1"; cblSupplementContract.SelectedValue = obj.SupplementContract != null?obj.SupplementContract.ToString() : "-1"; cblLesseeContract.SelectedValue = obj.LesseeContract != null?obj.LesseeContract.ToString() : "-1"; WorkFlowInstance workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(obj.FormID); #region 审批意见框 ApproveOpinionUC1.InstanceId = workFlowInstance.InstanceId; ApproveOpinionUC2.InstanceId = workFlowInstance.InstanceId; ApproveOpinionUC3.InstanceId = workFlowInstance.InstanceId; ApproveOpinionUC4.InstanceId = workFlowInstance.InstanceId; ApproveOpinionUC5.InstanceId = workFlowInstance.InstanceId; ApproveOpinionUC6.InstanceId = workFlowInstance.InstanceId; ApproveOpinionUC7.InstanceId = workFlowInstance.InstanceId; ApproveOpinionUC8.InstanceId = workFlowInstance.InstanceId; ApproveOpinionUC9.InstanceId = workFlowInstance.InstanceId; ApproveOpinionUC10.InstanceId = workFlowInstance.InstanceId; ApproveOpinionUC11.InstanceId = workFlowInstance.InstanceId; ApproveOpinionUC12.InstanceId = workFlowInstance.InstanceId; ApproveOpinionUC13.InstanceId = workFlowInstance.InstanceId; ApproveOpinionUC14.InstanceId = workFlowInstance.InstanceId; ApproveOpinionUC15.InstanceId = workFlowInstance.InstanceId; ApproveOpinionUC16.InstanceId = workFlowInstance.InstanceId; ApproveOpinionUC17.InstanceId = workFlowInstance.InstanceId; ApproveOpinionUC18.InstanceId = workFlowInstance.InstanceId; #endregion } 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); }