예제 #1
0
 public void ResetForm()
 {
     FullNameTxt.Clear();
     PhoneTxt.Clear();
     EmailTxt.Clear();
     if (ActiveRdBtn.Checked)
     {
         DisabledRdBtn.Checked = false;
     }
     if (DisabledRdBtn.Checked)
     {
         ActiveRdBtn.Checked = false;
     }
 }
예제 #2
0
        private void BtnCreate_Click(object sender, EventArgs e)
        {
            if (FullNameTxt.Text == "")
            {
                MessageBox.Show("FullName daxil edin.");
            }
            if (PhoneTxt.Text == "")
            {
                MessageBox.Show("Phone nomreni daxil edin");
            }
            if (EmailTxt.Text == "")
            {
                MessageBox.Show("Email daxil edin");
            }

            if (ActiveRdBtn.Checked == false && DisabledRdBtn.Checked == false)
            {
                MessageBox.Show("Status sechin");
            }
            if (!string.IsNullOrEmpty(FullNameTxt.Text) && !string.IsNullOrEmpty(EmailTxt.Text) && !string.IsNullOrEmpty(PhoneTxt.Text) &&
                (ActiveRdBtn.Checked || DisabledRdBtn.Checked))
            {
                Customer customer = new Customer();

                customer.FullName = FullNameTxt.Text;
                customer.Status   = ActiveRdBtn.Checked ? true : false;
                customer.Phone    = PhoneTxt.Text;
                customer.Email    = EmailTxt.Text;

                _db.Customers.Add(customer);
                _db.SaveChanges();

                MessageBox.Show("Author Added:" + FullNameTxt.Text + "New Author");
                FullNameTxt.Clear();
                PhoneTxt.Clear();
                EmailTxt.Clear();
                ActiveRdBtn.Checked   = false;
                DisabledRdBtn.Checked = false;

                FillCustomers();
            }
        }