Exemple #1
0
 public void DeleteCoupon(Coupon2 coupon)
 {
     using (SqlConnection objConn = new SqlConnection(OddsConnection.GetConnectionString()))
     {
         SqlCommand cmd = new SqlCommand("sp_CouponManage", objConn);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@couponid", coupon.CouponID);
         cmd.Parameters.AddWithValue("@Mode", "Delete");
         objConn.Open();
         cmd.ExecuteNonQuery();
         objConn.Close();
     }
 }
        public void SelectCoupn()
        {
            try
            {
                Coupon2 cid = new Coupon2();

                // ComboboxItem slelecteditem = (ComboboxItem)comboCoupon.SelectedValue;
                //  cid = clsCpn.SelectCoupon(Convert.ToInt32(comboCoupon.SelectedValue));
                txtcouponname.Text = comboCoupon.SelectedText;
            }
            catch (Exception ex)
            { }
        }
Exemple #3
0
 public void UpdateCoupon(Coupon2 coupon)
 {
     using (SqlConnection objConn = new SqlConnection(OddsConnection.GetConnectionString()))
     {
         SqlCommand cmd = new SqlCommand("sp_CouponManage", objConn);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@Couponname", coupon.CouponName);
         cmd.Parameters.AddWithValue("@Mode", "Update");
         cmd.Parameters.AddWithValue("@CID", coupon.CID);
         cmd.Parameters.AddWithValue("@IsArchived", coupon.IsArchived);
         cmd.Parameters.AddWithValue("@matchid", coupon.MatchID);
         objConn.Open();
         cmd.ExecuteNonQuery();
         objConn.Close();
     }
 }
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (comboCoupon.SelectedText == "")
     {
         MessageBox.Show("Please select coupon first.");
     }
     else
     {
         Coupon2 cup = new Coupon2();
         cup.CID = Convert.ToInt32(comboCoupon.SelectedValue);
         clsCpn  = new GenerateCoupon();
         clsCpn.DeleteCoupon(cup);
         MessageBox.Show("Coupon Saved.");
         RefreshCoupon(Convert.ToInt32(sport));
     }
 }
 private void btnsave_Click(object sender, EventArgs e)
 {
     if (lblMatchName.Text == "")
     {
         MessageBox.Show("Please select match first.");
     }
     else
     {
         Coupon2 cup = new Coupon2();
         cup.CouponName = txtcouponname.Text;
         string[] match = lblMatchName.Text.ToString().Split(':');
         cup.MatchID = Convert.ToInt32(match[1].ToString());
         string couponid = Guid.NewGuid().ToString().Substring(0, 5);
         cup.CouponID   = couponid;
         cup.IsArchived = false;
         clsCpn         = new GenerateCoupon();
         clsCpn.InsertCoupon(cup);
         MessageBox.Show("Coupon Saved.");
         RefreshCoupon(Convert.ToInt32(sport));
     }
 }
Exemple #6
0
 public Coupon2 SelectCoupon(int cid)
 {
     using (SqlConnection objConn = new SqlConnection(OddsConnection.GetConnectionString()))
     {
         SqlCommand cmd = new SqlCommand("sp_CouponManage", objConn);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@Mode", "SelectCoupon");
         cmd.Parameters.AddWithValue("@CID", cid);
         objConn.Open();
         SqlDataReader raader;
         raader = cmd.ExecuteReader();
         objConn.Close();
         Coupon2 cup = new Coupon2();
         if (raader.Read())
         {
             cup.CouponName = raader["CouponName"].ToString();
             cup.CouponID   = raader["CouponID"].ToString();
             cup.CID        = Convert.ToInt32(raader["cid"]);
             cup.IsArchived = Convert.ToBoolean(raader["IsArchived"].ToString());
             cup.MatchID    = Convert.ToInt32(raader["matchid"].ToString());
         }
         return(cup);
     }
 }