Example #1
0
    protected void ibtnAdd_Click(object sender, EventArgs e)
    {
        try
        {
            TFXK.Model.Users model = new TFXK.Model.Users();
            model.userName = Context.User.Identity.Name;
            model.password = txtPass2.Text;

            string password = this.txtPass.Text.Trim();
            bool   flg      = bll.Exists(model.userName, password);
            if (flg)
            {
                bll.UpdatePassword(model);
                Msg.Show("修改信息成功!");
            }
            else
            {
                Msg.Show("原始密码错误!");
            }
        }
        catch (Exception ex)
        {
            log.Error(ex.Message);
            Msg.Show("网络错误!原因:" + ex.Message);
        }
    }
Example #2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <TFXK.Model.Users> DataTableToList(DataTable dt)
        {
            List <TFXK.Model.Users> modelList = new List <TFXK.Model.Users>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                TFXK.Model.Users model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new TFXK.Model.Users();
                    if (dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    model.userName  = dt.Rows[n]["userName"].ToString();
                    model.password  = dt.Rows[n]["password"].ToString();
                    model.trueName  = dt.Rows[n]["trueName"].ToString();
                    model.email     = dt.Rows[n]["email"].ToString();
                    model.telephone = dt.Rows[n]["telephone"].ToString();
                    model.address   = dt.Rows[n]["address"].ToString();
                    if (dt.Rows[n]["roleid"].ToString() != "")
                    {
                        model.roleid = int.Parse(dt.Rows[n]["roleid"].ToString());
                    }
                    model.question = dt.Rows[n]["question"].ToString();
                    model.answer   = dt.Rows[n]["answer"].ToString();
                    if (dt.Rows[n]["state"].ToString() != "")
                    {
                        model.state = int.Parse(dt.Rows[n]["state"].ToString());
                    }
                    if (dt.Rows[n]["regDate"].ToString() != "")
                    {
                        model.regDate = DateTime.Parse(dt.Rows[n]["regDate"].ToString());
                    }
                    if (dt.Rows[n]["lastLoginDate"].ToString() != "")
                    {
                        model.lastLoginDate = DateTime.Parse(dt.Rows[n]["lastLoginDate"].ToString());
                    }
                    if (dt.Rows[n]["loginCount"].ToString() != "")
                    {
                        model.loginCount = int.Parse(dt.Rows[n]["loginCount"].ToString());
                    }
                    model.description = dt.Rows[n]["description"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Example #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(TFXK.Model.Users model)
        {
            int row = 0;

            if (!Exists(model.userName, ""))
            {
                model.password = Security.EncryptPassword(model.password, "MD5");
                row            = dal.Add(model);
            }
            else
            {
                row = -1;
            }

            return(row);
        }
Example #4
0
    protected void ibtnAdd_Click(object sender, EventArgs e)
    {
        try
        {
            TFXK.Model.Users model = new TFXK.Model.Users();
            model.userName = Request.QueryString["userName"].ToString();
            model.password = txtPass2.Text;

            try
            {
                bll.UpdatePassword(model);
                Msg.ShowAndRedirect("修改信息成功!", "Default.aspx");
            }
            catch (Exception ex)
            {
                Response.Write("出现错误,错误信息:" + ex.Message);
            }
        }
        catch (Exception ex)
        {
            log.Error(ex.Message);
            Msg.Show("网络错误!原因:" + ex.Message);
        }
    }
Example #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(TFXK.Model.Users model)
 {
     dal.Update(model);
 }
Example #6
0
 /// <summary>
 ///  更新密码
 /// </summary>
 public void UpdatePassword(TFXK.Model.Users model)
 {
     model.password = Security.EncryptPassword(model.password, "MD5");
     dal.UpdatePassword(model);
 }
Example #7
0
 /// <summary>
 ///  审核状态
 /// </summary>
 public void UpdateStatus(TFXK.Model.Users model)
 {
     //  dal.UpdateStatus(model);
 }