Esempio n. 1
0
        protected override DTObject DynamicInvoke(dynamic arg)
        {
            Guid[] roleIds = Array.Empty <Guid>();
            if (arg.RoleMarkedCode != null)
            {
                string markedCode = arg.RoleMarkedCode.ToString();
                var    role       = RoleCommon.FindByMarkedCode(markedCode, QueryLevel.None);
                if (!role.IsEmpty())
                {
                    roleIds = new Guid[] { role.Id };
                }
            }
            else
            {
                roleIds = arg.RoleIds != null?arg.RoleIds?.OfType <Guid>() : Array.Empty <Guid>();
            }

            var cmd = new CreateUser(arg.AccountName, arg.Password, arg.DiskSize ?? VirtualDisk.Size1G) //默认给予1G的大小
            {
                Email                                   = arg.Email,
                LocationId                              = arg.LocationId,
                MobileNumber                            = arg.MobileNumber,
                Name                                    = arg.Name,
                NickName                                = arg.NickName,
                PhotoId                                 = arg.PhotoId,
                RoleIds                                 = arg.RoleIds != null?arg.RoleIds?.OfType <Guid>() : Array.Empty <Guid>(),
                                              Sex       = arg.Sex,
                                              IsEnabled = arg.IsEnabled
            };

            var user = cmd.Execute();

            return(DTObject.CreateReusable("{id}", user));
        }
Esempio n. 2
0
 public ActionResult Manage(RoleCommon model)
 {
     if (ModelState.IsValid)
     {
         model.CreatedBy = Session["UserName"].ToString();
         buss.Manage(model).SetMessageInTempData(this, "index");
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
Esempio n. 3
0
        private Role GetOrCreateSARole()
        {
            var role = RoleCommon.FindByMarkedCode(SARole.MarkedCode, QueryLevel.HoldSingle);

            if (role.IsEmpty())
            {
                var cmd = new CreateRole(SARole.Name, Array.Empty <Guid>(), true)
                {
                    MarkedCode = SARole.MarkedCode
                };
                return(cmd.Execute());
            }
            return(role);
        }
Esempio n. 4
0
        public List <RoleCommon> GetRoles()
        {
            var    list  = new List <RoleCommon>();
            string sql   = "sproc_role_management @flag='s'";
            var    dbres = dao.ExecuteDataTable(sql);

            if (dbres != null)
            {
                foreach (DataRow dr in dbres.Rows)
                {
                    var rm = new RoleCommon
                    {
                        sno        = dr["role_id"].ToString(),
                        RoleName   = dr["role_name"].ToString(),
                        RoleType   = dr["role_type"].ToString(),
                        CreatedBy  = dr["created_by"].ToString(),
                        CreateDate = dr["created_local_date"].ToString(),
                    };
                    list.Add(rm);
                }
            }
            return(list);
        }
Esempio n. 5
0
        public CommonDbResponse Manage(RoleCommon setup)
        {
            string sql = "sproc_role_management @flag='i', @name =" + dao.FilterString(setup.RoleName) + ",@role_type =" + dao.FilterString(setup.RoleType) + ",@user =" + dao.FilterString(setup.CreatedBy);

            return(dao.ParseCommonDbResponse(sql));
        }
Esempio n. 6
0
        protected override DTObject DynamicInvoke(dynamic arg)
        {
            var detail = RoleCommon.FindBy(arg.Id, QueryLevel.None);

            return(DTObject.CreateReusable("{id,name,markedCode,description,organization:{id},permissions:[{id,name}],isSystem}", detail));
        }
Esempio n. 7
0
        public ActionResult Manage()
        {
            var model = new RoleCommon();

            return(View(model));
        }
Esempio n. 8
0
 public CommonDbResponse Manage(RoleCommon setup)
 {
     return(IRR.Manage(setup));
 }
Esempio n. 9
0
        protected override DTObject DynamicInvoke(dynamic arg)
        {
            var page = RoleCommon.FindPage(arg.OrganizationId ?? Guid.Empty, arg.Name, arg.PageIndex, arg.PageSize);

            return(DTObjectPro.Create("{id,name,markedCode,description,isSystem,permissions:[{id,name}]}", page));
        }