示例#1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         cust = Factory.Create(cmbCustomerType.Text);
         cust.CustomerName = txtCustomerName.Text;
         cust.Address      = txtAddress.Text;
         cust.PhoneNumber  = txtPhoneNumber.Text;
         if (cust.GetType() != typeof(LeadCustomer))
         {
             cust.BillDate   = Convert.ToDateTime(txtBillingDate.Text);
             cust.BillAmount = Convert.ToDecimal(txtBillingAmount.Text);
         }
         cust.CustomerType = cmbCustomerType.Text;
         string returnMessage = Fac.AddCustomer(cust);
         if (returnMessage == "SUCCESS")
         {
             MessageBox.Show("Customer saved successfully");
         }
         else if (returnMessage == "FAILED")
         {
             MessageBox.Show("Unable to save custome right now ,pleas try later");
         }
         else
         {
             MessageBox.Show(returnMessage);
         }
         Clear();
         LoadGridView();
     }
     catch (Exception ex)
     {
     }
 }