Beispiel #1
0
        private void idBtnSave_Click(object sender, EventArgs e)
        {
            var objCustInfo  = GetCustomerInfoFromTextBox();
            var ErrorCounter = 0;
            var ErrorMessage = "Following fields should not be empty \n\n";

            if (string.IsNullOrEmpty(objCustInfo.CompanyName))
            {
                ErrorCounter++;
                ErrorMessage += ErrorCounter.ToString() + "] " + "Please Enter Company Name \n";
            }

            if (string.IsNullOrEmpty(objCustInfo.Address))
            {
                ErrorCounter++;
                ErrorMessage += ErrorCounter.ToString() + "] " + "Please Enter Address \n";
            }

            if (string.IsNullOrEmpty(objCustInfo.Contact))
            {
                ErrorCounter++;
                ErrorMessage += ErrorCounter.ToString() + "] " + "Please Enter Contact \n";
            }

            if (string.IsNullOrEmpty(objCustInfo.StateName))
            {
                ErrorCounter++;
                ErrorMessage += ErrorCounter.ToString() + "] " + "Please Enter State Name \n";
            }

            if (ErrorCounter > 0)
            {
                MessageBox.Show(ErrorMessage, "Warning !...");
                return;
            }



            if (string.IsNullOrEmpty(objCustInfo.Id))
            {
                var dt = MastersBl.GetFilteredCustomerList("CompanyName", idTxtCompanyName.Text.Trim());
                if (dt.Rows.Count > 0)
                {
                    MessageBox.Show("Customer with company name '" + idTxtCompanyName.Text.Trim() + "' already exist.");
                    return;
                }
                CustomerBl.SaveCustomer(objCustInfo);
            }
            else
            {
                CustomerBl.UpdateCustomer(objCustInfo);
            }
            FormCancelButton = true;
            if (InitFromMenu != true)
            {
                MastersCustomers obj = new MastersCustomers();
                obj.Show();
            }
            this.Close();
        }
Beispiel #2
0
 private void idBtnCancel_Click(object sender, EventArgs e)
 {
     FormCancelButton = true;
     if (InitFromMenu != true)
     {
         MastersCustomers obj = new MastersCustomers();
         obj.Show();
     }
     this.Close();
 }
Beispiel #3
0
 private void Customers_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (FormCancelButton == false)
     {
         if (InitFromMenu != true)
         {
             MastersCustomers obj = new MastersCustomers();
             obj.Show();
         }
     }
 }
Beispiel #4
0
        private void customerMasterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MastersCustomers objmc = new MastersCustomers();

            objmc.Show();
        }
Beispiel #5
0
        private void idBtnAddCustomer_Click(object sender, EventArgs e)
        {
            MastersCustomers objmc = new MastersCustomers();

            objmc.Show();
        }