示例#1
0
 /// <summary>
 /// 添加权限
 /// </summary>
 /// <param name="permission"></param>
 /// <returns></returns>
 public static int AddPermission(PermissionEntity permission)
 {
     try
     {
         var dao    = UnityInstance.GetInstanceDAL <IRoleDao>();
         var result = dao.AddPermission(permission);
         return(result);
     }
     catch (Exception ex)
     {
         return(-1);
     }
 }
示例#2
0
 /// <summary>
 /// 添加账户
 /// </summary>
 /// <param name="role"></param>
 /// <returns></returns>
 public static int AddRole(RoleEntity role)
 {
     try
     {
         var dao    = UnityInstance.GetInstanceDAL <IRoleDao>();
         var result = dao.AddRole(role);
         return(result);
     }
     catch (Exception ex)
     {
         return(-1);
     }
 }
示例#3
0
 /// <summary>
 /// 添加账户
 /// </summary>
 /// <param name="account"></param>
 /// <returns></returns>
 public static int AddAccount(AdminEntity account)
 {
     try
     {
         var dao    = UnityInstance.GetInstanceDAL <IAdminDao>();
         var result = dao.AddAdmin(account);
         return(result);
     }
     catch (Exception ex)
     {
         return(-1);
     }
 }
示例#4
0
 public static AdminEntity GetAccountByName(string name)
 {
     try
     {
         var dao    = UnityInstance.GetInstanceDAL <IAdminDao>();
         var result = dao.GetAdminByName(name);
         return(result);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
示例#5
0
        public static int GetUserId()
        {
            int result = 0;

            try
            {
                var dao = UnityInstance.GetInstanceDAL <IUserDao>();
                result = dao.GetUserId();
            }
            catch (Exception ex)
            {
                return(-1);
            }
            return(result);
        }
示例#6
0
        public static int AddUser()
        {
            int result = 0;

            try
            {
                var dao = UnityInstance.GetInstanceDAL <IUserDao>();
                result = dao.AddUser(new Common.Entities.AccountUser()
                {
                    Name = "Test", Age = 23, Sex = false
                });
            }
            catch (Exception ex)
            {
                return(-1);
            }
            return(result);
        }
示例#7
0
 /// <summary>
 /// 获取用户列表
 /// </summary>
 /// <param name="pageIndex"></param>
 /// <param name="pageSize"></param>
 /// <returns></returns>
 public static List <UserData> GetUserDataList(int pageIndex, int pageSize)
 {
     try
     {
         var dao        = UnityInstance.GetInstanceDAL <IAdminDao>();
         var adminiList = dao.GetAdminEntityList(pageIndex, pageSize);
         var result     = new List <UserData>();
         if (adminiList != null && adminiList.Count > 0)
         {
             foreach (var admin in adminiList)
             {
                 var user = new UserData();
                 user.UserId   = admin.ID;
                 user.UserName = admin.Name;
                 result.Add(user);
             }
         }
         return(result);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }