Example #1
0
 protected void ok_Click(object sender, EventArgs e)
 {
     try
     {
         BLL_Users bu = new BLL_Users();
         Users     us = new Users();
         us.U_NAME         = name.Text;
         us.U_PASSWORD     = FormsAuthentication.HashPasswordForStoringInConfigFile(pass.Text, "MD5");
         us.U_EMAIL        = email.Text;
         us.U_REGISTERTIME = DateTime.Now.ToLocalTime();
         us.U_IMG          = "../Image/logo.png";
         if (bu.AddUsers(us) > 0)
         {
             Response.Write("<script>alert('注册成功!');window.location.href='index.aspx';</script>");
         }
         else
         {
             Response.Write("<script>alert('注册失败!');history.go(-1);</script>");
         }
     }
     catch
     {
         Response.Write("<script>alert('注册失败!');history.go(-1);</script>");
     }
 }
Example #2
0
 protected void save_Click(object sender, EventArgs e)
 {
     try
     {
         string path = Server.MapPath(@"../Image/User/" + fileup.FileName);
         fileup.SaveAs(path);
         photo.ImageUrl = @"../Image/User/" + fileup.FileName;
         BLL_Users bu = new BLL_Users();
         Users     u  = new Users();
         u.U_ID       = Convert.ToInt32(id.Text);
         u.U_IMG      = photo.ImageUrl;
         u.U_NAME     = name.Text;
         u.U_PASSWORD = FormsAuthentication.HashPasswordForStoringInConfigFile(pass.Text, "MD5");
         u.U_EMAIL    = email.Text;
         bu.UpdateUsers(u);
         if (bu.UpdateUsers(u) > 0)
         {
             Response.Write("<script>alert('修改成功!');</script>");
         }
         else
         {
             Response.Write("<script>alert('修改失败!');history.go(-1);</script>");
         }
     }
     catch
     {
         Response.Write("<script>alert('修改失败!');history.go(-1);</script>");
     }
 }
Example #3
0
 protected void add_Click(object sender, EventArgs e)
 {
     try
     {
         Users us = new Users();
         us.U_NAME         = uname.Text;
         us.U_PASSWORD     = FormsAuthentication.HashPasswordForStoringInConfigFile(upwd.Text, "MD5");
         us.U_IMG          = "../Image/logo.png";
         us.U_EMAIL        = "*****@*****.**";
         us.U_REGISTERTIME = DateTime.Now;
         BLL_Users add = new BLL_Users();
         if (add.AddUsers(us) > 0)
         {
             Response.Write(@"<script>alert('添加成功!');</script>");
         }
         else
         {
             Response.Write(@"<script>alert('添加失败!');history.go(-1);</script>");
         }
     }
     catch
     {
         Response.Write(@"<script>alert('添加失败!');history.go(-1);</script>");
     }
 }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BLL_Users bu = new BLL_Users();

            list.DataSource = bu.SelectUsers();
            list.DataBind();
        }
Example #5
0
        protected void log_Click(object sender, EventArgs e)
        {
            string    name = account.Text;
            string    pwd  = FormsAuthentication.HashPasswordForStoringInConfigFile(passwd.Text, "MD5");
            BLL_Users log  = new BLL_Users();

            log.log(name, pwd);
            if (log.log(name, pwd))
            {
                Response.Write("<script>window.location.href ='userProf.aspx';</script>");
                Session["name"] = account.Text;
                Session["pass"] = FormsAuthentication.HashPasswordForStoringInConfigFile(passwd.Text, "MD5");
            }
            else
            {
                Response.Write(@"<script>alert('用户名或密码错误!');history.go(-1);</script>");
            }
        }
Example #6
0
 protected void del_Click(object sender, EventArgs e)
 {
     try
     {
         BLL_UserCollect buc = new BLL_UserCollect();
         BLL_Users       del = new BLL_Users();
         Users           us  = new Users();
         us.U_ID   = Convert.ToInt32(uid.Text);
         us.U_NAME = duname.Text;
         buc.DeleteUserCollect(Convert.ToInt32(uid.Text));
         if (del.DeleteUsers(us) > 0)
         {
             Response.Write(@"<script>alert('删除成功!');location.reload();</script>");
         }
     }
     catch
     {
         Response.Write(@"<script>alert('删除失败!');history.go(-1);</script>");
     }
 }
Example #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BCZWeb.Views.index index = new BCZWeb.Views.index();
            Users u = new Users();

            u.U_NAME     = index.Session["name"].ToString();
            u.U_PASSWORD = index.Session["pass"].ToString();
            BLL_Users bu = new BLL_Users();

            bu.select(u);
            if (!Page.IsPostBack)
            {
                photo.ImageUrl = u.U_IMG;
                id.Text        = u.U_ID.ToString();
                Session["id"]  = id.Text;
                name.Text      = u.U_NAME;
                pass.Text      = u.U_PASSWORD;
                email.Text     = u.U_EMAIL;
                date.Text      = u.U_REGISTERTIME.ToString();
            }
        }
Example #8
0
        private void btnDK_Click(object sender, EventArgs e)
        {
            DTO_Users dto_user    = new DTO_Users();
            BLL_Users bll_user    = new BLL_Users();
            BLL_Per   b_per       = new BLL_Per();
            string    temp_urname = bll_user.Call_Get_Username_User(txtUsername.Text);

            if (txtname.Text == "" || txtpassword.Text == "" || txtemail.Text == "" || txtUsername.Text == "")
            {
                MessageBox.Show("Không được để trống bất cứ ô nào", "Thông báo", MessageBoxButtons.OK);
            }
            else if (temp_urname == txtUsername.Text)
            {
                MessageBox.Show("Tên Đăng nhập đã tồn tại, vui lòng nhập vào tên đăng nhập khác", "Thông báo", MessageBoxButtons.OK);
                txtUsername.Focus();
            }
            else
            {
                try
                {
                    dto_user.F_Username = txtUsername.Text;
                    dto_user.F_Password = txtpassword.Text;
                    dto_user.F_Name     = txtname.Text;
                    dto_user.F_DOB      = DateTime.Parse(dtdbo.Text);
                    dto_user.F_Email    = txtemail.Text;
                    bll_user.Call_Insert_User(dto_user);
                    //
                    int id = bll_user.Call_Get_ID_User(txtUsername.Text);
                    b_per.Call_Insert_per(id);
                    MessageBox.Show("successful");
                    this.Close();
                }
                catch (Exception ee)
                {
                    MessageBox.Show(ee.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }