示例#1
0
        protected void Btn_submit_Click(object sender, EventArgs e)
        {
            Model.Users users = new Model.Users();
            users.userName = txbUserName.Text;
            users.password = txbPassword1.Text;
            users.gender   = DropDownList1.SelectedItem.Text;

            string date = DropDownListYear.SelectedItem.Text.Trim().ToString() + "/" + DropDownListMonth.SelectedItem.Text.Trim().ToString() + "/" + DropDownListDay.SelectedItem.Text.Trim().ToString();
            //string dateString = date;
            //DateTime dt = DateTime.ParseExact(dateString, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
            //users.birthDate = dt;
            DateTime time = Convert.ToDateTime(date);

            users.birthDate = time;
            //users.birthDate = Convert.ToDateTime("1985-12-25");

            BLL.UsersManager users1 = new UsersManager();
            bool             bo     = users1.Add(users);

            if (bo == true)
            {
                Response.Redirect("~/Default.aspx");
            }
            else
            {
                Response.Write("<script language=javascript>alert('注册失败!')");
            }
        }
示例#2
0
        protected void Btn_Register_Click(object sender, EventArgs e)
        {
            Model.Users users = new Model.Users();
            users.userName = txbUserName.Text;
            users.password = txbPassword1.Text;
            users.gender   = DropDownList1.SelectedItem.Text;

            string date = DropDownListYear.SelectedItem.Text.Trim().ToString() + "/" + DropDownListMonth.SelectedItem.Text.Trim().ToString() + "/" + DropDownListDay.SelectedItem.Text.Trim().ToString();

            DateTime time = Convert.ToDateTime(date);

            users.birthDate = time;


            BLL.UsersManager users1 = new UsersManager();

            bool bo = users1.Add(users);

            if (bo == true)
            {
                string  str = "username='******'";
                DataSet ds  = users1.GetList(str);
                Session["userID"]   = ds.Tables[0].Rows[0]["UserID"].ToString();
                Session["username"] = txbUserName.Text.Trim();
                Response.Redirect("~/Users/Question.aspx");
            }
            else
            {
                Response.Write("<script language=javascript>alert('注册失败!')");
            }
        }
        protected void btnOK_Click(object sender, EventArgs e)
        {
            //获取用户输入的数据
            string userName = txtUserName.Text.Trim();
            string userPwd  = txtUserPwd.Text.Trim();
            int    status   = Convert.ToInt32(ddlStatus.SelectedValue);

            //添加用户
            //1、构造用户实体对象
            Users model = new Users();

            model.UserName = userName;
            model.UserPwd  = userPwd;
            model.Status   = status;

            //2、调用业务逻辑层添加用户
            int result = bll.Add(model);

            if (result > 0)
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('添加用户成功!');window.location.href='UsersList.aspx'</script>");
            }
            else
            {
                if (result == -1)
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('用户名已存在!')</script>");
                }
                else
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('添加用户失败!')</script>");
                }
            }
        }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (AuthCode1.IsMatch)
     {
         Model.Users user = new Model.Users();
         user.LoginId     = txtLoginId.Text.Trim();
         user.LoginPwd    = txtLoginPwd.Text.Trim();
         user.Name        = txtName.Text.Trim();
         user.Mail        = txtEmail.Text.Trim();
         user.Address     = txtAddress.Text.Trim();
         user.Phone       = txtPhoneNum.Text.Trim();
         user.UserRoleId  = 1; //1为普通用户
         user.UserStateId = 1; //1为无效用户,需要管理员开通
         UsersManager usersManager = new UsersManager();
         int          id           = usersManager.Add(user);
         if (id > 0)
         {
             Response.Redirect("Login.aspx");
         }
     }
     else
     {
         ClientScript.RegisterStartupScript(GetType(), "authResult", "alert(\"验证码输入错误!\")", true);
     }
 }
示例#5
0
        private static void UserAddition(UsersManager userManager)
        {
            Console.WriteLine("First Name: ");
            string userNameForAdd = Console.ReadLine();

            Console.WriteLine("Last Name: ");
            string userSurnameForAdd = Console.ReadLine();

            Console.WriteLine("Email Name: ");
            string userEmailForAdd = Console.ReadLine();

            Console.WriteLine("Password Name: ");
            string userPasswordForAdd = Console.ReadLine();


            User userForAdd = new User
            {
                FirstName = userNameForAdd,
                LastName  = userSurnameForAdd,
                Email     = userEmailForAdd,
                Password  = userPasswordForAdd
            };

            userManager.Add(userForAdd);
        }
示例#6
0
        private static void UserAdd()
        {
            UsersManager userManager = new UsersManager(new EfUserDal());

            userManager.Add(new Users {
                FirstName = "Yılmaz", LastName = "İyigün", Email = "yilmaz@yilmaz", Password = "******"
            });
        }
示例#7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Core.Entity.Users users = new Core.Entity.Users();
            users.UserName = txtUserName.Text;
            users.Password = txtPassword.Text;
            users.IsActive = chkIsActive.Checked;
            users.RoleId   = Convert.ToInt32(ddlRole.SelectedValue);

            usersManager.Add(users);
            BindUsersGrid();
            ResetControls();
        }
示例#8
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            int A = Convert.ToInt16(txtID.Text);

            if (txtPsw.Text == txtPswOK.Text)
            {
                UsersManager.Add(A, txtName.Text, txtPsw.Text);
                lblMess.Text = "注册成功。";
            }
            else
            {
            }
        }
示例#9
0
        public JsonResult AddUser(Users user)
        {
            UsersManager usersManager = new UsersManager();
            var          result       = usersManager.Add(user);
            var          fromAddress  = "*****@*****.**";
            var          toAddress    = result.EmailId;

            string subject = "Daily Status Report";
            string body    = "Welcome: " + result.UserName + "\n";

            body += "LogIn Id: " + result.LoginId + "\n";
            body += "Password: \n" + result.Password + "\n";


            SendEmail.SendingMail(fromAddress, toAddress, subject, body);
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#10
0
        private static void UsersTest()
        {
            UsersManager user = new UsersManager(new EfUsersDal());

            user.Add(new Users {
                FirstName = "Sena", LastName = "Sakallı", Email = "*****@*****.**", Password = "******"
            });

            var result = user.GetAll();

            if (result.Success)
            {
                foreach (var u in result.Data)
                {
                    System.Console.WriteLine(u.FirstName + " " + u.LastName);
                }
            }
        }
示例#11
0
        private void GenerateDemoEmployeesAndUsers(int numberOfEmployees = 20)
        {
            Employee employee;

            for (int i = 1; i <= numberOfEmployees; i++)
            {
                employee = _employeesManager.Add(
                    new Employee(GUIUtils.GetRandomFirstName(), GUIUtils.GetRandomLastName()));

                _usersManager.Add(new User(
                                      employee.EmployeeID,
                                      i == 1 ? UserType.Manager : i < 5 ? UserType.Supervisor : UserType.Worker)
                {
                    UserName = $"user{i:D2}",
                    Password = $"pass{i:D2}"
                }
                                  );
            }
        }
示例#12
0
 public int Add(Users u)
 {
     return(dal.Add(u));
 }