private void btnAddNewBooks_Click(object sender, EventArgs e)
 {
     using (Form_AddCustomer ae = new Form_AddCustomer())
     {
         ae.ShowDialog();
     }
 }
        public void OpenForm_AddCustomer()
        {
            Form_AddCustomer form = new Form_AddCustomer();
            var result            = form.ShowDialog();

            if (result == DialogResult.Yes)
            {
                MessageBox.Show("Customer added successfully !");
                return;
            }
            else if (result == DialogResult.No)
            {
                DialogResult retry = MessageBox.Show("Customer could not be added. Do you want to try again?", "Failed", MessageBoxButtons.YesNo);
                if (retry == DialogResult.Yes)
                {
                    OpenForm_AddCustomer();
                }
            }
        }
Example #3
0
        public void AddNewCustomer()
        {
            m_UIControl.lbl_customerError.Text = string.Empty;
            Form_AddCustomer form   = new Form_AddCustomer();
            DialogResult     result = form.ShowDialog();

            if (result != DialogResult.Yes)
            {
                return;
            }

            MessageBox.Show("Customer Added Successfully!");

            // fill the customer details
            CustomerGet customer = form.GetCustomer();

            m_UIControl.tb_customerName.Text  = customer.Name;
            m_UIControl.tb_mobileNumber.Text  = customer.MobileNumber;
            m_UIControl.tb_pendingAmount.Text = customer.PendingAmount.ToString();
            m_transactionSession.SetCustomer(customer);
        }