コード例 #1
0
        public JsonResult MyInfo_edit(string id, string name, string sex, string card, string tel, string address)
        {
            UserInfo info = BaseHelper.getCookie().clone();

            info.userID  = id.Trim();
            info.name    = name.Trim();
            info.sex     = sex.Trim();
            info.card    = card.Trim();
            info.tel     = tel.Trim();
            info.address = address.Trim();

            DaUserInfo dal      = new DaUserInfo();
            int        isAccess = dal.edit(info);

            if (isAccess == 1)
            {
                Session["info"] = info;
                BaseHelper.saveCookie(info);
            }

            var result = new CustomJsonResult();

            result.Data = isAccess;

            return(result);
        }
コード例 #2
0
        public ActionResult LogOn(LogOnModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                DaUserInfo daUser = new DaUserInfo();
                UserInfo   info   = daUser.checkUserID(model.UserName, model.Password);

                if (info != null)
                {
                    FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);

                    if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") &&
                        !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
                    {
                        return(Redirect(returnUrl));
                    }
                    else
                    {
                        return(RedirectToAction("Index", "Home"));
                    }
                }
                else
                {
                    ModelState.AddModelError("", "提供的用户名或密码不正确。");
                }
            }

            // 如果我们进行到这一步时某个地方出错,则重新显示表单
            return(View(model));
        }
コード例 #3
0
        /// <summary>
        /// 获取个人信息
        /// </summary>
        /// <returns></returns>
        public JsonResult MyInfo_getList()
        {
            DaUserInfo dal    = new DaUserInfo();
            UserInfo   info   = BaseHelper.getCookie();
            var        result = new CustomJsonResult();

            result.Data = dal.checkUserID(info.userID, info.password);
            return(result);
        }
コード例 #4
0
ファイル: HomeController.cs プロジェクト: burchin/Contract
        /// <summary>
        /// 获取用户名
        /// </summary>
        /// <returns></returns>
        public JsonResult getUserName(string t)
        {
            UserInfo   en  = BaseHelper.getCookie();
            DaUserInfo dal = new DaUserInfo();

            var result = new CustomJsonResult();

            result.Data = dal.getUserInfo(en.id).name;
            return(result);
        }
コード例 #5
0
ファイル: HomeController.cs プロジェクト: burchin/Contract
        /* ============ 下拉框取数 ============ */

        #region 获取业务员列表
        /// <summary>
        /// 获取业务员列表
        /// </summary>
        /// <returns></returns>
        public JsonResult drpPersonList()
        {
            DaUserInfo       dal   = new DaUserInfo();
            IList <UserInfo> users = dal.getList();

            var result = new CustomJsonResult();

            result.Data = users;
            return(result);
        }
コード例 #6
0
        /// <summary>
        /// 管理员修改密码
        /// </summary>
        /// <param name="id">用户编号</param>
        /// <param name="newPwd">新密码</param>
        /// <returns></returns>
        public JsonResult UserPwd_edit(string id, string newPwd)
        {
            DaUserInfo dal = new DaUserInfo();

            string[] re = dal.editPassword(Convert.ToInt32(id), newPwd);

            var result = new CustomJsonResult();

            result.Data = new { isSuccess = re[0], msg = re[1] };
            return(result);
        }
コード例 #7
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="oldPwd">旧密码</param>
        /// <param name="newPwd">新密码</param>
        /// <returns></returns>
        public JsonResult MyPwd_edit(string oldPwd, string newPwd)
        {
            DaUserInfo dal = new DaUserInfo();

            string[] re = dal.editPassword(BaseHelper.getCookie(), oldPwd, newPwd);

            var result = new CustomJsonResult();

            result.Data = new { isSuccess = re[0], msg = re[1] };
            return(result);
        }
コード例 #8
0
        /// <summary>
        /// 获取用户列表
        /// </summary>
        /// <returns></returns>
        public JsonResult Users_getList()
        {
            DaUserInfo       dal   = new DaUserInfo();
            IList <UserInfo> users = dal.getList();

            var result = new CustomJsonResult();

            result.dateFormat = "yyyy-MM-dd";

            result.Data = new { total = users.Count, rows = users };
            return(result);
        }
コード例 #9
0
        /// <summary>
        /// 搜索用户列表
        /// </summary>
        /// <param name="userID">用户名</param>
        /// <param name="beginDate">开始日期</param>
        /// <param name="endDate">结束日期</param>
        /// <returns></returns>
        public JsonResult Users_search(string userID, string beginDate, string endDate)
        {
            DaUserInfo       dal   = new DaUserInfo();
            IList <UserInfo> users = dal.getList(userID, beginDate, endDate);

            var result = new CustomJsonResult();

            result.dateFormat = "yyyy-MM-dd";

            result.Data = new { total = users.Count, rows = users };
            return(result);
        }
コード例 #10
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);
        }
コード例 #11
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);
        }
コード例 #12
0
        public JsonResult Users_add(string userID, string name, string sex, string card, string tel, string address)
        {
            UserInfo en = new UserInfo();

            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.add(en);

            return(result);
        }
コード例 #13
0
ファイル: HomeController.cs プロジェクト: burchin/Contract
        /* ============ 操作 ============ */

        #region 登录验证
        /// <summary>
        /// 登录验证
        /// </summary>
        /// <param name="userID">用户ID</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        public JsonResult logOn(string userID, string password, string t)
        {
            DaUserInfo daUser = new DaUserInfo();
            UserInfo   info   = daUser.checkUserID(userID, password);
            var        result = new CustomJsonResult();

            if (info != null)
            {
                Session["userInfo"] = info;
                Response.AppendCookie(BaseHelper.saveCookie(info));

                result.Data = 1;
            }
            else
            {
                result.Data = 0;
            }

            return(result);
        }
コード例 #14
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;
        }
コード例 #15
0
        public JsonResult MyInfo_edit(string id, string name, string sex, string card, string tel, string address)
        {
            UserInfo info = BaseHelper.getCookie().clone();
            info.userID = id.Trim();
            info.name = name.Trim();
            info.sex = sex.Trim();
            info.card = card.Trim();
            info.tel = tel.Trim();
            info.address = address.Trim();

            DaUserInfo dal = new DaUserInfo();
            int isAccess = dal.edit(info);

            if (isAccess == 1)
            {
                Session["info"] = info;
                BaseHelper.saveCookie(info);
            }

            var result = new CustomJsonResult();
            result.Data = isAccess;

            return result;
        }
コード例 #16
0
        /// <summary>
        /// 获取个人信息
        /// </summary>
        /// <returns></returns>
        public JsonResult MyInfo_getList()
        {
            DaUserInfo dal = new DaUserInfo();
            UserInfo info = BaseHelper.getCookie();
            var result = new CustomJsonResult();

            result.Data = dal.checkUserID(info.userID, info.password);
            return result;
        }
コード例 #17
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="oldPwd">旧密码</param>
        /// <param name="newPwd">新密码</param>
        /// <returns></returns>
        public JsonResult MyPwd_edit(string oldPwd, string newPwd)
        {
            DaUserInfo dal = new DaUserInfo();
            string[] re = dal.editPassword(BaseHelper.getCookie(), oldPwd, newPwd);

            var result = new CustomJsonResult();
            result.Data = new { isSuccess = re[0], msg = re[1] };
            return result;
        }
コード例 #18
0
        /// <summary>
        /// 管理员修改密码
        /// </summary>
        /// <param name="id">用户编号</param>
        /// <param name="newPwd">新密码</param>
        /// <returns></returns>
        public JsonResult UserPwd_edit(string id, string newPwd)
        {
            DaUserInfo dal = new DaUserInfo();
            string[] re = dal.editPassword(Convert.ToInt32(id), newPwd);

            var result = new CustomJsonResult();
            result.Data = new { isSuccess = re[0], msg = re[1] };
            return result;
        }
コード例 #19
0
ファイル: HomeController.cs プロジェクト: burchin/Contract
        /// <summary>
        /// 获取用户名
        /// </summary>
        /// <returns></returns>
        public JsonResult getUserName(string t)
        {
            UserInfo en = BaseHelper.getCookie();
            DaUserInfo dal = new DaUserInfo();

            var result = new CustomJsonResult();
            result.Data = dal.getUserInfo(en.id).name;
            return result;
        }
コード例 #20
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;
        }
コード例 #21
0
        /// <summary>
        /// 获取用户列表
        /// </summary>
        /// <returns></returns>
        public JsonResult Users_getList()
        {
            DaUserInfo dal = new DaUserInfo();
            IList<UserInfo> users = dal.getList();

            var result = new CustomJsonResult();
            result.dateFormat = "yyyy-MM-dd";

            result.Data = new { total = users.Count, rows = users };
            return result;
        }
コード例 #22
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;
        }
コード例 #23
0
ファイル: HomeController.cs プロジェクト: burchin/Contract
        /// <summary>
        /// 获取业务员列表
        /// </summary>
        /// <returns></returns>
        public JsonResult drpPersonList()
        {
            DaUserInfo dal = new DaUserInfo();
            IList<UserInfo> users = dal.getList();

            var result = new CustomJsonResult();
            result.Data = users;
            return result;
        }
コード例 #24
0
        /// <summary>
        /// 搜索用户列表
        /// </summary>
        /// <param name="userID">用户名</param>
        /// <param name="beginDate">开始日期</param>
        /// <param name="endDate">结束日期</param>
        /// <returns></returns>
        public JsonResult Users_search(string userID, string beginDate, string endDate)
        {
            DaUserInfo dal = new DaUserInfo();
            IList<UserInfo> users = dal.getList(userID, beginDate, endDate);

            var result = new CustomJsonResult();
            result.dateFormat = "yyyy-MM-dd";

            result.Data = new { total = users.Count, rows = users };
            return result;
        }
コード例 #25
0
ファイル: HomeController.cs プロジェクト: burchin/Contract
        /// <summary>
        /// 登录验证
        /// </summary>
        /// <param name="userID">用户ID</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        public JsonResult logOn(string userID, string password, string t)
        {
            DaUserInfo daUser = new DaUserInfo();
            UserInfo info = daUser.checkUserID(userID, password);
            var result = new CustomJsonResult();

            if (info != null)
            {
                Session["userInfo"] = info;
                Response.AppendCookie(BaseHelper.saveCookie(info));

                result.Data = 1;
            }
            else
            {
                result.Data = 0;
            }

            return result;
        }
コード例 #26
0
ファイル: AccountController.cs プロジェクト: burchin/Contract
        public ActionResult LogOn(LogOnModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                DaUserInfo daUser = new DaUserInfo();
                UserInfo info = daUser.checkUserID(model.UserName, model.Password);

                if (info != null)
                {
                    FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);

                    if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/")
                        && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
                    {
                        return Redirect(returnUrl);
                    }
                    else
                    {
                        return RedirectToAction("Index", "Home");
                    }
                }
                else
                {
                    ModelState.AddModelError("", "提供的用户名或密码不正确。");
                }
            }

            // 如果我们进行到这一步时某个地方出错,则重新显示表单
            return View(model);
        }