private void EditEmail(string email, string newEmail) { Classes.ClientManager clientManager = new Classes.ClientManager(); if (clientManager.CanAddClient(newEmail)) { new System.Threading.Thread(() => { SetLoadingState(true); if (clientManager.EditEmail(email, newEmail)) { DisplayNotifyBox("Edited", "Email changed to " + newEmail, 5); } else { edited = false; DisplayNotifyBox("Could not edit", "En error occured while trying to change email. Please try again later", 5); } SetLoadingState(false); }).Start(); } else { edited = false; DisplayNotifyBox("Could not edit", "Cannot change " + email + " to " + newEmail + " because " + newEmail + " already exists", 4); } }
private void AddClient() { new System.Threading.Thread(() => { Classes.ClientManager clientManager = new Classes.ClientManager(); if (clientManager.CanAddClient(GetEmail())) { SetLoadingState(true); if (clientManager.AddClient(GetName(), GetSurname(), GetPhone(), GetEmail(), GetPassword())) { DisplayNotifyBox("Client Added", GetName() + " has been successfully added", 2); } else { DisplayNotifyBox("ERROR", "Could not add " + GetName(), 2); } ClearForm(); } else { DisplayNotifyBox("Username Exists Already", "Cannot add " + GetName() + ", the email " + GetEmail() + " exits already", 3); } SetLoadingState(false); }).Start(); }
private void DeleteClient() { new System.Threading.Thread(() => { Classes.ClientManager clientManager = new Classes.ClientManager(); if (clientManager.DeleteClient(GetSelectedEmail())) { DisplayNotifyBox("Deleted", "The record has been deleted", 3); } else { DisplayNotifyBox("Not Deleted", GetSelectedName() + " " + GetSelectedSurname() + " has not been deleted", 3); } }).Start(); }
private void EditPassword(string email, string password) { new System.Threading.Thread(() => { SetLoadingState(true); Classes.ClientManager clientManager = new Classes.ClientManager(); if (clientManager.EditPassword(email, password)) { DisplayNotifyBox("Edited", "Password changed to " + password, 5); } else { edited = false; DisplayNotifyBox("Could not edit", "En error occured while trying to change password. Please try again later", 5); } SetLoadingState(false); }).Start(); }
private void EditSurname(string email, string surname) { new System.Threading.Thread(() => { SetLoadingState(true); Classes.ClientManager clientManager = new Classes.ClientManager(); if (clientManager.EditSurname(email, surname)) { DisplayNotifyBox("Edited", "Surname changed to " + surname, 5); } else { edited = false; DisplayNotifyBox("Could not edit", "En error occured while trying to change surname. Please try again later", 5); } SetLoadingState(false); }).Start(); }
private void EditPassword(string email, string password) { new System.Threading.Thread(() => { SetLoadingState(true); Classes.ClientManager clientManager = new Classes.ClientManager(); if (clientManager.EditPassword(email, password)) { DisplayNotifyBox("Edited", "Password changed", 5); } else { edited = false; DisplayNotifyBox("Could not edit", "En error occured while trying to change password. Please try again later", 5); } SetLoadingState(false); }).Start(); }