Beispiel #1
0
        /// <summary>
        /// 用于创建公司,审核认证
        /// </summary>
        public void NewByUserDT(M_Plat_Comp compMod, DataTable userDT)
        {
            B_Plat_Group gpBll = new B_Plat_Group();

            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 = gpBll.NewGroup(gname, compMod.ID, newmu.UserID);
                M_User_Plat  upMod = NewUser(newmu, compMod);
                gpMod.ID  = gpBll.Insert(gpMod);
                upMod.Gid = gpMod.ID.ToString();
                Insert(upMod);
            }
        }
        public void AddModel()
        {
            M_Plat_Group groupMod = new M_Plat_Group();

            groupMod.Status     = 1;
            groupMod.GroupType  = 1;
            groupMod.CreateTime = DateTime.Now;
            groupMod.CreateUser = buser.GetLogin().UserID;
            groupBll.Insert(groupMod);
        }
        protected void Save_Btn_Click(object sender, EventArgs e)
        {
            M_Plat_Group gpMod = Mid > 0 ? gpBll.SelReturnModel(Mid) : new M_Plat_Group();
            M_User_Plat  upMod = B_User_Plat.GetLogin();

            gpMod.GroupName = GroupName_T.Text;
            gpMod.GroupDesc = GroupDesc_T.Text;
            gpMod.ManageIDS = manage_hid.Value;
            gpMod.MemberIDS = member_hid.Value;
            if (gpMod.ID > 0)
            {
                gpBll.UpdateByID(gpMod);
            }
            else
            {
                string nodeTree = "";
                gpMod.Pid        = Pid;
                gpMod.CreateUser = upMod.UserID;
                gpMod.FirstID    = gpBll.SelFirstID(Pid, ref nodeTree);
                gpMod.Depth      = gpBll.GetDepth(Pid);
                gpBll.Insert(gpMod);
            }
            function.WriteSuccessMsg("信息保存成功", "GroupAdmin.aspx");
        }
        //选择好用户后,为其创建相关信息
        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");
        }