当前位置: 首页>>代码示例>>C#>>正文


C# BLL.users.GetModel方法代码示例

本文整理汇总了C#中BLL.users.GetModel方法的典型用法代码示例。如果您正苦于以下问题:C# BLL.users.GetModel方法的具体用法?C# BLL.users.GetModel怎么用?C# BLL.users.GetModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BLL.users的用法示例。


在下文中一共展示了BLL.users.GetModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsUserLogin

 /// <summary>
 /// 判断用户是否已经登录(解决Session超时问题)
 /// </summary>
 public bool IsUserLogin()
 {
     //如果Session为Null
     if (HttpContext.Current.Session[MXKeys.SESSION_USER_INFO] != null)
     {
         return true;
     }
     else
     {
         //检查Cookies
         string username = Utils.GetCookie(MXKeys.COOKIE_USER_NAME_REMEMBER, "MxWeiXinPF");
         string password = Utils.GetCookie(MXKeys.COOKIE_USER_PWD_REMEMBER, "MxWeiXinPF");
         if (username != "" && password != "")
         {
             BLL.users bll = new BLL.users();
             Model.users model = bll.GetModel(username, password, 0, 0, false);
             if (model != null)
             {
                 HttpContext.Current.Session[MXKeys.SESSION_USER_INFO] = model;
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:yi724926089,项目名称:MyWx,代码行数:28,代码来源:BasePage.cs

示例2: get_user_avatar

 /// <summary>
 /// 返回用户头像图片地址
 /// </summary>
 /// <param name="user_name">用户名</param>
 /// <returns>String</returns>
 protected string get_user_avatar(string user_name)
 {
     BLL.users bll = new BLL.users();
     if (!bll.Exists(user_name))
     {
         return "";
     }
     return bll.GetModel(user_name).avatar;
 }
开发者ID:codefighting,项目名称:shouxinzhihui,代码行数:14,代码来源:users.cs

示例3: get_real_name

 /// <summary>
 /// 获取用户真实姓名
 /// </summary>
 /// <param name="user_id"></param>
 /// <returns></returns>
 protected string get_real_name(int user_id)
 {
     BLL.users bll = new BLL.users();
     Model.users model = bll.GetModel(user_id);
     if (model != null)
     {
         return model.real_name;
     }
     else {
         return "";
     }
 }
开发者ID:wangjinfang,项目名称:DTCMS,代码行数:17,代码来源:users.cs

示例4: btnLogin_Click

        protected void btnLogin_Click(object sender, EventArgs e)
        {
            BLL.users userService = new BLL.users();
            string userName = txtUserName.Text.Trim();
            string password = Maticsoft.Common.DEncrypt.DESEncrypt.Encrypt(txtPassword.Text.Trim(), ConfigHelper.GetConfigString("PassWordEncrypt"));
            //string password = txtPassword.Text.Trim();
            DataTable userList = userService.GetList("userName='" + userName + "' and password='" + password + "' and roleId in (4,10,11)").Tables[0];
            if (userList.Rows.Count > 0)
            {

                if (userList.Rows[0]["status"].ToString() == "0")
                {
                    MessageBox.Show(this, "此用户名已被冻结,无法登陆!");
                    return;
                }
                //写入Cookie
                try
                {
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_UserId, 2, userList.Rows[0]["userId"].ToString());
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_UserName, 2, txtUserName.Text.Trim());
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_TrueName, 2, DESEncrypt.Encrypt(userList.Rows[0]["trueName"].ToString()));
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_RoleId, 2, userList.Rows[0]["roleId"].ToString());
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_RoleName, 2, DESEncrypt.Encrypt(userList.Rows[0]["roleName"].ToString()));
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_DeptId, 2, userList.Rows[0]["deptId"].ToString());
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_IsAdmin, 2, userList.Rows[0]["isAdmin"].ToString());
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_Avatar, 2, userList.Rows[0]["avatar_small"].ToString());
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_LastLoginTime, 2, DateTime.Parse(userList.Rows[0]["lastLoginTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"));
                }
                catch
                {
                    //Session["userName"] = txtUserName.Text.Trim();
                    //Session["userType"] = ddrUserTyp.SelectedValue;
                    //Session["orgId"] = userList.Rows[0]["orgId"].ToString();
                }
                //更新最后登陆时间
                Model.users userModel = userService.GetModel(int.Parse(userList.Rows[0]["userId"].ToString()));
                userModel.lastLoginTime = DateTime.Now;
                userService.Update(userModel);

                Response.Redirect("index.aspx");
                //MessageBox.ShowAndRedirect(this, "登录成功!", "index.html");
            }
            else
            {
                MessageBox.Show(this, "用户名或密码错误!");
            }
        }
开发者ID:tcld2269,项目名称:hmdfs,代码行数:47,代码来源:Login.aspx.cs

示例5: ShowInfo

        private void ShowInfo(int _id)
        {
            BLL.users bll = new BLL.users();
            Model.users model = bll.GetModel(_id);

            ddlGroupId.SelectedValue = model.group_id.ToString();
            rblStatus.SelectedValue = model.status.ToString();
            txtUserName.Text = model.user_name;
            txtUserName.ReadOnly = true;
            txtUserName.Attributes.Remove("ajaxurl");
            if (!string.IsNullOrEmpty(model.password))
            {
                txtPassword.Attributes["value"] = txtPassword1.Attributes["value"] = defaultpassword;
            }
            txtEmail.Text = model.email;
            txtNickName.Text = model.nick_name;
            txtAvatar.Text = model.avatar;
            rblSex.SelectedValue = model.sex;
            if (model.birthday != null)
            {
                txtBirthday.Text = model.birthday.GetValueOrDefault().ToString("yyyy-M-d");
            }
            txtTelphone.Text = model.telphone;
            txtMobile.Text = model.mobile;
            txtQQ.Text = model.qq;
            txtMsn.Text = model.msn;
            txtAddress.Text = model.address;
            txtAmount.Text = model.amount.ToString();
            txtPoint.Text = model.point.ToString();
            txtExp.Text = model.exp.ToString();
            lblRegTime.Text = model.reg_time.ToString();
            lblRegIP.Text = model.reg_ip.ToString();
            //查找最近登录信息
            Model.user_login_log logModel = new BLL.user_login_log().GetLastModel(model.user_name);
            if (logModel != null)
            {
                lblLastTime.Text = logModel.login_time.ToString();
                lblLastIP.Text = logModel.login_ip;
            }
        }
开发者ID:silverdan,项目名称:ahxrmyy2.0,代码行数:40,代码来源:user_edit.aspx.cs

示例6: btnSmsPost_Click

        //发送手机短信
        protected void btnSmsPost_Click(object sender, EventArgs e)
        {
            BLL.users bll = new BLL.users();
            StringBuilder str = new StringBuilder();

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    Model.users model = bll.GetModel(id);
                    if (model != null && !string.IsNullOrEmpty(model.mobile))
                    {
                        str.Append(model.mobile + ",");
                    }
                }
            }
            if (!string.IsNullOrEmpty(str.ToString()))
            {
                Response.Redirect("user_sms.aspx?mobiles=" + Utils.UrlEncode(Utils.DelLastComma(str.ToString())));
            }
        }
开发者ID:yi724926089,项目名称:MyWx,代码行数:24,代码来源:user_list.aspx.cs

示例7: ShowInfo

        private void ShowInfo(int _id)
        {
            BLL.users bll = new BLL.users();
            Model.users model = bll.GetModel(_id);

            ddlGroupId.SelectedValue = model.group_id.ToString();
            rblIsLock.SelectedValue = model.is_lock.ToString();
            txtUserName.Enabled = false;
            txtUserName.Text = model.user_name;
            hidUserName.Value = model.user_name;
            txtPassword.Attributes["value"] = model.password;
            txtEmail.Text = model.email;
            txtNickName.Text = model.nick_name;
            txtAvatar.Text = model.avatar;
            rblSex.SelectedValue = model.sex;
            if (model.birthday != null)
            {
                txtBirthday.Text = model.birthday.GetValueOrDefault().ToString("yyyy-M-d");
            }
            txtTelphone.Text = model.telphone;
            txtMobile.Text = model.mobile;
            txtQQ.Text = model.qq;
            txtAddress.Text = model.address;
            txtAmount.Text = model.amount.ToString();
            txtPoint.Text = model.point.ToString();
            txtExp.Text = model.exp.ToString();
            lblRegTime.Text = model.reg_time.ToString();
            lblRegIP.Text = model.reg_ip.ToString();
            //查找最近登录信息
            Model.user_login_log logModel = new BLL.user_login_log().GetLastModel(model.user_name);
            if (logModel != null)
            {
                lblLastTime.Text = logModel.login_time.ToString();
                lblLastIP.Text = logModel.login_ip;
            }
        }
开发者ID:sichina,项目名称:or-dtcms2.0,代码行数:36,代码来源:user_edit.aspx.cs

示例8: user_repassword

        private void user_repassword(HttpContext context)
        {
            string code = context.Request.Form["txtCode"];
            string strcode = context.Request.Form["hideCode"];
            string password = context.Request.Form["txtPassword"];

            //校检验证码
            string result = verify_code(context, code);
            if (result != "success")
            {
                context.Response.Write(result);
                return;
            }
            //检查验证字符串
            if (string.IsNullOrEmpty(strcode))
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"系统找不到邮件验证的字符串!\"}");
                return;
            }
            //检查输入的新密码
            if (string.IsNullOrEmpty(password))
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"请输入您的新密码!\"}");
                return;
            }

            BLL.user_code codeBll = new BLL.user_code();
            Model.user_code codeModel = codeBll.GetModel(strcode);
            if (codeModel == null)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"邮件验证的字符串不存在或已过期!\"}");
                return;
            }
            //验证用户是否存在
            BLL.users userBll = new BLL.users();
            if (!userBll.Exists(codeModel.user_id))
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"该用户不存在或已被删除!\"}");
                return;
            }
            Model.users userModel = userBll.GetModel(codeModel.user_id);
            //执行修改操作
            userModel.password = DESEncrypt.Encrypt(password);
            userBll.Update(userModel);
            //更改验证字符串状态
            codeModel.count = 1;
            codeModel.status = 1;
            codeBll.Update(codeModel);
            context.Response.Write("{\"msg\":1, \"msgbox\":\"修改密码成功,请记住您的新密码!\"}");
            return;
        }
开发者ID:qljiong,项目名称:LearnDTCMS,代码行数:51,代码来源:submit_ajax.ashx.cs

示例9: user_register

        private void user_register(HttpContext context)
        {
            string code = DTRequest.GetFormString("txtCode").Trim();
            string invitecode = DTRequest.GetFormString("txtInviteCode").Trim();
            string username = DTRequest.GetFormString("txtUserName").Trim();
            string password = DTRequest.GetFormString("txtPassword").Trim();
            string email = DTRequest.GetFormString("txtEmail").Trim();
            string userip = DTRequest.GetIP();

            #region 检查各项并提示
            //检查是否开启会员功能
            if (siteConfig.memberstatus == 0)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,会员功能已被关闭,无法注册新会员!\"}");
                return;
            }
            if (userConfig.regstatus == 0)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,系统暂不允许注册新用户!\"}");
                return;
            }
            //校检验证码
            string result = verify_code(context, code);
            if (result != "success")
            {
                context.Response.Write(result);
                return;
            }
            //检查用户输入信息是否为空
            if (username == "" || password == "")
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"用户名和密码不能为空!\"}");
                return;
            }
            if (email == "")
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"电子邮箱不能为空!\"}");
                return;
            }

            //检查用户名
            BLL.users bll = new BLL.users();
            Model.users model = new Model.users();
            if (bll.Exists(username))
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"该用户名已经存在!\"}");
                return;
            }
            //检查同一IP注册时隔
            if (userConfig.regctrl > 0)
            {
                if (bll.Exists(userip, userConfig.regctrl))
                {
                    context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,同一IP在" + userConfig.regctrl + "小时内不能注册多个用户!\"}");
                    return;
                }
            }
            //不允许同一Email注册不同用户
            if (userConfig.regemailditto == 0)
            {
                if (bll.ExistsEmail(email))
                {
                    context.Response.Write("{\"msg\":0, \"msgbox\":\"Email不允许重复注册,如果你忘记用户名,请找回密码!\"}");
                    return;
                }
            }
            //检查默认组别是否存在
            Model.user_groups modelGroup = new BLL.user_groups().GetDefault();
            if (modelGroup == null)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"系统尚未分组,请联系管理员设置会员分组!\"}");
                return;
            }
            //检查是否通过邀请码注册
            if (userConfig.regstatus == 2)
            {
                string result1 = verify_invite_reg(username, invitecode);
                if (result1 != "success")
                {
                    context.Response.Write(result1);
                    return;
                }
            }
            #endregion

            //保存注册信息
            model.group_id = modelGroup.id;
            model.user_name = username;
            model.password = DESEncrypt.Encrypt(password);
            model.email = email;
            model.reg_ip = userip;
            model.reg_time = DateTime.Now;
            model.is_lock = userConfig.regverify; //设置为对应状态
            int newId = bll.Add(model);
            if (newId < 1)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"系统故障,注册失败,请联系网站管理员!\"}");
                return;
            }
            model = bll.GetModel(newId);
//.........这里部分代码省略.........
开发者ID:qljiong,项目名称:LearnDTCMS,代码行数:101,代码来源:submit_ajax.ashx.cs

示例10: redpacket_info

        private void redpacket_info(HttpContext context)
        {
            string unique_code = DTRequest.GetQueryString("code");
            StringBuilder sb = new StringBuilder();
            if (string.IsNullOrEmpty(unique_code) || unique_code == "unsafe string")
            {
                sb.Append("  <dl><dt></dt><dd>消费码不能为空!</dd></dl>");
                context.Response.Write(sb.ToString());
                return;
            }

            BLL.redpacket bll_redpacket = new BLL.redpacket();
            int count = 0;
            DataSet ds_redpacket = bll_redpacket.GetRedPacketList_WebService(1, 1, "unique_code='" + unique_code + "'", "status desc", out count);
            if (ds_redpacket == null || count == 0)
            {
                sb.Append("  <dl><dt></dt><dd>此消费码不存在,验证无效!</dd></dl>");
                context.Response.Write(sb.ToString());
                return;
            }
            DataTable dt_redpacket = ds_redpacket.Tables[0];

            BLL.users bll_user = new BLL.users();
            Model.users model_user = bll_user.GetModel(int.Parse(dt_redpacket.Rows[0]["guid_id"].ToString()));
            if (model_user == null)
            {
                sb.Append("  <dl><dt></dt><dd>数据异常,请联系管理员!</dd></dl>");
                context.Response.Write(sb.ToString());
                return;
            }

            sb.Append("  <dl><dt></dt><dd>红包名称:" + dt_redpacket.Rows[0]["title"] + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>红包状态:" + GetUserStatus(int.Parse(dt_redpacket.Rows[0]["status"].ToString())) + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>有效期:" + dt_redpacket.Rows[0]["start_date"] + "至" + dt_redpacket.Rows[0]["end_date"] + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>会员名:" + model_user.user_name + " (昵称:" + model_user.nick_name + ")</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>工种:" + (model_user.work_type == 1 ? "领队" : "导游") + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>手机号:" + model_user.mobile + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>导游证号:" + model_user.guid_card + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>身份证号:" + model_user.card + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>申请时间:" + dt_redpacket.Rows[0]["apply_time"] + "</dd></dl>");

            context.Response.Write(sb.ToString());
            return;
        }
开发者ID:codefighting,项目名称:shouxinzhihui,代码行数:44,代码来源:admin_ajax.ashx.cs

示例11: edit_dealing_users

        /// <summary>
        /// 分配账户修改资料
        /// </summary>
        /// <param name="context"></param>
        private void edit_dealing_users(HttpContext context)
        {
            int id = DTRequest.GetQueryInt("id");
            string password = DTRequest.GetString("psd");
            string phone = DTRequest.GetString("phone");
            string email = DTRequest.GetString("email");
            string real_name = DTRequest.GetString("real_name");
            int branch = DTRequest.GetFormInt("branch_id");

            BLL.users bll = new BLL.users();
            Model.users model1 = new BasePage().GetUserInfo();
            if (model1 == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请重新登录!\"}");
                return;
            }
            Model.users model = bll.GetModel(id);

            string psd = DESEncrypt.Encrypt(password, model1.salt);
            model.password = psd;
            model.telphone = phone;
            model.real_name = real_name;
            model.email = email;
            model.branch_id = branch;
            model.user_status = 3;
            model.user_type = 1;
            model.parent_id = model1.id;
            model.group_id = 1;
            if (bll.Update(model))
            {
                context.Response.Write("{\"status\":1, \"msg\":\"修改员工资料成功!\"}");
                return;

            }
            else
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,修改员工资料失败!\"}");
                return;

            }
        }
开发者ID:wangjinfang,项目名称:DTCMS,代码行数:45,代码来源:submit_ajax.ashx.cs

示例12: ShowInfo

        private void ShowInfo(int _id)
        {
            BLL.users bll = new BLL.users();
            Model.users model = bll.GetModel(_id);

            ddlGroupId.SelectedValue = model.group_id.ToString();
            rblStatus.SelectedValue = model.status.ToString();
            txtUserName.Text = model.user_name;
            txtUserName.ReadOnly = true;
            txtUserName.Attributes.Remove("ajaxurl");
            if (!string.IsNullOrEmpty(model.password))
            {
                txtPassword.Attributes["value"] = txtPassword1.Attributes["value"] = defaultpassword;
            }
            txtEmail.Text = model.email;
            txtNickName.Text = model.nick_name;
            txtAvatar.Text = model.avatar;
            rblSex.SelectedValue = model.sex;
            if (model.birthday != null)
            {
                txtBirthday.Text = model.birthday.GetValueOrDefault().ToString("yyyy-M-d");
            }

            rb_user_type.SelectedValue = model.user_type.ToString();

            txtTelphone.Text = model.telphone;
            txtMobile.Text = model.mobile;
            txtQQ.Text = model.qq;
            txtAddress.Text = model.address;
            txtAmount.Text = model.amount.ToString();
            txtPoint.Text = model.point.ToString();
            txtExp.Text = model.exp.ToString();
            lblRegTime.Text = model.reg_time.ToString();
            lblRegIP.Text = model.reg_ip.ToString();
            //查找最近登录信息
            Model.user_login_log logModel = new BLL.user_login_log().GetLastModel(model.user_name);
            if (logModel != null)
            {
                lblLastTime.Text = logModel.login_time.ToString();
                lblLastIP.Text = logModel.login_ip;
            }

            ddl_province.SelectedValue = model.province.ToString();
            ddl_city.Items.Add(new ListItem("请选择市...", "0"));
            if (Convert.ToInt32(ddl_province.SelectedValue) > 0)
            {
                BLL.city bll_city = new BLL.city();
                DataTable dt = bll_city.GetList("ProvinceID=" + ddl_province.SelectedValue).Tables[0];

                foreach (DataRow dr in dt.Rows)
                {
                    ddl_city.Items.Add(new ListItem(dr["CityName"].ToString(), dr["CityID"].ToString()));
                }
                ddl_city.SelectedValue = model.city.ToString();
            }
            ddl_district.Items.Add(new ListItem("请选择区/县...", "0"));
            if (Convert.ToInt32(ddl_city.SelectedValue) > 0)
            {
                BLL.district bll_district = new BLL.district();
                ddl_district.Items.Clear();
                DataTable dt = bll_district.GetList("CityID=" + ddl_province.SelectedValue).Tables[0];
                foreach (DataRow dr in dt.Rows)
                {
                    ddl_district.Items.Add(new ListItem(dr["DistrictName"].ToString(), dr["DistrictID"].ToString()));
                }
                ddl_district.SelectedValue = model.district.ToString();
            }
        }
开发者ID:wangjinfang,项目名称:DTCMS,代码行数:68,代码来源:user_edit.aspx.cs

示例13: DoEdit

        private bool DoEdit(int _id)
        {
            bool result = false;
            BLL.users bll = new BLL.users();
            Model.users model = bll.GetModel(_id);

            model.group_id = int.Parse(ddlGroupId.SelectedValue);
            model.status = int.Parse(rblStatus.SelectedValue);
            //判断密码是否更改
            if (txtPassword.Text.Trim() != defaultpassword)
            {
                //获取用户已生成的salt作为密钥加密
                model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
            }
            model.email = Utils.DropHTML(txtEmail.Text);
            model.nick_name = Utils.DropHTML(txtNickName.Text);
            model.avatar = Utils.DropHTML(txtAvatar.Text);
            model.sex = rblSex.SelectedValue;
            DateTime _birthday;
            if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday))
            {
                model.birthday = _birthday;
            }
            model.telphone = Utils.DropHTML(txtTelphone.Text.Trim());
            model.mobile = Utils.DropHTML(txtMobile.Text.Trim());
            model.qq = Utils.DropHTML(txtQQ.Text);
            model.address = Utils.DropHTML(txtAddress.Text.Trim());
            model.amount = Utils.StrToDecimal(txtAmount.Text.Trim(), 0);
            model.point = Utils.StrToInt(txtPoint.Text.Trim(), 0);
            model.exp = Utils.StrToInt(txtExp.Text.Trim(), 0);
            model.user_type = Convert.ToInt32(rb_user_type.SelectedValue);
            model.province = Convert.ToInt32(ddl_province.SelectedValue);
            model.city = Convert.ToInt32(ddl_city.SelectedValue);
            model.district = Convert.ToInt32(ddl_district.SelectedValue);

            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改用户信息:" + model.user_name); //记录日志
                result = true;
            }
            return result;
        }
开发者ID:wangjinfang,项目名称:DTCMS,代码行数:42,代码来源:user_edit.aspx.cs

示例14: user_login

        private void user_login(HttpContext context)
        {
            string sitepath = DTRequest.GetQueryString("site");
            string username = DTRequest.GetFormString("txtUserName");
            string password = DTRequest.GetFormString("txtPassword");
            string remember = DTRequest.GetFormString("chkRemember");
            //检查站点目录
            if (string.IsNullOrEmpty(sitepath))
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"错误提示:站点传输参数不正确!\"}");
                return;
            }
            //检查用户名密码
            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"温馨提示:请输入用户名或密码!\"}");
                return;
            }

            BLL.users bll = new BLL.users();
            Model.users model = bll.GetModel(username, password, userConfig.emaillogin, userConfig.mobilelogin, true);
            if (model == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"错误提示:用户名或密码错误,请重试!\"}");
                return;
            }
            //检查用户是否通过验证
            if (model.status == 1) //待验证
            {
                if (userConfig.regverify == 1)
                {
                    context.Response.Write("{\"status\":1, \"url\":\""
                        + new Web.UI.BasePage().getlink(sitepath, new Web.UI.BasePage().linkurl("register", "?action=sendmail&username=" + Utils.UrlEncode(model.user_name))) + "\", \"msg\":\"会员尚未通过验证!\"}");
                }
                else
                {
                    context.Response.Write("{\"status\":1, \"url\":\"" +
                        new Web.UI.BasePage().getlink(sitepath, new Web.UI.BasePage().linkurl("register", "?action=sendsms&username=" + Utils.UrlEncode(model.user_name))) + "\", \"msg\":\"会员尚未通过验证!\"}");
                }
                return;
            }
            else if (model.status == 2) //待审核
            {
                context.Response.Write("{\"status\":1, \"url\":\""
                    + new Web.UI.BasePage().getlink(sitepath, new Web.UI.BasePage().linkurl("register", "?action=verify&username=" + Utils.UrlEncode(model.user_name))) + "\", \"msg\":\"会员尚未通过审核!\"}");
                return;
            }
            //检查用户每天登录是否获得积分
            if (!new BLL.user_login_log().ExistsDay(model.user_name) && userConfig.pointloginnum > 0)
            {
                new BLL.user_point_log().Add(model.id, model.user_name, userConfig.pointloginnum, "每天登录获得积分", true); //增加用户登录积分
                model = bll.GetModel(username, password, userConfig.emaillogin, userConfig.mobilelogin, true); //更新一下用户信息
            }
            context.Session[DTKeys.SESSION_USER_INFO] = model;
            context.Session.Timeout = 45;
            //记住登录状态下次自动登录
            if (remember.ToLower() == "true")
            {
                Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", model.user_name, 43200);
                Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", model.password, 43200);
            }
            else
            {
                //防止Session提前过期
                Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", model.user_name);
                Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", model.password);
            }

            //写入登录日志
            new BLL.user_login_log().Add(model.id, model.user_name, "会员登录");
            //返回URL
            context.Response.Write("{\"status\":1, \"msg\":\"会员登录成功!\"}");
            return;
        }
开发者ID:silverdan,项目名称:ahxrmyy2.0,代码行数:74,代码来源:submit_ajax.ashx.cs

示例15: user_repassword

        private void user_repassword(HttpContext context)
        {
            string strcode = DTRequest.GetFormString("hideCode"); //取回密码字符串
            string password = DTRequest.GetFormString("txtPassword"); //重设后的密码

            //检查验证字符串
            if (string.IsNullOrEmpty(strcode))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,校检码字符串不能为空!\"}");
                return;
            }
            //检查输入的新密码
            if (string.IsNullOrEmpty(password))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入您的新密码!\"}");
                return;
            }

            BLL.user_code codeBll = new BLL.user_code();
            Model.user_code codeModel = codeBll.GetModel(strcode);
            if (codeModel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,校检码不存在或已过期!\"}");
                return;
            }
            //验证用户是否存在
            BLL.users userBll = new BLL.users();
            if (!userBll.Exists(codeModel.user_id))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,该用户不存在或已被删除!\"}");
                return;
            }
            Model.users userModel = userBll.GetModel(codeModel.user_id);
            //执行修改操作
            userModel.password = DESEncrypt.Encrypt(password, userModel.salt);
            userBll.Update(userModel);
            //更改验证字符串状态
            codeModel.count = 1;
            codeModel.status = 1;
            codeBll.Update(codeModel);
            context.Response.Write("{\"status\":1, \"msg\":\"修改密码成功,请记住新密码!\"}");
            return;
        }
开发者ID:silverdan,项目名称:ahxrmyy2.0,代码行数:43,代码来源:submit_ajax.ashx.cs


注:本文中的BLL.users.GetModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。