예제 #1
0
        private string Login(HttpContext context)
        {
            string user = context.Request["user"].Trim();
            string pwd  = DBUtility.WcSecurity.Des.Encrypt(context.Request["pwd"].Trim());

            Model.BaseUser userModel = new BLL.BaseUser().GetModel(user);
            if (userModel != null)
            {
                if (userModel.Permissions == 0)
                {
                    return("该账号未激活!");
                }
                if (userModel.Pwd == pwd)
                {
                    context.Session.Timeout  = 1440;//1440最大值
                    context.Session["login"] = userModel;
                    return("success");
                }
                else
                {
                    return("密码不正确!");
                }
            }
            else
            {
                return("帐号不存在!");
            }
        }
예제 #2
0
        private string Password(HttpContext context)
        {
            string uid = context.Request["uid"].Trim();

            Model.BaseUser buModel = new BLL.BaseUser().GetModel(int.Parse(uid));
            buModel.Pwd = DBUtility.WcSecurity.Des.Encrypt(context.Request["newpass"].Trim());
            int flag = new BLL.BaseUser().Update(buModel);

            return(flag > 0 ? "success" : flag == 0 ? "修改失败。" : "账号不存在。");
        }
예제 #3
0
        private string Edit(HttpContext context)
        {
            Model.BaseUser buModel = new Model.BaseUser();
            try { buModel.Permissions = int.Parse(context.Request.Form["cbPermissions"]); }
            catch { buModel.Permissions = 0; }
            buModel.UserID   = long.Parse(context.Request.Form["hdUserID"]);
            buModel.UserName = context.Request.Form["txtUserName"].Replace("'", "''").Trim();
            buModel.Pwd      = string.IsNullOrWhiteSpace(context.Request.Form["hdPwd"]) ? DBUtility.WcSecurity.Des.Encrypt(buModel.UserName) : context.Request.Form["hdPwd"];
            buModel.Roles    = context.Request.Form["txtRoles"].Trim();
            int flag = new BLL.BaseUser().Update(buModel);

            return(flag > 0 ? "ok" : flag == 0 ? "保存失败。" : "【登录账号】“" + buModel.UserName + "”已存在。");
        }
예제 #4
0
        /// <summary>
        /// 检查密码是否正确(create by zxf)
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string CheckPWD(HttpContext context)
        {
            DataTable dt = new DataTable();

            dt = new BLL.BaseUser().GetList("UserID=" + context.Request["userID"].ToString() + " and UserName='******' and Pwd='" + DBUtility.WcSecurity.Des.Encrypt(context.Request["pwd"].Trim()) + "'").Tables[0];
            if (dt.Rows.Count == 1)
            {
                return("success");
            }
            else
            {
                return("fail");
            }
        }
예제 #5
0
        /// <summary>
        /// 检查工号是否存在(create by zxf)
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string CheckWorkID(HttpContext context)
        {
            DataTable dt = new DataTable();

            dt = new BLL.BaseUser().GetList("WorkID='" + context.Request["WorkID"].ToString() + "'").Tables[0];
            if (dt.Rows.Count == 0)
            {
                return("success");
            }
            else
            {
                return("fail");
            }
        }
예제 #6
0
        public string checkAbbr(HttpContext context)
        {
            DataTable dt = new DataTable();

            dt = new BLL.BaseUser().GetList("Value2='" + context.Request["Abbr"].ToString() + "'").Tables[0];
            if (dt.Rows.Count == 0)
            {
                return("success");
            }
            else
            {
                return("fail");
            }
        }
예제 #7
0
        private string QueryList(HttpContext context)
        {
            DataTable dt    = new DataTable();
            int       total = 0;
            int       page  = context.Request.Form["page"] != "" ? Convert.ToInt32(context.Request.Form["page"]) : 0;
            int       rows  = context.Request.Form["rows"] != "" ? Convert.ToInt32(context.Request.Form["rows"]) : 0;
            string    key   = context.Request.Form["key"] != null ? context.Request.Form["key"].Trim() : "";

            string where = " 1=1 ";
            if (key != "" && !string.IsNullOrEmpty(key))
            {
                where += " and (type_name like '%" + key + "%' or remark like '%" + key + "%' )";
            }
            string table      = "request_form_type";
            string show       = "*";
            string orderFiled = "sid";

            dt = new BLL.BaseUser().GetList(table, orderFiled, show, page, rows, out total, "asc", where).Tables[0];
            return(DBUtility.JsonHelper.DataTable2Json_Datagrid(dt, total));
        }
예제 #8
0
        public string QueryList(HttpContext context)
        {
            DataTable dt    = new DataTable();
            int       total = 0;
            int       page  = context.Request.Form["page"] != "" ? Convert.ToInt32(context.Request.Form["page"]) : 0;
            int       rows  = context.Request.Form["rows"] != "" ? Convert.ToInt32(context.Request.Form["rows"]) : 0;
            string    key   = context.Request.Form["key"] != null ? context.Request.Form["key"].Trim() : "";
            string    order = context.Request.Form["order"] != "" ? context.Request.Form["order"] : "asc";
            string    sort  = context.Request.Form["sort"] != "" ? context.Request.Form["sort"] : "type_name";

            string where = " 1=1 ";
            if (key != "" && !string.IsNullOrEmpty(key))
            {
                where += " and (form_name like '%" + key + "%' or type_name like '%" + key + "%' )";
            }
            string table = "v_request_form";
            string show  = "sid,form_name,rft_sid,url,rf_status,type_name,remark,create_date";

            dt = new BLL.BaseUser().GetList(table, sort, show, page, rows, out total, order, where).Tables[0];
            return(DBUtility.JsonHelper.DataTable2Json_Datagrid(dt, total));
        }
예제 #9
0
        public string QueryList(HttpContext context)
        {
            DataTable dt    = new DataTable();
            int       total = 0;
            int       page  = context.Request.Form["page"] != "" ? Convert.ToInt32(context.Request.Form["page"]) : 0;
            int       rows  = context.Request.Form["rows"] != "" ? Convert.ToInt32(context.Request.Form["rows"]) : 0;
            string    key   = context.Request.Form["key"] != null ? context.Request.Form["key"].Trim() : "";

            string where = " 1=1 ";
            if (key != "" && !string.IsNullOrEmpty(key))
            {
                where += " and (RoleID like '%" + key + "%' or RoleName like '%" + key + "%' or Note like '%" + key + "%' )";
            }
            string table      = "BaseRole";
            string show       = "*";
            string orderFiled = context.Request.Form["sort"] != null ? context.Request.Form["sort"] : "RoleID";
            string sort       = context.Request.Form["order"] != null ? context.Request.Form["order"] : "asc";//"RoleID";

            dt = new BLL.BaseUser().GetList(table, orderFiled, show, page, rows, out total, sort, where).Tables[0];
            return(DBUtility.JsonHelper.DataTable2Json_Datagrid(dt, total));
        }
예제 #10
0
        public string MyApprList(HttpContext context)
        {
            Model.BaseUser bu    = (Model.BaseUser)context.Session["login"];
            DataTable      dt    = new DataTable();
            int            total = 0;
            int            page  = context.Request.Form["page"] != "" ? Convert.ToInt32(context.Request.Form["page"]) : 0;
            int            rows  = context.Request.Form["rows"] != "" ? Convert.ToInt32(context.Request.Form["rows"]) : 0;
            string         order = context.Request.Form["order"] != "" ? context.Request.Form["order"] : "desc";
            string         sort  = context.Request.Form["sort"] != "" ? context.Request.Form["sort"] : "rf_sid,create_date";
            string         key   = context.Request.Form["key"] != null ? context.Request.Form["key"].Trim() : "";

            string where = " 1=1 and approver='" + bu.UserName + "' ";
            if (key != "" && !string.IsNullOrEmpty(key))
            {
                where += " ";
            }
            string table = "v_my_appr_record";
            string show  = "*";

            dt = new BLL.BaseUser().GetList(table, sort, show, page, rows, out total, order, where).Tables[0];
            return(DBUtility.JsonHelper.DataTable2Json_Datagrid(dt, total));
        }