public string ValidateLogin() { string str1 = this.Request.Form["Account"]; string str2 = this.Request.Form["Password"]; if (str1.IsNullOrEmpty() || str2.IsNullOrEmpty()) { return("{\"id\":\"\",\"status\":0,\"msg\":\"帐号或密码不能为空\"}"); } RoadFlow.Platform.Users users = new RoadFlow.Platform.Users(); RoadFlow.Data.Model.Users byAccount = users.GetByAccount(str1.Trim()); if (byAccount == null || string.Compare(byAccount.Password, users.GetUserEncryptionPassword(byAccount.ID.ToString(), str2.Trim()), false) != 0) { return("{\"id\":\"\",\"status\":0,\"msg\":\"帐号或密码错误\"}"); } if (byAccount.Status == 1) { return("{\"id\":\"\",\"status\":0,\"msg\":\"帐号已被冻结\"}"); } this.Session[Keys.SessionKeys.UserID.ToString()] = (object)byAccount.ID; this.Session[Keys.SessionKeys.BaseUrl.ToString()] = (object)this.Url.Content("~/"); this.Session[Keys.SessionKeys.UserName.ToString()] = (object)byAccount.Name; this.Response.Cookies.Add(new HttpCookie(Keys.SessionKeys.UserID.ToString(), byAccount.ID.ToString()) { Expires = MyController.CurrentDateTime.AddDays(7.0) }); RoadFlow.Platform.Log.Add("用户登录成功-test(帐号:" + str1 + ")", "", RoadFlow.Platform.Log.Types.用户登录, "", "", (RoadFlow.Data.Model.Users)null); return("{\"id\":\"" + byAccount.ID.ToString() + "\",\"token\":\"" + RoadFlow.Utility.Config.GetTokenByUserId(byAccount.ID) + "\",\"status\":1,\"msg\":\"用户登录成功\"}"); }
public string GetNote() { string id = Request.QueryString["id"]; Guid gid; if (id.IsNullOrEmpty()) { return(""); } RoadFlow.Platform.Organize borg = new RoadFlow.Platform.Organize(); RoadFlow.Platform.Users buser = new RoadFlow.Platform.Users(); if (id.StartsWith(RoadFlow.Platform.Users.PREFIX)) { Guid uid = buser.RemovePrefix1(id).ToGuid(); return(string.Concat(borg.GetAllParentNames(buser.GetMainStation(uid)), " / ", buser.GetName(uid))); } else if (id.StartsWith(RoadFlow.Platform.WorkGroup.PREFIX)) { return(new RoadFlow.Platform.WorkGroup().GetUsersNames(RoadFlow.Platform.WorkGroup.RemovePrefix(id).ToGuid(), '、')); } else if (id.IsGuid(out gid)) { return(borg.GetAllParentNames(gid)); } return(""); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { string oldpass = Request.Form["oldpass"]; string newpass = Request.Form["newpass"]; RoadFlow.Platform.Users busers = new RoadFlow.Platform.Users(); var user = RoadFlow.Platform.Users.CurrentUser; if (user != null) { if (string.Compare(user.Password, busers.GetUserEncryptionPassword(user.ID.ToString(), oldpass.Trim()), false) != 0) { RoadFlow.Platform.Log.Add("修改密码失败", string.Concat("用户:", user.Name, "(", user.ID, ")修改密码失败,旧密码错误!"), RoadFlow.Platform.Log.Types.用户登录); Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('旧密码错误!');", true); } else { busers.UpdatePassword(newpass.Trim(), user.ID); RoadFlow.Platform.Log.Add("修改密码成功", string.Concat("用户:", user.Name, "(", user.ID, ")修改密码成功!"), RoadFlow.Platform.Log.Types.用户登录); Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('密码修改成功!');new RoadUI.Window().close();", true); } } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string id = context.Request.QueryString["id"]; Guid gid; if (id.IsNullOrEmpty()) { context.Response.Write(""); } RoadFlow.Platform.Organize borg = new RoadFlow.Platform.Organize(); RoadFlow.Platform.Users buser = new RoadFlow.Platform.Users(); if (id.StartsWith(RoadFlow.Platform.Users.PREFIX)) { Guid uid = buser.RemovePrefix1(id).ToGuid(); context.Response.Write(string.Concat(borg.GetAllParentNames(buser.GetMainStation(uid)), " / ", buser.GetName(uid))); } else if (id.StartsWith(RoadFlow.Platform.WorkGroup.PREFIX)) { context.Response.Write(new RoadFlow.Platform.WorkGroup().GetUsersNames(RoadFlow.Platform.WorkGroup.RemovePrefix(id).ToGuid(), '、')); } else if (id.IsGuid(out gid)) { context.Response.Write(borg.GetAllParentNames(gid)); } context.Response.Write(""); }
public ActionResult UserAdd(FormCollection collection) { RoadFlow.Platform.Organize borganize = new RoadFlow.Platform.Organize(); RoadFlow.Platform.Users busers = new RoadFlow.Platform.Users(); string id = Request.QueryString["id"]; string name = string.Empty; string account = string.Empty; string status = string.Empty; string note = string.Empty; Guid parentID; if (collection != null && id.IsGuid(out parentID)) { name = Request.Form["Name"]; account = Request.Form["Account"]; status = Request.Form["Status"]; note = Request.Form["Note"]; Guid userID = Guid.NewGuid(); string userXML = string.Empty; using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope()) { //添加人员 RoadFlow.Data.Model.Users user = new RoadFlow.Data.Model.Users(); user.Account = account.Trim(); user.Name = name.Trim(); user.Note = note.IsNullOrEmpty() ? null : note; user.Password = busers.GetUserEncryptionPassword(userID.ToString(), busers.GetInitPassword()); user.Sort = 1; user.Status = status.IsInt() ? status.ToInt() : 0; user.ID = userID; busers.Add(user); //添加关系 RoadFlow.Data.Model.UsersRelation userRelation = new RoadFlow.Data.Model.UsersRelation(); userRelation.IsMain = 1; userRelation.OrganizeID = parentID; userRelation.Sort = new RoadFlow.Platform.UsersRelation().GetMaxSort(parentID); userRelation.UserID = userID; new RoadFlow.Platform.UsersRelation().Add(userRelation); //更新父级[ChildsLength]字段 borganize.UpdateChildsLength(parentID); //更新角色 new RoadFlow.Platform.UsersRole().UpdateByUserID(userID); userXML = user.Serialize(); scope.Complete(); } RoadFlow.Platform.Log.Add("添加了人员", userXML, RoadFlow.Platform.Log.Types.组织机构); ViewBag.Script = "alert('添加成功!');parent.frames[0].reLoad('" + id + "');window.location=window.location;"; } ViewBag.StatusRadios = borganize.GetStatusRadio("Status", "0", "validate=\"radio\""); return(View()); }
protected void Page_Load(object sender, EventArgs e) { this.Account.Attributes.Add("validate_url", "CheckAccount.ashx"); RoadFlow.Platform.Organize borganize = new RoadFlow.Platform.Organize(); RoadFlow.Platform.Users busers = new RoadFlow.Platform.Users(); string id = Request.QueryString["id"]; string name = string.Empty; string account = string.Empty; string status = string.Empty; string note = string.Empty; Guid parentID; if (IsPostBack && id.IsGuid(out parentID)) { name = Request.Form["Name"]; account = Request.Form["Account"]; status = Request.Form["Status"]; note = Request.Form["Note"]; Guid userID = Guid.NewGuid(); string userXML = string.Empty; using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope()) { //添加人员 RoadFlow.Data.Model.Users user = new RoadFlow.Data.Model.Users(); user.Account = account.Trim(); user.Name = name.Trim(); user.Note = note.IsNullOrEmpty() ? null : note; user.Password = busers.GetUserEncryptionPassword(userID.ToString(), busers.GetInitPassword()); user.Sort = 1; user.Status = status.IsInt() ? status.ToInt() : 0; user.ID = userID; busers.Add(user); //添加关系 RoadFlow.Data.Model.UsersRelation userRelation = new RoadFlow.Data.Model.UsersRelation(); userRelation.IsMain = 1; userRelation.OrganizeID = parentID; userRelation.Sort = new RoadFlow.Platform.UsersRelation().GetMaxSort(parentID); userRelation.UserID = userID; new RoadFlow.Platform.UsersRelation().Add(userRelation); //更新父级[ChildsLength]字段 borganize.UpdateChildsLength(parentID); //更新角色 new RoadFlow.Platform.UsersRole().UpdateByUserID(userID); userXML = user.Serialize(); scope.Complete(); } RoadFlow.Platform.Log.Add("添加了人员", userXML, RoadFlow.Platform.Log.Types.组织机构); Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('添加成功!');parent.frames[0].reLoad('" + id + "');window.location=window.location;", true); } this.StatusRadios.Text = borganize.GetStatusRadio("Status", "0", "validate=\"radio\""); }
public void UpdateAllUsers() { RoadFlow.Platform.Organize organize1 = new RoadFlow.Platform.Organize(); RoadFlow.Platform.UsersRelation usersRelation1 = new RoadFlow.Platform.UsersRelation(); List <RoadFlow.Data.Model.Users> all = new RoadFlow.Platform.Users().GetAll(); DataTable dt = new DataTable(); dt.Columns.Add("姓名", "".GetType()); dt.Columns.Add("帐号", "".GetType()); dt.Columns.Add("微信号", "".GetType()); dt.Columns.Add("手机号", "".GetType()); dt.Columns.Add("邮箱", "".GetType()); dt.Columns.Add("所在部门", "".GetType()); dt.Columns.Add("职位", "".GetType()); foreach (RoadFlow.Data.Model.Users users in all) { StringBuilder stringBuilder = new StringBuilder(); foreach (RoadFlow.Data.Model.UsersRelation usersRelation2 in usersRelation1.GetAllByUserID(users.ID)) { RoadFlow.Data.Model.Organize organize2 = organize1.Get(usersRelation2.OrganizeID); if (organize2 != null) { stringBuilder.Append(organize2.IntID); stringBuilder.Append(","); } } DataRow row = dt.NewRow(); row["姓名"] = (object)this.replaceName(users.Name); row["帐号"] = (object)users.Account; row["微信号"] = (object)users.WeiXin; row["手机号"] = (object)users.Mobile; row["邮箱"] = (object)users.Email; row["所在部门"] = (object)stringBuilder.ToString().TrimEnd(','); row["职位"] = (object)""; dt.Rows.Add(row); } string path = RoadFlow.Platform.Files.FilePath + "WeiXinCsv\\"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string str1 = path + Guid.NewGuid().ToString("N") + ".csv"; NPOIHelper.ExportCSV(dt, str1); string str2 = new Media(Config.GetSecret("weixinagents_organize")).UploadTemp(str1, "file"); if (str2.IsNullOrEmpty()) { return; } string url = "https://qyapi.weixin.qq.com/cgi-bin/batch/replaceuser?access_token=" + this.GetAccessToken(); string oldXML = "{\"media_id\":\"" + str2 + "\"}"; string data = oldXML; RoadFlow.Platform.Log.Add("调用了微信同步所有人员", "返回:" + HttpHelper.SendPost(url, data), RoadFlow.Platform.Log.Types.微信企业号, oldXML, "", (RoadFlow.Data.Model.Users)null); }
public ActionResult EditUserInfo(FormCollection collection) { RoadFlow.Platform.Users users = new RoadFlow.Platform.Users(); Guid currentUserId = RoadFlow.Platform.Users.CurrentUserID; RoadFlow.Data.Model.Users model = users.Get(currentUserId); if (collection != null) { string str1 = this.Request.Form["Tel"]; string str2 = this.Request.Form["MobilePhone"]; string str3 = this.Request.Form["WeiXin"]; string str4 = this.Request.Form["Email"]; string str5 = this.Request.Form["QQ"]; string str6 = this.Request.Form["OtherTel"]; string str7 = this.Request.Form["Note"]; int num = 0; model.Tel = str1; model.Mobile = str2; model.WeiXin = str3; model.Email = str4; model.QQ = str5; model.OtherTel = str6; model.Note = str7; if (num != 0) { users.Add(model); } else { users.Update(model); } // ISSUE: reference to a compiler-generated field if (UserInfoController.\u003C\u003Eo__2.\u003C\u003Ep__0 == null) { // ISSUE: reference to a compiler-generated field UserInfoController.\u003C\u003Eo__2.\u003C\u003Ep__0 = CallSite <Func <CallSite, object, string, object> > .Create(Binder.SetMember(CSharpBinderFlags.None, "script", typeof(UserInfoController), (IEnumerable <CSharpArgumentInfo>) new CSharpArgumentInfo[2] { CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string)null), CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.Constant, (string)null) })); } // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field object obj = UserInfoController.\u003C\u003Eo__2.\u003C\u003Ep__0.Target((CallSite)UserInfoController.\u003C\u003Eo__2.\u003C\u003Ep__0, this.ViewBag, "alert('保存成功!');window.location=window.location;"); } return((ActionResult)this.View((object)model)); }
public ActionResult Index(FormCollection coll) { RoadFlow.Platform.WeiXin.Organize.CheckLogin(); RoadFlow.Platform.Users users = new RoadFlow.Platform.Users(); string s_searchkey = this.Request.QueryString["searchkey"]; if (coll != null) { s_searchkey = this.Request.Form["searchkey"]; } List <WorkFlowStart> workFlowStartList = new RoadFlow.Platform.WorkFlow().GetUserStartFlows(RoadFlow.Platform.WeiXin.Organize.CurrentUserID); if (!s_searchkey.IsNullOrEmpty()) { workFlowStartList = workFlowStartList.FindAll((Predicate <WorkFlowStart>)(p => p.Name.Contains(s_searchkey.Trim1(), StringComparison.CurrentCultureIgnoreCase))); } return((ActionResult)this.View((object)workFlowStartList)); }
public string Query() { List <RoadFlow.Data.Model.WorkFlow> workFlowList = new List <RoadFlow.Data.Model.WorkFlow>(); RoadFlow.Platform.Users users = new RoadFlow.Platform.Users(); RoadFlow.Platform.WorkFlow workFlow1 = new RoadFlow.Platform.WorkFlow(); string name = this.Request.Form["flow_name"]; string str1 = this.Request.Form["typeid"]; string str2 = this.Request.Form["sidx"]; string str3 = this.Request.Form["sord"]; bool flag = "1" == this.Request.Form["openlist"]; string typeid = ""; if (str1.IsGuid()) { typeid = new RoadFlow.Platform.Dictionary().GetAllChildsIDString(str1.ToGuid(), true); } int pageSize = flag ? 10 : RoadFlow.Utility.Tools.GetPageSize(); int pageNumber = RoadFlow.Utility.Tools.GetPageNumber(); string order = (str2.IsNullOrEmpty() ? "CreateDate" : str2) + " " + (str3.IsNullOrEmpty() ? "asc" : str3); long count; List <RoadFlow.Data.Model.WorkFlow> pagerData = workFlow1.GetPagerData(out count, pageSize, pageNumber, RoadFlow.Platform.Users.CurrentUserID.ToString(), typeid, name, order); JsonData jsonData1 = new JsonData(); foreach (RoadFlow.Data.Model.WorkFlow workFlow2 in pagerData) { JsonData jsonData2 = new JsonData(); jsonData2["id"] = (JsonData)workFlow2.ID.ToString(); jsonData2["Name"] = (JsonData)workFlow2.Name; jsonData2["CreateDate"] = (JsonData)workFlow2.CreateDate.ToDateTimeString(); jsonData2["CreateUserID"] = (JsonData)users.GetName(workFlow2.CreateUserID); jsonData2["Status"] = (JsonData)workFlow1.GetStatusTitle(workFlow2.Status); if (flag) { jsonData2["Edit"] = (JsonData)("<a href=\"javascript:void(0);\" onclick=\"openflow('" + (object)workFlow2.ID + "');return false;\"><img src=\"" + this.Url.Content("~/Images/ico/topic_edit.gif") + "\" alt=\"\" style=\"vertical-align:middle; border:0;\" /><span style=\"vertical-align:middle; margin-left:3px;\">编辑</span></a>"); } else { jsonData2["Edit"] = (JsonData)("<a class=\"editlink\" href=\"javascript:void(0);\" onclick=\"openflow('" + (object)workFlow2.ID + "','" + workFlow2.Name + "');return false;\"><span style=\"vertical-align:middle;\">编辑</span></a><a class=\"deletelink\" href=\"javascript:void(0);\" style=\"margin-left:5px\" onclick=\"delflow('" + (object)workFlow2.ID + "'); return false;\"><span style=\"vertical-align:middle;\">删除</span></a><a href=\"javascript:void(0);\" style=\"margin-left:5px\" onclick=\"ExportFlow('" + (object)workFlow2.ID + "'); return false;\"><span style=\"vertical-align:middle; background:url(../Images/ico/arrow_medium_right.png) no-repeat;padding-left:18px;\">导出</span></a>"); } jsonData1.Add((object)jsonData2); } return("{\"userdata\":{\"total\":" + (object)count + ",\"pagesize\":" + (object)pageSize + ",\"pagenumber\":" + (object)pageNumber + "},\"rows\":" + jsonData1.ToJson(true) + "}"); }
protected void Page_Load(object sender, EventArgs e) { string parentID = Request.QueryString["parentid"]; if (IsPostBack) { string sort = Request.Form["sort"] ?? ""; string[] sortArray = sort.Split(','); RoadFlow.Platform.Users busers = new RoadFlow.Platform.Users(); for (int i = 0; i < sortArray.Length; i++) { Guid gid; if (!sortArray[i].IsGuid(out gid)) { continue; } busers.UpdateSort(gid, i + 1); } Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "parent.frames[0].reLoad('" + parentID + "');", true); } Users = new RoadFlow.Platform.Organize().GetAllUsers(parentID.ToGuid()); }
public string SaveUserHead() { string str1 = this.Request.Form["x"]; string str2 = this.Request.Form["y"]; string str3 = this.Request.Form["x2"]; string str4 = this.Request.Form["y2"]; string str5 = this.Request.Form["w"]; string str6 = this.Request.Form["h"]; string str7 = (this.Request.Form["img"] ?? "").DesDecrypt(); Guid currentUserId = RoadFlow.Platform.Users.CurrentUserID; if (!str7.IsNullOrEmpty()) { if (File.Exists(str7)) { try { string str8 = ImgHelper.CutAvatar(str7, WebMvc.Common.Tools.BaseUrl + "/Content/UserHeads/" + (object)currentUserId + ".jpg", str1.ToInt(), str2.ToInt(), str5.ToInt(), str6.ToInt()); if (str8.IsNullOrEmpty()) { return("保存失败!"); } RoadFlow.Platform.Users users = new RoadFlow.Platform.Users(); RoadFlow.Data.Model.Users model = users.Get(currentUserId); if (model != null) { model.HeadImg = str8; users.Update(model); } return("保存成功!"); } catch { return("保存失败!"); } } } return("文件不存在!"); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string code = context.Request.QueryString["code"]; if (code.IsNullOrEmpty()) { context.Response.Write("身份验证失败"); context.Response.End(); return; } string account = new RoadFlow.Platform.WeiXin.Organize().GetUserAccountByCode(code); if (account.IsNullOrEmpty()) { context.Response.Write("身份验证失败-"); context.Response.End(); return; } var user = new RoadFlow.Platform.Users().GetByAccount(account); if (user == null) { context.Response.Write("未找到帐号对应的人员"); context.Response.End(); return; } context.Response.Cookies.Add(new HttpCookie("weixin_userid", user.ID.ToString())); context.Session.Add(RoadFlow.Utility.Keys.SessionKeys.UserID.ToString(), user.ID.ToString()); var lastURLCookie = context.Request.Cookies.Get("LastURL"); var lastURL = lastURLCookie == null ? "" : lastURLCookie.Value; if (!lastURL.IsNullOrEmpty()) { context.Response.Redirect(lastURL); } }
public ActionResult EditPass(FormCollection collection) { string oldpass = Request.Form["oldpass"]; string newpass = Request.Form["newpass"]; RoadFlow.Platform.Users busers = new RoadFlow.Platform.Users(); var user = RoadFlow.Platform.Users.CurrentUser; if (user != null) { if (string.Compare(user.Password, busers.GetUserEncryptionPassword(user.ID.ToString(), oldpass.Trim()), false) != 0) { RoadFlow.Platform.Log.Add("修改密码失败", string.Concat("用户:", user.Name, "(", user.ID, ")修改密码失败,旧密码错误!"), RoadFlow.Platform.Log.Types.用户登录); ViewBag.Script = "alert('旧密码错误!');"; } else { busers.UpdatePassword(newpass.Trim(), user.ID); RoadFlow.Platform.Log.Add("修改密码成功", string.Concat("用户:", user.Name, "(", user.ID, ")修改密码成功!"), RoadFlow.Platform.Log.Types.用户登录); ViewBag.Script = "alert('密码修改成功!');new RoadUI.Window().close();"; } } return(View()); }
public ActionResult SortUsers(FormCollection collection) { string parentID = Request.QueryString["parentid"]; if (collection != null) { string sort = Request.Form["sort"] ?? ""; string[] sortArray = sort.Split(','); RoadFlow.Platform.Users busers = new RoadFlow.Platform.Users(); for (int i = 0; i < sortArray.Length; i++) { Guid gid; if (!sortArray[i].IsGuid(out gid)) { continue; } busers.UpdateSort(gid, i + 1); } ViewBag.Script = "parent.frames[0].reLoad('" + parentID + "');"; } var users = new RoadFlow.Platform.Organize().GetAllUsers(parentID.ToGuid()); return(View(users)); }
public ActionResult Index(FormCollection collection) { RoadFlow.Platform.WorkFlowDelegation bworkFlowDelegation = new RoadFlow.Platform.WorkFlowDelegation(); RoadFlow.Platform.Organize borganize = new RoadFlow.Platform.Organize(); RoadFlow.Platform.Users busers = new RoadFlow.Platform.Users(); RoadFlow.Platform.WorkFlow bworkFlow = new RoadFlow.Platform.WorkFlow(); IEnumerable <RoadFlow.Data.Model.WorkFlowDelegation> workFlowDelegationList; string startTime = string.Empty; string endTime = string.Empty; string suserid = string.Empty; string query1 = string.Format("&appid={0}&tabid={1}&isoneself={2}", Request.QueryString["appid"], Request.QueryString["tabid"], Request.QueryString["isoneself"]); if (collection != null) { if (!Request.Form["DeleteBut"].IsNullOrEmpty()) { string ids = Request.Form["checkbox_app"]; foreach (string id in ids.Split(',')) { Guid bid; if (!id.IsGuid(out bid)) { continue; } var comment = bworkFlowDelegation.Get(bid); if (comment != null) { bworkFlowDelegation.Delete(bid); RoadFlow.Platform.Log.Add("删除了流程意见", comment.Serialize(), RoadFlow.Platform.Log.Types.流程相关); } } bworkFlowDelegation.RefreshCache(); } startTime = Request.Form["S_StartTime"]; endTime = Request.Form["S_EndTime"]; suserid = Request.Form["S_UserID"]; } else { startTime = Request.QueryString["S_StartTime"]; endTime = Request.QueryString["S_EndTime"]; suserid = Request.QueryString["S_UserID"]; } query1 += "&S_StartTime=" + startTime + "&S_EndTime=" + endTime + "&S_UserID=" + suserid; string pager; bool isOneSelf = "1" == Request.QueryString["isoneself"]; if (isOneSelf) { workFlowDelegationList = bworkFlowDelegation.GetPagerData(out pager, query1, RoadFlow.Platform.Users.CurrentUserID.ToString(), startTime, endTime); } else { workFlowDelegationList = bworkFlowDelegation.GetPagerData(out pager, query1, RoadFlow.Platform.Users.RemovePrefix(suserid), startTime, endTime); } ViewBag.Query1 = query1; ViewBag.startTime = startTime; ViewBag.endTime = endTime; ViewBag.suserid = suserid; return(View(workFlowDelegationList)); }
public ActionResult Login(FormCollection collection) { string isVcodeSessionKey = RoadFlow.Utility.Keys.SessionKeys.IsValidateCode.ToString(); string vcodeSessionKey = RoadFlow.Utility.Keys.SessionKeys.ValidateCode.ToString(); ViewBag.Forcescript = ""; ViewBag.IsVcodeSessionKey = isVcodeSessionKey; ViewBag.ErrMsg = ""; string account = collection["Account"]; string password = collection["Password"]; string force = collection["Force"]; string vcode = collection["VCode"]; bool isSessionLost = "1" == Request.QueryString["session"];//是否是超时后再登录 if (System.Web.HttpContext.Current.Session[isVcodeSessionKey] != null && "1" == System.Web.HttpContext.Current.Session[isVcodeSessionKey].ToString() && (System.Web.HttpContext.Current.Session[vcodeSessionKey] == null || string.Compare(System.Web.HttpContext.Current.Session[vcodeSessionKey].ToString(), vcode.Trim(), true) != 0)) { ViewBag.ErrMsg = "alert('验证码错误!');"; } else if (account.IsNullOrEmpty() || password.IsNullOrEmpty()) { Session[isVcodeSessionKey] = "1"; RoadFlow.Platform.Log.Add("用户登录失败", string.Concat("用户:", account, "登录失败,帐号或密码为空"), RoadFlow.Platform.Log.Types.用户登录); ViewBag.ErrMsg = "alert('帐号或密码不能为空!');"; } else { RoadFlow.Platform.Users busers = new RoadFlow.Platform.Users(); var user = busers.GetByAccount(account.Trim()); if (user == null || string.Compare(user.Password, busers.GetUserEncryptionPassword(user.ID.ToString(), password.Trim()), false) != 0) { System.Web.HttpContext.Current.Session[isVcodeSessionKey] = "1"; RoadFlow.Platform.Log.Add("用户登录失败", string.Concat("用户:", account, "登录失败,帐号或密码错误"), RoadFlow.Platform.Log.Types.用户登录); ViewBag.ErrMsg = "alert('帐号或密码错误!');"; } else if (user.Status == 1) { System.Web.HttpContext.Current.Session[isVcodeSessionKey] = "1"; RoadFlow.Platform.Log.Add("用户登录失败", string.Concat("用户:", account, "登录失败,帐号已被冻结"), RoadFlow.Platform.Log.Types.用户登录); ViewBag.ErrMsg = "alert('帐号已被冻结!');"; } else { RoadFlow.Platform.OnlineUsers bou = new RoadFlow.Platform.OnlineUsers(); var onUser = bou.Get(user.ID); if (onUser != null && "1" != force) { string ip = onUser.IP; System.Web.HttpContext.Current.Session.Remove(isVcodeSessionKey); ViewBag.Forcescript = "if(confirm('当前帐号已经在" + ip + "登录,您要强行登录吗?')){$('#Account').val('" + account + "');$('#Password').val('" + password + "');$('#Force').val('1');$('#form1').submit();}"; } else { Guid uniqueID = Guid.NewGuid(); System.Web.HttpContext.Current.Session[RoadFlow.Utility.Keys.SessionKeys.UserID.ToString()] = user.ID; System.Web.HttpContext.Current.Session[RoadFlow.Utility.Keys.SessionKeys.UserUniqueID.ToString()] = uniqueID; System.Web.HttpContext.Current.Session[RoadFlow.Utility.Keys.SessionKeys.BaseUrl.ToString()] = Url.Content("~/"); bou.Add(user, uniqueID); System.Web.HttpContext.Current.Session.Remove(isVcodeSessionKey); RoadFlow.Platform.Log.Add("用户登录成功", string.Concat("用户:", user.Name, "(", user.ID, ")登录成功"), RoadFlow.Platform.Log.Types.用户登录); if (isSessionLost) { ViewBag.Forcescript = "alert('登录成功!');new RoadUI.Window().close();"; } else { ViewBag.Forcescript = "top.location='" + Url.Content("~/Home") + "';"; } } } } return(View()); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string rootid = context.Request.QueryString["rootid"]; string showtype = context.Request.QueryString["showtype"]; RoadFlow.Platform.Organize BOrganize = new RoadFlow.Platform.Organize(); System.Text.StringBuilder json = new System.Text.StringBuilder("[", 1000); if ("1" == showtype)//显示工作组 { RoadFlow.Platform.WorkGroup BWorkGroup = new RoadFlow.Platform.WorkGroup(); var workGroups = BWorkGroup.GetAll(); json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", Guid.Empty); json.AppendFormat("\"parentID\":\"{0}\",", Guid.Empty); json.AppendFormat("\"title\":\"{0}\",", "工作组"); json.AppendFormat("\"ico\":\"{0}\",", Common.Tools.BaseUrl + "/images/ico/group.gif"); json.AppendFormat("\"link\":\"{0}\",", ""); json.AppendFormat("\"type\":\"{0}\",", 5); json.AppendFormat("\"hasChilds\":\"{0}\",", workGroups.Count); json.Append("\"childs\":["); int countwg = workGroups.Count; int iwg = 0; foreach (var wg in workGroups) { json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", wg.ID); json.AppendFormat("\"parentID\":\"{0}\",", Guid.Empty); json.AppendFormat("\"title\":\"{0}\",", wg.Name); json.AppendFormat("\"ico\":\"{0}\",", ""); json.AppendFormat("\"link\":\"{0}\",", ""); json.AppendFormat("\"type\":\"{0}\",", 5); json.AppendFormat("\"hasChilds\":\"{0}\",", 0); json.Append("\"childs\":["); json.Append("]"); json.Append("}"); if (iwg++ < countwg - 1) { json.Append(","); } } json.Append("]"); json.Append("}"); json.Append("]"); context.Response.Write(json.ToString()); context.Response.End(); } Guid rootID; RoadFlow.Data.Model.Organize root; if (rootid.IsGuid(out rootID)) { root = BOrganize.Get(rootID); } else { root = BOrganize.GetRoot(); } List <RoadFlow.Data.Model.Users> users = new List <RoadFlow.Data.Model.Users>(); RoadFlow.Platform.Users busers = new RoadFlow.Platform.Users(); users = busers.GetAllByOrganizeID(root.ID); json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", root.ID); json.AppendFormat("\"parentID\":\"{0}\",", root.ParentID); json.AppendFormat("\"title\":\"{0}\",", root.Name); json.AppendFormat("\"ico\":\"{0}\",", Common.Tools.BaseUrl + "/images/ico/icon_site.gif"); json.AppendFormat("\"link\":\"{0}\",", ""); json.AppendFormat("\"type\":\"{0}\",", root.Type); json.AppendFormat("\"hasChilds\":\"{0}\",", root.ChildsLength == 0 && users.Count == 0 ? "0" : "1"); json.Append("\"childs\":["); var orgs = BOrganize.GetChilds(root.ID); int count = orgs.Count; int i = 0; foreach (var org in orgs) { json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", org.ID); json.AppendFormat("\"parentID\":\"{0}\",", org.ParentID); json.AppendFormat("\"title\":\"{0}\",", org.Name); json.AppendFormat("\"ico\":\"{0}\",", ""); json.AppendFormat("\"link\":\"{0}\",", ""); json.AppendFormat("\"type\":\"{0}\",", org.Type); json.AppendFormat("\"hasChilds\":\"{0}\",", org.ChildsLength); json.Append("\"childs\":["); json.Append("]"); json.Append("}"); if (i++ < count - 1 || users.Count > 0) { json.Append(","); } } if (users.Count > 0) { var userRelations = new RoadFlow.Platform.UsersRelation().GetAllByOrganizeID(root.ID); int count1 = users.Count; int j = 0; foreach (var user in users) { var ur = userRelations.Find(p => p.UserID == user.ID); json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", user.ID); json.AppendFormat("\"parentID\":\"{0}\",", root.ID); json.AppendFormat("\"title\":\"{0}{1}\",", user.Name, ur != null && ur.IsMain == 0 ? "<span style='color:#999;'>[兼职]</span>" : ""); json.AppendFormat("\"ico\":\"{0}\",", ""); json.AppendFormat("\"link\":\"{0}\",", ""); json.AppendFormat("\"type\":\"{0}\",", "4"); json.AppendFormat("\"hasChilds\":\"{0}\",", "0"); json.Append("\"childs\":["); json.Append("]"); json.Append("}"); if (j++ < count1 - 1) { json.Append(","); } } } json.Append("]"); json.Append("}"); json.Append("]"); context.Response.Write(json.ToString()); }
public string TreeRefresh() { string id = Request.QueryString["refreshid"]; string showtype = Request.QueryString["showtype"]; System.Text.StringBuilder json = new System.Text.StringBuilder("[", 1000); if ("1" == showtype)//显示工作组 { RoadFlow.Platform.WorkGroup BWorkGroup = new RoadFlow.Platform.WorkGroup(); var workGroups = BWorkGroup.GetAll(); int countwg = workGroups.Count; int iwg = 0; foreach (var wg in workGroups) { json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", wg.ID); json.AppendFormat("\"parentID\":\"{0}\",", Guid.Empty); json.AppendFormat("\"title\":\"{0}\",", wg.Name); json.AppendFormat("\"ico\":\"{0}\",", ""); json.AppendFormat("\"link\":\"{0}\",", ""); json.AppendFormat("\"type\":\"{0}\",", 5); json.AppendFormat("\"hasChilds\":\"{0}\",", 0); json.Append("\"childs\":["); json.Append("]"); json.Append("}"); if (iwg++ < countwg - 1) { json.Append(","); } } json.Append("]"); json.Append("}"); Response.Write(json.ToString()); Response.End(); } Guid orgID; if (!id.IsGuid(out orgID)) { json.Append("]"); Response.Write(json.ToString()); } RoadFlow.Platform.Organize BOrganize = new RoadFlow.Platform.Organize(); var childOrgs = BOrganize.GetChilds(orgID); int count = childOrgs.Count; int i = 0; foreach (var org in childOrgs) { json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", org.ID); json.AppendFormat("\"parentID\":\"{0}\",", id); json.AppendFormat("\"title\":\"{0}\",", org.Name); json.AppendFormat("\"ico\":\"{0}\",", ""); json.AppendFormat("\"link\":\"{0}\",", ""); json.AppendFormat("\"type\":\"{0}\",", org.Type); json.AppendFormat("\"hasChilds\":\"{0}\",", org.ChildsLength); json.Append("\"childs\":["); json.Append("]"); json.Append("}"); if (i++ < count - 1) { json.Append(","); } } var userRelations = new RoadFlow.Platform.UsersRelation().GetAllByOrganizeID(orgID); var users = new RoadFlow.Platform.Users().GetAllByOrganizeID(orgID); int count1 = users.Count; if (count1 > 0 && count > 0) { json.Append(","); } int j = 0; foreach (var user in users) { var ur = userRelations.Find(p => p.UserID == user.ID); json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", user.ID); json.AppendFormat("\"parentID\":\"{0}\",", id); json.AppendFormat("\"title\":\"{0}{1}\",", user.Name, ur != null && ur.IsMain == 0 ? "<span style='color:#999;'>[兼职]</span>" : ""); json.AppendFormat("\"ico\":\"{0}\",", Url.Content("~/images/ico/contact_grey.png")); json.AppendFormat("\"link\":\"{0}\",", ""); json.AppendFormat("\"type\":\"{0}\",", "4"); json.AppendFormat("\"hasChilds\":\"{0}\",", "0"); json.Append("\"childs\":["); json.Append("]"); json.Append("}"); if (j++ < count1 - 1) { json.Append(","); } } json.Append("]"); return(json.ToString()); }
public string Query() { RoadFlow.Platform.WorkFlowDelegation workFlowDelegation1 = new RoadFlow.Platform.WorkFlowDelegation(); RoadFlow.Platform.Organize organize = new RoadFlow.Platform.Organize(); RoadFlow.Platform.Users users = new RoadFlow.Platform.Users(); RoadFlow.Platform.WorkFlow workFlow1 = new RoadFlow.Platform.WorkFlow(); string startTime = this.Request.Form["S_StartTime"]; string endTime = this.Request.Form["S_EndTime"]; string id1 = this.Request.Form["S_UserID"]; string str1 = this.Request.Form["sidx"]; string str2 = this.Request.Form["sord"]; string str3 = this.Request.Form["typeid"]; int pageSize = Tools.GetPageSize(); int pageNumber = Tools.GetPageNumber(); string order = (str1.IsNullOrEmpty() ? "SenderTime" : str1) + " " + (str2.IsNullOrEmpty() ? "asc" : str2); long count; IEnumerable <RoadFlow.Data.Model.WorkFlowDelegation> workFlowDelegations = !("1" == this.Request.QueryString["isoneself"]) ? (IEnumerable <RoadFlow.Data.Model.WorkFlowDelegation>)workFlowDelegation1.GetPagerData(out count, pageSize, pageNumber, RoadFlow.Platform.Users.RemovePrefix(id1), startTime, endTime, order) : (IEnumerable <RoadFlow.Data.Model.WorkFlowDelegation>)workFlowDelegation1.GetPagerData(out count, pageSize, pageNumber, MyController.CurrentUserID.ToString(), startTime, endTime, order); JsonData jsonData1 = new JsonData(); foreach (RoadFlow.Data.Model.WorkFlowDelegation workFlowDelegation2 in workFlowDelegations) { string str4 = "委托中"; if (workFlowDelegation2.StartTime > DateTimeNew.Now) { str4 = "未开始"; } else if (workFlowDelegation2.EndTime < DateTimeNew.Now) { str4 = "已失效"; } JsonData jsonData2 = new JsonData(); JsonData jsonData3 = jsonData2; string index1 = "id"; Guid id2 = workFlowDelegation2.ID; JsonData jsonData4 = (JsonData)id2.ToString(); jsonData3[index1] = jsonData4; jsonData2["UserID"] = (JsonData)users.GetName(workFlowDelegation2.UserID); jsonData2["ToUserID"] = (JsonData)users.GetName(workFlowDelegation2.ToUserID); JsonData jsonData5 = jsonData2; string index2 = "FlowID"; Guid? flowId = workFlowDelegation2.FlowID; string str5; if (!flowId.HasValue) { str5 = ""; } else { RoadFlow.Platform.WorkFlow workFlow2 = workFlow1; flowId = workFlowDelegation2.FlowID; Guid flowID = flowId.Value; str5 = workFlow2.GetFlowName(flowID); } JsonData jsonData6 = (JsonData)str5; jsonData5[index2] = jsonData6; jsonData2["StartTime"] = (JsonData)workFlowDelegation2.StartTime.ToDateTimeString(); jsonData2["EndTime"] = (JsonData)workFlowDelegation2.EndTime.ToDateTimeString(); jsonData2["Note"] = (JsonData)workFlowDelegation2.Note; jsonData2["Status"] = (JsonData)str4; JsonData jsonData7 = jsonData2; string index3 = "Edit"; string str6 = "<a class=\"editlink\" href=\"javascript:edit('"; id2 = workFlowDelegation2.ID; string str7 = id2.ToString(); string str8 = "');\">编辑</a>"; JsonData jsonData8 = (JsonData)(str6 + str7 + str8); jsonData7[index3] = jsonData8; jsonData1.Add((object)jsonData2); } return("{\"userdata\":{\"total\":" + (object)count + ",\"pagesize\":" + (object)pageSize + ",\"pagenumber\":" + (object)pageNumber + "},\"rows\":" + jsonData1.ToJson(true) + "}"); }
private void check() { string isVcodeSessionKey = RoadFlow.Utility.Keys.SessionKeys.IsValidateCode.ToString(); string vcodeSessionKey = RoadFlow.Utility.Keys.SessionKeys.ValidateCode.ToString(); string account = Request.Form["Account"]; string password = Request.Form["Password"]; string force = Request.Form["Force"]; string vcode = Request.Form["VCode"]; bool isSessionLost = "1" == Request.QueryString["session"];//是否是超时后再登录 if (Session[isVcodeSessionKey] != null && "1" == Session[isVcodeSessionKey].ToString() && (Session[vcodeSessionKey] == null || string.Compare(Session[vcodeSessionKey].ToString(), vcode.Trim(), true) != 0)) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "error", "alert('验证码错误!');", true); } else if (account.IsNullOrEmpty() || password.IsNullOrEmpty()) { Session[isVcodeSessionKey] = "1"; RoadFlow.Platform.Log.Add("用户登录失败", string.Concat("用户:", account, "登录失败,帐号或密码为空"), RoadFlow.Platform.Log.Types.用户登录); Script = "alert('帐号或密码不能为空!');"; } else { RoadFlow.Platform.Users busers = new RoadFlow.Platform.Users(); var user = busers.GetByAccount(account.Trim()); if (user == null || string.Compare(user.Password, busers.GetUserEncryptionPassword(user.ID.ToString(), password.Trim()), false) != 0) { Session[isVcodeSessionKey] = "1"; RoadFlow.Platform.Log.Add("用户登录失败", string.Concat("用户:", account, "登录失败,帐号或密码错误"), RoadFlow.Platform.Log.Types.用户登录); Script = "alert('帐号或密码错误!');"; } else if (user.Status == 1) { Session[isVcodeSessionKey] = "1"; RoadFlow.Platform.Log.Add("用户登录失败", string.Concat("用户:", account, "登录失败,帐号已被冻结"), RoadFlow.Platform.Log.Types.用户登录); Script = "alert('帐号已被冻结!');"; } else { RoadFlow.Platform.OnlineUsers bou = new RoadFlow.Platform.OnlineUsers(); var onUser = bou.Get(user.ID); if (onUser != null && "1" != force) { string ip = onUser.IP; Session.Remove(isVcodeSessionKey); Script = "if(confirm('当前帐号已经在" + ip + "登录,您要强行登录吗?')){$('#Account').val('" + account + "');$('#Password').val('" + password + "');$('#Force').val('1');$('#form1').submit();}"; } else { Guid uniqueID = Guid.NewGuid(); Session[RoadFlow.Utility.Keys.SessionKeys.UserID.ToString()] = user.ID; Session[RoadFlow.Utility.Keys.SessionKeys.UserUniqueID.ToString()] = uniqueID; bou.Add(user, uniqueID); Session.Remove(isVcodeSessionKey); RoadFlow.Platform.Log.Add("用户登录成功", string.Concat("用户:", user.Name, "(", user.ID, ")登录成功"), RoadFlow.Platform.Log.Types.用户登录); if (isSessionLost) { Script = "alert('登录成功!');new RoadUI.Window().close();"; } else { Script = "top.location='" + Common.Tools.BaseUrl + "Default.aspx';"; } } } } }
public static string GetWildcardValue(string wildcard, string userID = "") { if (MyExtensions.IsNullOrEmpty(wildcard)) { return(""); } string result = string.Empty; switch (wildcard.ToLower()) { case "$userid$": result = ((!MyExtensions.IsGuid(userID)) ? RoadFlow.Platform.Users.CurrentUserID.ToString() : userID.ToString()); break; case "$username$": if (MyExtensions.IsGuid(userID)) { RoadFlow.Data.Model.Users users2 = new RoadFlow.Platform.Users().Get(MyExtensions.ToGuid(userID)); result = ((users2 == null) ? "" : users2.Name); } else { result = RoadFlow.Platform.Users.CurrentUserName; } break; case "$deptid$": if (MyExtensions.IsGuid(userID)) { RoadFlow.Data.Model.Organize deptByUserID2 = new RoadFlow.Platform.Users().GetDeptByUserID(MyExtensions.ToGuid(userID)); result = ((deptByUserID2 == null) ? "" : deptByUserID2.ID.ToString()); } else { result = RoadFlow.Platform.Users.CurrentDeptID.ToString(); } break; case "$deptname$": if (MyExtensions.IsGuid(userID)) { RoadFlow.Data.Model.Organize deptByUserID = new RoadFlow.Platform.Users().GetDeptByUserID(MyExtensions.ToGuid(userID)); result = ((deptByUserID == null) ? "" : deptByUserID.Name); } else { result = RoadFlow.Platform.Users.CurrentDeptName.ToString(); } break; case "$unitid$": if (MyExtensions.IsGuid(userID)) { RoadFlow.Data.Model.Organize unitByUserID = new RoadFlow.Platform.Users().GetUnitByUserID(MyExtensions.ToGuid(userID)); result = ((unitByUserID == null) ? "" : unitByUserID.ID.ToString()); } else { result = RoadFlow.Platform.Users.CurrentUnitID.ToString(); } break; case "$unitname$": if (MyExtensions.IsGuid(userID)) { RoadFlow.Data.Model.Organize unitByUserID2 = new RoadFlow.Platform.Users().GetUnitByUserID(MyExtensions.ToGuid(userID)); result = ((unitByUserID2 == null) ? "" : unitByUserID2.Name); } else { result = RoadFlow.Platform.Users.CurrentUnitName.ToString(); } break; case "$account$": if (MyExtensions.IsGuid(userID)) { RoadFlow.Data.Model.Users users = new RoadFlow.Platform.Users().Get(MyExtensions.ToGuid(userID)); result = ((users == null) ? "" : users.Account); } else { result = RoadFlow.Platform.Users.CurrentUserAccount; } break; } return(result); }
public string CheckLogin() { string name1 = Keys.SessionKeys.IsValidateCode.ToString(); string index1 = Keys.SessionKeys.ValidateCode.ToString(); string str1 = this.Request.Form["Account"]; string str2 = this.Request.Form["Password"]; string str3 = this.Request.Form["VCode"]; string str4 = this.Request.Form["Force"]; string str5 = "(帐号:" + str1 + " 密码:" + str2 + " 验证码:" + str3 + ")"; if (str1.IsNullOrEmpty() || str2.IsNullOrEmpty()) { RoadFlow.Platform.Log.Add("用户登录失败(帐号或密码为空)" + str5, "", RoadFlow.Platform.Log.Types.用户登录, "", "", (RoadFlow.Data.Model.Users)null); return("{\"status\":0,\"msg\":\"帐号或密码不能为空!\"}"); } if (this.Session[name1] != null && "1" == this.Session[name1].ToString() && (this.Session[index1] == null || string.Compare(this.Session[index1].ToString(), str3.Trim1(), true) != 0)) { RoadFlow.Platform.Log.Add("用户登录失败(验证码错误)" + str5, "", RoadFlow.Platform.Log.Types.用户登录, "", "", (RoadFlow.Data.Model.Users)null); return("{\"status\":0,\"msg\":\"验证码错误!\"}"); } RoadFlow.Platform.Users users = new RoadFlow.Platform.Users(); RoadFlow.Data.Model.Users byAccount = users.GetByAccount(str1.Trim()); if (byAccount == null || string.Compare(byAccount.Password, users.GetUserEncryptionPassword(byAccount.ID.ToString(), str2.Trim()), false) != 0) { this.Session[name1] = (object)"1"; RoadFlow.Platform.Log.Add("用户登录失败(帐号或密码错误)" + str5, "", RoadFlow.Platform.Log.Types.用户登录, "", "", (RoadFlow.Data.Model.Users)null); return("{\"status\":0,\"msg\":\"帐号或密码错误!\"}"); } if (byAccount.Status == 1) { this.Session[name1] = (object)"1"; RoadFlow.Platform.Log.Add("用户登录失败(帐号已被冻结)" + str5, "", RoadFlow.Platform.Log.Types.用户登录, "", "", (RoadFlow.Data.Model.Users)null); return("{\"status\":0,\"msg\":\"帐号已被冻结!\"}"); } RoadFlow.Platform.OnlineUsers onlineUsers1 = new RoadFlow.Platform.OnlineUsers(); RoadFlow.Data.Model.OnlineUsers onlineUsers2 = onlineUsers1.Get(byAccount.ID); if (onlineUsers2 != null && "1" != str4) { string ip = onlineUsers2.IP; this.Session.Remove(name1); return("{\"status\":2,\"msg\":\"当前帐号已经在" + ip + "登录,您要强行登录吗?\"}"); } Guid uniqueID = Guid.NewGuid(); this.Session[Keys.SessionKeys.UserID.ToString()] = (object)byAccount.ID; HttpSessionStateBase session1 = this.Session; Keys.SessionKeys sessionKeys = Keys.SessionKeys.UserUniqueID; string index2 = sessionKeys.ToString(); // ISSUE: variable of a boxed type __Boxed <Guid> local = (ValueType)uniqueID; session1[index2] = (object)local; HttpSessionStateBase session2 = this.Session; sessionKeys = Keys.SessionKeys.BaseUrl; string index3 = sessionKeys.ToString(); string str6 = this.Url.Content("~/"); session2[index3] = (object)str6; HttpSessionStateBase session3 = this.Session; sessionKeys = Keys.SessionKeys.UserName; string index4 = sessionKeys.ToString(); string name2 = byAccount.Name; session3[index4] = (object)name2; HttpCookieCollection cookies = this.Response.Cookies; sessionKeys = Keys.SessionKeys.UserID; cookies.Add(new HttpCookie(sessionKeys.ToString(), byAccount.ID.ToString()) { Expires = MyController.CurrentDateTime.AddDays(7.0) }); onlineUsers1.Add(byAccount, uniqueID); this.Session.Remove(name1); RoadFlow.Platform.Log.Add("用户登录成功(帐号:" + str1 + ")", "", RoadFlow.Platform.Log.Types.用户登录, "", "", (RoadFlow.Data.Model.Users)null); return("{\"status\":1,\"msg\":\"成功!\"}"); }
public ActionResult User(FormCollection collection) { RoadFlow.Platform.Organize borganize = new RoadFlow.Platform.Organize(); RoadFlow.Platform.Users busers = new RoadFlow.Platform.Users(); RoadFlow.Platform.UsersRelation buserRelation = new RoadFlow.Platform.UsersRelation(); RoadFlow.Data.Model.Users user = null; RoadFlow.Data.Model.Organize organize = null; string id = Request.QueryString["id"]; string parentID = Request.QueryString["parentid"]; string name = string.Empty; string account = string.Empty; string status = string.Empty; string note = string.Empty; string parentString = string.Empty; Guid userID, organizeID; if (id.IsGuid(out userID)) { user = busers.Get(userID); if (user != null) { name = user.Name; account = user.Account; status = user.Status.ToString(); note = user.Note; //所在组织字符串 System.Text.StringBuilder sb = new System.Text.StringBuilder(); var userRelations = buserRelation.GetAllByUserID(user.ID).OrderByDescending(p => p.IsMain); foreach (var userRelation in userRelations) { sb.Append("<div style='margin:3px 0;'>"); sb.Append(borganize.GetAllParentNames(userRelation.OrganizeID, true)); if (userRelation.IsMain == 0) { sb.Append("<span style='color:#999'> [兼职]</span>"); } sb.Append("</div>"); } ViewBag.ParentString = sb.ToString(); var roles = new RoadFlow.Platform.UsersRole().GetByUserIDFromCache(userID); RoadFlow.Platform.Role brole = new RoadFlow.Platform.Role(); System.Text.StringBuilder rolesb = new System.Text.StringBuilder(); foreach (var role in roles) { var role1 = brole.Get(role.RoleID); if (role1 == null) { continue; } rolesb.Append(role1.Name); rolesb.Append(","); } ViewBag.RoleString = rolesb.ToString().TrimEnd(','); } } if (parentID.IsGuid(out organizeID)) { organize = borganize.Get(organizeID); } if (collection != null) { //保存 if (!Request.Form["Save"].IsNullOrEmpty() && user != null) { name = Request.Form["Name"]; account = Request.Form["Account"]; status = Request.Form["Status"]; note = Request.Form["Note"]; string oldXML = user.Serialize(); user.Name = name.Trim(); user.Account = account.Trim(); user.Status = status.ToInt(1); user.Note = note.IsNullOrEmpty() ? null : note.Trim(); busers.Update(user); RoadFlow.Platform.Log.Add("修改了用户", "", RoadFlow.Platform.Log.Types.组织机构, oldXML, user.Serialize()); ViewBag.Script = "alert('保存成功!');parent.frames[0].reLoad('" + parentID + "');"; } //删除用户 if (!Request.Form["DeleteBut"].IsNullOrEmpty() && user != null && organize != null) { using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope()) { var urs = buserRelation.GetAllByUserID(user.ID); busers.Delete(user.ID); buserRelation.DeleteByUserID(user.ID); new RoadFlow.Platform.UsersInfo().Delete(user.ID); new RoadFlow.Platform.UsersRole().DeleteByUserID(user.ID); //更新父级[ChildsLength]字段 foreach (var ur in urs) { borganize.UpdateChildsLength(ur.OrganizeID); } scope.Complete(); } string refreshID = parentID; string url = string.Empty; var users = borganize.GetAllUsers(refreshID.ToGuid()); if (users.Count > 0) { url = "User?id=" + users.Last().ID + "&appid=" + Request.QueryString["appid"] + "&tabid=" + Request.QueryString["tabid"] + "&parentid=" + parentID; } else { refreshID = organize.ParentID == Guid.Empty ? organize.ID.ToString() : organize.ParentID.ToString(); url = "Body?id=" + parentID + "&appid=" + Request.QueryString["appid"] + "&tabid=" + Request.QueryString["tabid"] + "&parentid=" + organize.ParentID; } RoadFlow.Platform.Log.Add("删除了用户", user.Serialize(), RoadFlow.Platform.Log.Types.组织机构); ViewBag.Script = "alert('删除成功');parent.frames[0].reLoad('" + refreshID + "');window.location='" + url + "'"; new RoadFlow.Platform.AppLibrary().ClearUseMemberCache(); } //初始化密码 if (!Request.Form["InitPass"].IsNullOrEmpty() && user != null) { string initpass = busers.GetInitPassword(); busers.InitPassword(user.ID); RoadFlow.Platform.Log.Add("初始化了用户密码", user.Serialize(), RoadFlow.Platform.Log.Types.组织机构); ViewBag.Script = "alert('密码已初始化为:" + initpass + "');"; } //调动 if (!Request.Form["Move1"].IsNullOrEmpty() && user != null) { string moveto = Request.Form["movetostation"]; string movetostationjz = Request.Form["movetostationjz"]; Guid moveToID; if (moveto.IsGuid(out moveToID)) { using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope()) { var us = buserRelation.GetAllByUserID(user.ID); if ("1" != movetostationjz) { buserRelation.DeleteByUserID(user.ID); } RoadFlow.Data.Model.UsersRelation ur = new RoadFlow.Data.Model.UsersRelation(); ur.UserID = user.ID; ur.OrganizeID = moveToID; ur.IsMain = "1" == movetostationjz ? 0 : 1; ur.Sort = buserRelation.GetMaxSort(moveToID); buserRelation.Add(ur); foreach (var u in us) { borganize.UpdateChildsLength(u.OrganizeID); } borganize.UpdateChildsLength(organizeID); borganize.UpdateChildsLength(moveToID); scope.Complete(); ViewBag.Script = "alert('调动成功!');parent.frames[0].reLoad('" + parentID + "');parent.frames[0].reLoad('" + moveto + "')"; } RoadFlow.Platform.Log.Add(("1" == movetostationjz ? "兼职" : "全职") + "调动了人员的岗位", "将人员调往岗位(" + moveto + ")", RoadFlow.Platform.Log.Types.组织机构); new RoadFlow.Platform.AppLibrary().ClearUseMemberCache(); } } } ViewBag.StatusRadios = borganize.GetStatusRadio("Status", status, "validate=\"radio\""); return(View(user)); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string rootid = context.Request.QueryString["rootid"] ?? ""; string showtype = context.Request.QueryString["showtype"] ?? ""; RoadFlow.Platform.Organize BOrganize = new RoadFlow.Platform.Organize(); RoadFlow.Platform.Users busers = new RoadFlow.Platform.Users(); RoadFlow.Platform.WorkGroup BWorkGroup = new RoadFlow.Platform.WorkGroup(); System.Text.StringBuilder json = new System.Text.StringBuilder("[", 1000); if ("1" == showtype) { #region 显示工作组 var workGroups = BWorkGroup.GetAll(); json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", Guid.Empty); json.AppendFormat("\"parentID\":\"{0}\",", Guid.Empty); json.AppendFormat("\"title\":\"{0}\",", "工作组"); json.AppendFormat("\"ico\":\"{0}\",", Common.Tools.BaseUrl + "/images/ico/group.gif"); json.AppendFormat("\"link\":\"{0}\",", ""); json.AppendFormat("\"type\":\"{0}\",", 5); json.AppendFormat("\"hasChilds\":\"{0}\",", workGroups.Count); json.Append("\"childs\":["); int countwg = workGroups.Count; int iwg = 0; foreach (var wg in workGroups) { json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", wg.ID); json.AppendFormat("\"parentID\":\"{0}\",", Guid.Empty); json.AppendFormat("\"title\":\"{0}\",", wg.Name); json.AppendFormat("\"ico\":\"{0}\",", ""); json.AppendFormat("\"link\":\"{0}\",", ""); json.AppendFormat("\"type\":\"{0}\",", 5); json.AppendFormat("\"hasChilds\":\"{0}\",", 0); json.Append("\"childs\":["); json.Append("]"); json.Append("}"); if (iwg++ < countwg - 1) { json.Append(","); } } json.Append("]"); json.Append("}"); json.Append("]"); context.Response.Write(json.ToString()); context.Response.End(); #endregion } if (rootid.IsNullOrEmpty()) { rootid = BOrganize.GetRoot().ID.ToString(); } string[] rootIDArray = rootid.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); int m = 0; foreach (string rootID in rootIDArray) { List <RoadFlow.Data.Model.Users> users = new List <RoadFlow.Data.Model.Users>(); Guid rootGuid = Guid.Empty; if (rootID.IsGuid(out rootGuid)) { var root = BOrganize.Get(rootGuid); if (root != null) { users = busers.GetAllByOrganizeID(rootGuid); json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", root.ID); json.AppendFormat("\"parentID\":\"{0}\",", root.ParentID); json.AppendFormat("\"title\":\"{0}\",", root.Name); json.AppendFormat("\"ico\":\"{0}\",", rootIDArray.Length == 1 ? Common.Tools.BaseUrl + "/images/ico/icon_site.gif" : ""); json.AppendFormat("\"link\":\"{0}\",", ""); json.AppendFormat("\"type\":\"{0}\",", root.Type); json.AppendFormat("\"hasChilds\":\"{0}\",", root.ChildsLength == 0 && users.Count == 0 ? "0" : "1"); json.Append("\"childs\":["); } } else if (rootID.StartsWith(RoadFlow.Platform.Users.PREFIX)) { var root = busers.Get(busers.RemovePrefix1(rootID).ToGuid()); if (root != null) { json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", root.ID); json.AppendFormat("\"parentID\":\"{0}\",", Guid.Empty); json.AppendFormat("\"title\":\"{0}\",", root.Name); json.AppendFormat("\"ico\":\"{0}\",", Common.Tools.BaseUrl + "/images/ico/contact_grey.png"); json.AppendFormat("\"link\":\"{0}\",", ""); json.AppendFormat("\"type\":\"{0}\",", "4"); json.AppendFormat("\"hasChilds\":\"{0}\",", "0"); json.Append("\"childs\":["); } } else if (rootID.StartsWith(RoadFlow.Platform.WorkGroup.PREFIX)) { var root = BWorkGroup.Get(BWorkGroup.RemovePrefix1(rootID).ToGuid()); if (root != null) { users = BOrganize.GetAllUsers(rootID); json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", root.ID); json.AppendFormat("\"parentID\":\"{0}\",", Guid.Empty); json.AppendFormat("\"title\":\"{0}\",", root.Name); json.AppendFormat("\"ico\":\"{0}\",", ""); json.AppendFormat("\"link\":\"{0}\",", ""); json.AppendFormat("\"type\":\"{0}\",", "5"); json.AppendFormat("\"hasChilds\":\"{0}\",", users.Count > 0 ? "1" : "0"); json.Append("\"childs\":["); } } #region 只有一个根时显示二级 if (rootIDArray.Length == 1) { List <RoadFlow.Data.Model.Organize> orgs = rootID.IsGuid() ? BOrganize.GetChilds(rootGuid) : new List <RoadFlow.Data.Model.Organize>(); int count = orgs.Count; int i = 0; foreach (var org in orgs) { json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", org.ID); json.AppendFormat("\"parentID\":\"{0}\",", org.ParentID); json.AppendFormat("\"title\":\"{0}\",", org.Name); json.AppendFormat("\"ico\":\"{0}\",", ""); json.AppendFormat("\"link\":\"{0}\",", ""); json.AppendFormat("\"type\":\"{0}\",", org.Type); json.AppendFormat("\"hasChilds\":\"{0}\",", org.ChildsLength); json.Append("\"childs\":["); json.Append("]"); json.Append("}"); if (i++ < count - 1 || users.Count > 0) { json.Append(","); } } if (users.Count > 0) { var userRelations = new RoadFlow.Platform.UsersRelation().GetAllByOrganizeID(rootGuid); int count1 = users.Count; int j = 0; foreach (var user in users) { var ur = userRelations.Find(p => p.UserID == user.ID); json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", user.ID); json.AppendFormat("\"parentID\":\"{0}\",", rootGuid); json.AppendFormat("\"title\":\"{0}{1}\",", user.Name, ur != null && ur.IsMain == 0 ? "<span style='color:#999;'>[兼职]</span>" : ""); json.AppendFormat("\"ico\":\"{0}\",", Common.Tools.BaseUrl + "/images/ico/contact_grey.png"); json.AppendFormat("\"link\":\"{0}\",", ""); json.AppendFormat("\"type\":\"{0}\",", "4"); json.AppendFormat("\"hasChilds\":\"{0}\",", "0"); json.Append("\"childs\":["); json.Append("]"); json.Append("}"); if (j++ < count1 - 1) { json.Append(","); } } } } #endregion json.Append("]"); json.Append("}"); if (m++ < rootIDArray.Length - 1) { json.Append(","); } } json.Append("]"); context.Response.Write(json.ToString()); }
protected void Page_Load(object sender, EventArgs e) { isoneself = "1" == Request.QueryString["isoneself"]; if (isoneself) { this.S_UserID.Disabled = true; this.S_UserID.Value = RoadFlow.Platform.Users.PREFIX + RoadFlow.Platform.Users.CurrentUserID.ToString(); } RoadFlow.Platform.WorkFlowDelegation bworkFlowDelegation = new RoadFlow.Platform.WorkFlowDelegation(); RoadFlow.Platform.Organize borganize = new RoadFlow.Platform.Organize(); RoadFlow.Platform.Users busers = new RoadFlow.Platform.Users(); RoadFlow.Platform.WorkFlow bworkFlow = new RoadFlow.Platform.WorkFlow(); string startTime = string.Empty; string endTime = string.Empty; string suserid = string.Empty; string Query1 = string.Format("&appid={0}&tabid={1}&isoneself={2}", Request.QueryString["appid"], Request.QueryString["tabid"], Request.QueryString["isoneself"]); if (IsPostBack) { if (!Request.Form["DeleteBut"].IsNullOrEmpty()) { string ids = Request.Form["checkbox_app"]; foreach (string id in ids.Split(',')) { Guid bid; if (!id.IsGuid(out bid)) { continue; } var comment = bworkFlowDelegation.Get(bid); if (comment != null) { bworkFlowDelegation.Delete(bid); RoadFlow.Platform.Log.Add("删除了流程意见", comment.Serialize(), RoadFlow.Platform.Log.Types.流程相关); } } bworkFlowDelegation.RefreshCache(); } startTime = Request.Form["S_StartTime"]; endTime = Request.Form["S_EndTime"]; suserid = Request.Form["S_UserID"]; } else { startTime = Request.QueryString["S_StartTime"]; endTime = Request.QueryString["S_EndTime"]; suserid = Request.QueryString["S_UserID"]; } Query1 += "&S_StartTime=" + startTime + "&S_EndTime=" + endTime + "&S_UserID=" + suserid; string pager; bool isOneSelf = "1" == Request.QueryString["isoneself"]; if (isOneSelf) { workFlowDelegationList = bworkFlowDelegation.GetPagerData(out pager, Query1, RoadFlow.Platform.Users.CurrentUserID.ToString(), startTime, endTime); } else { workFlowDelegationList = bworkFlowDelegation.GetPagerData(out pager, Query1, RoadFlow.Platform.Users.RemovePrefix(suserid), startTime, endTime); } this.Pager.Text = pager; }