Example #1
0
        private void btnViewBusinessClients_Click(object sender, EventArgs e)
        {
            Business_Client_Info businessform = new Business_Client_Info();

            businessform.Show();
            this.Close();
        }
Example #2
0
        private void btnInsertClient_Click(object sender, EventArgs e)
        {
            //assign values to variables

            try
            {
                int    id        = Convert.ToInt32(nudID.Value);
                string name      = txtName.Text;
                string surname   = txtSurname.Text;
                string email     = txtEmail.Text;
                string cellphone = txtCellphone.Text;
                if (cellphone == "")
                {
                    cellphone = "Unknown";
                }

                string status = rtbStatus.Text;
                if (status == "")
                {
                    status = "Unknown";
                }
                string role = txtRole.Text;
                if (role == "")
                {
                    role = "Unknown";
                }

                int streetnumber = Convert.ToInt32(nudStreetNumber.Value);

                string streetname = txtStreetName.Text;
                if (streetname == "")
                {
                    streetname = "Unknown";
                }

                string city = txtCity.Text;
                if (city == "")
                {
                    city = "Unknown";
                }

                string country;
                if (lstCountries.SelectedItem == null)
                {
                    country = "Unknown";
                }
                else
                {
                    country = lstCountries.SelectedItem.ToString();
                }

                BusinessClient client = new BusinessClient(id, name, surname, status, role, email, cellphone, streetnumber, streetname, city, country);
                client.SendClientToDataAccess(client);
            }
            catch (Exception ex)
            {
                MessageBox.Show("There was an error with one of your values: " + ex.Message);
            }
            finally
            {
                Business_Client_Info client_Info = new Business_Client_Info();
                client_Info.Show();
                this.Close();
            }
        }