Ejemplo n.º 1
0
 /// <summary>
 /// Users the change PWD by id.
 /// </summary>
 /// <param name="id">The id.</param>
 /// <param name="pwd">The PWD.</param>
 /// <returns></returns>
 public bool ModifyPwdById(int id, string pwd, Sys_AdminUser operUser)
 {
     bool b = false;
     pwd = iPow.Infrastructure.Crosscutting.Function.StringHelper.Tomd5(pwd);
     int res = ProcedureService.UserChangePwdById(id, pwd);
     if (res > 0)
     {
         b = true;
         var log = new Sys_AdminUserLog();
         log.AddTime = System.DateTime.Now;
         log.IpAddress = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP();
         log.PageUrl = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetCurrentUrl();
         log.ReferrerUrl = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetReferrerUrl();
         log.State = true;
         log.TypeId = 1;
         if (operUser != null)
         {
             log.UserId = operUser.id;
             log.ShortMessage = "用户Id:" + operUser.id + " 改变用户Id号:" + id.ToString() + " 的密码";
             log.FullMessage = "UserChangePwdById 用户:" + operUser.username + " 用户Id:" + operUser.id.ToString()
                 + " 改变用户Id号:" + id.ToString() + " 的密码:" + pwd;
         }
         else
         {
             log.UserId = 0;
             log.ShortMessage = "用户Id号:" + id.ToString() + " 的密码被修改";
             log.FullMessage = "UserChangePwdById " + "用户Id号:" + id.ToString() + " 的密码被修改";
         }
     }
     return b;
 }
Ejemplo n.º 2
0
 protected iPow.Infrastructure.Data.DataSys.Sys_AdminUser InitAddUser(iPow.Infrastructure.Data.DataSys.Sys_AdminUser entity,
                                                                      iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser)
 {
     if (entity != null)
     {
         entity.Activity     = false;
         entity.DepartmentID = "0";
         //user.Email
         entity.EmployeeID = 0;
         var userid = adminUserRepository.GetList().Max(e => e.id) + 1;
         //user.id = userid;
         entity.lastloginip   = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP();
         entity.lastlogintime = System.DateTime.Now;
         entity.logintimes    = 1;
         //user.password
         //user.Phone = "";
         //user.sex = "";
         entity.style = 0;
         //user.truename = "";
         entity.UserGuid = iPow.Infrastructure.Crosscutting.Comm.Service.UserGuidService.BuilderUserGuid();
         entity.userid   = operUser.id;
         //user.username
     }
     return(entity);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Deletes the user by id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public bool DeleteById(int id, iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser)
        {
            bool b    = false;
            var  user = GetUserById(id);

            b = Delete(user, operUser);
            return(b);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Deletes the user true by id.
        /// 物理删除
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="operUser"></param>
        /// <returns></returns>
        public bool DeleteTrueById(int id, iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser)
        {
            var res  = false;
            var user = GetUserById(id);

            res = DeleteTrue(user, operUser);
            return(res);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Deletes the name of the user by.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        public bool DeleteByName(string name, iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser)
        {
            bool b    = false;
            var  user = GetUserByName(name);

            b = Delete(user, operUser);
            return(b);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Deletes the name of the user true by.
        /// 物理删除
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="operUser">The oper user.</param>
        /// <returns></returns>
        public bool DeleteTrueByName(string name, iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser)
        {
            var res  = false;
            var user = GetUserByName(name);

            res = DeleteTrue(user, operUser);
            return(res);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Updates the user.
 /// </summary>
 /// <param name="user">The user.</param>
 /// <param name="operUser">The oper user.</param>
 /// <returns></returns>
 public bool Modify(Sys_AdminUser user, Sys_AdminUser operUser)
 {
     var b = false;
     if (user != null && user.id > 0)
     {
         var log = new Sys_AdminUserLog();
         log.AddTime = System.DateTime.Now;
         log.IpAddress = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP();
         log.PageUrl = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetCurrentUrl();
         log.ReferrerUrl = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetReferrerUrl();
         log.State = true;
         log.TypeId = 1;
         try
         {
             adminUserRepository.Modify(user);
             adminUserRepository.Uow.Commit();
             b = true;
             if (operUser != null)
             {
                 log.UserId = operUser.id;
                 log.ShortMessage = "用户Id:" + operUser.id.ToString() + " 改变用户Id号:" + user.id.ToString() + " 的信息";
                 log.FullMessage = "UpdateUser 用户名:" + operUser.username + " 用户Id:" + operUser.id.ToString()
                     + " 改变了用户Id号:" + user.id.ToString() + " 的信息";
             }
             else
             {
                 log.UserId = 0;
                 log.ShortMessage = "用户Id号:" + user.id.ToString() + " 的信息被修改";
                 log.FullMessage = "UpdateUser " + "用户Id号:" + user.id.ToString() + " 的信息被修改";
             }
         }
         catch (Exception ex)
         {
             #region  exception
             if (operUser != null && operUser.id > 0)
             {
                 log.ShortMessage = "更新用户数据异常";
                 log.FullMessage = log.ShortMessage = "更新用户Id:" + user.id + " 用户名:" + user.username + " 操作用户Id:" + operUser.id + " 错误信息:" + ex.Message;
                 if (ex.InnerException != null)
                 {
                     log.FullMessage += "   内部错误信息:" + ex.InnerException.Message;
                 }
             }
             else
             {
                 log.ShortMessage = "更新用户数据异常";
                 log.FullMessage = log.ShortMessage = "更新用户Id:" + user.id + " 用户名:" + user.username + " 错误信息:" + ex.Message;
                 if (ex.InnerException != null)
                 {
                     log.FullMessage += "   内部错误信息:" + ex.InnerException.Message;
                 }
             }
             #endregion
         }
         iPow.Infrastructure.Data.LoggerReopsitoryManager.AddLogInfo(log);
     }
     return b;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Deletes the name of the user by.
 /// 只设置为不可用
 /// </summary>
 /// <param name="email"></param>
 /// <param name="operUser">The oper user.</param>
 /// <returns></returns>
 public bool DeleteByEmail(string email, Sys_AdminUser operUser)
 {
     var b = false;
     if (ExistUserByEmail(email))
     {
         var user = GetUserByEmail(email);
         b = Delete(user, operUser);
     }
     return b;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Deletes the name of the user by.
 /// 只设置为不可用
 /// </summary>
 /// <param name="email"></param>
 /// <param name="operUser">The oper user.</param>
 /// <returns></returns>
 public bool DeleteByEmail(string email, Sys_AdminUser operUser)
 {
     var res = false;
     if (!string.IsNullOrEmpty(email))
     {
         var user = GetUserByEmail(email);
         if (user != null)
         {
             res = Delete(user, operUser);
         }
     }
     return res;
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Deletes the user by id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public bool DeleteById(int id, iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser)
        {
            bool res = false;

            if (id > 0)
            {
                var user = GetUserById(id);
                if (user != null)
                {
                    res = Delete(user, operUser);
                }
            }
            return(res);
        }
Ejemplo n.º 11
0
        public bool DeleteTrue(IList <int> idList, iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser)
        {
            var res = false;

            if (idList != null && idList.Count > 0)
            {
                var delete = controllerClassRepository.GetList(e => idList.Contains(e.Id)).ToList();
                if (delete != null && delete.Count > 0)
                {
                    res = DeleteTrue(delete, operUser);
                }
            }
            return(res);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Deletes the name of the user true by.
        /// 物理删除
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="operUser">The oper user.</param>
        /// <returns></returns>
        public bool DeleteTrueByName(string name, iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser)
        {
            var res = false;

            if (!string.IsNullOrEmpty(name))
            {
                var user = GetUserByName(name);
                if (user != null)
                {
                    res = DeleteTrue(user, operUser);
                }
            }
            return(res);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Regsters the user.
        /// </summary>
        /// <param name="entity">The user.</param>
        /// <param name="userRole">The user role.</param>
        /// <param name="operUser">The oper user.</param>
        /// <returns></returns>
        public bool Add(Sys_AdminUser entity, Sys_UserRoles userRole, iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser)
        {
            var res = false;

            if (entity != null && !ExistUserByName(entity.username) && !ExistUserByEmail(entity.Email))
            {
                try
                {
                    #region admin user
                    InitAddUser(entity, operUser);
                    adminUserRepository.Add(entity);
                    adminUserRepository.Uow.Commit();
                    #endregion

                    #region user role
                    userRole.UserID = entity.id;
                    userRoleRepository.Add(userRole);
                    userRoleRepository.Uow.Commit();
                    #endregion

                    var log = new Sys_AdminUserLog();
                    log.AddTime     = System.DateTime.Now;
                    log.IpAddress   = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP();
                    log.PageUrl     = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetCurrentUrl();
                    log.ReferrerUrl = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetReferrerUrl();
                    log.State       = true;
                    log.TypeId      = 1;
                    if (operUser != null)
                    {
                        log.UserId       = operUser.id;
                        log.ShortMessage = "用户Id:" + operUser.id + " 添加一个新用户Id:" + entity.id;
                        log.FullMessage  = "AddUser 用户名:" + operUser.username + " 用户Id:" + operUser.id.ToString()
                                           + " 添加用户Id:" + entity.id + " 添加用户名:" + entity.username + " 添加用户角色Id:" + userRole.RoleID;
                    }
                    else
                    {
                        log.UserId       = 0;
                        log.ShortMessage = "用户名:" + entity.username + "被添加";
                        log.FullMessage  = "AddUser " + "用户名:" + entity.username + "被添加";
                    }
                    iPow.Infrastructure.Data.LoggerReopsitoryManager.AddLogInfo(log);
                }
                catch (Exception ex)
                {
                    entity.id = 0;
                }
            }
            return(res);
        }
Ejemplo n.º 14
0
        public bool DeleteTrue(iPow.Infrastructure.Data.DataSys.Sys_AdminUser user)
        {
            var res = false;

            try
            {
                adminUserRepository.Delete(user);
                adminUserRepository.Uow.Commit();
                res = true;
                //添加日志操作
            }
            catch (Exception ex)
            {
            }
            return(res);
        }
Ejemplo n.º 15
0
        public bool Add(IList<Sys_AdminUser> entity, Sys_AdminUser operUser)
        {
            var res = false;
            if (entity != null && entity.Count > 0)
            {
                try
                {
                    foreach (var item in entity)
                    {
                        if (item != null && !ExistUserByName(item.username) && !ExistUserByEmail(item.Email))
                        {
                            InitAddUser(item, operUser);
                            adminUserRepository.Add(item);
                            adminUserRepository.Uow.Commit();

                            var log = new Sys_AdminUserLog();
                            log.AddTime = System.DateTime.Now;
                            log.IpAddress = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP();
                            log.PageUrl = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetCurrentUrl();
                            log.ReferrerUrl = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetReferrerUrl();
                            log.State = true;
                            log.TypeId = 1;
                            if (operUser != null)
                            {
                                log.UserId = operUser.id;
                                log.ShortMessage = "用户Id:" + operUser.id + " 添加一个新用户Id:" + item.id;
                                log.FullMessage = "AddUser 用户名:" + operUser.username + " 用户Id:" + operUser.id.ToString()
                                    + " 添加用户Id:" + item.id + " 添加用户名:" + item.username;
                            }
                            else
                            {
                                log.UserId = 0;
                                log.ShortMessage = "用户名:" + item.username + "被添加";
                                log.FullMessage = "AddUser " + "用户名:" + item.username + "被添加";
                            }
                            iPow.Infrastructure.Data.LoggerReopsitoryManager.AddLogInfo(log);
                        }
                    }
                    res = true;
                }
                catch (Exception ex)
                {
                }
            }
            return res;
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Deletes the user.
 /// </summary>
 /// <param name="user">The user.</param>
 /// <param name="operUser">The oper user.</param>
 /// <returns></returns>
 public bool Delete(Sys_AdminUser user, Sys_AdminUser operUser)
 {
     bool b = false;
     if (user != null && user.id > 0)
     {
         user.Activity = false;
         var log = new Sys_AdminUserLog();
         log.AddTime = System.DateTime.Now;
         log.IpAddress = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP();
         log.PageUrl = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetCurrentUrl();
         log.ReferrerUrl = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetReferrerUrl();
         log.State = true;
         log.TypeId = 1;
         if (operUser != null)
         {
             log.UserId = operUser.id;
             log.ShortMessage = "用户Id:" + operUser.id.ToString() + " 非物理删除用户Id号:" + user.id.ToString();
             log.FullMessage = "DeleteUser 用户名:" + operUser.username + " 用户Id:" + operUser.id.ToString()
                 + " 非物理删除用户Id号:" + user.id.ToString();
         }
         else
         {
             log.UserId = 0;
             log.ShortMessage = "用户Id:" + user.id.ToString() + " 被非物理删除";
             log.FullMessage = "DeleteUser 用户名:" + user.username + " 用户Id:" + operUser.id.ToString()
                 + " 被非物理删除";
         }
         try
         {
             adminUserRepository.Uow.Commit();
             b = true;
             iPow.Infrastructure.Data.LoggerReopsitoryManager.AddLogInfo(log);
         }
         catch (Exception ex)
         { }
     }
     return b;
 }
Ejemplo n.º 17
0
 public bool Add(IList<Sys_AdminUserExtension> entity, Sys_AdminUser operUser)
 {
     var res = false;
     if (entity != null && entity.Count > 0)
     {
         try
         {
             foreach (var item in entity)
             {
                 if (item != null)
                 {
                     userExtensionRepository.Add(item);
                 }
             }
             userExtensionRepository.Uow.Commit();
             res = true;
         }
         catch (Exception ex)
         {
         }
     }
     return res;
 }
Ejemplo n.º 18
0
 public bool Delete(IList<Sys_AdminUser> entity, Sys_AdminUser operUser)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Deletes the name of the user true by.
 /// 物理删除
 /// </summary>
 /// <param name="guid">The GUID.</param>
 /// <param name="operUser">The oper user.</param>
 /// <returns></returns>
 public bool DeleteTrueByGuid(string guid, Sys_AdminUser operUser)
 {
     var b = false;
     var user = adminUserRepository.GetList(d => d.UserGuid == guid).FirstOrDefault();
     b = DeleteTrue(user, operUser);
     return b;
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Deletes the name of the user true by.
 /// 物理删除
 /// </summary>
 /// <param name="email">The email.</param>
 /// <param name="operUser">The oper user.</param>
 /// <returns></returns>
 public bool DeleteTrueByEmail(string email, Sys_AdminUser operUser)
 {
     var b = false;
     if (!string.IsNullOrEmpty(email))
     {
         var user = GetUserByEmail(email);
         b = DeleteTrue(user, operUser);
     }
     return b;
 }
Ejemplo n.º 21
0
        /// <summary>
        /// Deletes the user true.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="operUser">The oper user.</param>
        /// <returns></returns>
        public bool DeleteTrue(Sys_AdminUser user, Sys_AdminUser operUser)
        {
            bool b = false;
            if (user != null && user.id > 0)
            {
                try
                {
                    //要删除角色
                    var userRoles = userRoleRepository.GetList(d => d.UserID == user.id);
                    foreach (var item in userRoles)
                    {
                        userRoleRepository.Delete(item);
                    }
                    adminUserRepository.Delete(user);
                    //用户扩展信息
                    var userExtension = adminUserExtensionRepository.GetList(d => d.UserId == user.id);
                    foreach (var item in userExtension)
                    {
                        adminUserExtensionRepository.Delete(item);
                    }
                    //个性化设置内容
                    var userIndividu = adminUserIndividuationRepository.GetList(d => d.UserId == user.id);
                    foreach (var item in userIndividu)
                    {
                        adminUserIndividuationRepository.Delete(item);
                    }
                    adminUserRepository.Uow.Commit();
                    userRoleRepository.Uow.Commit();
                    adminUserExtensionRepository.Uow.Commit();
                    adminUserIndividuationRepository.Uow.Commit();

                    //rolePermissionRepository.这是角色权限

                    var log = new Sys_AdminUserLog();
                    log.AddTime = System.DateTime.Now;
                    log.IpAddress = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP();
                    log.PageUrl = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetCurrentUrl();
                    log.ReferrerUrl = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetReferrerUrl();
                    log.State = true;
                    log.TypeId = 1;
                    if (operUser != null)
                    {
                        log.UserId = operUser.id;
                        log.ShortMessage = "用户Id:" + operUser.id + " 物理删除用户Id号:" + user.id.ToString();
                        log.FullMessage = "DeleteUserTrue 用户:" + operUser.username + " 用户Id:" + operUser.id.ToString()
                            + " 删除用户Id号:" + user.id.ToString();
                    }
                    else
                    {
                        log.UserId = 0;
                        log.ShortMessage = "用户Id号:" + user.id.ToString() + " 被删除";
                        log.FullMessage = "DeleteUserTrue " + "用户Id号:" + user.id.ToString() + " 被删除";
                    }
                    iPow.Infrastructure.Data.LoggerReopsitoryManager.AddLogInfo(log);
                    b = true;
                }
                catch (Exception ex)
                { }
            }
            return b;
        }
Ejemplo n.º 22
0
        public bool Delete(IList <iPow.Infrastructure.Data.DataSys.Sys_MvcControllerClass> entity, iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser)
        {
            var res = false;

            if (entity != null && entity.Count > 0)
            {
                try
                {
                    foreach (var item in entity)
                    {
                        if (item != null)
                        {
                            item.State = false;
                            controllerClassRepository.Modify(item);
                        }
                    }
                    res = true;
                }
                catch (Exception ex)
                {
                }
            }
            return(res);
        }
Ejemplo n.º 23
0
        public bool Delete(iPow.Infrastructure.Data.DataSys.Sys_MvcControllerClass entity, iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser)
        {
            var res = false;

            if (entity != null && entity.Id > 0)
            {
                try
                {
                    entity.State = false;
                    controllerClassRepository.Modify(entity);
                    res = true;
                }
                catch (Exception ex)
                {
                }
            }
            return(res);
        }
Ejemplo n.º 24
0
        public bool Add(iPow.Infrastructure.Data.DataSys.Sys_MvcControllerClass entity, iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser)
        {
            var res = false;

            if (entity != null)
            {
                try
                {
                    controllerClassRepository.Add(entity);
                    controllerClassRepository.Uow.Commit();
                    res = true;
                }
                catch (Exception ex)
                {
                }
            }
            return(res);
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 用于在用户管理面板 添加一个没有Role的User
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="userRole">The user role.</param>
        /// <param name="operUser">The oper user.</param>
        /// <returns></returns>
        public Sys_AdminUser Add(Sys_AdminUser user, iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser)
        {
            if (user != null)
            {
                if (!ExistUserByName(user.username) && !ExistUserByEmail(user.Email))
                {
                    try
                    {
                        #region admin user

                        user.Activity     = false;
                        user.DepartmentID = "0";
                        //user.Email
                        user.EmployeeID = 0;
                        var userid = adminUserRepository.GetList().Max(e => e.id) + 1;
                        //user.id = userid;
                        user.lastloginip   = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP();
                        user.lastlogintime = System.DateTime.Now;
                        user.logintimes    = 1;
                        //user.password
                        //user.Phone = "";
                        //user.sex = "";
                        user.style = 0;
                        //user.truename = "";
                        user.UserGuid = iPow.Infrastructure.Crosscutting.Comm.Service.UserGuidService.BuilderUserGuid();
                        user.userid   = operUser.id;
                        //user.username
                        adminUserRepository.Add(user);
                        #endregion

                        adminUserRepository.Uow.Commit();
                        var log = new Sys_AdminUserLog();
                        log.AddTime     = System.DateTime.Now;
                        log.IpAddress   = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP();
                        log.PageUrl     = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetCurrentUrl();
                        log.ReferrerUrl = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetReferrerUrl();
                        log.State       = true;
                        log.TypeId      = 1;
                        if (operUser != null)
                        {
                            log.UserId       = operUser.id;
                            log.ShortMessage = "用户Id:" + operUser.id + " 添加一个新用户Id:" + user.id;
                            log.FullMessage  = "AddUser 用户名:" + operUser.username + " 用户Id:" + operUser.id.ToString()
                                               + " 添加用户Id:" + user.id + " 添加用户名:" + user.username;
                        }
                        else
                        {
                            log.UserId       = 0;
                            log.ShortMessage = "用户名:" + user.username + "被添加";
                            log.FullMessage  = "AddUser " + "用户名:" + user.username + "被添加";
                        }
                        iPow.Infrastructure.Data.LoggerReopsitoryManager.AddLogInfo(log);
                    }
                    catch (Exception ex)
                    {
                        user.id = 0;
                    }
                }
            }
            return(user);
        }
Ejemplo n.º 26
0
 /// <summary>
 /// 创建新的 Sys_AdminUser 对象。
 /// </summary>
 /// <param name="id">id 属性的初始值。</param>
 public static Sys_AdminUser CreateSys_AdminUser(global::System.Int32 id)
 {
     Sys_AdminUser sys_AdminUser = new Sys_AdminUser();
     sys_AdminUser.id = id;
     return sys_AdminUser;
 }
Ejemplo n.º 27
0
 /// <summary>
 /// 用于向 Sys_AdminUser EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToSys_AdminUser(Sys_AdminUser sys_AdminUser)
 {
     base.AddObject("Sys_AdminUser", sys_AdminUser);
 }
Ejemplo n.º 28
0
        /// <summary>
        /// 用于在用户管理面板 添加一个没有Role的User
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="userRole">The user role.</param>
        /// <param name="operUser">The oper user.</param>
        /// <returns></returns>
        public Sys_AdminUser Add(Sys_AdminUser user, iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser)
        {
            if (user != null)
            {
                if (!ExistUserByName(user.username) && !ExistUserByEmail(user.Email))
                {
                    try
                    {
                        #region admin user

                        user.Activity = false;
                        user.DepartmentID = "0";
                        //user.Email
                        user.EmployeeID = 0;
                        var userid = adminUserRepository.GetList().Max(e => e.id) + 1;
                        //user.id = userid;
                        user.lastloginip = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP();
                        user.lastlogintime = System.DateTime.Now;
                        user.logintimes = 1;
                        //user.password
                        //user.Phone = "";
                        //user.sex = "";
                        user.style = 0;
                        //user.truename = "";
                        user.UserGuid = iPow.Infrastructure.Crosscutting.Comm.Service.UserGuidService.BuilderUserGuid();
                        user.userid = operUser.id;
                        //user.username
                        adminUserRepository.Add(user);
                        #endregion

                        adminUserRepository.Uow.Commit();
                        var log = new Sys_AdminUserLog();
                        log.AddTime = System.DateTime.Now;
                        log.IpAddress = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP();
                        log.PageUrl = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetCurrentUrl();
                        log.ReferrerUrl = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetReferrerUrl();
                        log.State = true;
                        log.TypeId = 1;
                        if (operUser != null)
                        {
                            log.UserId = operUser.id;
                            log.ShortMessage = "用户Id:" + operUser.id + " 添加一个新用户Id:" + user.id;
                            log.FullMessage = "AddUser 用户名:" + operUser.username + " 用户Id:" + operUser.id.ToString()
                                + " 添加用户Id:" + user.id + " 添加用户名:" + user.username;
                        }
                        else
                        {
                            log.UserId = 0;
                            log.ShortMessage = "用户名:" + user.username + "被添加";
                            log.FullMessage = "AddUser " + "用户名:" + user.username + "被添加";
                        }
                        iPow.Infrastructure.Data.LoggerReopsitoryManager.AddLogInfo(log);
                    }
                    catch (Exception ex)
                    {
                        user.id = 0;
                    }
                }
            }
            return user;
        }
Ejemplo n.º 29
0
 /// <summary>
 /// Deletes the name of the user by.
 /// 只设置为不可用
 /// </summary>
 /// <param name="guid">The GUID.</param>
 /// <param name="operUser">The oper user.</param>
 /// <returns></returns>
 public bool DeleteByUserGuid(string guid, Sys_AdminUser operUser)
 {
     var res = false;
     if (!string.IsNullOrEmpty(guid))
     {
         var user = GetUserByUserGuid(guid);
         if (user != null)
         {
             res = Delete(user, operUser);
         }
     }
     return res;
 }
Ejemplo n.º 30
0
 public bool Delete(IList<Sys_AdminUserExtension> entity, Sys_AdminUser operUser)
 {
     var res = false;
     if (entity != null && entity.Count > 0)
     {
         try
         {
             foreach (var item in entity)
             {
                 if (item != null)
                 {
                     item.State = false;
                     userExtensionRepository.Modify(item);
                 }
             }
             res = true;
         }
         catch (Exception ex)
         {
         }
     }
     return res;
 }
Ejemplo n.º 31
0
 /// <summary>
 /// Gets the name of the user model by.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <returns></returns>
 public iPow.Infrastructure.Data.DataSys.Sys_AdminUser GetUserByName(string name)
 {
     iPow.Infrastructure.Data.DataSys.Sys_AdminUser user = null;
     user = adminUserRepository.GetList(e => e.username == name).FirstOrDefault();
     return(user);
 }
Ejemplo n.º 32
0
 /// <summary>
 /// Users the name of the change PWD by.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="pwd">The PWD.</param>
 /// <returns></returns>
 public bool ModifyPwdByName(string name, string pwd, Sys_AdminUser operUser)
 {
     bool b = false;
     pwd = iPow.Infrastructure.Crosscutting.Function.StringHelper.Tomd5(pwd);
     int id = GetUserIdByName(name);
     if (id > 0)
     {
         b = ModifyPwdById(id, pwd, operUser);
     }
     return b;
 }
Ejemplo n.º 33
0
 public bool Delete(IList<int> idList, Sys_AdminUser operUser)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 34
0
 public bool DeleteTrue(IList<int> idList, Sys_AdminUser operUser)
 {
     var res = false;
     if (idList != null && idList.Count > 0)
     {
         var delete = adminUserRepository.GetList(e => idList.Contains(e.id)).ToList();
         if (delete.Count > 0)
         {
             res = DeleteTrue(delete, operUser);
         }
     }
     return res;
 }
Ejemplo n.º 35
0
        /// <summary>
        /// Regsters the user.
        /// </summary>
        /// <param name="entity">The user.</param>
        /// <param name="userRole">The user role.</param>
        /// <param name="operUser">The oper user.</param>
        /// <returns></returns>
        public bool Add(Sys_AdminUser entity, Sys_UserRoles userRole, iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser)
        {
            var res = false;
            if (entity != null && !ExistUserByName(entity.username) && !ExistUserByEmail(entity.Email))
            {
                try
                {
                    #region admin user
                    InitAddUser(entity, operUser);
                    adminUserRepository.Add(entity);
                    adminUserRepository.Uow.Commit();
                    #endregion

                    #region user role
                    userRole.UserID = entity.id;
                    userRoleRepository.Add(userRole);
                    userRoleRepository.Uow.Commit();
                    #endregion

                    var log = new Sys_AdminUserLog();
                    log.AddTime = System.DateTime.Now;
                    log.IpAddress = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP();
                    log.PageUrl = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetCurrentUrl();
                    log.ReferrerUrl = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetReferrerUrl();
                    log.State = true;
                    log.TypeId = 1;
                    if (operUser != null)
                    {
                        log.UserId = operUser.id;
                        log.ShortMessage = "用户Id:" + operUser.id + " 添加一个新用户Id:" + entity.id;
                        log.FullMessage = "AddUser 用户名:" + operUser.username + " 用户Id:" + operUser.id.ToString()
                            + " 添加用户Id:" + entity.id + " 添加用户名:" + entity.username + " 添加用户角色Id:" + userRole.RoleID;
                    }
                    else
                    {
                        log.UserId = 0;
                        log.ShortMessage = "用户名:" + entity.username + "被添加";
                        log.FullMessage = "AddUser " + "用户名:" + entity.username + "被添加";
                    }
                    iPow.Infrastructure.Data.LoggerReopsitoryManager.AddLogInfo(log);
                }
                catch (Exception ex)
                {
                    entity.id = 0;
                }
            }
            return res;
        }