public FoWoSoft.Data.Model.Users CreateNewUser(string userid) { var user = new FoWoSoft.Platform.Users().GetByAccount(userid); if (user != null) { return(user); } //根据UserId获取从远程用户信息 var userInfoEdu = new EduWebService().GetUser(userid); if (userInfoEdu == null) { return(null); } //更新用户信息 user = new FoWoSoft.Data.Model.Users() { Account = userid, ID = Guid.NewGuid(), Name = userInfoEdu.XM, Status = 0, Password = "******", Sort = 1, Note = "" }; new FoWoSoft.Platform.Users().Add(user); //创建组织关系 var guidId = new FoWoSoft.Platform.Guid_id().Get(userInfoEdu.BMBH); new FoWoSoft.Platform.UsersRelation().Add(new FoWoSoft.Data.Model.UsersRelation() { OrganizeID = guidId.GuidId, UserID = user.ID, Sort = 1, IsMain = 1 }); //更新组织下人员的个数 new FoWoSoft.Platform.Organize().UpdateChildsLength(guidId.GuidId); //创建用户角色 new FoWoSoft.Platform.UsersRole().Add(new FoWoSoft.Data.Model.UsersRole() { RoleID = Guid.Parse("0CF2ABB1-5F90-4FB3-8FA9-B53628B92879"), MemberID = user.ID, IsDefault = true }); return(user); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string title = context.Request.QueryString["title"]; string all = context.Request.QueryString["all"]; string orgina = context.Request.QueryString["orgina"]; string guid = context.Request.QueryString["guid"]; if (guid != null) { context.Response.ContentType = "text/json"; var guids = new FoWoSoft.Platform.Guid_id().GetAll(); var ss = JsonConvert.SerializeObject(guids); context.Response.Write(ss); } else if (title != null) { var ss = new WebForm.EduWebService().GetUser(title); if (ss != null) { context.Response.Write("{\"BMBH\":" + ss.BMBH + ",\"BMMC\":\"" + ss.BMMC + "\"}"); } else { context.Response.Write(string.Format("没有{0}账号信息", title)); } } else if (all != null) { if (all == "ok") { new WebForm.Common.UserService().CreateAllUser(); context.Response.Write("all"); } else { new WebForm.Common.UserService().CreateUser(all); } } else if (orgina != null) { Guid first = Guid.Parse("04F12BEB-D99D-43DF-AC9A-3042957D6BDA"); var rist = new FoWoSoft.Platform.Organize().GetChilds(first)[0]; new EduWebService().organizeResize1("04F12BEB-D99D-43DF-AC9A-3042957D6BDA", first, 1); } }
public void CreateAllUser() { var ss = new FoWoSoft.Platform.Guid_id().GetAll(); var kk = new FoWoSoft.Platform.UsersRelation().GetAll(); var ll = new FoWoSoft.Platform.Log().GetAll(); for (int i = ss.Count - 1; i > 0; i--) { var useid = ss[i].useId.Trim(); var or = ll.FirstOrDefault(s => s.Contents == useid); if (or != null) { continue; } //Task.Factory.StartNew(new Action(() => CreateUser(useid))); CreateUser(useid); } }
//重建组织时用 public void AddOrganize(DataSet ds) { FoWoSoft.Platform.Guid_id guidIdService = new FoWoSoft.Platform.Guid_id(); var dt = ds.Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { var dr = dt.Rows[i]; #region 部门编号转换成GUID string id = dr["BMBH"].ToString(); var guidId = guidIdService.Get(id); Guid org1ID; if (guidId == null) { org1ID = GetGuid(id); //插入对应表guid--id FoWoSoft.Data.Model.Guid_id guidIdModel = new FoWoSoft.Data.Model.Guid_id() { GuidId = org1ID, useId = id }; guidIdService.Add(guidIdModel); } else { org1ID = guidId.GuidId; } dr["BMBH"] = org1ID; #endregion var orgrion = borganize.Get(org1ID); if (orgrion != null) { continue; } #region 转上级编号为GUID id = dr["SJBM"].ToString(); guidId = guidIdService.Get(id); if (guidId == null) { org1ID = GetGuid(id); //插入对应表guid--id FoWoSoft.Data.Model.Guid_id guidIdModel = new FoWoSoft.Data.Model.Guid_id() { GuidId = org1ID, useId = id }; guidIdService.Add(guidIdModel); } else { org1ID = guidId.GuidId; } dr["SJBM"] = org1ID; #endregion #region 插入组织结构 FoWoSoft.Data.Model.Organize org = new FoWoSoft.Data.Model.Organize(); org.ID = Guid.Parse(dr["BMBH"].ToString()); org.Name = dr["BMMC"].ToString(); org.Note = null; org.Number = ""; // org.Number + "," + org1ID.ToString().ToLower(); org.ParentID = Guid.Parse(dr["SJBM"].ToString()); org.Sort = 0; // borganize.GetMaxSort(org.ID); org.Status = 0; org.Type = 0; // type.ToInt(); org.Depth = 0; // org.Depth + 1; //using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope()) // { borganize.Add(org); //更新父级[ChildsLength]字段 //borganize.UpdateChildsLength(org.ID); // scope.Complete(); // } #endregion } }