Beispiel #1
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();
                }
            }
        }
Beispiel #2
0
        private void buttonUpdateClient_Click(object sender, EventArgs e)
        {
            List <Client> listC = ClientDA.ListClient();

            if (IsValidClientData())
            {
                Client Client = new Client();
                Client.ClientID               = Convert.ToInt32(textBoxClientID.Text);
                Client.InstitutionName        = textBoxInstitutionName.Text;
                Client.InstitutionAddress     = textBoxInstitutionAddress.Text;
                Client.InstitutionCity        = textBoxInstitutionCity.Text;
                Client.InstitutionZipCode     = textBoxZipCode.Text;
                Client.InstitutionPhoneNumber = maskedTextBoxPhoneClient.Text;
                Client.InstitutionEmail       = textBoxEmailClient.Text;
                DialogResult ans = MessageBox.Show("Do you really want to update this Client?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (ans == DialogResult.Yes)
                {
                    ClientDA.Update(Client);
                    MessageBox.Show("Client record has been updated successfully", "Confirmation");
                    ClearAll();
                    textBoxClientID.Enabled = true;
                }
            }
        }
Beispiel #3
0
 private void buttonListClient_Click(object sender, EventArgs e)
 {
     listViewClient.Items.Clear();
     ClientDA.ListClient(listViewClient);
 }