Beispiel #1
0
        /// <summary>
        /// 根据账号密码获取信息(登录)
        /// </summary>
        /// <param name="loginname"></param>
        /// <param name="pwd"></param>
        /// <param name="operateip"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public static M_Users GetM_UserByProUserName(string loginname, string pwd, string operateip, out int result, EnumUserOperateType type = EnumUserOperateType.Login, int sourceType = 0)
        {
            pwd = ProBusiness.Encrypt.GetEncryptPwd(pwd, loginname);
            DataSet ds    = new M_UsersDAL().GetM_UserByProUserName(loginname, pwd, sourceType, out result);
            M_Users model = null;

            if (ds.Tables.Contains("M_User") && ds.Tables["M_User"].Rows.Count > 0)
            {
                model = new M_Users();
                model.FillData(ds.Tables["M_User"].Rows[0]);
                if (!string.IsNullOrEmpty(model.RoleID))
                {
                    model.Role = ManageSystemBusiness.GetRoleByIDCache(model.RoleID);
                }
                //权限
                if (model.Role != null && model.Role.IsDefault == 1)
                {
                    model.Menus = CommonBusiness.ManageMenus;
                }
                else if (model.IsAdmin == 1)
                {
                    model.Menus = CommonBusiness.ManageMenus;
                }
                else
                {
                    model.Menus = new List <Menu>();
                    foreach (DataRow dr in ds.Tables["Permission"].Rows)
                    {
                        Menu menu = new Menu();
                        menu.FillData(dr);
                        model.Menus.Add(menu);
                    }
                }
            }
            if (model != null && model.Status == 1)
            {
                LogBusiness.AddLoginLog(loginname, operateip, model != null ? model.UserID : "", type);
                LogBusiness.UpdateLastIP(model != null ? model.UserID : "", operateip);
            }
            return(model);
        }
Beispiel #2
0
 /// <summary>
 /// 记录操作日志
 /// </summary>
 public static async void AddOperateLog(string userid, string username, string leveid, string seeid, string seename, EnumUserOperateType type, string message, string operateip)
 {
     await LogDAL.AddOperateLog(userid, username, leveid, seeid, seename, (int)type, message, operateip);
 }
 /// <summary>
 /// 记录登录日志
 /// </summary>
 /// <param name="loginname">用户名</param>
 /// <param name="status">登录结果</param>
 /// <param name="systemtype">系统类型</param>
 /// <param name="operateip">登录IP</param>
 public static async void AddLoginLog(string loginname, string operateip, string userid, EnumUserOperateType systemtype = EnumUserOperateType.Login, string remark = "用户登录")
 {
     if ((int)systemtype == 7)
     {
         if (userid != "993b30f7-a8c4-49f9-b2bc-0b629d34bb76")
         {
             await LogDAL.AddManageLoginLog(loginname, (int)systemtype, operateip, userid, remark);
         }
     }
     else
     {
         await LogDAL.AddLoginLog(loginname, (int)systemtype, operateip, userid, remark);
     }
 }
Beispiel #4
0
 /// <summary>
 /// 记录登录日志
 /// </summary>
 /// <param name="loginname">用户名</param>
 /// <param name="status">登录结果</param>
 /// <param name="systemtype">系统类型</param>
 /// <param name="operateip">登录IP</param>
 public static async void AddLoginLog(string loginname, string operateip, string userid, EnumUserOperateType systemtype = EnumUserOperateType.Login, string leveid = "")
 {
     await LogDAL.AddLoginLog(loginname, (int)systemtype, operateip, userid, leveid);
 }