Ejemplo n.º 1
0
        private void AddAgent()
        {
            new System.Threading.Thread(() =>
            {
                Classes.AgentManager agentManager = new Classes.AgentManager();

                if (agentManager.CanAddAgent(GetEmail()))
                {
                    SetLoadingState(true);

                    if (agentManager.AddAgent(GetName(), GetSurname(), GetPhone(), GetEmail(), GetPassword()))
                    {
                        DisplayNotifyBox("Agent 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 AddAgent()
        {
            new System.Threading.Thread(() =>
            {
                Classes.AgentManager agentManager = new Classes.AgentManager();

                if (agentManager.CanAddAgent(GetEmail()))
                {
                    SetLoadingState(true);

                    if (agentManager.AddAgent(GetName(), GetSurname(), GetPhone(), GetEmail(), GetPassword()))
                    {
                        DisplayNotifyBox("Agent 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();
        }
Ejemplo n.º 3
0
        private void EditEmail(string email, string newEmail)
        {
            Classes.AgentManager agentManager = new Classes.AgentManager();

            if (agentManager.CanAddAgent(newEmail))
            {
                new System.Threading.Thread(() =>
                {
                    SetLoadingState(true);

                    if (agentManager.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);
            }
        }
Ejemplo n.º 4
0
        private void DeleteAgent()
        {
            new System.Threading.Thread(() =>
            {
                Classes.AgentManager agentManager = new Classes.AgentManager();

                if (agentManager.DeleteAgent(GetSelectedEmail()))
                {
                    DisplayNotifyBox("Deleted", "The record has been deleted", 3);
                }
                else
                {
                    DisplayNotifyBox("Not Deleted", GetSelectedName() + " " + GetSelectedSurname() + " has not been deleted", 3);
                }
            }).Start();
        }
        private void AddAgent()
        {
            new System.Threading.Thread(() =>
            {
                Classes.AgentManager agentManager = new Classes.AgentManager();

                if (agentManager.CanAddAgent(GetEmail()))
                {
                    SetLoadingState(true);

                    Classes.Validation valid = new Classes.Validation();
                    if (valid.TextIsShorterThan(GetName(), 32) && valid.TextIsShorterThan(GetSurname(), 32) && valid.TextIsShorterThan(GetPhone(), 12))
                    {
                        if (valid.IsTextNumeric(GetPhone()))
                        {
                            if (agentManager.AddAgent(GetName(), GetSurname(), GetPhone(), GetEmail(), GetPassword()))
                            {
                                DisplayNotifyBox("Agent Added", GetName() + " has been successfully added", 5);

                            }
                            else
                            {
                                DisplayNotifyBox("ERROR", "Could not add " + GetName(), 2);
                            }
                        }
                        else
                        {
                            DisplayNotifyBox("ERROR", "Please use a valid cellphone number with local 099 999 999 format", 10);
                        }
                    }
                    else
                    {
                        DisplayNotifyBox("ERROR", "Please ensure all fields have lengths shorter than 32 characters", 10);
                    }
                    ClearForm();
                }
                else
                {
                    DisplayNotifyBox("Username Exists Already", "Cannot add " + GetName() + ", the email " + GetEmail() + " exits already", 3);
                }

                SetLoadingState(false);
            }).Start();
        }
        private void AddAgent()
        {
            new System.Threading.Thread(() =>
            {
                Classes.AgentManager agentManager = new Classes.AgentManager();

                if (agentManager.CanAddAgent(GetEmail()))
                {
                    SetLoadingState(true);

                    Classes.Validation valid = new Classes.Validation();
                    if (valid.TextIsShorterThan(GetName(), 32) && valid.TextIsShorterThan(GetSurname(), 32) && valid.TextIsShorterThan(GetPhone(), 12))
                    {
                        if (valid.IsTextNumeric(GetPhone()))
                        {
                            if (agentManager.AddAgent(GetName(), GetSurname(), GetPhone(), GetEmail(), GetPassword()))
                            {
                                DisplayNotifyBox("Agent Added", GetName() + " has been successfully added", 5);
                            }
                            else
                            {
                                DisplayNotifyBox("ERROR", "Could not add " + GetName(), 2);
                            }
                        }
                        else
                        {
                            DisplayNotifyBox("ERROR", "Please use a valid cellphone number with local 099 999 999 format", 10);
                        }
                    }
                    else
                    {
                        DisplayNotifyBox("ERROR", "Please ensure all fields have lengths shorter than 32 characters", 10);
                    }
                    ClearForm();
                }
                else
                {
                    DisplayNotifyBox("Username Exists Already", "Cannot add " + GetName() + ", the email " + GetEmail() + " exits already", 3);
                }

                SetLoadingState(false);
            }).Start();
        }
Ejemplo n.º 7
0
        private void EditPassword(string email, string password)
        {
            new System.Threading.Thread(() =>
            {
                SetLoadingState(true);

                Classes.AgentManager agentManager = new Classes.AgentManager();

                if (agentManager.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();
        }
Ejemplo n.º 8
0
        private void EditSurname(string email, string surname)
        {
            new System.Threading.Thread(() =>
            {
                SetLoadingState(true);

                Classes.AgentManager agentManager = new Classes.AgentManager();

                if (agentManager.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 EditSurname(string email, string surname)
        {
            new System.Threading.Thread(() =>
            {
                SetLoadingState(true);

                Classes.AgentManager agentManager = new Classes.AgentManager();

                if (agentManager.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.AgentManager agentManager = new Classes.AgentManager();

                if (agentManager.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();
        }
        private void EditEmail(string email, string newEmail)
        {
            Classes.AgentManager agentManager = new Classes.AgentManager();

            if (agentManager.CanAddAgent(newEmail))
            {
                new System.Threading.Thread(() =>
                {
                    SetLoadingState(true);

                    if (agentManager.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);
            }
        }