Exemple #1
0
        public bool PostCheckout(TR_Checkout_Request param)
        {
            bool RetVal = false;

            try
            {
                DataTable CartID = new DataTable();

                using (CartID)
                {
                    CartID.Columns.Add("CartID", typeof(int));
                    foreach (var i in param.Cart)
                    {
                        int item = Convert.ToInt32(i.CartID_PK);
                        CartID.Rows.Add(item);
                    }
                }
                using (TransactionScope transactionScope = new TransactionScope())
                {
                    List <SqlParameter> Parameter = new List <SqlParameter>();

                    Parameter.Add(new SqlParameter()
                    {
                        ParameterName = "@pListCartID", SqlDbType = SqlDbType.Structured
                    });
                    Parameter[0].TypeName = "[dbo].[CARTLIST]";
                    Parameter[0].Value    = CartID;
                    Parameter.Add(new SqlParameter()
                    {
                        ParameterName = "@pShippingAddress", SqlDbType = SqlDbType.VarChar, Value = param.ShippingAddress ?? ""
                    });
                    Parameter.Add(new SqlParameter()
                    {
                        ParameterName = "@pPaymentTypeID", SqlDbType = SqlDbType.Int, Value = param.PaymentTypeID.HasValue ? param.PaymentTypeID :0
                    });
                    Parameter.Add(new SqlParameter()
                    {
                        ParameterName = "@pCreatedBy", SqlDbType = SqlDbType.VarChar, Value = param.CreatedBy ?? ""
                    });
                    Parameter.Add(new SqlParameter()
                    {
                        ParameterName = "@pCreatedDate", SqlDbType = SqlDbType.DateTime, Value = param.CreatedDate.HasValue ? param.CreatedDate : DateTime.Now
                    });

                    DBtran.DbExecute("USP_POST_CHECKOUT", Parameter, true, out SqlParameterCollection outParameter);
                    transactionScope.Complete();

                    RetVal = true;
                }
            }
            catch (Exception ex)
            {
            }

            return(RetVal);
        }
Exemple #2
0
        public string ValidationRequest(TR_Checkout_Request req)
        {
            string RetVal = "";

            if (req.UserName != Session["UserName"].ToString())
            {
                RetVal = "UserName Not Match";
            }
            return(RetVal);
        }
Exemple #3
0
        public bool PostCheckout(TR_Checkout_Request req)
        {
            bool RetVal = false;

            try
            {
                RetVal = DALCheckout.PostCheckout(req);
            }
            catch (Exception ex)
            {
            }

            return(RetVal);
        }
Exemple #4
0
 public ActionResult Checkout(TR_Checkout_Request req)
 {
     try
     {
         if (ModelState.IsValid)
         {
             string Valid = ValidationRequest(req);
             if (Valid == "")
             {
                 string Address = req.ShippingAddress + " " + req.City + " " + req.Districs;
                 List <TR_Cart_Item>     Items    = Session["TesData"] as List <TR_Cart_Item>;
                 List <TR_Cart_Response> CartItem = GetCartItems(Items);
                 req.Cart      = CartItem;
                 req.CreatedBy = Session["UserName"].ToString();
                 bool PostCheckout = BLCheckout.PostCheckout(req);
             }
         }
     }
     catch (Exception ex)
     {
     }
     return(RedirectToAction("Index", "Home"));
 }