public M_MisProLevel SelByProIDAndStepNum(int proID, int StepNum) { M_MisProLevel mod = null; SqlParameter[] sp = new SqlParameter[] { new SqlParameter("proID", proID), new SqlParameter("StepNum", StepNum) }; DataTable dt = SqlHelper.ExecuteTable(CommandType.Text, "Select * From " + strTableName + " Where ProID=@proID And StepNum=@StepNum", sp); if (dt != null && dt.Rows.Count > 0) { mod = model.GetModelFromDR(dt.Rows[0]); } return(mod); }
// 返回当前需要进行的流程模型,如果无流程,或流已完结,返回最后一步模型 //仅用于处理自由流程(另一页面改为只处理自由流程) public M_MisProLevel GetNextLevel() { //CurStepNum:指定当前进行到的步骤 M_MisProLevel model = new M_MisProLevel(); //获取下一级 oaMod = oaBll.SelReturnModel(appID); //公文模型 if (oaMod.Status == -1 || oaMod.Status == 99) //如果已经处理完成,则返回最后一步模型 { model = freeBll.SelByProIDAndStepNum(oaMod.ID, oaMod.CurStepNum); return(model); } DataTable progDT = progBll.SelByAppID(appID.ToString()); //已进行到的流程 DataTable freeDT = freeBll.SelDTByDocID(oaMod.ID); //全部自由流程 if (oaMod.CurStepNum == 0) //步骤为0时,加载第一步 { if (freeDT == null || freeDT.Rows.Count < 1) { function.WriteErrMsg("该自由流程未指定投递人!!!"); } model = model.GetModelFromDR(freeDT.Rows[0]);//用第一个填充,其值是经过Level排序的 } else { model = freeBll.SelByProIDAndStepNum(oaMod.ID, oaMod.CurStepNum); //获取上一步骤的模型 if (!freeBll.IsLastFreeStep(model)) //如果不是最后一步,则进一位 { model = freeBll.SelByProIDAndStepNum(oaMod.ID, (oaMod.CurStepNum + 1)); } } return(model); }
/// <summary> /// 是否最后一步 /// </summary> public bool IsLastStep(M_MisProLevel currentModel) { bool flag = false; DataTable dt = SelByProID(currentModel.ProID); model = model.GetModelFromDR(dt.Rows[(dt.Rows.Count - 1)]); if (model.stepNum == currentModel.stepNum) { flag = true; } return(flag); }
public void InsertRecord() { int status = DataConverter.CLng(Request["status"]); int id = DataConverter.CLng(Request["ID"]); M_MisApproval maMod = maBll.SelReturnModel(id); #region M_MisProLevel M_MisProLevel CurrentLevel = new M_MisProLevel(); DataTable appProgDT = mappBll.SelByAppID(id.ToString()); //已进行到的流程 DataTable proLevelDT = proBll.SelByProID(maMod.ProcedureID); //全部流程 if (appProgDT.Rows.Count < 1) //尚未开始 { CurrentLevel = CurrentLevel.GetModelFromDR(proLevelDT.Rows[0]); //用第一个填充,其值是经过Level排序的 } else if (appProgDT.Rows.Count < proLevelDT.Rows.Count) //已经开始但未完成 { string proLevel = appProgDT.Rows[appProgDT.Rows.Count - 1]["ProLevel"].ToString(); //现在进行到的最后 CurrentLevel = proBll.SelByProIDAndStepNum(maMod.ProcedureID, DataConverter.CLng(proLevel)); } else //已完成,或无流程的 { CurrentLevel.Status = 99; } #endregion M_Mis_AppProg model = new M_Mis_AppProg(); model.AppID = maMod.ID; model.ProID = maMod.ProcedureID; model.ProLevel = CurrentLevel.stepNum; model.ProLevelName = CurrentLevel.stepName; model.ApproveID = mu.UserID; model.Result = status; model.CreateTime = DateTime.Now; mappBll.Insert(model); if (status == -1) { maMod.Results = -1; } maBll.UpdateByID(maMod); Response.Redirect("ApproverView"); return; }