protected void Save_Btn_Click(object sender, EventArgs e) { M_UserInfo mu = buser.SelReturnModel(UserID); M_User_Plat upMod = upBll.SelReturnModel(UserID); M_Plat_Group gpMod = gpBll.SelReturnModel(DataConvert.CLng(PlatGroup_DP.SelectedValue)); M_Plat_Comp compMod = compBll.SelReturnModel(Convert.ToInt32(PlatComp_DP.SelectedValue)); if (upMod == null) { upMod = upBll.NewUser(mu, compMod); upMod.Plat_Group = PlatGroup_DP.SelectedValue; upBll.Insert(upMod); } else { upMod.CompID = compMod.ID; upMod.Status = 1; upBll.UpdateByID(upMod); } if (gpMod != null) { gpBll.AddMember(UserID.ToString(), gpMod.ID); } function.WriteSuccessMsg("操作成功", Request.RawUrl); }
protected void BatAgree_Btn_Click(object sender, EventArgs e) { string ids = Request.Form["idchk"]; //修改公司状态,并更正名称 DataTable dt = ualyBll.Search(ztype, ids, "", (int)ZLEnum.ConStatus.UnAudit, 0); foreach (DataRow dr in dt.Rows) { M_Common_UserApply ualyMod = new M_Common_UserApply().GetModelFromReader(dr); M_UserInfo mu = buser.SelReturnModel(ualyMod.UserID); //-------------创建公司和用户 M_User_Plat upMod = upBll.NewUser(mu); M_Plat_Comp compMod = compBll.CreateByUser(upMod); compMod.CompName = ualyMod.CompName; compMod.CompShort = ualyMod.Info1; compMod.Telephone = ualyMod.Mobile; compMod.Mobile = ualyMod.Mobile; compMod.Status = 1; compBll.UpdateByID(compMod); upBll.Insert(upMod); //-------------创建部门 DataTable userDT = GetUserDT(); NewByUserDT(compMod, userDT); } ualyBll.ChangeByIDS(ids, (int)ZLEnum.ConStatus.Audited); function.WriteSuccessMsg("批量同意完成"); }
protected void BatAdd_Btn_Click(object sender, EventArgs e) { M_Plat_Comp compMod = compBll.SelReturnModel(CompID); string[] ids = UserIDS_Hid.Value.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < ids.Length; i++) { int uid = DataConvert.CLng(ids[i]); M_User_Plat upMod = upBll.SelReturnModel(uid); if (upMod == null) { M_UserInfo newmu = buser.SelReturnModel(uid); upMod = upBll.NewUser(newmu, compMod); upBll.Insert(upMod); } else { upMod.CompID = CompID; upBll.UpdateByID(upMod); } } MyBind(); }
//选择好用户后,为其创建相关信息 protected void Submit_Btn_Click(object sender, EventArgs e) { int uid = Convert.ToInt32(User_Hid.Value.Split(',')[0]); M_UserInfo mu = buser.SelReturnModel(uid); if (mu.IsNull) { function.WriteErrMsg("用户[" + User_T.Text + "]不存在"); } if (upBll.SelReturnModel(uid) != null) { function.WriteErrMsg("创建失败:用户" + User_T.Text + "已经有了企业,不能重复创建"); } M_Plat_Comp compMod = new M_Plat_Comp(); M_Plat_UserRole urMod = new M_Plat_UserRole(); DataTable userDT = JsonConvert.DeserializeObject <DataTable>(UserInfo_Hid.Value);//为空下是否会报错 if (SFileUp.HasFile) { SFileUp.SaveFile(); } //------------------公司 compMod.CompName = CompName_T.Text; compMod.Status = 1; compMod.CreateUser = mu.UserID; compMod.CompLogo = SFileUp.FileUrl; compMod.UPPath = compBll.CreateUPPath(compMod); compMod.ID = compBll.Insert(compMod); //------------------角色 urMod.IsSuper = 1; urMod.RoleAuth = ""; urMod.CompID = compMod.ID; urMod.RoleName = "网络管理员"; urMod.RoleDesc = "公司网络管理员,拥有全部权限,该角色只允许存在一个"; urMod.UserID = mu.UserID; urMod.ID = urBll.Insert(urMod); //------------------网络管理员 { M_User_Plat upMod = upBll.NewUser(mu, compMod); upMod.Plat_Role = "," + urMod.ID + ","; upBll.Insert(upMod); M_Plat_Group gpMod = NewGroup(upMod.CompID, "办公部门", upMod.UserID); gpBll.Insert(gpMod); } //------------------其他权限管理员 { for (int i = 0; i < userDT.Rows.Count; i++) { string gname = userDT.Rows[i]["gname"].ToString(); string uname = userDT.Rows[i]["uname"].ToString(); string honey = userDT.Rows[i]["honey"].ToString(); if (string.IsNullOrEmpty(uname)) { continue; } M_UserInfo newmu = buser.NewUser(uname, "111111"); newmu.HoneyName = honey; newmu.UserID = buser.Add(newmu); M_Uinfo basemu = buser.NewBase(newmu); buser.AddBase(basemu); //----能力相关信息 M_Plat_Group gpMod = NewGroup(compMod.ID, gname, newmu.UserID); M_User_Plat upMod = upBll.NewUser(newmu, compMod); gpMod.ID = gpBll.Insert(gpMod); upMod.Gid = gpMod.ID.ToString(); upBll.Insert(upMod); } } function.WriteSuccessMsg(mu.UserName + "的企业[" + compMod.CompName + "]创建成功", "CompList.aspx"); }