public ActionResult Add(Music.Model.EF.User user, HttpPostedFileBase IMG) { user.user_bin = false; if (user.user_active != true && user.user_active != false) { user.user_active = false; } //Chèn ảnh if (IMG != null) { var code = Guid.NewGuid().ToString(); var img = new FilesController(); img.AddImages(IMG, Common.Link.IMG_USER, code); user.user_img = code + IMG.FileName; } else { user.user_img = "notImg.png"; } if (usersDAO.Add(user)) { return(Redirect("/Admin/UsersAdmin")); } else { return(Redirect(Common.Link.NOT_404)); } }
/// เพิ่มข้อมูลพนักงาน /// public ActionResult InsertEmployees() { UsersModel uModel = new UsersModel(); uModel.USERNAME = Request.Params["username"].Trim().ToLower(); uModel.PASSWORD = Request.Params["password"]; uModel.ID_CARD = Request.Params["ID_CARD"].Trim(); uModel.NAME = Request.Params["name"]; uModel.LASTNAME = Request.Params["lname"]; uModel.TEL = Request.Params["tel"].Trim(); uModel.EMAIL = Request.Params["email"].Trim(); uModel.ADDRESS = Request.Params["addr"].Trim(); uModel.START_WORK = Convert.ToDateTime(Request.Params["start_work"]); uModel.SALARY = Request.Params["salary"].Trim(); uModel.USER_UID = UID.ranByLen(8); uModel.PRIORITY = new PriorityModel(); uModel.PRIORITY.PRIO_ID = 2; Database db = new Database(); UsersDAO uDAO = new UsersDAO(db); uDAO.Add(uModel); db.Close(); return(RedirectToAction("ManageEmployees")); }
private void SaveData() { try { if (CheckValidity()) { Users oUser = new Users(); oUser.Name = txtLoginName.Text.Trim(); oUser.Password = txtPassword.Text.Trim(); oUser.HasDiscountRight = chkDiscount.Checked; oUser.HasRefundright = chkRefund.Checked; oUser.IsLoggedIn = false; oUser.EnteredBy = MDIParent.userId; oUser.UpdatedBy = storeId; oUser.EnteredTime = DateTime.Now; oUser.FirstName = cmbEmployee.SelectedValue.ToString(); oUser.LastName = cmbDesignation.SelectedValue.ToString(); oUser.Email = cmbStatus.SelectedItem.ToString(); DataTable storeE = oUsersDAO.Store_GetById(Convert.ToInt32(cmbStore.SelectedValue)); oUser.projectId = Convert.ToInt32(storeE.Rows[0][5].ToString()); if (btnAdd.Text == "UPDATE") { oUser.UserId = int.Parse(txtUserID.Text); oUsersDAO.Update(oUser); BindGrid(); } else if (btnAdd.Text == "ADD") { int iUserId = oUsersDAO.Add(oUser); BindGrid(); } AddMode(); } } catch (Exception exc) { if (btnAdd.Text == "UPDATE") { Alert(exc.Message + "User information did not updated successfully."); } else { Alert(exc.Message + "User information did not added successfully."); } } }
public IActionResult Add(VMAdminUser ViewModel) { ViewModel.Admin.ClinicID = Convert.ToInt32(HttpContext.Session.GetInt32("clinicId")); var adminId = AdministratorsDAO.Add(ViewModel.Admin); if (adminId > 0) { ViewModel.User.ID = adminId; UsersDAO.Add(ViewModel.User); return(RedirectToAction("Details", new { id = adminId })); } ViewBag.Types = UsersDAO.GetTypes().Where(t => t.Name != "DEV" && t.Name != "DENTIST"); return(View(ViewModel)); }
public ActionResult Add(User user, HttpPostedFileBase IMG, string del) { //Cập nhật có thay đổi user.user_option = true; user.user_bin = false; //Kiem tra thay đổi value if (user.user_active != true && user.user_active != false) { user.user_active = false; } //Hinh ảnh if (IMG != null) { var code = Guid.NewGuid().ToString(); var img = new ImagesController(); img.AddImages(IMG, Common.Link.IMG_USER, code); user.user_img = code + IMG.FileName; } else { user.user_img = "notImg.png"; } var dao = new UsersDAO(); var j = new JsonAdminController(); if (dao.Add(user)) { return(Redirect("/Admin/UsersAdmin")); } else { return(Redirect(Common.Link.NOT_404)); } }
public ActionResult Registration(ViewRegister register) { if (ModelState.IsValid) { if (db.Users.SingleOrDefault(t => t.user_email == register.Email) != null) { TempData["noti_register"] = "Email đã tồn tại!"; return(View(register)); } var user = new User() { user_email = register.Email, user_pass = register.Password, user_name = register.DisplayName }; user.role_id = 1; usersDAO.Add(user); return(RedirectToAction("Login")); } return(View(register)); }
public IActionResult Add(VMDentistUser ViewModel) { string error = string.Empty; if (UsersDAO.EmailRepeated(ViewModel.User)) { error += "Este e-mail já está sendo utilizado por outro usuário do sistema;"; } if (string.IsNullOrEmpty(ViewModel.User.Password)) { error += "Informe uma senha de acesso para o dentista;"; } ViewModel.Dentist.ClinicID = Convert.ToInt32(HttpContext.Session.GetInt32("clinicId")); int dentistId = DentistsDAO.Add(ViewModel.Dentist); if (dentistId == -1) { error += "Este CPF já foi cadastrado;"; } if (!string.IsNullOrEmpty(error)) { ViewData["Section"] = "Dentistas"; ViewData["Action"] = "Criar Novo"; ViewBag.Types = UsersDAO.GetTypes(); ViewBag.Error = error; return(View(ViewModel)); } ViewModel.User.ID = dentistId; UsersDAO.Add(ViewModel.User); return(RedirectToAction("Details", new { id = dentistId })); }
public bool Add(Users u) { return(UserDao.Add(u)); }
public int Add(Users u) { return(uDAO.Add(u)); }
public void TestAdd(Users u) { Assert.Positive(userDAO.Add(u)); //Nếu giá trị trả về >0 là đúng }