/// <summary> /// 得到一组机构字符串下所有人员 /// </summary> /// <param name="idString"></param> /// <returns></returns> public List <RoadFlow.Data.Model.Users> GetAllUsers(string idString) { if (idString.IsNullOrEmpty()) { return(new List <RoadFlow.Data.Model.Users>()); } string[] idArray = idString.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); List <RoadFlow.Data.Model.Users> userList = new List <RoadFlow.Data.Model.Users>(); Users busers = new Users(); WorkGroup bwg = new WorkGroup(); foreach (string id in idArray) { if (id.StartsWith(Users.PREFIX))//人员 { userList.Add(busers.Get(Users.RemovePrefix(id).ToGuid())); } else if (id.IsGuid())//机构 { userList.AddRange(GetAllUsers(id.ToGuid())); } else if (id.StartsWith(WorkGroup.PREFIX))//工作组 { addWorkGroupUsers(userList, bwg.Get(WorkGroup.RemovePrefix(id).ToGuid())); } } userList.RemoveAll(p => p == null); return(userList.Distinct(new UsersEqualityComparer()).ToList()); }
private void addWorkGroupUsers(List <RoadFlow.Data.Model.Users> userList, RoadFlow.Data.Model.WorkGroup wg) { if (wg == null || wg.Members.IsNullOrEmpty()) { return; } string[] idArray = wg.Members.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); Users busers = new Users(); WorkGroup bwg = new WorkGroup(); foreach (var id in idArray) { if (id.StartsWith(Users.PREFIX))//人员 { userList.Add(busers.Get(Users.RemovePrefix(id).ToGuid())); } else if (id.IsGuid())//机构 { userList.AddRange(GetAllUsers(id.ToGuid())); } else if (id.StartsWith(WorkGroup.PREFIX))//工作组 { addWorkGroupUsers(userList, bwg.Get(WorkGroup.RemovePrefix(id).ToGuid())); } } }
private void addWorkGroupUsers(List <RoadFlow.Data.Model.Users> userList, Guid workGroupID) { RoadFlow.Data.Model.WorkGroup workGroup = new WorkGroup().Get(workGroupID); if (workGroup != null && !workGroup.Members.IsNullOrEmpty()) { string[] array = workGroup.Members.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); Users users = new Users(); new WorkGroup(); string[] array2 = array; foreach (string text in array2) { if (text.StartsWith("u_")) { userList.Add(users.Get(Users.RemovePrefix(text).ToGuid())); } else if (text.IsGuid()) { userList.AddRange(GetAllUsers(text.ToGuid())); } else if (text.StartsWith("w_")) { addWorkGroupUsers(userList, WorkGroup.RemovePrefix(text).ToGuid()); } } } }
public string GetName(string id) { string empty = string.Empty; if (id.IsGuid()) { return(GetName(id.ToGuid())); } if (id.StartsWith("u_")) { Guid test; if (!Users.RemovePrefix(id).IsGuid(out test)) { return(""); } return(new Users().GetName(test)); } if (id.StartsWith("w_")) { Guid test2; if (!WorkGroup.RemovePrefix(id).IsGuid(out test2)) { return(""); } return(new WorkGroup().GetName(test2)); } return(""); }
public List <RoadFlow.Data.Model.Users> GetAllUsers(string idString) { if (idString.IsNullOrEmpty()) { return(new List <RoadFlow.Data.Model.Users>()); } string[] array = idString.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); List <RoadFlow.Data.Model.Users> list = new List <RoadFlow.Data.Model.Users>(); Users users = new Users(); new WorkGroup(); string[] array2 = array; foreach (string text in array2) { if (text.StartsWith("u_")) { list.Add(users.Get(Users.RemovePrefix(text).ToGuid())); } else if (text.IsGuid()) { list.AddRange(GetAllUsers(text.ToGuid())); } else if (text.StartsWith("w_")) { addWorkGroupUsers(list, WorkGroup.RemovePrefix(text).ToGuid()); } } list.RemoveAll((RoadFlow.Data.Model.Users p) => p == null); return(list.Distinct(new UsersEqualityComparer()).ToList()); }
private void addWorkGroupUsers(List <RoadFlow.Data.Model.Users> userList, Guid workGroupID) { RoadFlow.Data.Model.WorkGroup workGroup1 = new WorkGroup().Get(workGroupID); if (workGroup1 == null || workGroup1.Members.IsNullOrEmpty()) { return; } string[] strArray = workGroup1.Members.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); Users users = new Users(); WorkGroup workGroup2 = new WorkGroup(); foreach (string str in strArray) { if (str.StartsWith("u_")) { userList.Add(users.Get(Users.RemovePrefix(str).ToGuid())); } else if (str.IsGuid()) { userList.AddRange((IEnumerable <RoadFlow.Data.Model.Users>) this.GetAllUsers(str.ToGuid())); } else if (str.StartsWith("w_")) { this.addWorkGroupUsers(userList, WorkGroup.RemovePrefix(str).ToGuid()); } } }
public List <RoadFlow.Data.Model.Users> GetAllUsers(string idString) { if (idString.IsNullOrEmpty()) { return(new List <RoadFlow.Data.Model.Users>()); } string[] strArray = idString.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); List <RoadFlow.Data.Model.Users> usersList = new List <RoadFlow.Data.Model.Users>(); Users users = new Users(); WorkGroup workGroup = new WorkGroup(); foreach (string str in strArray) { if (str.StartsWith("u_")) { usersList.Add(users.Get(Users.RemovePrefix(str).ToGuid())); } else if (str.IsGuid()) { usersList.AddRange((IEnumerable <RoadFlow.Data.Model.Users>) this.GetAllUsers(str.ToGuid())); } else if (str.StartsWith("w_")) { this.addWorkGroupUsers(usersList, WorkGroup.RemovePrefix(str).ToGuid()); } } usersList.RemoveAll((Predicate <RoadFlow.Data.Model.Users>)(p => p == null)); return(usersList.Distinct <RoadFlow.Data.Model.Users>((IEqualityComparer <RoadFlow.Data.Model.Users>) new UsersEqualityComparer()).ToList <RoadFlow.Data.Model.Users>()); }
/// <summary> /// 根据ID得到名称(有前缀的情况) /// </summary> /// <param name="id"></param> /// <returns></returns> public string GetName(string id) { string name = string.Empty; if (id.IsGuid())//机构 { return(GetName(id.ToGuid())); } else if (id.StartsWith(Users.PREFIX))//用户 { string uid = Users.RemovePrefix(id); Guid userID; if (!uid.IsGuid(out userID)) { return(""); } else { return(new Users().GetName(userID)); } } else if (id.StartsWith(WorkGroup.PREFIX))//工作组 { string uid = WorkGroup.RemovePrefix(id); Guid wid; if (!uid.IsGuid(out wid)) { return(""); } else { return(new WorkGroup().GetName(wid)); } } return(""); }
public DataTable GetPagerData(out long count, int size = 15, int number = 1, string title = "", string type = "", string date1 = "", string date2 = "", string userID = "", string order = "") { return(dataLog.GetPagerData(out count, size, number, title, type, date1, date2, Users.RemovePrefix(userID), order)); }
public DataTable GetPagerData(out string pager, string query = "", string title = "", string type = "", string date1 = "", string date2 = "", string userID = "") { return(dataLog.GetPagerData(out pager, query, Tools.GetPageSize(), Tools.GetPageNumber(), title, type, date1, date2, Users.RemovePrefix(userID))); }
public static void Hasten(string types, string users, string contents, RoadFlow.Data.Model.WorkFlowTask task, string othersParams = "") { if (!users.IsNullOrEmpty() && !types.IsNullOrEmpty() && task != null) { string[] array = users.Split(','); Guid guid = Guid.NewGuid(); List <RoadFlow.Data.Model.WorkFlowTask> list = new WorkFlowTask().GetNextTaskList(task.ID).FindAll((RoadFlow.Data.Model.WorkFlowTask p) => p.Status.In(0, 1)); string text = ""; text = ((!(HttpContext.Current.Request.Url != null) || !HttpContext.Current.Request.Url.AbsolutePath.EndsWith(".aspx", StringComparison.CurrentCultureIgnoreCase)) ? "/WorkFlowRun/Index" : "/Platform/WorkFlowRun/Default.aspx"); string[] array2 = types.Split(','); for (int i = 0; i < array2.Length; i++) { int test; if (array2[i].IsInt(out test)) { string[] array3 = array; foreach (string id in array3) { Guid userGuid; if (Users.RemovePrefix(id).IsGuid(out userGuid)) { RoadFlow.Data.Model.WorkFlowTask workFlowTask = list.Find((RoadFlow.Data.Model.WorkFlowTask p) => p.ReceiveID == userGuid); string linkUrl = (workFlowTask == null) ? "" : ("javascript:openApp('" + text + "?flowid=" + workFlowTask.FlowID + "&stepid=" + workFlowTask.StepID + "&instanceid=" + workFlowTask.InstanceID + "&taskid=" + workFlowTask.ID + "&groupid=" + workFlowTask.GroupID + "',0,'" + workFlowTask.Title.Replace1(",", "") + "','tab_" + workFlowTask.ID + "');closeMessage('" + guid + "');"); switch (test) { case 1: SMSLog.SendSMS(new Users().GetMobileNumber(userGuid), contents); break; case 2: Email.Send(userGuid, "任务催办", contents); break; case 3: { RoadFlow.Data.Model.Users users3 = new Users().Get(userGuid); if (users3 != null) { ShortMessage.Send(users3.ID, users3.Name, "任务催办", contents, 0, linkUrl, task.ID.ToString(), guid.ToString()); } break; } case 4: { RoadFlow.Data.Model.Users users2 = new Users().Get(userGuid); if (users2 != null) { new Message().SendText(contents, users2.Account, "", "", 0, new Agents().GetAgentIDByCode("weixinagents_waittasks"), true); } break; } } } } } } RoadFlow.Data.Model.HastenLog hastenLog = new RoadFlow.Data.Model.HastenLog(); hastenLog.Contents = contents; hastenLog.ID = Guid.NewGuid(); hastenLog.SendTime = DateTimeNew.Now; hastenLog.SendUser = Users.CurrentUserID; hastenLog.SendUserName = Users.CurrentUserName; hastenLog.OthersParams = (othersParams.IsNullOrEmpty() ? task.ID.ToString() : othersParams); hastenLog.Types = types; hastenLog.Users = users; new HastenLog().Add(hastenLog); } }
public static void Hasten(string types, string users, string contents, RoadFlow.Data.Model.WorkFlowTask task, string othersParams = "") { if (users.IsNullOrEmpty() || types.IsNullOrEmpty() || task == null) { return; } string[] strArray = users.Split(','); Guid guid = Guid.NewGuid(); List <RoadFlow.Data.Model.WorkFlowTask> all = new WorkFlowTask().GetNextTaskList(task.ID).FindAll((Predicate <RoadFlow.Data.Model.WorkFlowTask>)(p => p.Status.In(0, 1))); string str1 = !(HttpContext.Current.Request.Url != (Uri)null) || !HttpContext.Current.Request.Url.AbsolutePath.EndsWith(".aspx", StringComparison.CurrentCultureIgnoreCase) ? "/WorkFlowRun/Index" : "/Platform/WorkFlowRun/Default.aspx"; string str2 = types; char[] chArray = new char[1] { ',' }; foreach (string str3 in str2.Split(chArray)) { int test; if (str3.IsInt(out test)) { foreach (string id in strArray) { Guid userGuid; if (Users.RemovePrefix(id).IsGuid(out userGuid)) { RoadFlow.Data.Model.WorkFlowTask workFlowTask = all.Find((Predicate <RoadFlow.Data.Model.WorkFlowTask>)(p => p.ReceiveID == userGuid)); string str4; if (workFlowTask != null) { str4 = "javascript:openApp('" + str1 + "?flowid=" + (object)workFlowTask.FlowID + "&stepid=" + (object)workFlowTask.StepID + "&instanceid=" + workFlowTask.InstanceID + "&taskid=" + (object)workFlowTask.ID + "&groupid=" + (object)workFlowTask.GroupID + "',0,'" + workFlowTask.Title.Replace1(",", "") + "','tab_" + (object)workFlowTask.ID + "');closeMessage('" + (object)guid + "');"; } else { str4 = ""; } string linkUrl = str4; switch (test) { case 1: SMSLog.SendSMS(new Users().GetMobileNumber(userGuid), contents); continue; case 2: Email.Send(userGuid, "任务催办", contents, ""); continue; case 3: RoadFlow.Data.Model.Users users1 = new Users().Get(userGuid); if (users1 != null) { ShortMessage.Send(users1.ID, users1.Name, "任务催办", contents, 0, linkUrl, task.ID.ToString(), guid.ToString()); continue; } continue; case 4: RoadFlow.Data.Model.Users users2 = new Users().Get(userGuid); if (users2 != null) { new Message().SendText(contents, users2.Account, "", "", 0, new Agents().GetAgentIDByCode("weixinagents_waittasks"), true); continue; } continue; default: continue; } } } } } new HastenLog().Add(new RoadFlow.Data.Model.HastenLog() { Contents = contents, ID = Guid.NewGuid(), SendTime = DateTimeNew.Now, SendUser = Users.CurrentUserID, SendUserName = Users.CurrentUserName, OthersParams = othersParams.IsNullOrEmpty() ? task.ID.ToString() : othersParams, Types = types, Users = users }); }