private bool SetPreferences()
        {
            bool flag = false;

            Classes.Validation valid = new Classes.Validation();
            this.Dispatcher.Invoke(() =>
            {
                if (valid.IsTextNumeric(TB_MinPlotSize.Text) && valid.IsTextNumeric(TB_MaxPlotSize.Text) && valid.IsTextNumeric(TB_MinHouseSize.Text) && valid.IsTextNumeric(TB_MaxHouseSize.Text) && valid.IsTextNumeric(TB_MinPrice.Text) && valid.IsTextNumeric(TB_MaxPrice.Text))
                {
                    try
                    {
                        if (valid.IsNumberInRange(Convert.ToInt32(CB_MinBedrooms.SelectedItem), 50, CB_MaxBedrooms.SelectedItem.ToString()) && valid.IsNumberInRange(Convert.ToInt32(CB_MinBathrooms.SelectedItem), 50, CB_MaxBathrooms.SelectedItem.ToString()) && valid.IsNumberInRange(Convert.ToInt32(CB_MinGarages.SelectedItem), 50, CB_MaxGarages.SelectedItem.ToString()) && valid.IsNumberInRange(Convert.ToInt32(TB_MinPlotSize.Text), 2147483645, TB_MaxPlotSize.Text) && valid.IsNumberInRange(Convert.ToInt32(TB_MinHouseSize.Text), 2147483645, TB_MaxHouseSize.Text) && valid.IsNumberInRange(Convert.ToInt32(TB_MinPrice.Text), 2147483645, TB_MaxPrice.Text))
                        {
                            minBedrooms  = Convert.ToInt32(CB_MinBedrooms.SelectedItem);
                            maxBedrooms  = Convert.ToInt32(CB_MaxBedrooms.SelectedItem);
                            minBathrooms = Convert.ToInt32(CB_MinBathrooms.SelectedItem);
                            maxBathrooms = Convert.ToInt32(CB_MaxBathrooms.SelectedItem);
                            minGarages   = Convert.ToInt32(CB_MinGarages.SelectedItem);
                            maxGarages   = Convert.ToInt32(CB_MaxGarages.SelectedItem);
                            minPlotSize  = Convert.ToInt32(TB_MinPlotSize.Text);
                            maxPlotSize  = Convert.ToInt32(TB_MaxPlotSize.Text);
                            minHouseSize = Convert.ToInt32(TB_MinHouseSize.Text);
                            maxHouseSize = Convert.ToInt32(TB_MaxHouseSize.Text);
                            minPrice     = Convert.ToInt32(TB_MinPrice.Text);
                            maxPrice     = Convert.ToInt32(TB_MaxPrice.Text);
                            hasPool      = Convert.ToInt32(CB_HasPool.SelectedIndex.ToString());
                            flag         = true;
                        }
                        else
                        {
                            DisplayNotifyBox("ERROR", "Please ensure that all min values are smaller than their corresponding max values", 10);
                        }
                    }
                    catch
                    {
                        DisplayNotifyBox("ERROR", "Please ensure that all field values are smaller than 2 147 483 645", 10);
                    }
                }
                else
                {
                    DisplayNotifyBox("ERROR", "Please ensure that the plotsize, housesize and price fields are numeric", 10);
                }
            });
            return(flag);
        }
        private void IPOctetValidation(object sender, TextCompositionEventArgs e)
        {
            bool eHandled = true;
            TextBox temp = (TextBox)sender;
            string temp_text;
            Classes.Validation validation = new Classes.Validation();

            if( validation.IsTextNumeric(e.Text) )
            {
                temp_text = temp.Text.ToString() + e.Text;
                eHandled = !validation.IsNumberInRange(0, 255, temp_text);
            }

            e.Handled = eHandled;
        }
Esempio n. 3
0
        private void IPOctetValidation(object sender, TextCompositionEventArgs e)
        {
            bool    eHandled = true;
            TextBox temp     = (TextBox)sender;
            string  temp_text;

            Classes.Validation validation = new Classes.Validation();

            if (validation.IsTextNumeric(e.Text))
            {
                temp_text = temp.Text.ToString() + e.Text;
                eHandled  = !validation.IsNumberInRange(0, 255, temp_text);
            }

            e.Handled = eHandled;
        }
        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();
        }
 private void BT_AddOffer_Click(object sender, RoutedEventArgs e)
 {
     Classes.OfferManager offerManager = new Classes.OfferManager();
     Classes.Validation valid = new Classes.Validation();
     if (valid.IsTextNumeric(TB_Price.Text) && valid.IsNumberInRange(0, 2147483645, TB_Price.Text) && valid.DateTest(TB_Price.Text))
     {
         if (offerManager.AddOffer(listID[CB_Listing.SelectedIndex], clientsID[CB_Client.SelectedIndex], Convert.ToInt32(TB_Price.Text), CB_Status.SelectedIndex, DP_Date.Text))
         {
             DisplayNotifyBox("Offer added", "The offer from " + CB_Client.SelectedItem + " has been added", 5);
             ClearAddOfferOverlay();
         }
         else
         {
             DisplayNotifyBox("ERROR", "Offer could not be added", 5);
         }
     }
     else
     {
         DisplayNotifyBox("ERROR", "Please ensure the price is numeric and lower than 2 147 483 645, and that the date is in the valid format", 5);
     }
 }
 private void BT_AddOffer_Click(object sender, RoutedEventArgs e)
 {
     Classes.OfferManager offerManager = new Classes.OfferManager();
     Classes.Validation   valid        = new Classes.Validation();
     if (valid.IsTextNumeric(TB_Price.Text) && valid.IsNumberInRange(0, 2147483645, TB_Price.Text) && valid.DateTest(TB_Price.Text))
     {
         if (offerManager.AddOffer(listID[CB_Listing.SelectedIndex], clientsID[CB_Client.SelectedIndex], Convert.ToInt32(TB_Price.Text), CB_Status.SelectedIndex, DP_Date.Text))
         {
             DisplayNotifyBox("Offer added", "The offer from " + CB_Client.SelectedItem + " has been added", 5);
             ClearAddOfferOverlay();
         }
         else
         {
             DisplayNotifyBox("ERROR", "Offer could not be added", 5);
         }
     }
     else
     {
         DisplayNotifyBox("ERROR", "Please ensure the price is numeric and lower than 2 147 483 645, and that the date is in the valid format", 5);
     }
 }
 private void BT_AddClient_Click(object sender, RoutedEventArgs e)
 {
     if (PB_ConfirmPassword.Password.ToString() == PB_Password.Password.ToString())
     {
         Classes.Validation valid = new Classes.Validation();
         if (valid.TextHasNumber(GetPassword()) && valid.TextHasSpecialChars(GetPassword()) && valid.TextIsLongerThan(GetPassword(), 8) && valid.TextIsShorterThan(GetPassword(), 32) && valid.TextContainsUpperCase(GetPassword()))
         {
             if (valid.TextIsShorterThan(GetName(), 32) && valid.TextIsShorterThan(GetSurname(), 32) && valid.TextIsShorterThan(GetPhone(), 12))
             {
                 if (valid.IsTextNumeric(GetPhone()))
                 {
                     if (valid.TextisEmail(GetEmail()) && valid.TextIsShorterThan(GetEmail(), 32))
                     {
                         AddClient();
                     }
                     else
                     {
                         DisplayNotifyBox("ERROR", "Please use a valid email address with length shorter than 32 characters", 10);
                     }
                 }
                 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);
             }
         }
         else
         {
             DisplayNotifyBox("ERROR", "Your password must contain at least one of each of the following: a special character, a number and an uppercase letter. It must also have a length of between 8 and 32 characters.", 10);
         }
     }
     else
     {
         DisplayNotifyBox("ERROR", "The passwords do not match", 2);
     }
 }
Esempio n. 9
0
 private void BT_AddClient_Click(object sender, RoutedEventArgs e)
 {
     if (PB_ConfirmPassword.Password.ToString() == PB_Password.Password.ToString())
     {
         Classes.Validation valid = new Classes.Validation();
         if (valid.TextHasNumber(GetPassword()) && valid.TextHasSpecialChars(GetPassword()) && valid.TextIsLongerThan(GetPassword(), 8) && valid.TextIsShorterThan(GetPassword(), 32) && valid.TextContainsUpperCase(GetPassword()))
         {
             if (valid.TextIsShorterThan(GetName(), 32) && valid.TextIsShorterThan(GetSurname(), 32) && valid.TextIsShorterThan(GetPhone(), 12))
             {
                 if (valid.IsTextNumeric(GetPhone()))
                 {
                     if (valid.TextisEmail(GetEmail()) && valid.TextIsShorterThan(GetEmail(), 32))
                     {
                         AddClient();
                     }
                     else
                     {
                         DisplayNotifyBox("ERROR", "Please use a valid email address with length shorter than 32 characters", 10);
                     }
                 }
                 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);
             }
         }
         else
         {
             DisplayNotifyBox("ERROR", "Your password must contain at least one of each of the following: a special character, a number and an uppercase letter. It must also have a length of between 8 and 32 characters.", 10);
         }
     }
     else
     {
         DisplayNotifyBox("ERROR", "The passwords do not match", 2);
     }
 }
        private void LoadVariablesTB()
        {
            Classes.Validation valid = new Classes.Validation();
            if (valid.TextIsShorterThan(TB_Streetname.Text, 32) && valid.TextIsShorterThan(TB_Description.Text, 300) && valid.IsTextNumeric(TB_Streetno.Text) && valid.IsTextNumeric(TB_Bedrooms.Text) && valid.IsTextNumeric(TB_Bathrooms.Text) && valid.IsTextNumeric(TB_Garages.Text) && valid.IsTextNumeric(TB_PlotSize.Text) && valid.IsTextNumeric(TB_HouseSize.Text) && valid.IsTextNumeric(TB_ListPrice.Text) && valid.IsTextNumeric(TB_Price.Text) && valid.IsTextNumeric(TB_ComplexNo.Text) )
            {
                streetName = TB_Streetname.Text;
                streetNo = Convert.ToInt32(TB_Streetno.Text);
                bedrooms = Convert.ToInt32(TB_Bedrooms.Text);
                bathrooms = Convert.ToInt32(TB_Bathrooms.Text);
                garages = Convert.ToInt32(TB_Garages.Text);
                plotSize = Convert.ToInt32(TB_PlotSize.Text);
                houseSize = Convert.ToInt32(TB_HouseSize.Text);
                propertyPrice = Convert.ToInt32(TB_ListPrice.Text);
                propertyValue = Convert.ToInt32(TB_Price.Text);
                isSold = Convert.ToInt32(CB_isSold.IsChecked);
                isNegotiable = Convert.ToInt32(CB_isNegotiable.IsChecked);
                hasPool = Convert.ToInt32(CB_hasPool.IsChecked);
                description = TB_Description.Text;

                complexName = "Null";
                complexNo = 0;

                if (CB_Complex.IsChecked == true)
                {
                    complexName = TB_ComplexName.Text;
                    complexNo = Convert.ToInt32(TB_ComplexNo.Text);
                }
            }
            else
            {
                DisplayNotifyBox("ERROR", "Invalid Input. Please ensure all text inputs are below 32 characters, 300 for the description. Also streetnumber, bedrooms, bathrooms, garages, plotsize, house size, property price and property value must be numeric", 15);
            }
        }
 private void PortValidation(object sender, TextCompositionEventArgs e)
 {
     Classes.Validation validation = new Classes.Validation();
     e.Handled = !validation.IsTextNumeric(e.Text);
 }
Esempio n. 12
0
        private void LoadVariablesTB()
        {
            Classes.Validation valid = new Classes.Validation();
            if (valid.TextIsShorterThan(TB_Streetname.Text, 32) && valid.TextIsShorterThan(TB_Description.Text, 300) && valid.IsTextNumeric(TB_Streetno.Text) && valid.IsTextNumeric(TB_Bedrooms.Text) && valid.IsTextNumeric(TB_Bathrooms.Text) && valid.IsTextNumeric(TB_Garages.Text) && valid.IsTextNumeric(TB_PlotSize.Text) && valid.IsTextNumeric(TB_HouseSize.Text) && valid.IsTextNumeric(TB_ListPrice.Text) && valid.IsTextNumeric(TB_Price.Text) && valid.IsTextNumeric(TB_ComplexNo.Text))
            {
                streetName    = TB_Streetname.Text;
                streetNo      = Convert.ToInt32(TB_Streetno.Text);
                bedrooms      = Convert.ToInt32(TB_Bedrooms.Text);
                bathrooms     = Convert.ToInt32(TB_Bathrooms.Text);
                garages       = Convert.ToInt32(TB_Garages.Text);
                plotSize      = Convert.ToInt32(TB_PlotSize.Text);
                houseSize     = Convert.ToInt32(TB_HouseSize.Text);
                propertyPrice = Convert.ToInt32(TB_ListPrice.Text);
                propertyValue = Convert.ToInt32(TB_Price.Text);
                isSold        = Convert.ToInt32(CB_isSold.IsChecked);
                isNegotiable  = Convert.ToInt32(CB_isNegotiable.IsChecked);
                hasPool       = Convert.ToInt32(CB_hasPool.IsChecked);
                description   = TB_Description.Text;

                complexName = "Null";
                complexNo   = 0;

                if (CB_Complex.IsChecked == true)
                {
                    complexName = TB_ComplexName.Text;
                    complexNo   = Convert.ToInt32(TB_ComplexNo.Text);
                }
            }
            else
            {
                DisplayNotifyBox("ERROR", "Invalid Input. Please ensure all text inputs are below 32 characters, 300 for the description. Also streetnumber, bedrooms, bathrooms, garages, plotsize, house size, property price and property value must be numeric", 15);
            }
        }
        private void BT_SaveAndClose_Click(object sender, RoutedEventArgs e)
        {
            if (editName || editSurname || editPhone || editEmail || editPassword)
            {
                Classes.Validation valid = new Classes.Validation();
                edited = true;
                if (editName)
                {
                    if (GetNewName() != "")
                    {
                        if (valid.TextIsShorterThan(GetNewName(), 32))
                        {
                            EditName(clientEmail, GetNewName());
                        }
                        else
                        {
                            DisplayNotifyBox("ERROR", "Please use a name shorter than 32 characters", 10);
                        }
                    }
                    else
                    {
                        edited = false;
                        DisplayNotifyBox("ERROR", "New name cannot be empty", 3);
                    }
                }

                if (editSurname)
                {
                    if (GetNewSurname() != "")
                    {
                        if (valid.TextIsShorterThan(GetNewSurname(), 32))
                        {
                            EditSurname(clientEmail, GetNewSurname());
                        }
                        else
                        {
                            DisplayNotifyBox("ERROR", "Please use a surname shorter than 32 characters", 10);
                        }
                    }
                    else
                    {
                        edited = false;
                        DisplayNotifyBox("ERROR", "New surname cannot be empty", 3);
                    }
                }

                if (editPhone)
                {
                    if (GetNewPhone() != "")
                    {
                        if (valid.IsTextNumeric(GetNewPhone()) && valid.TextIsShorterThan(GetNewPhone(), 12))
                        {
                            EditPhone(clientEmail, GetNewPhone());
                        }
                        else
                        {
                            DisplayNotifyBox("ERROR", "Please use a valid cellphone number with local 099 999 9999 format", 10);
                        }
                    }
                    else
                    {
                        edited = false;
                        DisplayNotifyBox("ERROR", "New phone number cannot be empty", 3);
                    }
                }

                if (editEmail)
                {
                    if (GetNewEmail() != "")
                    {
                        if (valid.TextisEmail(GetNewEmail()) && valid.TextIsShorterThan(GetNewEmail(), 32))
                        {
                            EditEmail(clientEmail, GetNewEmail());
                        }
                        else
                        {
                            DisplayNotifyBox("ERROR", "Please use a valid email address with length shorter than 32 characters", 10);
                        }
                    }
                    else
                    {
                        edited = false;
                        DisplayNotifyBox("ERROR", "New email cannot be empty", 3);
                    }
                }

                if (editPassword)
                {
                    if (GetNewPassword() != "" && CanEditPassword())
                    {
                        if (valid.TextHasNumber(GetNewPassword()) && valid.TextHasSpecialChars(GetNewPassword()) && valid.TextIsLongerThan(GetNewPassword(), 8) && valid.TextIsShorterThan(GetNewPassword(), 32) && valid.TextContainsUpperCase(GetNewPassword()))
                        {
                            EditPassword(clientEmail, GetNewPassword());
                        }
                        else
                        {
                            DisplayNotifyBox("ERROR", "Your password must contain at least one of each of the following: a special character, a number and an uppercase letter. It must also have a length of between 8 and 32 characters.", 10);
                        }
                    }
                    else
                    {
                        edited = false;
                        DisplayNotifyBox("ERROR", "New password cannot be empty", 3);
                    }
                }

                if (edited)
                {
                    CloseForm();
                }
            }
            else
            {
                DisplayNotifyBox("No change selected", "Please select a property to change", 3);
            }
        }
 private bool SetPreferences()
 {
     bool flag = false;
     Classes.Validation valid = new Classes.Validation();
     this.Dispatcher.Invoke(() =>
     {
         if (valid.IsTextNumeric(TB_MinPlotSize.Text) && valid.IsTextNumeric(TB_MaxPlotSize.Text) && valid.IsTextNumeric(TB_MinHouseSize.Text) && valid.IsTextNumeric(TB_MaxHouseSize.Text) && valid.IsTextNumeric(TB_MinPrice.Text) && valid.IsTextNumeric(TB_MaxPrice.Text))
         {
             try
             {
                 if (valid.IsNumberInRange(Convert.ToInt32(CB_MinBedrooms.SelectedItem), 50, CB_MaxBedrooms.SelectedItem.ToString()) && valid.IsNumberInRange(Convert.ToInt32(CB_MinBathrooms.SelectedItem), 50, CB_MaxBathrooms.SelectedItem.ToString()) && valid.IsNumberInRange(Convert.ToInt32(CB_MinGarages.SelectedItem), 50, CB_MaxGarages.SelectedItem.ToString()) && valid.IsNumberInRange(Convert.ToInt32(TB_MinPlotSize.Text), 2147483645, TB_MaxPlotSize.Text) && valid.IsNumberInRange(Convert.ToInt32(TB_MinHouseSize.Text), 2147483645, TB_MaxHouseSize.Text) && valid.IsNumberInRange(Convert.ToInt32(TB_MinPrice.Text), 2147483645, TB_MaxPrice.Text))
                 {
                     minBedrooms = Convert.ToInt32(CB_MinBedrooms.SelectedItem);
                     maxBedrooms = Convert.ToInt32(CB_MaxBedrooms.SelectedItem);
                     minBathrooms = Convert.ToInt32(CB_MinBathrooms.SelectedItem);
                     maxBathrooms = Convert.ToInt32(CB_MaxBathrooms.SelectedItem);
                     minGarages = Convert.ToInt32(CB_MinGarages.SelectedItem);
                     maxGarages = Convert.ToInt32(CB_MaxGarages.SelectedItem);
                     minPlotSize = Convert.ToInt32(TB_MinPlotSize.Text);
                     maxPlotSize = Convert.ToInt32(TB_MaxPlotSize.Text);
                     minHouseSize = Convert.ToInt32(TB_MinHouseSize.Text);
                     maxHouseSize = Convert.ToInt32(TB_MaxHouseSize.Text);
                     minPrice = Convert.ToInt32(TB_MinPrice.Text);
                     maxPrice = Convert.ToInt32(TB_MaxPrice.Text);
                     hasPool = Convert.ToInt32(CB_HasPool.SelectedIndex.ToString());
                     flag = true;
                 }
                 else
                 {
                     DisplayNotifyBox("ERROR", "Please ensure that all min values are smaller than their corresponding max values", 10);
                 }
             }
             catch
             {
                 DisplayNotifyBox("ERROR", "Please ensure that all field values are smaller than 2 147 483 645", 10);
             }
         }
         else
         {
             DisplayNotifyBox("ERROR", "Please ensure that the plotsize, housesize and price fields are numeric", 10);
         }
     });
     return flag;
 }
Esempio n. 15
0
 private void PortValidation(object sender, TextCompositionEventArgs e)
 {
     Classes.Validation validation = new Classes.Validation();
     e.Handled = !validation.IsTextNumeric(e.Text);
 }
        private void BT_SaveAndClose_Click(object sender, RoutedEventArgs e)
        {
            if (editName || editSurname || editPhone || editEmail || editPassword)
            {
                edited = true;
                Classes.Validation valid = new Classes.Validation();

                if (editName)
                {
                    if (GetNewName() != "")
                    {
                        if (valid.TextIsShorterThan(GetNewName(), 32))
                        {
                            EditName(agentEmail, GetNewName());
                        }
                        else
                        {
                            DisplayNotifyBox("ERROR", "Please use a name shorter than 32 characters", 10);
                        }
                    }
                    else
                    {
                        edited = false;
                        DisplayNotifyBox("ERROR", "New name cannot be empty", 5);
                    }
                }

                if (editSurname)
                {
                    if (GetNewSurname() != "")
                    {
                        if (valid.TextIsShorterThan(GetNewSurname(), 32))
                        {
                            EditSurname(agentEmail, GetNewSurname());
                        }
                        else
                        {
                            DisplayNotifyBox("ERROR", "Please use a surname shorter than 32 characters", 10);
                        }
                    }
                    else
                    {
                        edited = false;
                        DisplayNotifyBox("ERROR", "New surname cannot be empty", 5);
                    }
                }

                if (editPhone)
                {
                    if (GetNewPhone() != "")
                    {
                        if (valid.IsTextNumeric(GetNewPhone()) && valid.TextIsShorterThan(GetNewPhone(), 12))
                        {
                            EditPhone(agentEmail, GetNewPhone());
                        }
                        else
                        {
                            DisplayNotifyBox("ERROR", "Please use a valid cellphone number with local 099 999 9999 format", 10);
                        }
                    }
                    else
                    {
                        edited = false;
                        DisplayNotifyBox("ERROR", "New phone number cannot be empty", 5);
                    }
                }

                if (editEmail)
                {
                    if (GetNewEmail() != "")
                    {
                        if (valid.TextisEmail(GetNewEmail()) && valid.TextIsShorterThan(GetNewEmail(), 32))
                        {
                            EditEmail(agentEmail, GetNewEmail());
                        }
                        else
                        {
                            DisplayNotifyBox("ERROR", "Please use a valid email address with length shorter than 32 characters", 10);
                        }
                    }
                    else
                    {
                        edited = false;
                        DisplayNotifyBox("ERROR", "New email cannot be empty", 5);
                    }
                }

                if (editPassword)
                {
                    if (GetNewPassword() != "" && CanEditPassword())
                    {
                        if (valid.TextHasNumber(GetNewPassword()) && valid.TextHasSpecialChars(GetNewPassword()) && valid.TextIsLongerThan(GetNewPassword(), 8) && valid.TextIsShorterThan(GetNewPassword(), 32) && valid.TextContainsUpperCase(GetNewPassword()))
                        {
                            EditPassword(agentEmail, GetNewPassword());
                        }
                        else
                        {
                            DisplayNotifyBox("ERROR", "Your password must contain at least one of each of the following: a special character, a number and an uppercase letter. It must also have a length of between 8 and 32 characters.", 10);
                        }
                    }
                    else
                    {
                        edited = false;
                        DisplayNotifyBox("ERROR", "New password cannot be empty", 5);
                    }
                }

               if (edited)
               {
                   CloseForm();
               }
            }
            else
            {
                DisplayNotifyBox("No change selected", "Please select a property to change", 5);
            }
        }