Пример #1
0
 internal static DataTable GETCOUPON(COUPONS obj)
 {
     DataTable dt = BLL.ExecuteQuery("EXEC USP_COUPON @OPERATION ='COUPON_PRICE',@COUPON_NAME='" + obj.COUPON_NAME + "'");
     return dt;
 }
Пример #2
0
        public static string coupon(string code, string price)
        {
            string garnd_total = price;
            string message = "";
            if (price != "00.00")
            {
                HttpContext.Current.Session["price"] = price;

                COUPONS obj1 = new COUPONS();

                obj1.COUPON_NAME = code;
                decimal price1 = decimal.Parse(price);

                DataTable dt_coupon = BLL.GETCOUPON(obj1);
                if (dt_coupon.Rows.Count != 0)
                {

                    foreach (DataRow row in dt_coupon.Rows)
                    {

                        string coupon_price1 = row["COUPON_PRICE"].ToString();

                        if (coupon_price1 != "")
                        {
                            string coupon_price = row["COUPON_PRICE"].ToString();
                            decimal coup_price = decimal.Parse(coupon_price);
                            decimal total1 = price1 - coup_price;

                            garnd_total = total1.ToString();

                            message = "Coupon Applied";

                        }
                        else
                        {
                            string coupon_discount = row["COUPON_DISCOUNT"].ToString();
                            decimal D = decimal.Parse(coupon_discount);
                            decimal D1 = D / 100;
                            decimal D2 = D1 * price1;

                            decimal totalprice = price1 - D2;

                            garnd_total = totalprice.ToString();
                            message = "Coupon Applied";
                        }

                    }
                }

                else
                {

                    message = "Inavlid Coupon ";

                }
            }

            else
            {
                message = "coupon can't be applied";
            }

            return garnd_total + ',' + message;
        }