예제 #1
0
        /// <summary>
        /// 修改权限组
        /// </summary>
        /// <param name="en"></param>
        /// <returns></returns>
        public int update(UserInfo en)
        {
            string strSql = "update UserInfo set powergroupID=@groupID where id=@id";

            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@id", en.id),
                new SqlParameter("@groupID", en.powergroupID)
            };

            int result = SqlHelper.ExecuteNonQuery(BaseHelper.DBConnStr, CommandType.Text, strSql, param);
            return result;
        }
예제 #2
0
        /// <summary>
        /// 获取Cookie
        /// </summary>
        /// <returns></returns>
        public static UserInfo getCookie()
        {
            UserInfo info = null;

            if (HttpContext.Current.Request.Cookies["info"] != null)
            {
                HttpCookie cookie = HttpContext.Current.Request.Cookies["info"];

                info = new UserInfo();
                info.id = Convert.ToInt32(cookie.Values["id"]);
                info.userID = cookie.Values["userID"];
                info.name = cookie.Values["userName"];
                info.password = cookie.Values["password"];
                info.powergroupID = cookie.Values["powergroupID"];
            }

            return info;
        }
예제 #3
0
        /// <summary>
        /// 实体克隆
        /// </summary>
        /// <returns></returns>
        public UserInfo clone()
        {
            UserInfo en = new UserInfo();

            en.id = id;
            en.userID = userID;
            en.powergroupID = powergroupID;
            en.password = password;
            en.state = state;
            en.name = name;
            en.sex = sex;
            en.card = card;
            en.tel = tel;
            en.address = address;
            en.date = date;

            return en;
        }
예제 #4
0
        /// <summary>
        /// 保存Cookie
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public static HttpCookie saveCookie(UserInfo info)
        {
            HttpCookie cookie = new HttpCookie("info");
            TimeSpan ts = new TimeSpan(1, 0, 0, 0, 0);
            cookie.Expires = DateTime.Now.Add(ts);
            cookie.Values.Add("id", info.id.ToString());
            cookie.Values.Add("userID", info.userID);
            cookie.Values.Add("userName", info.name);
            cookie.Values.Add("password", info.password);
            cookie.Values.Add("powergroupID", info.powergroupID);

            return cookie;
        }
예제 #5
0
        /// <summary>
        /// 删除用户
        /// </summary>
        /// <param name="id">编号</param>
        /// <returns></returns>
        public JsonResult Users_remove(string id)
        {
            UserInfo en = new UserInfo();
            en.id = Convert.ToInt32(id);

            DaUserInfo dal = new DaUserInfo();
            var result = new CustomJsonResult();
            result.Data = dal.delete(en);

            return result;
        }
예제 #6
0
        /// <summary>
        /// 修改权限组
        /// </summary>
        /// <param name="id"></param>
        /// <param name="groupID"></param>
        /// <returns></returns>
        public JsonResult Users_editRole(string id, string groupID)
        {
            DaUserGroup dal = new DaUserGroup();
            UserInfo en = new UserInfo();
            en.id = Convert.ToInt32(id);
            en.powergroupID = groupID;

            var result = new CustomJsonResult();
            result.Data = dal.update(en);
            return result;
        }
예제 #7
0
        /// <summary>
        /// 设置用户的启用/禁用状态
        /// </summary>
        /// <param name="id"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public JsonResult Users_editOpen(string id, string state)
        {
            UserInfo en = new UserInfo();
            en.id = Convert.ToInt32(id);
            en.state = state;

            DaUserInfo dal = new DaUserInfo();
            var result = new CustomJsonResult();
            result.Data = dal.updateOpen(en);

            return result;
        }
예제 #8
0
        public JsonResult Users_edit(string id, string userID, string name, string sex, string card, string tel, string address)
        {
            UserInfo en = new UserInfo();
            en.id = Convert.ToInt32(id);
            en.userID = userID;
            en.name = name;
            en.sex = sex;
            en.card = card;
            en.tel = tel;
            en.address = address;

            DaUserInfo dal = new DaUserInfo();
            var result = new CustomJsonResult();
            result.Data = dal.edit(en);

            return result;
        }