protected void BtnSubmit_Click(object sender, EventArgs e) { PageBase page = (PageBase)this.Page; RM rm = new RM(ResourceFile.Msg); if (mode != PageMode.View) { page.Alert(rm["SAVEFIRST"]); return; } CheckSubmitReturnMessage = ""; if (OnBeforeProcessSubmit != null) { OnBeforeProcessSubmit(this, EventArgs.Empty); } if (CheckSubmitReturnMessage.Length != 0) { page.Alert(CheckSubmitReturnMessage); return; } if (!CheckSubmitResult) { return; } //if (AppSetting.HttpsEnabled) //{ // HttpClientCertificate cert = Request.ClientCertificate; // if (!Certificate.CheckClientCertificate(cert)) // { // page.Alert("Your client certificate has problem, please contact helpdesk!"); // return; // } //} if (GrdActivity.EditIndex > -1) { InstanceProcess instprocess = new InstanceProcess(ApplicationID, ProcessID, InstanceID); GridViewRow editRow = GrdActivity.Rows[GrdActivity.EditIndex]; RadioButtonList rblOperation = (RadioButtonList)editRow.FindControl("RblOperation"); UcTextBox txtRemark = (UcTextBox)editRow.FindControl("TxtRemark"); if (rblOperation.SelectedItem == null) { page.Alert(rm["PleaseSelectOperation"]); return; } string operationCode = rblOperation.SelectedValue; int assignTo = 0; int userID = CurrentUser.UserID; int redefineStateId = State.GetStateID(UserDefineProcess.RedefineStateCode); int userdefineStateId = State.GetStateID(UserDefineProcess.UserDefineStateCode); if (operationCode.ToUpper() == "FORWARD") { assignTo = Fn.ToInt(HidForwardPerson.Value); if (assignTo == 0) { page.Alert(rm["Notsetforward"]); return; } } if (operationCode.ToUpper() == "HOLD") { InstanceProcessTemplate instanceTemplate = new InstanceProcessTemplate(); assignTo = instanceTemplate.GetApplicantId(ApplicationID, InstanceID); } if (operationCode.ToUpper() == "APPROVE" && CurrentStateID == State.GetStateID(UserDefineProcess.RedefineStateCode)) { int c = UserDefineProcess.GetItemsCount(ApplicationID, InstanceID); if (c == 0) { page.Alert(rm["PROCESS_NOT_DEFINED"]); return; } string errorMessageDefine; if (!UserDefineProcess.SetUserDefineProcessStep( ApplicationID, ProcessID, InstanceID, txtRemark.Text, out errorMessageDefine)) { page.Alert(rm["SubmitFailed"] + errorMessageDefine); return; } else { if (OnAfterRedefineProcessSubmit != null) { RM rm2 = new RM(ResourceFile.Msg); OnAfterRedefineProcessSubmit(this, new RedefineSubmitEventArgs(rm2["RedefineFlowStep"])); } } } else { string errorMessage; InstanceProcessTemplate instanceTemplate = new InstanceProcessTemplate(OnAfterworkFlowTransit); if (!instanceTemplate.TransitProcess(ApplicationID, ProcessID, InstanceID, IsUserDefineProcess, CurrentStateID, operationCode, txtRemark.Text, assignTo, out errorMessage)) { page.Alert(rm["SubmitFailed"] + errorMessage); return; } else { if (CurrentStateID == redefineStateId || CurrentStateID == userdefineStateId) { if (OnAfterRedefineProcessSubmit != null) { OnAfterRedefineProcessSubmit(this, new RedefineSubmitEventArgs(UserDefineProcess.GetOperationNameByCode(operationCode))); } } } if (OnSubmitSuccess != null) { OnSubmitSuccess(this, new EventArgs()); } } SetInstanceActivityGrid(); } }
public void SetInstanceActivityGrid() { GrdActivity.EditIndex = -1; bool isPrint = false; if (Page.Request.Path.IndexOf("Print", StringComparison.CurrentCultureIgnoreCase) > 0) { //print mode isPrint = true; } InstanceProcessTemplate instanceTemplate = new InstanceProcessTemplate(); DataSet ds = instanceTemplate.GetInstanceProcess(ApplicationID, ProcessID, InstanceID, DBSetting.MultiLanguageSuffix); InstanceProcess instprocess = new InstanceProcess(ApplicationID, ProcessID, InstanceID); CurrentStateID = instprocess.GetCurrentStateID(); InstanceState ins = new InstanceState(ApplicationID, InstanceID); RM rm = new RM(ResourceFile.Msg); //int EditIndex = -1; int assignTo = instanceTemplate.GetAssignTo(ApplicationID, InstanceID); GrdActivity.DataSource = ds; if (!isPrint) { //以下部分需要判断是否是处在用户自定义流程状态,如果是,则只允许在未定义流程管理页面进行操作 //但需要注意,如果当前状态是用户自定义流程状态,有可能被Hold了,此时在未定义流程管理页面也不允许进行流程操作, //也不需要添加指示未定义流程操作的行 if (instprocess.CheckActionPermission(CurrentUser.UserID)) { DataRow[] drs = ds.Tables[0].Select("P_Level=1"); if (drs.Length > 0) { if (Fn.ToInt(drs[0]["from_state_id"]) != CurrentStateID) { throw new Exception("State error. Please contact with administrator."); } GrdActivity.EditIndex = ds.Tables[0].Rows.IndexOf(drs[0]); //if (CurrentStateID == State.GetStateID(UserDefineProcess.RedefineStateCode)) //{ // drs[0]["Operator_name"] = rm["ToBeRedefine"]; // EditIndex = GrdActivity.EditIndex; // GrdActivity.EditIndex = -1; //} } } //if (CurrentStateID == State.GetStateID(UserDefineProcess.RedefineStateCode)) //{ // if (assignTo == 0) //刚执行了用户重定义流程操作 // { // DataRow dr = ds.Tables[0].NewRow(); // dr["Operator_name"] = rm["ToBeRedefine"]; // ds.Tables[0].Rows.Add(dr); // if (IsAdminPage) // { // GrdActivity.EditIndex = ds.Tables[0].Rows.Count - 1; // } // } // else if (assignTo > 0) // { // if (EditIndex != -1) // { // if (IsAdminPage) // { // GrdActivity.EditIndex = EditIndex; // } // } // else // { // ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["Operator_name"] = rm["ToBeRedefine"]; // } // } //} } GrdActivity.DataBind(); if (GrdActivity.EditIndex > -1) { SetOperationRadioList(); } }