private string[] UserChoice() { //审批人 // string SQL = @"select UserId1+'|'+UserName1+','+UserId2 +'|'+UserName2+','+UserId3+'|'+UserName3+','+UserId4+'|'+UserName4+','+UserId5+'|'+UserName5 // from FL_Culture..SurveyWFUserSet where SurveyId='{0}'"; // SQL = string.Format(SQL, SurveyId); //Change by WGM 7/23 UserId1 SysWFUserSet Ent = SysWFUserSet.FindFirstByProperties("SurveyId", SurveyId); var UserIds = Ent.UserId1.Split(','); var UserNames = Ent.UserName1.Split(','); //string UsrTemp = DataHelper.QueryValue(SQL).ToString(); string UsrTemp = string.Empty; for (int i = 0; i < UserIds.Length; i++) { if (i > 0) { UsrTemp += ","; } UsrTemp += UserIds[i] + "|" + UserNames[i]; } string[] User = UsrTemp.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Where(ten => ten.Replace("|", "").Length > 0).ToArray(); return(User); }
//创建流程 private void StartFlow(string SurveyId) { string state = RequestData.Get <string>("state"); string formtype = RequestData.Get("formtype") + ""; SurveyQuestion Ent = SurveyQuestion.Find(SurveyId); string FlowKey = "questionnaire_"; //工作流key string NextUsr = string.Empty; //下一个审批人 SysWFUserSet UsrEnt = SysWFUserSet.FindFirstByProperties("SurveyId", SurveyId); int lg = UsrEnt.UserId1.Split(',').Length; FlowKey = FlowKey + lg; NextUsr += UsrEnt.UserId1.Split(',')[0] + "|" + UsrEnt.UserName1.Split(',')[0]; //指定流程Key //if (!string.IsNullOrEmpty(Ent.WorkFlowCode)) //{ // FlowKey = Ent.WorkFlowCode; //} //else //{ // 根据人员 获取工作流key //SQL = @"select Code from WorkflowTemplate where TemplateName like '调查问卷%' "; //DataTable FlDt = DataHelper.QueryDataTable(SQL); //if (!string.IsNullOrEmpty(FlDt.Rows[0][0] + "")) //{ // FlowKey = (FlDt.Rows[0][0] + "").Substring(0, (FlDt.Rows[0][0] + "").Length - 1) + UserCount.Length; //} if (!string.IsNullOrEmpty(FlowKey)) { string formUrl = string.Empty; //if (formtype.Contains("onlyView")) //onlyView 表示固定问卷 //{ //formUrl = "/SurveyManage/InternetSurvey.aspx?flow=y&op=v&type=read&Id=" + SurveyId; //} //else //{ formUrl = "/SurveyManage/WorkFlowTab.aspx?op=r&SurveyId=" + SurveyId; //} Guid guid = Aim.WorkFlow.WorkFlow.StartWorkFlow(SurveyId, formUrl, "调查问卷审批", FlowKey, UserInfo.UserID, UserInfo.Name); Ent.WorkFlowState = "Start"; Ent.WorkFlowCode = guid.ToString(); //InstanceId Ent.DoUpdate(); this.PageState.Add("NextInfo", guid.ToString() + "$" + NextUsr); } }
protected void Page_Load(object sender, EventArgs e) { SurveyId = RequestData.Get("SurveyId") + ""; //SetApproveAttr(SurveyId); SysWFUserSet ent = null; switch (this.RequestAction) { case RequestActionEnum.Update: ent = this.GetMergedData <SysWFUserSet>(); ent.DoUpdate(); StartFlow(SurveyId); return; case RequestActionEnum.Insert: case RequestActionEnum.Create: ent = this.GetPostedData <SysWFUserSet>(); ent.DoCreate(); StartFlow(ent.SurveyId); break; default: if (RequestActionString == "AutoExecuteFlow") { AutoExecuteFlow(); } else if (RequestActionString == "getUserInfo") { GetUserInfo(); } else if (RequestActionString == "CheckUsr") { CheckUsr(); } else { if (!String.IsNullOrEmpty(SurveyId)) { string approve = CheckFL(); //ent = SysWFUserSet.FindFirstByProperties(SysWFUserSet.Prop_SurveyId, SurveyId); //if (ent == null) ent = new SysWFUserSet(); //if (approve.Split('|').Length > 3) //默认审批人 //{ // //ent.UserId1 // string UserId1 = string.IsNullOrEmpty(approve.Split('|')[4]) ? "" : approve.Split('|')[4]; // string UserName1 = string.IsNullOrEmpty(approve.Split('|')[5]) ? "" : approve.Split('|')[5]; // if (UserId1.Split(',').Length > 1) // { // int rd = new Random().Next(UserId1.Split(',').Length); // UserId1 = UserId1.Split(',')[rd]; // UserName1 = UserName1.Split(',')[rd]; // } // else // { // UserId1 = UserId1.Split(',')[0]; // UserName1 = UserName1.Split(',')[0]; // } // ent.UserId1 = UserId1; // ent.UserName1 = UserName1; //} this.PageState.Add("ChState", approve); } this.SetFormData(ent); } break; } }