private void btnIndividualNew_Click(object sender, EventArgs e)
        {
            newcontact       = txtContact.Text;
            newclientname    = txtNameNewI.Text;
            newclientsurname = txtSurnameNewI.Text;
            clientID         = tbClientID.Text;

            IndividualClientController individualClientController = new IndividualClientController();

            IndividualClient individualClient = new IndividualClient(
                newcontact,
                newclientname,
                newclientsurname,
                clientID
                );


            if (newcontact.Equals(""))
            {
                MessageBox.Show("Please enter client contact details", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (newclientname.Equals(""))
            {
                MessageBox.Show("Please enter a client name", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (newclientsurname.Equals(""))
            {
                MessageBox.Show("Please enter a client name", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                individualClientController.Create(individualClient);

                MessageBox.Show("Individual Client add successful, returning to Client Menu", "INDIVIDUAL CLIENT ADDED",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                Hide();
                frmClientMenu form = new frmClientMenu();
                form.ShowDialog();
                Show();
            }
        }
コード例 #2
0
        private void btnNewBusiness_Click(object sender, EventArgs e)
        {
            newbusicontact    = txtnewbusicontact.Text;
            newbusinessclient = txtBusinessNameNew.Text;
            clientID          = tbClientID.Text;

            BusinessClientController businessClientController = new BusinessClientController();

            BusinessClient businessClient = new BusinessClient(
                newbusicontact,
                newbusinessclient,
                clientID
                );


            if (newbusicontact.Equals(""))
            {
                MessageBox.Show("Please enter business contact details", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (newbusinessclient.Equals(""))
            {
                MessageBox.Show("Please enter a business client name", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                businessClientController.Create(businessClient);

                MessageBox.Show("Business Client add successful, returning to Client Menu", " BUSINESS CLIENT ADDED",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                Hide();
                frmClientMenu form = new frmClientMenu();
                form.ShowDialog();
                Show();
            }
        }