Example #1
0
    /// <summary>
    /// 获取具有某权限的人员列表
    /// </summary>
    /// <param name="manage"></param>
    /// <returns></returns>
    public static List <Admin_User> GetHasManageAdmin(string manage)
    {
        List <Admin_User> returnList = new List <Admin_User>();
        Admin_User        condition  = new Admin_User();
        Admin_User        value      = new Admin_User();

        condition.AddConditon(" and manage like @Manage");
        condition.AddParameter("Manage", "%" + manage + "%");

        List <Admin_User> list = TableOperate <Admin_User> .Select(value, condition);

        foreach (Admin_User item in list)
        {
            if (string.IsNullOrEmpty(item.Manage))
            {
                continue;
            }
            string[] arr = item.Manage.Split(',');
            for (int i = 0; i < arr.Length; i++)
            {
                if (arr[i] == manage)
                {
                    returnList.Add(item);
                    break;
                }
            }
        }
        return(returnList);
    }
Example #2
0
    /// <summary>
    /// 验证用户名,密码
    /// </summary>
    /// <param name="username">用户名</param>
    /// <param name="password">密码</param>
    /// <returns></returns>
    public static Boolean VerifyPwd(string username, string password)
    {
        if (string.IsNullOrEmpty(username))
        {
            return(false);
        }
        if (string.IsNullOrEmpty(password))
        {
            return(false);
        }

        string jiaMiPass = Md5JiaMi.JiaMi(password); //加密密码

        Admin_User valueTable = new Admin_User();


        Admin_User conditionTable = new Admin_User();

        conditionTable.Name = username;
        conditionTable.Pass = jiaMiPass;
        conditionTable.AddConditon(" and States > 0");
        Admin_User admin = TableOperate <Admin_User> .GetRowData(valueTable, conditionTable);

        if (!admin.IsNull)
        {
            GetConfig();
            HttpContext.Current.Session["adminName"] = username;
            if (admin.HeadPic != null && admin.HeadPic != "")
            {
                HttpContext.Current.Session["headpic"] = SysConfig.headpicfile + admin.HeadPic;
            }
            HttpContext.Current.Session["adminFullName"] = admin.FullName;
            HttpContext.Current.Session["adminLevel"]    = admin.UserLevel;
            HttpContext.Current.Session["adminID"]       = admin.ID;
            HttpContext.Current.Session["ExhibitionID"]  = admin.ExhibitionID;
            if (admin.Manage != null && admin.Manage != "")
            {
                string[] arrManage = admin.Manage.Split(',');
                HttpContext.Current.Session["adminManage"] = arrManage;
            }

            UpdateLoginDate(admin.ID); //更新最后登录时间
            string check = admin.ID + "|" + AdminJiaMi(admin.ID, admin.Pass, HttpContext.Current.Request.UserHostName, HttpContext.Current.Request.UserHostAddress);
            // CookieUserCheck = check;


            return(true);
        }
        return(false);
    }
Example #3
0
    protected void AddLog(string ids)
    {
        Admin_User condition = new Admin_User();
        Admin_User value     = new Admin_User();

        condition.AddConditon(" and id in(" + ids + ")");
        List <Admin_User> list = TableOperate <Admin_User> .Select(value, condition);

        if (list.Count > 0)
        {
            string deltitle = "";
            for (int i = 0; i < list.Count; i++)
            {
                deltitle += list[i].Name + ",";
            }
            deltitle = deltitle.TrimEnd(',');
            if (deltitle != "")
            {
                string logbrief = "管理员:【" + AdminMethod.AdminFullName + "】在" + DateTime.Now.GetDateTimeFormats('f')[0].ToString() + "删除了【" + deltitle + "】的管理员";
                Lognet.AddLogin(logbrief);
            }
        }
    }