Пример #1
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        if (Session["Users"] != null)
        {
            Maticsoft.Model.Admin users = (Maticsoft.Model.Admin)Session["Users"];
            if (users.Pwd != txtOldPwd.Value.Trim())
            {
                txtOldPwd.Focus();
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('旧密码错误!');</script>");
                return;
            }
            else
            {
                Maticsoft.BLL.Admin UsersBLL = new Maticsoft.BLL.Admin();

                users.Pwd = txtNewPwd.Value.Trim();
                if (UsersBLL.Update(users))
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('修改密码成功!\\n新密码为:" + txtNewPwd.Value.Trim() + "');location=location;</script>");
                    return;
                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('修改密码失败!');</script>");
                    return;
                }
            }
        }
    }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["Users"] != null)
     {
         users = (Maticsoft.Model.Admin)Session["Users"];
     }
     else
     {
         users = null;
         Response.Write("<script>parent.window.location.href='Login.aspx'</script>");
     }
     if (!IsPostBack)
     {
         //共多少条记录
         int DataCount = UsersBLL.GetAllList().Tables[0].Rows.Count;
         //共多少页
         int hPageSize = (DataCount % Convert.ToInt32(HCount.Value)) != 0 ? DataCount / Convert.ToInt32(HCount.Value) + 1 : DataCount / Convert.ToInt32(HCount.Value);
         HPageSize.Value = DataCount.ToString();
         HAllPage.Value  = hPageSize.ToString();
         int startIndex = (Convert.ToInt32(HNowPage.Value) - 1) * Convert.ToInt32(HCount.Value);
         int endindex   = startIndex + Convert.ToInt32(HCount.Value);
         this.RpNews.DataSource = UsersBLL.GetListByPage(strWhere, "", startIndex, endindex);
         this.RpNews.DataBind();
         BindData("");
     }
 }
Пример #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["Users"] != null)
     {
         users = (Maticsoft.Model.Admin)Session["Users"];
     }
     else
     {
         users = null;
         Response.Write("<script>parent.window.location.href='Login.aspx'</script>");
     }
     if (!IsPostBack)
     {
         if (Request.QueryString["id"] != null)//点击修改传值
         {
             Maticsoft.Model.Users model = UsersBLL.GetModel(Convert.ToInt32(Request.QueryString["id"]));
             if (model != null && model.ID != 0)
             {
                 txtName.Value        = model.Name.Trim();
                 ddlSex.SelectedValue = model.Sex.Trim();
                 txtCode.Value        = model.Code.Trim();
                 txtCardID.Value      = model.CardID.Trim();
                 txtPosition.Value    = model.Position.Trim();
                 txtSalary.Value      = model.Salary.ToString();
                 txtRemark.Value      = model.Remark.ToString().Trim();
             }
             strNav         = "修改员工";
             btnUpdate.Text = "修改";
         }
     }
 }
Пример #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["Users"] != null)
     {
         users = (Maticsoft.Model.Admin)Session["Users"];
     }
     else
     {
         users = null;
         Response.Write("<script>parent.window.location.href='Login.aspx'</script>");
     }
 }
Пример #5
0
    /// <summary>
    /// 用户登录
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void BtnLogin_Click(object sender, EventArgs e)
    {
        Maticsoft.Model.Admin Admin = new Maticsoft.Model.Admin();

        Maticsoft.BLL.Admin admin = new Maticsoft.BLL.Admin();

        DataSet   ds = admin.GetList(" Name='" + this.txtU_Name.Value.Trim() + "'  and Pwd='" + this.txtU_Pass.Value.Trim() + "'");
        DataTable dt = ds.Tables[0];

        if (dt.Rows.Count > 0)
        {
            Admin.Name       = this.txtU_Name.Value.Trim();
            Admin.Pwd        = this.txtU_Pass.Value.Trim();
            Admin.ID         = Convert.ToInt32(dt.Rows[0]["ID"]);
            Session["Users"] = Admin;
            Response.Redirect("Index.aspx");
        }
        else
        {
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('用户名或者密码错误!');</script>");
            return;
        }
    }
Пример #6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Maticsoft.Model.Admin model)
 {
     return(dal.Update(model));
 }
Пример #7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Maticsoft.Model.Admin model)
 {
     return(dal.Add(model));
 }