public static void FillUserInformation(int UserID, TextBox Tele, TextBox Email) { var user = UserHandling.GetUser(UserID); Tele.Text = user.phone; Email.Text = user.email; }
private void Button_Click_1(object sender, RoutedEventArgs e) { var userinput = tbxUser.Text; var passwordinput = pbxPassword.Password; if (userinput.Trim() == "" || passwordinput.Trim() == "") { MessageBox.Show("Fyll i alla fälten"); } else { int value; if (int.TryParse(userinput, out value)) { var user = HandleItems.GetUser(value); if (user.userID.Equals(value) && user.password.Equals(passwordinput)) { Application.Current.Properties["currentUser"] = user; Application.Current.Properties["currentUser"] = UserHandling.GetUser(value); var rapport = new RapportHantering(); rapport.Show(); Close(); } else { MessageBox.Show("Inlogg eller lösenord fel"); } } else { MessageBox.Show("Fyll i alla fälten"); } } }
public static void ChangePassword(int user, PasswordBox newPasswordOne, PasswordBox newPasswordTwo, PasswordBox OldPassword) { if (Validering.CheckIf3Password(newPasswordOne, newPasswordTwo, OldPassword)) { var userNow = UserHandling.GetUser(user); if (userNow.password != OldPassword.Password) { MessageBox.Show("Du har angivit fel lösenord"); } else if (newPasswordOne.Password != newPasswordTwo.Password) { MessageBox.Show("Lösenorden stämmer inte överens"); } else { userNow.password = newPasswordOne.Password; UserHandling.UpdateUser(userNow); MessageBox.Show("Lösenordet har ändrats"); newPasswordOne.Password = ""; newPasswordTwo.Password = ""; OldPassword.Password = ""; } } }
private void LoadMenu() { Myuser = new UserHandling(Program.AccountStatic.LoggingAsLocal); DataTable tb = Myuser.GetMenuObjectList(0, 0); if (tb != null) { int mcy = 0; foreach (DataRow r in tb.Rows) { TreeNode trn = new TreeNode(); trn.Name = r["ObgfileName"].ToString(); trn.Text = r["ObgDisplayName"].ToString(); int MainobgID = int.Parse(r["SysID"].ToString()); TreeMenu.Nodes.Add(trn); TreeMenu.Nodes[mcy].ImageIndex = int.Parse(r["IconID"].ToString()); mcy++; DataTable tb1 = Myuser.GetMenuObjectList(MainobgID, 1); // tb1 = Myuser.GetMenuObjectList(MainobgID, 1); if (tb1 != null) { int Nount1 = TreeMenu.Nodes.Count - 1; int Secline = 0; foreach (DataRow r1 in tb1.Rows) { TreeNode trn2 = new TreeNode(); trn2.Name = r1["ObgfileName"].ToString(); trn2.Text = r1["ObgDisplayName"].ToString(); MainobgID = int.Parse(r1["SysID"].ToString()); TreeMenu.Nodes[Nount1].Nodes.Add(trn2); TreeMenu.Nodes[Nount1].Nodes[Secline].ImageIndex = int.Parse(r1["IconID"].ToString()); int MainobgID1 = int.Parse(r["SysID"].ToString()); Secline++; DataTable tb2; // Myuser.GetMenuObjectList(0, 0); tb2 = Myuser.GetMenuObjectList(MainobgID, 2); int Nount2 = TreeMenu.Nodes[Nount1].Nodes.Count - 1; if (tb2 != null) { int imx1 = 0; foreach (DataRow r2 in tb2.Rows) { TreeNode trn3 = new TreeNode(); trn3.Name = r2["ObgfileName"].ToString(); trn3.Text = r2["ObgDisplayName"].ToString(); MainobgID = int.Parse(r2["SysID"].ToString()); TreeMenu.Nodes[Nount1].Nodes[Nount2].Nodes.Add(trn3); TreeMenu.Nodes[Nount1].Nodes[Nount2].Nodes[imx1].ImageIndex = int.Parse(r2["IconID"].ToString()); imx1++; } } } } } } }
public static void UpdateUser(int UserID, TextBox Tele, TextBox Email) { if (Validering.CheckIf2Empty(Tele, Email)) { var user = UserHandling.GetUser(UserID); user.phone = Tele.Text; user.email = Email.Text; UserHandling.UpdateUser(user); MessageBox.Show("Uppgifter sparade"); Tele.Text = ""; Email.Text = ""; } }
public static void AddNewUser(UserModel userModel) { var user = new User(); user.firstname = userModel.firstname; user.lastname = userModel.lastname; user.password = userModel.password; user.email = userModel.email; user.phone = userModel.phone; user.boss = null; UserHandling.AddUser(user); }
public static void DeleteUser(int userId, ComboBox cb) { var checkIfBoss = UserHandling.CheckIfBoss(userId); if (checkIfBoss != null) { UserHandling.DeleteBosses(userId); //UserHandling.DeleteUsers(userID); cb.Items.Clear(); } UserHandling.DeleteUsers(userId); cb.Items.Clear(); }
private void rbt3Sfab_CheckedChanged(object sender, EventArgs e) { try { WrireConf("network"); Program.AccountStatic.LoggingAsLocal = false; MyUser = new UserHandling(Program.AccountStatic.LoggingAsLocal); MyGeneral = new CommonOperations(Program.AccountStatic.LoggingAsLocal); MyGeneral.LoadCompany(cmbCompanyName); } catch (Exception ex) { } }
public RapportHantering() { InitializeComponent(); HandleItems.FillBossList(cbBosses); LoadReseUtlägg(); HandleItems.FillCbsWithCountries(cbCountryArrival, cbCountryDeparture); HandleItems.FillListBoxWithAwaitingApproval(lbReportsDenied); var bosses = UserHandling.getBosses(); for (int i = 0; i < bosses.Count; i++) { if (bosses[i].userID == HandleItems.GetCurrentUserId()) { bossFound = true; } } if (bossFound == false) { tab3.Visibility = Visibility.Hidden; tab4.Visibility = Visibility.Hidden; tab5.Visibility = Visibility.Hidden; } if (HandleItems.GetCurrentUserId() == 0) { tab3.Visibility = Visibility.Hidden; tab4.Visibility = Visibility.Hidden; tab5.Visibility = Visibility.Hidden; tbSearchAnstIdDenied.IsEnabled = false; btnGetReportsDenied.IsEnabled = false; tbSearchAnstIdApproved.IsEnabled = false; btnGetReportsApproved.IsEnabled = false; anvInstallningar.IsEnabled = false; } }
public UtilizadorViewController(UtilizadorContext context) { userHandling = new UserHandling(context); }
public UserController(UserContext context) { //_context = context; userHandling = new UserHandling(context); }
public static List <User> SendUserList() { return(UserHandling.GetUsers()); }
public static User GetUser(int id) { return(UserHandling.GetUser(id)); }
public static List <User> SendBossList() { return(UserHandling.getBosses()); }
public ActionResult EditThisUser(UserHandling user) { string chosenRole = Request.Form["Roles"]; bool isUserActive = bool.Parse( Request.Form["Active"].ToString() ); monster.updateBan(user.UserName, isUserActive); if (user != null) { // Prevents duplicates if (Roles.IsUserInRole(user.UserName, "Administrators")) Roles.RemoveUserFromRole(user.UserName, "Administrators"); if (Roles.IsUserInRole(user.UserName, "Professionals")) Roles.RemoveUserFromRole(user.UserName, "Professionals"); // ends if (chosenRole != "Parents") { Roles.AddUserToRole(user.UserName, chosenRole); if (Roles.IsUserInRole(user.UserName, chosenRole)) return RedirectToAction("EditUser"); else return RedirectToAction("Error", "Shared"); } } if (chosenRole == "Parents") // If selected role is Parents then nothing is done return RedirectToAction("EditUser"); else return RedirectToAction("NotFound", "Shared"); }
public UserController(UserContext context) { userHandling = new UserHandling(context); }