예제 #1
0
    protected void Button5_Click(object sender, EventArgs e)
    {
        if (TextBox2.Text.Trim() != "" && TextBox6.Text.Trim() != "" && TextBox3.Text.Trim() != "" && TextBox4.Text.Trim() != "" && TextBox5.Text.Trim() != "" && TextBox11.Text.Trim() != "")
        {
            if (Button5.Text == "确定修改")             //修改信息的操作
            {
                if (TextBox5.Text.Length == 18)
                {
                    if (TextBox11.Text.Length <= 16 && TextBox11.Text.Length >= 6)
                    {
                        staff sf = new DAL.StaffDAO().getStaffByNum(TextBox6.Text.Trim());
                        sf.StaffName   = TextBox3.Text.Trim();
                        sf.IdCard      = TextBox4.Text.Trim();
                        sf.PhoneNumber = TextBox5.Text.Trim();

                        SysUser s = new DAL.SysUserDAO().getUserByNum(sf.StaffNum);
                        s.Password = TextBox11.Text;
                        bool sta   = new DAL.StaffDAO().updateStaff(sf);
                        bool systa = new DAL.SysUserDAO().updateUser(s);
                        if (sta && systa)
                        {
                            new Warehouse.Tools.AddSysLog().addlog("1", "用户管理", "修改");
                            Response.Write("<script>alert('信息修改成功!')</script>");
                            add.Visible    = false;
                            update.Visible = false;
                            search.Visible = true;
                            refresh();
                            clea();
                        }
                        else
                        {
                            Response.Write("<script>alert('信息修改失败!')</script>");
                        }
                    }

                    else
                    {
                        Label27.Text = "密码要在8-16位之间";
                    }
                }
                else
                {
                    Label10.Text = "身份证号长度为18位";
                }
            }
            else                //添加用户的操作
            {
            }
        }
        else
        {
            Response.Write("<script>alert('所有信息不能为空!')</script>");
        }
    }
예제 #2
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     clea();
     if (TextBox2.Text.Trim() == "" || TextBox6.Text.Trim() == "" || TextBox3.Text.Trim() == "" || TextBox1.Text.Trim() == "")
     {
         Response.Write("<script>alert('所有信息不能为空!')</script>");
     }
     else
     {
         if (TextBox6.Text.Length > 16 || TextBox6.Text.Length < 6)
         {
             Label6.Text = "密码长度为6-16位";
         }
         else
         {
             if (TextBox6.Text.Trim() != TextBox3.Text.Trim())
             {
                 Label8.Text = "两次输入的密码不一致";
             }
             else
             {
                 SysUser s = new DAL.SysUserDAO().getUserByNum(TextBox2.Text.Trim());
                 if (s != null)
                 {
                     Label1.Text = "此人已注册,请更换注册员工";
                 }
                 else
                 {
                     staff sta = new DAL.StaffDAO().getStaffByNum(TextBox2.Text.Trim());
                     if (sta == null)
                     {
                         Label1.Text = "查无此人,请确定无误再输入";
                     }
                     else
                     {
                         if (sta.IdCard != TextBox1.Text.Trim())
                         {
                             Label12.Text = "您输入的身份证号和本人不符,请重新输入";
                         }
                         else
                         {
                             SysUser su = new SysUser();
                             su.Job      = DropDownList1.SelectedValue.ToString();
                             su.Password = TextBox3.Text.Trim();
                             su.StaffNum = TextBox2.Text.Trim();
                             bool addsuccess = new DAL.SysUserDAO().addUser(su);
                             if (addsuccess)
                             {
                                 ClientScript.RegisterStartupScript(GetType(), "Message", "<script>alert('注册成功');window.location='登录.aspx';</script>");
                                 //RegisterStartupScript("false", "<script>alert('注册成功');window.location.href='登录.aspx'</script>");
                             }
                             else
                             {
                                 Response.Write("<script>alert('注册失败!')</script>");
                             }
                         }
                     }
                 }
             }
         }
     }
 }
예제 #3
0
 protected void Button7_Click(object sender, EventArgs e)          //确认添加
 {
     cleartip();
     if (TextBox1.Text.Trim() == "" || TextBox7.Text.Trim() == "" || TextBox8.Text.Trim() == "" || TextBox9.Text.Trim() == "")
     {
         Response.Write("<script>alert('所有信息不能为空!')</script>");
     }
     else
     {
         if (TextBox7.Text.Trim() != TextBox8.Text.Trim())
         {
             Label16.Text = "两次输入的密码不一致";
         }
         else
         {
             staff sta = new DAL.StaffDAO().getStaffByNum(TextBox1.Text.Trim());
             if (sta == null)
             {
                 Label12.Text = "查无此人,请确定无误再输入";
             }
             else
             {
                 if (TextBox9.Text.Length == 18)
                 {
                     SysUser s = new DAL.SysUserDAO().getUserByNum(TextBox1.Text.Trim());
                     if (s != null)
                     {
                         Label12.Text = "此人已注册,请更换注册员工";
                     }
                     else
                     {
                         if (sta.IdCard != TextBox9.Text.Trim())
                         {
                             Label19.Text = "您输入的身份证号和本人不符,请重新输入";
                         }
                         else
                         {
                             SysUser su = new SysUser();
                             su.Job      = DropDownList1.SelectedValue.ToString();
                             su.Password = TextBox7.Text.Trim();
                             su.StaffNum = TextBox1.Text.Trim();
                             bool addsuccess = new DAL.SysUserDAO().addUser(su);
                             if (addsuccess)
                             {
                                 new Warehouse.Tools.AddSysLog().addlog("1", "用户管理", "添加");
                                 Response.Write("<script>alert('注册成功')</script>");
                                 clea();
                                 refresh();
                                 update.Visible = false;
                                 add.Visible    = false;
                                 search.Visible = true;
                             }
                             else
                             {
                                 Response.Write("<script>alert('注册失败!')</script>");
                             }
                         }
                     }
                 }
                 else
                 {
                     Label19.Text = "身份证格式不正确";
                 }
             }
         }
     }
 }