Пример #1
0
 private void BtnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Global.ComboNull(CboEmail))
         {
             throw new Exception("Select Email address");
         }
         loyalcustomer            = new LoyalCustomer();
         loyalcustomer.Email      = CboEmail.Text;
         loyalcustomer.CustomerId = Convert.ToInt32(CboEmail.SelectedValue);
         bool flag = loyalcustomer.DeleteLoyalCustomer();
         if (flag == true)
         {
             LoadLoyalCustomerCbo();
             MessageBox.Show("Selected loyal customer is deleted");
         }
         else
         {
             MessageBox.Show("Email address does not exist");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #2
0
 private void LoadCustomerCbo()
 {
     loyalcustomer = new LoyalCustomer();
     CboLoyalcustomer.DisplayMember = "Email";
     CboLoyalcustomer.ValueMember   = "LoyalCustomerId";
     CboLoyalcustomer.DataSource    = loyalcustomer.GetLoyalCustomer().Tables["LoyalCustomer"];
 }
Пример #3
0
 private void BtnAddcust_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Global.InputHandle(TxtEmail))
         {
             throw new Exception("Enter Email address");
         }
         if (!Global.IsValidEmail(TxtEmail.ToString()))
         {
             throw new Exception("Invalid Email address");
         }
         loyalcustomer       = new LoyalCustomer();
         loyalcustomer.Email = TxtEmail.Text;
         bool flag = loyalcustomer.AddLoyalCustomer();
         if (flag == true)
         {
             MessageBox.Show("Loyal Customer added");
             TxtEmail.Text = "";
         }
         else
         {
             MessageBox.Show("Email address already exist");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #4
0
 private void CboLoyalcustomer_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (CboLoyalcustomer.SelectedIndex != -1)
     {
         loyalcustomer            = new LoyalCustomer();
         loyalcustomer.CustomerId = Convert.ToInt32(CboLoyalcustomer.SelectedValue);
         string points = loyalcustomer.GetCustomerPoints().Rows[0][0].ToString();
         LblPoints.Text = points;
     }
 }