// GET: Admin/User public ActionResult Index() { var usersAccess = new UsersAccess(); var users = usersAccess.ReadUsers(); return(View(users)); }
public ActionResult Trash() { var usersAccess = new UsersAccess(); var users = usersAccess.GetUsersInTrash(); return(View(users)); }
public ActionResult Create(Users users) { if (ModelState.IsValid) { var user = new UsersAccess(); users.Password = Encryptor.MD5Hash(users.Password); var sess = (UserLogin)Session[CommonConstant.USER_SESSION]; users.CreatedBy = sess.Username; users.CreatedDate = DateTime.Now; users.ModifiedBy = sess.Username; users.ModifiedDate = DateTime.Now; long id = user.CreateUser(users); if (id > 0) { return(RedirectToAction("Index", "User")); } else if (id == 0) { ModelState.AddModelError("", "Tên tài khoản đã tồn tại"); } else { ModelState.AddModelError("", "Thêm người dùng thất bại"); } } return(View("Create")); }
public ActionResult Update(int id) { var usersAccess = new UsersAccess(); var user = usersAccess.GetUserById(id); return(View(user)); }
public ActionResult Status(int id) { var usersAccess = new UsersAccess(); var sess = (UserLogin)Session[CommonConstant.USER_SESSION]; usersAccess.Status(id, sess.Username); return(RedirectToAction("Index")); }
public AddMembersWindow(int chatroomId) { InitializeComponent(); this.users = new UsersAccess(); this.messenger = new MessengerAccess(); this.chatroomId = chatroomId; GetAllUsers(); }
public static void Initialize(TestContext context) { testHelpers = new TestHelpers(); usersAccess = new UsersAccess(); db = ContextProvider.Instance.DB; testHelpers.ClearData(); testHelpers.InsertTestData(); }
public ActionResult ReTrash(int id) { var usersAccess = new UsersAccess(); var user = usersAccess.GetUserById(id); var sess = (UserLogin)Session[CommonConstant.USER_SESSION]; user.ModifiedBy = sess.Username; usersAccess.ReTrash(id); return(RedirectToAction("Trash")); }
private void btnSave_Click(object sender, EventArgs e) { int EmployeeID = Convert.ToInt32(cmbEmployees.EditValue); var x = db.Users.Find(EmployeeID); if (x != null) { XtraMessageBox.Show("هذا الموظف مسجل كمستخدم بالفعل", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (!valPassword.Validate()) { return; } var emp = db.Employees.Find(EmployeeID); User u = new User() { EmployeeID = Convert.ToInt32(cmbEmployees.EditValue), UserName = cmbEmployees.Text, Password = txtPassword.Text, CardNumber = emp.CardNumber, }; db.Users.Add(u); db.SaveChanges(); UsersAccess ua = new UsersAccess() { UserID = u.EmployeeID, AddNewTrainee = Convert.ToBoolean(AddNewTraineeCheckEdit.EditValue), SearchMen = Convert.ToBoolean(SearchMenCheckEdit.EditValue), SearchWomen = Convert.ToBoolean(SearchWomenCheckEdit.EditValue), AddOffer = Convert.ToBoolean(AddOfferCheckEdit.EditValue), EditOffer = Convert.ToBoolean(EditOfferCheckEdit.EditValue), ShowTrainees = Convert.ToBoolean(ShowTraineesCheckEdit.EditValue), CancelTraineeProfile = Convert.ToBoolean(CancelTraineeProfileCheckEdit.EditValue), AddIncomeOutCome = Convert.ToBoolean(AddIncomeOutComeCheckEdit.EditValue), Settings = Convert.ToBoolean(SettingsCheckEdit.EditValue), EditTraineeProfile = Convert.ToBoolean(EditTraineeProfileCheckEdit.EditValue), Reports = Convert.ToBoolean(ReportsCheckEdit.EditValue), NewIncomeOutCome = Convert.ToBoolean(NewIncomeOutComeCheckEdit.EditValue), AddNewUser = Convert.ToBoolean(AddNewUserCheckEdit.EditValue), EditUsers = Convert.ToBoolean(EditUsersCheckEdit.EditValue), DeleteTrainee = Convert.ToBoolean(DeleteTraineeCheckEdit.EditValue), FreezeTrainee = Convert.ToBoolean(FreezeTraineeCheckEdit.EditValue) }; db.UsersAccesses.Add(ua); db.SaveChanges(); XtraMessageBox.Show("تم إضافة المستخدم", "إضافة", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); }
public static int SqlBulkCopyBatchInsert(List <Users> list, int count) { try { using (var access = new UsersAccess()) { return(access.SqlBulkCopyBatchInsert(list, count)); } } catch (Exception ex) { throw ex; } }
/// <summary> /// /// </summary> /// <param name="order">列名,分页排序字段,可支持多字段,多顺序</param> /// <param name="whereStr">以 where 开头</param> /// <returns></returns> public static IList <Users> SelectPage(string cloumns, string order, string whereStr, int pageIndex, int pageSize, out int rowCount) { try { using (var access = new UsersAccess()) { return(access.SelectPage(cloumns, order, whereStr, pageIndex, pageSize, out rowCount)); } } catch (Exception ex) { throw ex; } }
/// <summary> /// /// </summary> /// <param name="whereStr">以where 开始</param> /// <returns></returns> public static IList <Users> Select(string whereStr) { try { using (var access = new UsersAccess()) { return(access.Select(whereStr)); } } catch (Exception ex) { throw ex; } }
public static Users SelectObject(int id) { try { using (var access = new UsersAccess()) { return(access.SelectObject(id)); } } catch (Exception ex) { throw ex; } }
public static int Update(Users obj) { try { using (var access = new UsersAccess()) { return(access.Update(obj)); } } catch (Exception ex) { throw ex; } }
public static int Delete(int id) { try { using (var access = new UsersAccess()) { return(access.Delete(id)); } } catch (Exception ex) { throw ex; } }
public ActionResult Delete(int id) { var usersAccess = new UsersAccess(); var user = usersAccess.GetUserById(id); var sess = (UserLogin)Session[CommonConstant.USER_SESSION]; user.ModifiedBy = sess.Username; var result = usersAccess.DeleteUser(id); if (result) { ViewBag.Message = "Xóa " + user.Username + " thành công"; } return(RedirectToAction("Index")); }
public MainWindow() { InitializeComponent(); AuthenticationDialogWindow authenticationDialog = new AuthenticationDialogWindow(); authenticationDialog.ShowDialog(); this.user = authenticationDialog.User; if (this.user == null) { Environment.Exit(0); } this.messenger = new MessengerAccess(); this.users = new UsersAccess(); GenerateAllChatrooms(); this.chatHub = new ChatHub(); }
public ActionResult News() { var manager = UsersAccess.getUserManager(); ApplicationUser user = manager.FindById(User.Identity.GetUserId()); if (user != null) { if (user.UnreadNewsCount > 0) { user.UnreadNewsCount = 0; manager.UpdateAsync(user); db.SaveChanges(); } } var newsList = db.News.ToList(); return(View(newsList)); }
public ActionResult SignIn(SignInModel signInModel) { if (ModelState.IsValid) { var user = new UsersAccess(); // kiểm tra người dùng là admin hay customer var check = user.GetUserByUsername(signInModel.Username); if (check.Authorization == 1) { var result = user.SignIn(signInModel.Username, Encryptor.MD5Hash(signInModel.Password)); if (result == 1) { var u = user.GetUserByUsername(signInModel.Username); var userSession = new UserLogin(); userSession.Username = u.Username; userSession.UserId = u.Id; Session.Add(CommonConstant.USER_SESSION, userSession); return(RedirectToAction("Index", "Home")); } else if (result == 0) { ModelState.AddModelError("", "Tài khoản không tồn tại"); } else if (result == 2) { ModelState.AddModelError("", "Tài khoản đã bị khóa"); } else if (result == -1) { ModelState.AddModelError("", "Tài khoản hoặc mật khẩu không đúng"); } else { ModelState.AddModelError("", "Đăng nhập không thành công"); } } else { ModelState.AddModelError("", "Bạn không có quyền đăng nhập"); } } return(View("Index")); }
public ActionResult Update(Users users) { if (ModelState.IsValid) { var user = new UsersAccess(); if (!string.IsNullOrEmpty(users.Password)) { users.Password = Encryptor.MD5Hash(users.Password); } var sess = (UserLogin)Session[CommonConstant.USER_SESSION]; users.ModifiedBy = sess.Username; bool result = user.UpdateUser(users); if (result) { return(RedirectToAction("Index", "User")); } else { ModelState.AddModelError("", "Cập nhật người dùng thất bại"); } } return(View("Update")); }
public void BaseUsuariosContenidoTest() { UsersAccess usersAccess = new UsersAccess(); Assert.IsTrue(!string.IsNullOrEmpty(usersAccess.ListarUnUsuario().Nombre)); }
protected ApplicationUser getUser() { return(UsersAccess.getUserManager().FindById(User.Identity.GetUserId())); }
public UserController() { usersAccess = new UsersAccess(); skillController = new SkillController(); applicationController = new ApplicationController(); }
public void BaseUsuariosConexionTest() { UsersAccess usersAccess = new UsersAccess(); Assert.IsTrue(usersAccess.TestConnection()); }
public List <Users> ListarUsuarios() { UsersAccess usersAccess = new UsersAccess(); return(usersAccess.ListarUsuarios()); }
public AuthenticationDialogWindow() { InitializeComponent(); this.users = new UsersAccess(); }
public CivMoneyUsers() { _usersDataBaseAccess = new UsersAccess(new CivMoneyContextFactory()); }