Exemplo n.º 1
0
        //Add
        private void buttonClAdd_Click(object sender, EventArgs e)
        {
            Validator checker = new Validator();

            if (checker.isValidID(textBoxClID, 5) && checker.isNotNull(textBoxClName.Text, "Client Name") && checker.isNotNull(textBoxClEmail.Text, "E-mail") && checker.isNotNull(textBoxClStrt.Text, "Street") && checker.isNotNull(textBoxClCity.Text, "City") && checker.isNotNull(maskedTextBoxClPhone.Text, "Phone") && checker.isNotNull(maskedTextBoxClFax.Text, "Fax") && checker.isNotNull(maskedTextBoxClPostCode.Text, "Post Code"))
            {
                ClientDA.Save(createClient());
                UpdateComboBoxes();
            }
        }
 private void buttonAddClient_Click(object sender, EventArgs e)
 {
     if (Validator.IsValidID(textBoxClientId))
     {
         Client client = new Client();
         client.clientId     = Convert.ToInt32(textBoxClientId.Text);
         client.name         = textBoxName.Text;
         client.phoneNumber  = maskedTextBoxPhone.Text;
         client.faxNumber    = textBoxFax.Text;
         client.address      = textBoxAddress.Text;
         client.city         = textBoxCity.Text;
         client.postalCode   = textBoxPostalCode.Text;
         client.bankNumber   = Convert.ToInt32(textBoxBankNumber.Text);
         client.branchNumber = Convert.ToInt32(textBoxBranch.Text);
         client.bankAccount  = textBoxAccountType.Text;
         listClient.Add(client);
         ClientDA.Save(client);
         buttonListBook.Enabled = true;
         ClearAll();
     }
 }
Exemplo n.º 3
0
        private void buttonSaveClient_Click(object sender, EventArgs e)
        {
            List <Client> listC = ClientDA.ListClient();

            if (IsValidClientData())
            {
                if (!Validation.IsUniqueClientID(listC, Convert.ToInt32(textBoxClientID.Text)))
                {
                    MessageBox.Show(" DUPLICATE ", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    textBoxClientID.Clear();
                    textBoxClientID.Focus();
                    return;
                }
                if (!Validation.IsUniqueClientName(listC, textBoxInstitutionName.Text))
                {
                    MessageBox.Show(" DUPLICATE ", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    textBoxInstitutionName.Clear();
                    textBoxInstitutionName.Focus();
                    return;
                }
                else
                {
                    Client aClient = new Client();
                    aClient.ClientID               = Convert.ToInt32(textBoxClientID.Text);
                    aClient.InstitutionName        = textBoxInstitutionName.Text;
                    aClient.InstitutionAddress     = textBoxInstitutionAddress.Text;
                    aClient.InstitutionCity        = textBoxInstitutionCity.Text;
                    aClient.InstitutionZipCode     = textBoxZipCode.Text;
                    aClient.InstitutionPhoneNumber = maskedTextBoxPhoneClient.Text;
                    aClient.InstitutionEmail       = textBoxEmailClient.Text;
                    ClientDA.Save(aClient);
                    listC.Add(aClient);
                    buttonListClient.Enabled = true;
                    ClearAll();
                }
            }
        }