Ejemplo n.º 1
0
        public int AddBillingAddress(OrderDetailsCollection orderData, SqlTransaction tran, int addressID)
        {
            try
            {
                List<KeyValuePair<string, object>> parameter = new List<KeyValuePair<string, object>>();

                parameter.Add(new KeyValuePair<string, object>("@AddressID", addressID));
                parameter.Add(new KeyValuePair<string, object>("@IsDefault",
                                                               orderData.ObjBillingAddressInfo.IsDefaultBilling));

                parameter.Add(new KeyValuePair<string, object>("@StoreID", orderData.ObjCommonInfo.StoreID));
                parameter.Add(new KeyValuePair<string, object>("@PortalID", orderData.ObjCommonInfo.PortalID));
                parameter.Add(new KeyValuePair<string, object>("@CultureName", orderData.ObjCommonInfo.CultureName));
                parameter.Add(new KeyValuePair<string, object>("@AddedBy", orderData.ObjCommonInfo.AddedBy));

                SQLHandler sqlH = new SQLHandler();

                int billingAddressID = sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure,
                                                            "usp_Aspx_UserBillingAddress", parameter,
                                                            "@UserBillingAddressID");

                return addressID;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public static void ParseIPN(int orderID, string transID, string status, int storeID, int portalID, string userName, int customerID, string sessionCode)
 {
     MoneybookersHandler ph = new MoneybookersHandler();
     try
     {
         OrderDetailsCollection ot = new OrderDetailsCollection();
         OrderDetailsInfo odinfo = new OrderDetailsInfo();
         CartManageSQLProvider cms = new CartManageSQLProvider();
         CommonInfo cf = new CommonInfo();
         cf.StoreID = storeID;
         cf.PortalID = portalID;
         cf.AddedBy = userName;
         // UpdateOrderDetails
         AspxOrderDetails objad = new AspxOrderDetails();
         SQLHandler sqlH = new SQLHandler();
         // use split to split array we already have using "=" as delimiter
         // WcfSession ws = new WcfSession();
         odinfo.OrderID = orderID;//ws.GetSessionVariable("OrderID");
         odinfo.ResponseReasonText = status;
         odinfo.TransactionID = transID;
         ot.ObjOrderDetails = odinfo;
         ot.ObjCommonInfo = cf;
         odinfo.OrderStatusID = 8;
         objad.UpdateOrderDetails(ot);
         // UpdateItemQuantity
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 3
0
        public void UpdateItemQuantity(OrderDetailsCollection orderData)
        {
            try
            {
                if (orderData.ObjOrderDetails.CouponCode != null && System.Web.HttpContext.Current.Session["CouponApplied"] != null)
                {
                    ReduceCouponUsed(orderData.ObjOrderDetails.CouponCode.Trim(), orderData.ObjCommonInfo.StoreID, orderData.ObjCommonInfo.PortalID, orderData.ObjCommonInfo.AddedBy, orderData.ObjOrderDetails.OrderID);
                }

                foreach (OrderItemInfo objItems in orderData.LstOrderItemsInfo)
                {
                    if (objItems.IsDownloadable != true)
                    {
                        List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >();
                        parameter.Add(new KeyValuePair <string, object>("@StoreID", orderData.ObjCommonInfo.StoreID));
                        parameter.Add(new KeyValuePair <string, object>("@PortalID", orderData.ObjCommonInfo.PortalID));
                        parameter.Add(new KeyValuePair <string, object>("@AddedBy", orderData.ObjCommonInfo.AddedBy));
                        parameter.Add(new KeyValuePair <string, object>("@ItemID", objItems.ItemID));
                        parameter.Add(new KeyValuePair <string, object>("@Quantity", objItems.Quantity));
                        parameter.Add(new KeyValuePair <string, object>("@OrderID", orderData.ObjOrderDetails.OrderID));
                        parameter.Add(new KeyValuePair <string, object>("@CostVariantsIDs", objItems.Variants));
                        SQLHandler sqlH = new SQLHandler();
                        sqlH.ExecuteNonQuery("[dbo].[usp_Aspx_UpdateItemQuantitybyOrder]", parameter);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 4
0
        public void ParseIPN(int orderId, string transId, string status, int storeId, int portalId, string userName, int customerId, string sessionCode)
        {
            var ph = new PayPalHandler();
            try
            {

                var ot = new OrderDetailsCollection();
                var odinfo = new OrderDetailsInfo();
                var cms = new CartManageSQLProvider();
                var cf = new CommonInfo {StoreID = storeId, PortalID = portalId, AddedBy = userName};
                // UpdateOrderDetails
            
                var sqlH = new SQLHandler();
                // use split to split array we already have using "=" as delimiter
                // WcfSession ws = new WcfSession();
                odinfo.OrderID = orderId;//ws.GetSessionVariable("OrderID");
                odinfo.ResponseReasonText = status;
                odinfo.TransactionID = transId;
                ot.ObjOrderDetails = odinfo;
                ot.ObjCommonInfo = cf;
                odinfo.OrderStatusID = 8;
                AspxOrderController.UpdateOrderDetails(ot);

               
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 5
0
        //single
        public void AddOrderItems(OrderDetailsCollection orderData, SqlTransaction tran, int orderID, int shippingAddressID)
        {
            try
            {
                foreach (OrderItemInfo objItems in orderData.LstOrderItemsInfo)
                {
                    List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >();

                    parameter.Add(new KeyValuePair <string, object>("@OrderID", orderID));
                    parameter.Add(new KeyValuePair <string, object>("@UserShippingAddressID", shippingAddressID));
                    parameter.Add(new KeyValuePair <string, object>("@ShippingMethodID", objItems.ShippingMethodID));
                    parameter.Add(new KeyValuePair <string, object>("@ItemID", objItems.ItemID));
                    parameter.Add(new KeyValuePair <string, object>("@Price", objItems.Price));
                    parameter.Add(new KeyValuePair <string, object>("@Quantity", objItems.Quantity));
                    parameter.Add(new KeyValuePair <string, object>("@Weight", objItems.Weight));
                    parameter.Add(new KeyValuePair <string, object>("@Remarks", objItems.Remarks));
                    parameter.Add(new KeyValuePair <string, object>("@ShippingRate", objItems.ShippingRate));

                    parameter.Add(new KeyValuePair <string, object>("@StoreID", orderData.ObjCommonInfo.StoreID));
                    parameter.Add(new KeyValuePair <string, object>("@PortalID", orderData.ObjCommonInfo.PortalID));
                    parameter.Add(new KeyValuePair <string, object>("@CultureName", orderData.ObjCommonInfo.CultureName));
                    parameter.Add(new KeyValuePair <string, object>("@AddedBy", orderData.ObjCommonInfo.AddedBy));
                    parameter.Add(new KeyValuePair <string, object>("@CostVariants", objItems.Variants));
                    parameter.Add(new KeyValuePair <string, object>("@RewardedPoints", objItems.RewardedPoints));

                    SQLHandler sqlH = new SQLHandler();
                    sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure, "[usp_Aspx_OrderItem]", parameter);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 6
0
        public static PayPalHandler ParseIPN(int orderID, string transID, string status, int storeID, int portalID, string userName, int customerID, string sessionCode)
        {
            PayPalHandler ph = new PayPalHandler();

            try
            {
                OrderDetailsCollection ot     = new OrderDetailsCollection();
                OrderDetailsInfo       odinfo = new OrderDetailsInfo();
                CartManageSQLProvider  cms    = new CartManageSQLProvider();
                CommonInfo             cf     = new CommonInfo();
                cf.StoreID  = storeID;
                cf.PortalID = portalID;
                cf.AddedBy  = userName;
                // UpdateOrderDetails
                AspxOrderDetails objad = new AspxOrderDetails();
                SQLHandler       sqlH  = new SQLHandler();
                // use split to split array we already have using "=" as delimiter
                // WcfSession ws = new WcfSession();
                odinfo.OrderID            = orderID;//ws.GetSessionVariable("OrderID");
                odinfo.ResponseReasonText = status;
                odinfo.TransactionID      = transID;
                ot.ObjOrderDetails        = odinfo;
                ot.ObjCommonInfo          = cf;
                odinfo.OrderStatusID      = 8;
                objad.UpdateOrderDetails(ot);

                return(ph);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public int AddBillingAddress(OrderDetailsCollection orderData, OracleTransaction tran, int addressID)
        {
            try
            {
                List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >();

                parameter.Add(new KeyValuePair <string, object>("AddressID", addressID));
                parameter.Add(new KeyValuePair <string, object>("IsDefault",
                                                                orderData.ObjBillingAddressInfo.IsDefaultBilling));

                parameter.Add(new KeyValuePair <string, object>("StoreID", orderData.ObjCommonInfo.StoreID));
                parameter.Add(new KeyValuePair <string, object>("PortalID", orderData.ObjCommonInfo.PortalID));
                parameter.Add(new KeyValuePair <string, object>("CultureName", orderData.ObjCommonInfo.CultureName));
                parameter.Add(new KeyValuePair <string, object>("AddedBy", orderData.ObjCommonInfo.AddedBy));

                OracleHandler sqlH = new OracleHandler();

                int billingAddressID = sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure,
                                                            "usp_Aspx_UserBillingAddress", parameter,
                                                            "UserBillingAddressID");

                return(addressID);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 8
0
        public static void UpdateItemQuantity(OrderDetailsCollection orderData)
        {
            try
            {
                if (orderData.Coupons.Count > 0)
                {
                    foreach (var coupon in orderData.Coupons)
                    {
                        ReduceCouponUsed(coupon, orderData.ObjCommonInfo.StoreID, orderData.ObjCommonInfo.PortalID, orderData.ObjCommonInfo.AddedBy, orderData.ObjOrderDetails.OrderID);
                    }
                }

                foreach (OrderItemInfo objItems in orderData.LstOrderItemsInfo)
                {
                    if (objItems.IsDownloadable != true)
                    {
                        List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >();
                        parameter.Add(new KeyValuePair <string, object>("@StoreID", orderData.ObjCommonInfo.StoreID));
                        parameter.Add(new KeyValuePair <string, object>("@PortalID", orderData.ObjCommonInfo.PortalID));
                        parameter.Add(new KeyValuePair <string, object>("@AddedBy", orderData.ObjCommonInfo.AddedBy));
                        parameter.Add(new KeyValuePair <string, object>("@ItemID", objItems.ItemID));
                        parameter.Add(new KeyValuePair <string, object>("@Quantity", objItems.Quantity));
                        parameter.Add(new KeyValuePair <string, object>("@OrderID", orderData.ObjOrderDetails.OrderID));
                        parameter.Add(new KeyValuePair <string, object>("@CostVariantsIDs", objItems.Variants));
                        SQLHandler sqlH = new SQLHandler();
                        sqlH.ExecuteNonQuery("[dbo].[usp_Aspx_UpdateItemQuantitybyOrder]", parameter);
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 9
0
        public static int AddShippingAddress(OrderDetailsCollection orderData, SqlTransaction tran, int addressID)
        {
            try
            {
                List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >();

                parameter.Add(new KeyValuePair <string, object>("@AddressID", addressID));

                parameter.Add(new KeyValuePair <string, object>("@StoreID", orderData.ObjCommonInfo.StoreID));
                parameter.Add(new KeyValuePair <string, object>("@PortalID", orderData.ObjCommonInfo.PortalID));
                parameter.Add(new KeyValuePair <string, object>("@CultureName", orderData.ObjCommonInfo.CultureName));
                parameter.Add(new KeyValuePair <string, object>("@AddedBy", orderData.ObjCommonInfo.AddedBy));

                SQLHandler sqlH = new SQLHandler();

                int shippingAddressID = sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure,
                                                             "usp_Aspx_UserShippingAddress", parameter,
                                                             "@ShippingAddressID");

                return(shippingAddressID);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public int AddOrder(OrderDetailsCollection orderData, SqlTransaction tran, int billingAddressID, int paymentMethodId)
        {
            try
            {
                List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >();

                parameter.Add(new KeyValuePair <string, object>("@InvoiceNumber", orderData.ObjOrderDetails.InvoiceNumber));
                if (orderData.ObjOrderDetails.CustomerID == 0)
                {
                    parameter.Add(new KeyValuePair <string, object>("@SessionCode", orderData.ObjOrderDetails.SessionCode));
                    parameter.Add(new KeyValuePair <string, object>("@CustomerID", 0));
                }
                else
                {
                    parameter.Add(new KeyValuePair <string, object>("@SessionCode", ""));
                    parameter.Add(new KeyValuePair <string, object>("@CustomerID", orderData.ObjOrderDetails.CustomerID));
                }
                parameter.Add(new KeyValuePair <string, object>("@TransactionID", orderData.ObjOrderDetails.TransactionID));
                parameter.Add(new KeyValuePair <string, object>("@GrandTotal", orderData.ObjOrderDetails.GrandTotal));
                parameter.Add(new KeyValuePair <string, object>("@DiscountAmount",
                                                                orderData.ObjOrderDetails.DiscountAmount));
                parameter.Add(new KeyValuePair <string, object>("@CouponCode", orderData.ObjOrderDetails.CouponCode));
                parameter.Add(new KeyValuePair <string, object>("@PurchaseOrderNumber",
                                                                orderData.ObjOrderDetails.PurchaseOrderNumber));
                parameter.Add(new KeyValuePair <string, object>("@PaymentGateTypeID",
                                                                orderData.ObjOrderDetails.PaymentGatewayTypeID));
                parameter.Add(new KeyValuePair <string, object>("@PaymentGateSubTypeID",
                                                                orderData.ObjOrderDetails.PaymentGatewaySubTypeID));
                parameter.Add(new KeyValuePair <string, object>("@ClientIPAddress",
                                                                orderData.ObjOrderDetails.ClientIPAddress));
                parameter.Add(new KeyValuePair <string, object>("@UserBillingAddressID",
                                                                billingAddressID));
                parameter.Add(new KeyValuePair <string, object>("@PaymentMethodID",
                                                                paymentMethodId));
                parameter.Add(new KeyValuePair <string, object>("@OrderStatusID", orderData.ObjOrderDetails.OrderStatusID));
                parameter.Add(new KeyValuePair <string, object>("@IsGuestUser", orderData.ObjOrderDetails.IsGuestUser));
                parameter.Add(new KeyValuePair <string, object>("@TaxTotal", orderData.ObjOrderDetails.TaxTotal));
                parameter.Add(new KeyValuePair <string, object>("@CurrencyCode", orderData.ObjOrderDetails.CurrencyCode));
                parameter.Add(new KeyValuePair <string, object>("@ResponseCode", orderData.ObjOrderDetails.ResponseCode));
                parameter.Add(new KeyValuePair <string, object>("@ResponseReasonCode",
                                                                orderData.ObjOrderDetails.ResponseReasonCode));
                parameter.Add(new KeyValuePair <string, object>("@ResponseReasonText",
                                                                orderData.ObjOrderDetails.ResponseReasonText));
                parameter.Add(new KeyValuePair <string, object>("@Remarks", orderData.ObjOrderDetails.Remarks));
                parameter.Add(new KeyValuePair <string, object>("@StoreID", orderData.ObjCommonInfo.StoreID));
                parameter.Add(new KeyValuePair <string, object>("@PortalID", orderData.ObjCommonInfo.PortalID));
                parameter.Add(new KeyValuePair <string, object>("@CultureName", orderData.ObjCommonInfo.CultureName));
                parameter.Add(new KeyValuePair <string, object>("@AddedBy", orderData.ObjCommonInfo.AddedBy));

                SQLHandler sqlH    = new SQLHandler();
                int        orderID = sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure, "[usp_Aspx_OrderDetails]",
                                                          parameter, "@OrderID");
                return(orderID);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 11
0
 //multiple
 public static void AddOrderItemsList(OrderDetailsCollection orderData, SqlTransaction tran, int orderID)
 {
     try
     {
         AspxOrderProvider.AddOrderItemsList(orderData, tran, orderID);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public static void UpdateItemQuantity(OrderDetailsCollection orderData)
 {
     try
     {
         AspxOrderProvider.UpdateItemQuantity(orderData);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 //single
 public static void AddOrderItems(OrderDetailsCollection orderData, OracleTransaction tran, int orderID, int shippingAddressID)
 {
     try
     {
         AspxOrderProvider.AddOrderItems(orderData, tran, orderID, shippingAddressID);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 14
0
 public static int AddAddress(OrderDetailsCollection orderData, SqlTransaction tran)
 {
     try
     {
         int addressID = AspxOrderProvider.AddAddress(orderData, tran);
         return(addressID);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public static int AddShippingAddress(OrderDetailsCollection orderData, SqlTransaction tran)
 {
     try
     {
         int shippingAddressID = AspxOrderProvider.AddShippingAddress(orderData, tran);
         return shippingAddressID;
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public static int AddPaymentInfo(OrderDetailsCollection orderData, SqlTransaction tran)
 {
     try
     {
         int paymentMethodID = AspxOrderProvider.AddPaymentInfo(orderData, tran);
         return paymentMethodID;
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public static int AddBillingAddress(OrderDetailsCollection orderData, SqlTransaction tran, int addressID)
 {
     try
     {
         int billingAddressID = AspxOrderProvider.AddBillingAddress(orderData, tran, addressID);
         return billingAddressID;
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public static int AddOrderWithMultipleCheckOut(OrderDetailsCollection orderData, OracleTransaction tran, int paymentMethodId)
 {
     try
     {
         int orderID = AspxOrderProvider.AddOrderWithMultipleCheckOut(orderData, tran, paymentMethodId);
         return(orderID);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public static int AddOrder(OrderDetailsCollection orderData, OracleTransaction tran, int billingAddressID, int paymentMethodId)
 {
     try
     {
         int orderID = AspxOrderProvider.AddOrder(orderData, tran, billingAddressID, paymentMethodId);
         return(orderID);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public static int AddShippingAddress(OrderDetailsCollection orderData, OracleTransaction tran)
 {
     try
     {
         int shippingAddressID = AspxOrderProvider.AddShippingAddress(orderData, tran);
         return(shippingAddressID);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public static int AddPaymentInfo(OrderDetailsCollection orderData, OracleTransaction tran)
 {
     try
     {
         int paymentMethodID = AspxOrderProvider.AddPaymentInfo(orderData, tran);
         return(paymentMethodID);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public static int AddBillingAddress(OrderDetailsCollection orderData, OracleTransaction tran, int addressID)
 {
     try
     {
         int billingAddressID = AspxOrderProvider.AddBillingAddress(orderData, tran, addressID);
         return(billingAddressID);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 23
0
        //single
        public static void AddOrderItems(OrderDetailsCollection orderData, SqlTransaction tran, int orderID, int shippingAddressID)
        {
            try
            {
                foreach (OrderItemInfo objItems in orderData.LstOrderItemsInfo)
                {
                    List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >();
                    parameter.Add(new KeyValuePair <string, object>("@OrderID", orderID));
                    if (orderData.ObjOrderDetails.IsGuestUser)
                    {
                        parameter.Add(new KeyValuePair <string, object>("@UserShippingAddressID", shippingAddressID));
                    }
                    else
                    {
                        parameter.Add(new KeyValuePair <string, object>("@UserShippingAddressID", objItems.ShippingAddressID > 0 ? shippingAddressID : 0));
                    }
                    parameter.Add(new KeyValuePair <string, object>("@ShippingMethodID", objItems.ShippingMethodID));
                    parameter.Add(new KeyValuePair <string, object>("@ItemID", objItems.ItemID));
                    parameter.Add(new KeyValuePair <string, object>("@Price", objItems.Price));
                    parameter.Add(new KeyValuePair <string, object>("@Quantity", objItems.Quantity));
                    parameter.Add(new KeyValuePair <string, object>("@Weight", objItems.Weight));
                    parameter.Add(new KeyValuePair <string, object>("@Remarks", objItems.Remarks));
                    parameter.Add(new KeyValuePair <string, object>("@ShippingRate", objItems.ShippingRate));

                    parameter.Add(new KeyValuePair <string, object>("@StoreID", orderData.ObjCommonInfo.StoreID));
                    parameter.Add(new KeyValuePair <string, object>("@PortalID", orderData.ObjCommonInfo.PortalID));
                    parameter.Add(new KeyValuePair <string, object>("@CultureName", orderData.ObjCommonInfo.CultureName));
                    parameter.Add(new KeyValuePair <string, object>("@AddedBy", orderData.ObjCommonInfo.AddedBy));
                    parameter.Add(new KeyValuePair <string, object>("@CostVariants", objItems.Variants));
                    parameter.Add(new KeyValuePair <string, object>("@RewardedPoints", objItems.RewardedPoints));

                    //allow null
                    parameter.Add(new KeyValuePair <string, object>("@KitDescription", objItems.KitDescription));
                    parameter.Add(new KeyValuePair <string, object>("@KitData", objItems.KitData));
                    //parameter.Add(new KeyValuePair<string, object>("@AddressID", orderData.ObjShippingAddressInfo.AddressID));
                    //parameter.Add(new KeyValuePair<string, object>("@Country", orderData.ObjShippingAddressInfo.Country));
                    //parameter.Add(new KeyValuePair<string, object>("@State", orderData.ObjShippingAddressInfo.State));
                    //parameter.Add(new KeyValuePair<string, object>("@zip", orderData.ObjShippingAddressInfo.Zip));
                    //parameter.Add(new KeyValuePair<string, object>("@CustmerID", orderData.ObjOrderDetails.CustomerID));


                    SQLHandler sqlH = new SQLHandler();
                    sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure, "[usp_Aspx_OrderItem]", parameter);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public static int AddOrderWithMultipleCheckOut(OrderDetailsCollection orderData, OracleTransaction tran, int paymentMethodId)
        {
            try
            {
                List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >();

                parameter.Add(new KeyValuePair <string, object>("InvoiceNumber", orderData.ObjOrderDetails.InvoiceNumber));
                parameter.Add(new KeyValuePair <string, object>("TransactionID", orderData.ObjOrderDetails.TransactionID));
                parameter.Add(new KeyValuePair <string, object>("SessionCode", ""));
                parameter.Add(new KeyValuePair <string, object>("CustomerID", orderData.ObjOrderDetails.CustomerID));
                parameter.Add(new KeyValuePair <string, object>("GrandTotal", orderData.ObjOrderDetails.GrandTotal));
                parameter.Add(new KeyValuePair <string, object>("DiscountAmount", orderData.ObjOrderDetails.DiscountAmount));
                parameter.Add(new KeyValuePair <string, object>("CouponDiscountAmount", orderData.ObjOrderDetails.CouponDiscountAmount));

                string couponCode = String.Join(",", orderData.Coupons.Select(c => c.Key).ToList());
                parameter.Add(new KeyValuePair <string, object>("CouponCode", couponCode));
                parameter.Add(new KeyValuePair <string, object>("RewardDiscountAmount",
                                                                orderData.ObjOrderDetails.RewardDiscountAmount));
                parameter.Add(new KeyValuePair <string, object>("UsedRewardPoints",
                                                                orderData.ObjOrderDetails.UsedRewardPoints));
                parameter.Add(new KeyValuePair <string, object>("PurchaseOrderNumber", orderData.ObjOrderDetails.PurchaseOrderNumber));
                parameter.Add(new KeyValuePair <string, object>("PaymentGateTypeID", orderData.ObjOrderDetails.PaymentGatewayTypeID));
                parameter.Add(new KeyValuePair <string, object>("PaymentGateSubTypeID", orderData.ObjOrderDetails.PaymentGatewaySubTypeID));
                parameter.Add(new KeyValuePair <string, object>("ClientIPAddress", orderData.ObjOrderDetails.ClientIPAddress));
                parameter.Add(new KeyValuePair <string, object>("UserBillingAddressID", orderData.ObjOrderDetails.UserBillingAddressID));
                parameter.Add(new KeyValuePair <string, object>("PaymentMethodID", paymentMethodId));
                parameter.Add(new KeyValuePair <string, object>("OrderStatusID", orderData.ObjOrderDetails.OrderStatusID));
                parameter.Add(new KeyValuePair <string, object>("IsGuestUser", "false"));
                parameter.Add(new KeyValuePair <string, object>("TaxTotal", orderData.ObjOrderDetails.TaxTotal));
                parameter.Add(new KeyValuePair <string, object>("CurrencyCode", orderData.ObjOrderDetails.CurrencyCode));
                parameter.Add(new KeyValuePair <string, object>("ResponseCode", orderData.ObjOrderDetails.ResponseCode));
                parameter.Add(new KeyValuePair <string, object>("ResponseReasonCode", orderData.ObjOrderDetails.ResponseReasonCode));
                parameter.Add(new KeyValuePair <string, object>("ResponseReasonText", orderData.ObjOrderDetails.ResponseReasonText));
                parameter.Add(new KeyValuePair <string, object>("Remarks", orderData.ObjOrderDetails.Remarks));
                parameter.Add(new KeyValuePair <string, object>("StoreID", orderData.ObjCommonInfo.StoreID));
                parameter.Add(new KeyValuePair <string, object>("PortalID", orderData.ObjCommonInfo.PortalID));
                parameter.Add(new KeyValuePair <string, object>("CultureName", orderData.ObjCommonInfo.CultureName));
                parameter.Add(new KeyValuePair <string, object>("AddedBy", orderData.ObjCommonInfo.AddedBy));

                OracleHandler sqlH    = new OracleHandler();
                int           orderID = sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure, "usp_Aspx_OrderDetails",
                                                             parameter, "OrderID");
                return(orderID);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public static string Parse(int orderId, string transId, string invoice, string POrderno, int responseCode, int responsereasonCode,
                                   string responsetext, AspxCommonInfo aspxCommonObj)
        {
            try
            {
                OrderDetailsCollection ot     = new OrderDetailsCollection();
                OrderDetailsInfo       odinfo = new OrderDetailsInfo();
                CartManageSQLProvider  cms    = new CartManageSQLProvider();
                CommonInfo             cf     = new CommonInfo();
                cf.StoreID  = aspxCommonObj.StoreID;
                cf.PortalID = aspxCommonObj.PortalID;
                cf.AddedBy  = aspxCommonObj.UserName;
                // UpdateOrderDetails

                odinfo.OrderID             = orderId;
                odinfo.TransactionID       = odinfo.ResponseCode.ToString(transId);
                odinfo.InvoiceNumber       = Convert.ToString(invoice);
                odinfo.PurchaseOrderNumber = Convert.ToString(POrderno);
                odinfo.ResponseCode        = Convert.ToInt32(responseCode);
                odinfo.ResponseReasonCode  = Convert.ToInt32(responsereasonCode);
                odinfo.ResponseReasonText  = Convert.ToString(responsetext);
                ot.ObjOrderDetails         = odinfo;
                ot.ObjCommonInfo           = cf;
                //GIFT CARD PURCHAGE PAYMENT COMPLETED
                odinfo.OrderStatusID = 3;
                AspxOrderController.UpdateOrderDetails(ot);

                if (HttpContext.Current.Session["OrderCollection"] != null)
                {
                    var orderdata2 = new OrderDetailsCollection();
                    orderdata2 = (OrderDetailsCollection)HttpContext.Current.Session["OrderCollection"];
                    AspxOrderController.UpdateItemQuantity(orderdata2);
                    IssueGiftCard(orderdata2.LstOrderItemsInfo, orderId, true, aspxCommonObj);
                }
                HttpContext.Current.Session.Remove("OrderID");
                cms.ClearCartAfterPayment(aspxCommonObj);
                return("This transaction has been approved");
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 26
0
        public static string Parse(string transId, string invoice, string POrderno, int responseCode, int responsereasonCode, string responsetext, int storeID, int portalID, string userName, int customerID, string sessionCode)
        {
            try
            {
                OrderDetailsCollection ot = new OrderDetailsCollection();
                OrderDetailsInfo odinfo = new OrderDetailsInfo();
                CartManageSQLProvider cms = new CartManageSQLProvider();
                CommonInfo cf = new CommonInfo();
                cf.StoreID = storeID;
                cf.PortalID = portalID;
                cf.AddedBy = userName;
                // UpdateOrderDetails
                AspxOrderDetails objad = new AspxOrderDetails();
                SQLHandler sqlH = new SQLHandler();
                WcfSession ws = new WcfSession();
                odinfo.OrderID = ws.GetSessionVariable("OrderID");
                odinfo.TransactionID = odinfo.ResponseCode.ToString(transId);
                odinfo.InvoiceNumber = Convert.ToString(invoice);
                odinfo.PurchaseOrderNumber = Convert.ToString(POrderno);
                odinfo.ResponseCode = Convert.ToInt32(responseCode);
                odinfo.ResponseReasonCode = Convert.ToInt32(responsereasonCode);
                odinfo.ResponseReasonText = Convert.ToString(responsetext);
                ot.ObjOrderDetails = odinfo;
                ot.ObjCommonInfo = cf;
                odinfo.OrderStatusID = 8;
                objad.UpdateOrderDetails(ot);
                if (HttpContext.Current.Session["OrderCollection"] != null)
                {
                    OrderDetailsCollection orderdata2 = new OrderDetailsCollection();
                    orderdata2 = (OrderDetailsCollection)HttpContext.Current.Session["OrderCollection"];
                    objad.UpdateItemQuantity(orderdata2);
                }
                ws.ClearSessionVariable("OrderID");
                cms.ClearCartAfterPayment(customerID, sessionCode, storeID, portalID);
                return "This transaction has been approved";
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
        public int AddBillingAddress(OrderDetailsCollection orderData, OracleTransaction tran)
        {
            try
            {
                List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >();
                parameter.Add(new KeyValuePair <string, object>("CustomerID", orderData.ObjOrderDetails.CustomerID));
                parameter.Add(new KeyValuePair <string, object>("SessionCode", orderData.ObjOrderDetails.SessionCode));
                parameter.Add(new KeyValuePair <string, object>("FirstName", orderData.ObjBillingAddressInfo.FirstName));
                parameter.Add(new KeyValuePair <string, object>("LastName", orderData.ObjBillingAddressInfo.LastName));
                parameter.Add(new KeyValuePair <string, object>("Email", orderData.ObjBillingAddressInfo.EmailAddress));
                parameter.Add(new KeyValuePair <string, object>("Company", orderData.ObjBillingAddressInfo.CompanyName));
                parameter.Add(new KeyValuePair <string, object>("Address1", orderData.ObjBillingAddressInfo.Address));
                parameter.Add(new KeyValuePair <string, object>("Address2", orderData.ObjBillingAddressInfo.Address2));
                parameter.Add(new KeyValuePair <string, object>("City", orderData.ObjBillingAddressInfo.City));
                parameter.Add(new KeyValuePair <string, object>("State", orderData.ObjBillingAddressInfo.State));
                parameter.Add(new KeyValuePair <string, object>("Country", orderData.ObjBillingAddressInfo.Country));
                parameter.Add(new KeyValuePair <string, object>("Zip", orderData.ObjBillingAddressInfo.Zip));
                parameter.Add(new KeyValuePair <string, object>("Phone", orderData.ObjBillingAddressInfo.Phone));
                parameter.Add(new KeyValuePair <string, object>("Mobile", orderData.ObjBillingAddressInfo.Mobile));
                parameter.Add(new KeyValuePair <string, object>("Fax", orderData.ObjBillingAddressInfo.Fax));
                parameter.Add(new KeyValuePair <string, object>("WebSite", orderData.ObjBillingAddressInfo.WebSite));
                parameter.Add(new KeyValuePair <string, object>("UserName", orderData.ObjBillingAddressInfo.EmailAddress));
                parameter.Add(new KeyValuePair <string, object>("IsDefault", orderData.ObjBillingAddressInfo.IsDefaultBilling));
                parameter.Add(new KeyValuePair <string, object>("StoreID", orderData.ObjCommonInfo.StoreID));
                parameter.Add(new KeyValuePair <string, object>("PortalID", orderData.ObjCommonInfo.PortalID));
                parameter.Add(new KeyValuePair <string, object>("CultureName", orderData.ObjCommonInfo.CultureName));
                parameter.Add(new KeyValuePair <string, object>("AddedBy", orderData.ObjCommonInfo.AddedBy));

                OracleHandler sqlH = new OracleHandler();

                int billingAddressID = sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure,
                                                            "usp_Aspx_BillingAddress", parameter,
                                                            "UserBillingAddressID");

                return(billingAddressID);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 28
0
 public static string Parse(string transId, string invoice, string POrderno, int responseCode, int responsereasonCode, string responsetext, int storeID, int portalID, string userName, int customerID, string sessionCode)
 {
     try
     {
         OrderDetailsCollection ot     = new OrderDetailsCollection();
         OrderDetailsInfo       odinfo = new OrderDetailsInfo();
         CartManageSQLProvider  cms    = new CartManageSQLProvider();
         CommonInfo             cf     = new CommonInfo();
         cf.StoreID  = storeID;
         cf.PortalID = portalID;
         cf.AddedBy  = userName;
         // UpdateOrderDetails
         AspxOrderDetails objad = new AspxOrderDetails();
         SQLHandler       sqlH  = new SQLHandler();
         WcfSession       ws    = new WcfSession();
         odinfo.OrderID             = ws.GetSessionVariable("OrderID");
         odinfo.TransactionID       = odinfo.ResponseCode.ToString(transId);
         odinfo.InvoiceNumber       = Convert.ToString(invoice);
         odinfo.PurchaseOrderNumber = Convert.ToString(POrderno);
         odinfo.ResponseCode        = Convert.ToInt32(responseCode);
         odinfo.ResponseReasonCode  = Convert.ToInt32(responsereasonCode);
         odinfo.ResponseReasonText  = Convert.ToString(responsetext);
         ot.ObjOrderDetails         = odinfo;
         ot.ObjCommonInfo           = cf;
         odinfo.OrderStatusID       = 8;
         objad.UpdateOrderDetails(ot);
         if (HttpContext.Current.Session["OrderCollection"] != null)
         {
             OrderDetailsCollection orderdata2 = new OrderDetailsCollection();
             orderdata2 = (OrderDetailsCollection)HttpContext.Current.Session["OrderCollection"];
             objad.UpdateItemQuantity(orderdata2);
         }
         ws.ClearSessionVariable("OrderID");
         cms.ClearCartAfterPayment(customerID, sessionCode, storeID, portalID);
         return("This transaction has been approved");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 29
0
        public static int AddAddress(OrderDetailsCollection orderData, SqlTransaction tran)
        {
            try
            {
                List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >();

                parameter.Add(new KeyValuePair <string, object>("@FirstName", orderData.ObjBillingAddressInfo.FirstName));
                parameter.Add(new KeyValuePair <string, object>("@LastName", orderData.ObjBillingAddressInfo.LastName));
                parameter.Add(new KeyValuePair <string, object>("@CustomerID", orderData.ObjOrderDetails.CustomerID));
                parameter.Add(new KeyValuePair <string, object>("@SessionCode", orderData.ObjOrderDetails.SessionCode));
                parameter.Add(new KeyValuePair <string, object>("@Email", orderData.ObjBillingAddressInfo.EmailAddress));
                parameter.Add(new KeyValuePair <string, object>("@Company", orderData.ObjBillingAddressInfo.CompanyName));
                parameter.Add(new KeyValuePair <string, object>("@Address1", orderData.ObjBillingAddressInfo.Address));
                parameter.Add(new KeyValuePair <string, object>("@Address2", orderData.ObjBillingAddressInfo.Address2));
                parameter.Add(new KeyValuePair <string, object>("@City", orderData.ObjBillingAddressInfo.City));
                parameter.Add(new KeyValuePair <string, object>("@State", orderData.ObjBillingAddressInfo.State));
                parameter.Add(new KeyValuePair <string, object>("@Country", orderData.ObjBillingAddressInfo.Country));
                parameter.Add(new KeyValuePair <string, object>("@Zip", orderData.ObjBillingAddressInfo.Zip));
                parameter.Add(new KeyValuePair <string, object>("@Phone", orderData.ObjBillingAddressInfo.Phone));
                parameter.Add(new KeyValuePair <string, object>("@Mobile", orderData.ObjBillingAddressInfo.Mobile));
                parameter.Add(new KeyValuePair <string, object>("@Fax", orderData.ObjBillingAddressInfo.Fax));
                parameter.Add(new KeyValuePair <string, object>("@UserName", orderData.ObjBillingAddressInfo.EmailAddress));
                parameter.Add(new KeyValuePair <string, object>("@WebSite", orderData.ObjBillingAddressInfo.WebSite));
                parameter.Add(new KeyValuePair <string, object>("@StoreID", orderData.ObjCommonInfo.StoreID));
                parameter.Add(new KeyValuePair <string, object>("@PortalID", orderData.ObjCommonInfo.PortalID));
                parameter.Add(new KeyValuePair <string, object>("@CultureName", orderData.ObjCommonInfo.CultureName));
                parameter.Add(new KeyValuePair <string, object>("@AddedBy", orderData.ObjCommonInfo.AddedBy));

                SQLHandler sqlH = new SQLHandler();

                int addressID = sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure,
                                                     "usp_Aspx_UserAddress", parameter,
                                                     "@AddressID");

                return(addressID);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 30
0
        public int AddAddress(OrderDetailsCollection orderData, SqlTransaction tran)
        {
            try
            {
                List<KeyValuePair<string, object>> parameter = new List<KeyValuePair<string, object>>();

                parameter.Add(new KeyValuePair<string, object>("@FirstName", orderData.ObjBillingAddressInfo.FirstName));
                parameter.Add(new KeyValuePair<string, object>("@LastName", orderData.ObjBillingAddressInfo.LastName));
                parameter.Add(new KeyValuePair<string, object>("@CustomerID", orderData.ObjOrderDetails.CustomerID));
                parameter.Add(new KeyValuePair<string, object>("@SessionCode", orderData.ObjOrderDetails.SessionCode));
                parameter.Add(new KeyValuePair<string, object>("@Email", orderData.ObjBillingAddressInfo.EmailAddress));
                parameter.Add(new KeyValuePair<string, object>("@Company", orderData.ObjBillingAddressInfo.CompanyName));
                parameter.Add(new KeyValuePair<string, object>("@Address1", orderData.ObjBillingAddressInfo.Address));
                parameter.Add(new KeyValuePair<string, object>("@Address2", orderData.ObjBillingAddressInfo.Address2));
                parameter.Add(new KeyValuePair<string, object>("@City", orderData.ObjBillingAddressInfo.City));
                parameter.Add(new KeyValuePair<string, object>("@State", orderData.ObjBillingAddressInfo.State));
                parameter.Add(new KeyValuePair<string, object>("@Country", orderData.ObjBillingAddressInfo.Country));
                parameter.Add(new KeyValuePair<string, object>("@Zip", orderData.ObjBillingAddressInfo.Zip));
                parameter.Add(new KeyValuePair<string, object>("@Phone", orderData.ObjBillingAddressInfo.Phone));
                parameter.Add(new KeyValuePair<string, object>("@Mobile", orderData.ObjBillingAddressInfo.Mobile));
                parameter.Add(new KeyValuePair<string, object>("@Fax", orderData.ObjBillingAddressInfo.Fax));
                parameter.Add(new KeyValuePair<string, object>("@UserName", orderData.ObjBillingAddressInfo.EmailAddress));
                parameter.Add(new KeyValuePair<string, object>("@WebSite", orderData.ObjBillingAddressInfo.WebSite));
                parameter.Add(new KeyValuePair<string, object>("@StoreID", orderData.ObjCommonInfo.StoreID));
                parameter.Add(new KeyValuePair<string, object>("@PortalID", orderData.ObjCommonInfo.PortalID));
                parameter.Add(new KeyValuePair<string, object>("@CultureName", orderData.ObjCommonInfo.CultureName));
                parameter.Add(new KeyValuePair<string, object>("@AddedBy", orderData.ObjCommonInfo.AddedBy));

                SQLHandler sqlH = new SQLHandler();

                int addressID = sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure,
                                                            "usp_Aspx_UserAddress", parameter,
                                                            "@AddressID");

                return addressID;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 31
0
 public static void UpdateOrderDetails(OrderDetailsCollection orderData)
 {
     try
     {
         List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >();
         parameter.Add(new KeyValuePair <string, object>("@TransactionID", orderData.ObjOrderDetails.TransactionID));
         parameter.Add(new KeyValuePair <string, object>("@OrderStatusID", orderData.ObjOrderDetails.OrderStatusID));
         parameter.Add(new KeyValuePair <string, object>("@ResponseCode", orderData.ObjOrderDetails.ResponseCode));
         parameter.Add(new KeyValuePair <string, object>("@ResponseReasonCode", orderData.ObjOrderDetails.ResponseReasonCode));
         parameter.Add(new KeyValuePair <string, object>("@ResponseReasonText", orderData.ObjOrderDetails.ResponseReasonText));
         parameter.Add(new KeyValuePair <string, object>("@StoreID", orderData.ObjCommonInfo.StoreID));
         parameter.Add(new KeyValuePair <string, object>("@PortalID", orderData.ObjCommonInfo.PortalID));
         parameter.Add(new KeyValuePair <string, object>("@AddedBy", orderData.ObjCommonInfo.AddedBy));
         parameter.Add(new KeyValuePair <string, object>("@OrderID", orderData.ObjOrderDetails.OrderID));
         SQLHandler sqlH = new SQLHandler();
         sqlH.ExecuteNonQuery("[dbo].[usp_Aspx_UpdateOrderDetails]", parameter);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 32
0
        public static string ParseForMobile(string transId, OrderInfo orderInfo, string POrderno, int responseCode, int responsereasonCode, string responsetext)
        {
            try
            {
                var ot = new OrderDetailsCollection();
                var odinfo = new OrderDetailsInfo();
                var cms = new CartManageSQLProvider();
                var cf = new CommonInfo
                             {StoreID = orderInfo.StoreId, PortalID = orderInfo.PortalId, AddedBy = orderInfo.AddedBy};
                // UpdateOrderDetails
              
                odinfo.OrderID = orderInfo.OrderId;
                odinfo.TransactionID = odinfo.ResponseCode.ToString(transId);
                odinfo.InvoiceNumber = orderInfo.InvoiceNumber;
                odinfo.PurchaseOrderNumber = Convert.ToString(POrderno);
                odinfo.ResponseCode = Convert.ToInt32(responseCode);
                odinfo.ResponseReasonCode = Convert.ToInt32(responsereasonCode);
                odinfo.ResponseReasonText = Convert.ToString(responsetext);
                ot.ObjOrderDetails = odinfo;
                ot.ObjCommonInfo = cf;
                odinfo.OrderStatusID = 8;
                AspxOrderController.UpdateOrderDetails(ot);
                AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
                aspxCommonObj.CustomerID = orderInfo.CustomerId;
                aspxCommonObj.SessionCode = orderInfo.SessionCode;
                aspxCommonObj.StoreID = orderInfo.StoreId;
                aspxCommonObj.PortalID = orderInfo.PortalId;
                cms.ClearCartAfterPayment(aspxCommonObj);
                return "This transaction has been approved";
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
        public void UpdateOrderDetails(OrderDetailsCollection orderData)
        {
            try
            {
                List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >();

                //  parameter.Add(new KeyValuePair<string, object>("@InvoiceNumber", DateTime.Now.ToString("yyyyMMddhhmmss")));
                parameter.Add(new KeyValuePair <string, object>("TransactionID", orderData.ObjOrderDetails.TransactionID));
                parameter.Add(new KeyValuePair <string, object>("OrderStatusID", orderData.ObjOrderDetails.OrderStatusID));
                parameter.Add(new KeyValuePair <string, object>("ResponseCode", orderData.ObjOrderDetails.ResponseCode));
                parameter.Add(new KeyValuePair <string, object>("ResponseReasonCode", orderData.ObjOrderDetails.ResponseReasonCode));
                parameter.Add(new KeyValuePair <string, object>("ResponseReasonText", orderData.ObjOrderDetails.ResponseReasonText));
                parameter.Add(new KeyValuePair <string, object>("StoreID", orderData.ObjCommonInfo.StoreID));
                parameter.Add(new KeyValuePair <string, object>("PortalID", orderData.ObjCommonInfo.PortalID));
                parameter.Add(new KeyValuePair <string, object>("AddedBy", orderData.ObjCommonInfo.AddedBy));
                parameter.Add(new KeyValuePair <string, object>("OrderID", orderData.ObjOrderDetails.OrderID));
                OracleHandler sqlH = new OracleHandler();
                sqlH.ExecuteNonQuery("usp_Aspx_UpdateOrderDetails", parameter);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 34
0
        public static string Parse(string transId, string invoice, string POrderno, int responseCode, int responsereasonCode, string responsetext, AspxCommonInfo aspxCommonObj)
        {
            try
            {
                var ot = new OrderDetailsCollection();
                var odinfo = new OrderDetailsInfo();
                var cms = new CartManageSQLProvider();
                var cf = new CommonInfo {StoreID = aspxCommonObj.StoreID, PortalID = aspxCommonObj.PortalID, AddedBy = aspxCommonObj.UserName};
                // UpdateOrderDetails
              
                odinfo.OrderID =int.Parse(HttpContext.Current.Session["OrderID"].ToString());
                odinfo.TransactionID = odinfo.ResponseCode.ToString(transId);
                odinfo.InvoiceNumber = Convert.ToString(invoice);
                odinfo.PurchaseOrderNumber = Convert.ToString(POrderno);
                odinfo.ResponseCode = Convert.ToInt32(responseCode);
                odinfo.ResponseReasonCode = Convert.ToInt32(responsereasonCode);
                odinfo.ResponseReasonText = Convert.ToString(responsetext);
                ot.ObjOrderDetails = odinfo;
                ot.ObjCommonInfo = cf;
                odinfo.OrderStatusID = 8;
                AspxOrderController.UpdateOrderDetails(ot);
                if (HttpContext.Current.Session["OrderCollection"] != null)
                {
                    var orderdata2 =  (OrderDetailsCollection)HttpContext.Current.Session["OrderCollection"];
                    AspxOrderController.UpdateItemQuantity(orderdata2);
                }
                HttpContext.Current.Session.Remove("OrderID");
                cms.ClearCartAfterPayment(aspxCommonObj);
                return "This transaction has been approved";
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
        public int AddOrderDetails(OrderDetailsCollection orderData)
        {
            SQLHandler sqlH = new SQLHandler();
            SqlTransaction tran;
            tran = (SqlTransaction)sqlH.GetTransaction();
            //AspxCommerceSession sn = new AspxCommerceSession();

            orderData.Coupons = CheckOutSessions.Get<List<CouponSession>>("CouponSession");

            if (orderData.ObjOrderDetails.InvoiceNumber == null || orderData.ObjOrderDetails.InvoiceNumber == "")
            {
                orderData.ObjOrderDetails.InvoiceNumber = DateTime.Now.ToString("yyyyMMddhhmmss");
            }
            try
            {
                int billingAddressID = 0;
                int shippingAddressId = 0;
                int orderID = 0;
                if (orderData.ObjOrderDetails.IsMultipleCheckOut == false)
                {
                    if (int.Parse(orderData.ObjBillingAddressInfo.AddressID) == 0 &&
                        int.Parse(orderData.ObjShippingAddressInfo.AddressID) == 0)
                    {

                        billingAddressID = AspxOrderController.AddBillingAddress(orderData, tran);
                        if (!orderData.ObjOrderDetails.IsShippingAddressRequired)
                        {
                            shippingAddressId = AspxOrderController.AddShippingAddress(orderData, tran);
                        }
                    }
                    else
                    {

                        billingAddressID = AspxOrderController.AddBillingAddress(orderData, tran, int.Parse(orderData.ObjBillingAddressInfo.AddressID));
                        if (!orderData.ObjOrderDetails.IsDownloadable && !orderData.ObjOrderDetails.IsShippingAddressRequired)
                        {
                            shippingAddressId = AspxOrderController.AddShippingAddress(orderData, tran, int.Parse(orderData.ObjShippingAddressInfo.AddressID));
                        }
                    }

                }
                int paymentMethodID = AspxOrderController.AddPaymentInfo(orderData, tran);

                if (billingAddressID > 0)
                {
                    orderID = AspxOrderController.AddOrder(orderData, tran, billingAddressID, paymentMethodID);
                    //sn.SetSessionVariable("OrderID", orderID);
                    SetSessionVariable("OrderID", orderID);
                    orderData.ObjOrderDetails.OrderID = orderID;
                    SetSessionVariable("OrderCollection", orderData);
                }
                else
                {
                    orderID = AspxOrderController.AddOrderWithMultipleCheckOut(orderData, tran, paymentMethodID);

                    //sn.SetSessionVariable("OrderID", orderID);
                    SetSessionVariable("OrderID", orderID);
                    orderData.ObjOrderDetails.OrderID = orderID;
                    SetSessionVariable("OrderCollection", orderData);
                }

                foreach (OrderTaxInfo item in orderData.ObjOrderTaxInfo)
                {
                    int itemID = item.ItemID;
                    int taxManageRuleID = item.TaxManageRuleID;
                    decimal taxSubTotal = item.TaxSubTotal;
                    int storeID = item.StoreID;
                    int portalID = item.PortalID;
                    string addedBy = item.AddedBy;
                    string costVariantValueIDs = item.CostVariantsValueIDs;
                    OrderTaxRuleMapping(itemID, orderID, taxManageRuleID, taxSubTotal, storeID, portalID, addedBy, costVariantValueIDs);
                }

                if (shippingAddressId > 0)
                    AspxOrderController.AddOrderItems(orderData, tran, orderID, shippingAddressId);
                else
                    AspxOrderController.AddOrderItemsList(orderData, tran, orderID);



                //add every paymentgateway
                // GiftCardController.IssueGiftCard(orderData.LstOrderItemsInfo, orderData.ObjCommonInfo.StoreID,
                //                               orderData.ObjCommonInfo.PortalID,orderData.ObjCommonInfo.AddedBy, orderData.ObjCommonInfo.CultureName);

                tran.Commit();
                return orderID;
            }
            catch (SqlException sqlEX)
            {

                throw new ArgumentException(sqlEX.Message);
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw ex;
            }
        }
        public int SaveOrderDetails(OrderDetailsCollection orderDetail)
        {
            try
            {
                if (orderDetail.ObjOrderDetails.OrderStatusID == 0)
                    orderDetail.ObjOrderDetails.OrderStatusID = 7;
                int orderID = AddOrderDetails(orderDetail);
                return orderID;
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
 public static int AddOrder(OrderDetailsCollection orderData, SqlTransaction tran, int billingAddressID, int paymentMethodId)
 {
     try
     {
         int orderID = AspxOrderProvider.AddOrder(orderData, tran, billingAddressID, paymentMethodId);
         return orderID;
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 38
0
        public void ParseAfterIPN(string postData, AspxCommonInfo aspxCommonObj, string templateName, string addressPath)
        {
            var ph = new PayPalHandler();
            string transId = string.Empty;
            string orderStatus = string.Empty;

            try
            {
                //split response into string array using whitespace delimeter
                String[] stringArray = postData.Split('\n');

                // NOTE:
                /*
                * loop is set to start at 1 rather than 0 because first
                string in array will be single word SUCCESS or FAIL
                Only used to verify post data
                */
                var ot = new OrderDetailsCollection();
                var odinfo = new OrderDetailsInfo();
                var cms = new CartManageSQLProvider();
                var cf = new CommonInfo {StoreID = aspxCommonObj.StoreID, PortalID = aspxCommonObj.PortalID, AddedBy = aspxCommonObj.UserName};
                // UpdateOrderDetails
            
                var sqlH = new SQLHandler();
                // use split to split array we already have using "=" as delimiter
             
                int i;
                for (i = 1; i < stringArray.Length - 1; i++)
                {
                    String[] stringArray1 = stringArray[i].Split('=');

                    String sKey = stringArray1[0];
                    String sValue = HttpUtility.UrlDecode(stringArray1[1]);

                    // set string vars to hold variable names using a switch
                    switch (sKey)
                    {
                        case "payment_status":
                            odinfo.ResponseReasonText = Convert.ToString(sValue);
                            orderStatus = Convert.ToString(sValue);
                            break;

                        case "mc_fee":
                            // ph.PaymentFee = Convert.ToDouble(sValue);
                            break;

                        case "payer_email":
                            // ph.PayerEmail = Convert.ToString(sValue);
                            break;

                        case "Tx Token":
                            // ph.TxToken = Convert.ToString(sValue);
                            break;

                        case "txn_id":
                            odinfo.TransactionID = Convert.ToString(sValue);
                            transId = Convert.ToString(sValue);
                            break;

                    }
                }
             
                ot.ObjCommonInfo = cf;
                //odinfo.OrderStatusID = 8;
                //objad.UpdateOrderDetails(ot);
                if (odinfo.ResponseReasonText.ToLower().Trim() == "completed")
                {
                    if (HttpContext.Current.Session["OrderCollection"] != null)
                    {
                        var orderdata2 = (OrderDetailsCollection)HttpContext.Current.Session["OrderCollection"];
                        AspxOrderController.UpdateItemQuantity(orderdata2);
                    }
                }
                cms.ClearCartAfterPayment(aspxCommonObj);

                //invoice  transID
                if (HttpContext.Current.Session["OrderCollection"] != null)
                {
                    var orderdata = (OrderDetailsCollection)HttpContext.Current.Session["OrderCollection"];
                    orderdata.ObjOrderDetails.OrderStatus = orderStatus;
                    EmailTemplate.SendEmailForOrder(aspxCommonObj.PortalID, orderdata, addressPath, templateName, transId);
                }
                HttpContext.Current.Session.Remove("OrderCollection");
               
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 39
0
        public int AddPaymentInfo(OrderDetailsCollection orderData, SqlTransaction tran)
        {
            try
            {
                List<KeyValuePair<string, object>> parameter = new List<KeyValuePair<string, object>>();

                parameter.Add(new KeyValuePair<string, object>("@PaymentMethodName",
                                                               orderData.ObjPaymentInfo.PaymentMethodName));
                parameter.Add(new KeyValuePair<string, object>("@PaymentMethodCode",
                                                               orderData.ObjPaymentInfo.PaymentMethodCode));
                if (orderData.ObjPaymentInfo.PaymentMethodCode == "CC")
                {
                    parameter.Add(new KeyValuePair<string, object>("@CardNumber", orderData.ObjPaymentInfo.CardNumber));
                    parameter.Add(new KeyValuePair<string, object>("@TransactionType",
                                                                   orderData.ObjPaymentInfo.TransactionType));
                    parameter.Add(new KeyValuePair<string, object>("@CardType", orderData.ObjPaymentInfo.CardType));
                    parameter.Add(new KeyValuePair<string, object>("@CardCode", orderData.ObjPaymentInfo.CardCode));
                    parameter.Add(new KeyValuePair<string, object>("@ExpireDate", orderData.ObjPaymentInfo.ExpireDate));

                    parameter.Add(new KeyValuePair<string, object>("@AccountNumber",
                                                                   ""));
                    parameter.Add(new KeyValuePair<string, object>("@RoutingNumber",
                                                                   ""));
                    parameter.Add(new KeyValuePair<string, object>("@AccountType", ""));
                    parameter.Add(new KeyValuePair<string, object>("@BankName", ""));
                    parameter.Add(new KeyValuePair<string, object>("@AccountHolderName",
                                                                   ""));
                    parameter.Add(new KeyValuePair<string, object>("@ChequeType", ""));
                    parameter.Add(new KeyValuePair<string, object>("@ChequeNumber",
                                                                   ""));
                    parameter.Add(new KeyValuePair<string, object>("@RecurringBillingStatus",
                                                                   false));
                }
                else if (orderData.ObjPaymentInfo.PaymentMethodCode == "ECHECK")
                {
                    parameter.Add(new KeyValuePair<string, object>("@CardNumber", ""));
                    parameter.Add(new KeyValuePair<string, object>("@TransactionType", ""));
                    parameter.Add(new KeyValuePair<string, object>("@CardType", ""));
                    parameter.Add(new KeyValuePair<string, object>("@CardCode", ""));
                    parameter.Add(new KeyValuePair<string, object>("@ExpireDate", ""));
                    parameter.Add(new KeyValuePair<string, object>("@AccountNumber", orderData.ObjPaymentInfo.AccountNumber));
                    parameter.Add(new KeyValuePair<string, object>("@RoutingNumber", orderData.ObjPaymentInfo.RoutingNumber));
                    parameter.Add(new KeyValuePair<string, object>("@AccountType", orderData.ObjPaymentInfo.AccountType));
                    parameter.Add(new KeyValuePair<string, object>("@BankName", orderData.ObjPaymentInfo.BankName));
                    parameter.Add(new KeyValuePair<string, object>("@AccountHolderName", orderData.ObjPaymentInfo.AccountHolderName));
                    parameter.Add(new KeyValuePair<string, object>("@ChequeType", orderData.ObjPaymentInfo.ChequeType));
                    parameter.Add(new KeyValuePair<string, object>("@ChequeNumber", orderData.ObjPaymentInfo.ChequeNumber));
                    parameter.Add(new KeyValuePair<string, object>("@RecurringBillingStatus", orderData.ObjPaymentInfo.RecurringBillingStatus));
                }
                else
                {
                    parameter.Add(new KeyValuePair<string, object>("@CardNumber", ""));
                    parameter.Add(new KeyValuePair<string, object>("@TransactionType", ""));
                    parameter.Add(new KeyValuePair<string, object>("@CardType", ""));
                    parameter.Add(new KeyValuePair<string, object>("@CardCode", ""));
                    parameter.Add(new KeyValuePair<string, object>("@ExpireDate", ""));
                    parameter.Add(new KeyValuePair<string, object>("@AccountNumber", ""));
                    parameter.Add(new KeyValuePair<string, object>("@RoutingNumber", ""));
                    parameter.Add(new KeyValuePair<string, object>("@AccountType", ""));
                    parameter.Add(new KeyValuePair<string, object>("@BankName", ""));
                    parameter.Add(new KeyValuePair<string, object>("@AccountHolderName", ""));
                    parameter.Add(new KeyValuePair<string, object>("@ChequeType", ""));
                    parameter.Add(new KeyValuePair<string, object>("@ChequeNumber", ""));
                    parameter.Add(new KeyValuePair<string, object>("@RecurringBillingStatus", orderData.ObjPaymentInfo.RecurringBillingStatus));

                }

                parameter.Add(new KeyValuePair<string, object>("@StoreID", orderData.ObjCommonInfo.StoreID));
                parameter.Add(new KeyValuePair<string, object>("@PortalID", orderData.ObjCommonInfo.PortalID));
                parameter.Add(new KeyValuePair<string, object>("@CultureName", orderData.ObjCommonInfo.CultureName));
                parameter.Add(new KeyValuePair<string, object>("@AddedBy", orderData.ObjCommonInfo.AddedBy));
                SQLHandler sqlH = new SQLHandler();
                int paymentMethodID = sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure, "[usp_Aspx_PaymentInfo]",
                                                           parameter, "@PaymentMethodID");
                return paymentMethodID;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 40
0
        public static int AddPaymentInfo(OrderDetailsCollection orderData, SqlTransaction tran)
        {
            try
            {
                List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >();

                parameter.Add(new KeyValuePair <string, object>("@PaymentMethodName",
                                                                orderData.ObjPaymentInfo.PaymentMethodName));
                parameter.Add(new KeyValuePair <string, object>("@PaymentMethodCode",
                                                                orderData.ObjPaymentInfo.PaymentMethodCode));
                if (orderData.ObjPaymentInfo.PaymentMethodCode == "CC")
                {
                    parameter.Add(new KeyValuePair <string, object>("@CardNumber", orderData.ObjPaymentInfo.CardNumber));
                    parameter.Add(new KeyValuePair <string, object>("@TransactionType",
                                                                    orderData.ObjPaymentInfo.TransactionType));
                    parameter.Add(new KeyValuePair <string, object>("@CardType", orderData.ObjPaymentInfo.CardType));
                    parameter.Add(new KeyValuePair <string, object>("@CardCode", orderData.ObjPaymentInfo.CardCode));
                    parameter.Add(new KeyValuePair <string, object>("@ExpireDate", orderData.ObjPaymentInfo.ExpireDate));

                    parameter.Add(new KeyValuePair <string, object>("@AccountNumber",
                                                                    ""));
                    parameter.Add(new KeyValuePair <string, object>("@RoutingNumber",
                                                                    ""));
                    parameter.Add(new KeyValuePair <string, object>("@AccountType", ""));
                    parameter.Add(new KeyValuePair <string, object>("@BankName", ""));
                    parameter.Add(new KeyValuePair <string, object>("@AccountHolderName",
                                                                    ""));
                    parameter.Add(new KeyValuePair <string, object>("@ChequeType", ""));
                    parameter.Add(new KeyValuePair <string, object>("@ChequeNumber",
                                                                    ""));
                    parameter.Add(new KeyValuePair <string, object>("@RecurringBillingStatus",
                                                                    false));
                }
                else if (orderData.ObjPaymentInfo.PaymentMethodCode == "ECHECK")
                {
                    parameter.Add(new KeyValuePair <string, object>("@CardNumber", ""));
                    parameter.Add(new KeyValuePair <string, object>("@TransactionType", ""));
                    parameter.Add(new KeyValuePair <string, object>("@CardType", ""));
                    parameter.Add(new KeyValuePair <string, object>("@CardCode", ""));
                    parameter.Add(new KeyValuePair <string, object>("@ExpireDate", ""));
                    parameter.Add(new KeyValuePair <string, object>("@AccountNumber", orderData.ObjPaymentInfo.AccountNumber));
                    parameter.Add(new KeyValuePair <string, object>("@RoutingNumber", orderData.ObjPaymentInfo.RoutingNumber));
                    parameter.Add(new KeyValuePair <string, object>("@AccountType", orderData.ObjPaymentInfo.AccountType));
                    parameter.Add(new KeyValuePair <string, object>("@BankName", orderData.ObjPaymentInfo.BankName));
                    parameter.Add(new KeyValuePair <string, object>("@AccountHolderName", orderData.ObjPaymentInfo.AccountHolderName));
                    parameter.Add(new KeyValuePair <string, object>("@ChequeType", orderData.ObjPaymentInfo.ChequeType));
                    parameter.Add(new KeyValuePair <string, object>("@ChequeNumber", orderData.ObjPaymentInfo.ChequeNumber));
                    parameter.Add(new KeyValuePair <string, object>("@RecurringBillingStatus", orderData.ObjPaymentInfo.RecurringBillingStatus));
                }
                else
                {
                    parameter.Add(new KeyValuePair <string, object>("@CardNumber", ""));
                    parameter.Add(new KeyValuePair <string, object>("@TransactionType", ""));
                    parameter.Add(new KeyValuePair <string, object>("@CardType", ""));
                    parameter.Add(new KeyValuePair <string, object>("@CardCode", ""));
                    parameter.Add(new KeyValuePair <string, object>("@ExpireDate", ""));
                    parameter.Add(new KeyValuePair <string, object>("@AccountNumber", ""));
                    parameter.Add(new KeyValuePair <string, object>("@RoutingNumber", ""));
                    parameter.Add(new KeyValuePair <string, object>("@AccountType", ""));
                    parameter.Add(new KeyValuePair <string, object>("@BankName", ""));
                    parameter.Add(new KeyValuePair <string, object>("@AccountHolderName", ""));
                    parameter.Add(new KeyValuePair <string, object>("@ChequeType", ""));
                    parameter.Add(new KeyValuePair <string, object>("@ChequeNumber", ""));
                    parameter.Add(new KeyValuePair <string, object>("@RecurringBillingStatus", orderData.ObjPaymentInfo.RecurringBillingStatus));
                }

                parameter.Add(new KeyValuePair <string, object>("@StoreID", orderData.ObjCommonInfo.StoreID));
                parameter.Add(new KeyValuePair <string, object>("@PortalID", orderData.ObjCommonInfo.PortalID));
                parameter.Add(new KeyValuePair <string, object>("@CultureName", orderData.ObjCommonInfo.CultureName));
                parameter.Add(new KeyValuePair <string, object>("@AddedBy", orderData.ObjCommonInfo.AddedBy));
                SQLHandler sqlH            = new SQLHandler();
                int        paymentMethodID = sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure, "[usp_Aspx_PaymentInfo]",
                                                                  parameter, "@PaymentMethodID");
                return(paymentMethodID);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
    public void AddOrderDetails(OrderDetailsCollection OrderData)
    {
        SQLHandler sqlH = new SQLHandler();
        SqlTransaction tran;
        tran = (SqlTransaction)sqlH.GetTransaction();
        WcfSession sn = new WcfSession();
        try
        {
            AspxOrderDetails ObjOrderDetails = new AspxOrderDetails();

            int billingAddressID = 0;
            int shippingAddressId = 0;
            int orderID = 0;
            if (OrderData.ObjOrderDetails.IsMultipleCheckOut == false)
            {
                if (OrderData.ObjBillingAddressInfo.IsBillingAsShipping == true)
                {
                    if (int.Parse(OrderData.ObjBillingAddressInfo.AddressID) == 0 &&
                        int.Parse(OrderData.ObjShippingAddressInfo.AddressID) == 0)
                    {
                        int addressID = ObjOrderDetails.AddAddress(OrderData, tran);
                        billingAddressID = ObjOrderDetails.AddBillingAddress(OrderData, tran, addressID);
                        shippingAddressId = ObjOrderDetails.AddShippingAddress(OrderData, tran, addressID);
                    }
                }
                else
                {
                    if (int.Parse(OrderData.ObjBillingAddressInfo.AddressID) == 0)
                        billingAddressID = ObjOrderDetails.AddBillingAddress(OrderData, tran);
                    if (int.Parse(OrderData.ObjShippingAddressInfo.AddressID) == 0)
                        shippingAddressId = ObjOrderDetails.AddShippingAddress(OrderData, tran);
                }
            }
            int paymentMethodID = ObjOrderDetails.AddPaymentInfo(OrderData, tran);

            if (billingAddressID > 0)
            {
                orderID = ObjOrderDetails.AddOrder(OrderData, tran, billingAddressID, paymentMethodID);

                sn.SetSessionVariable("OrderID", orderID);

            }
            else
            {
                orderID = ObjOrderDetails.AddOrderWithMultipleCheckOut(OrderData, tran, paymentMethodID);

                sn.SetSessionVariable("OrderID", orderID);
            }

            if (shippingAddressId > 0)
                ObjOrderDetails.AddOrderItems(OrderData, tran, orderID, shippingAddressId);
            else
                ObjOrderDetails.AddOrderItemsList(OrderData, tran, orderID);

            tran.Commit();
        }
        catch (SqlException sqlEX)
        {

            throw new ArgumentException(sqlEX.Message);
        }
        catch (Exception ex)
        {
            tran.Rollback();
            throw ex;
        }
    }
Ejemplo n.º 42
0
        //single
        public void AddOrderItems(OrderDetailsCollection orderData, SqlTransaction tran,int orderID,int shippingAddressID)
        {
            try
            {
                foreach (OrderItemInfo objItems in orderData.LstOrderItemsInfo)
                {
                    List<KeyValuePair<string, object>> parameter = new List<KeyValuePair<string, object>>();

                    parameter.Add(new KeyValuePair<string, object>("@OrderID", orderID));
                    parameter.Add(new KeyValuePair<string, object>("@UserShippingAddressID", shippingAddressID));
                    parameter.Add(new KeyValuePair<string, object>("@ShippingMethodID", objItems.ShippingMethodID));
                    parameter.Add(new KeyValuePair<string, object>("@ItemID", objItems.ItemID));
                    parameter.Add(new KeyValuePair<string, object>("@Price", objItems.Price));
                    parameter.Add(new KeyValuePair<string, object>("@Quantity", objItems.Quantity));
                    parameter.Add(new KeyValuePair<string, object>("@Weight", objItems.Weight));
                    parameter.Add(new KeyValuePair<string, object>("@Remarks", objItems.Remarks));
                    parameter.Add(new KeyValuePair<string, object>("@ShippingRate", objItems.ShippingRate));

                    parameter.Add(new KeyValuePair<string, object>("@StoreID", orderData.ObjCommonInfo.StoreID));
                    parameter.Add(new KeyValuePair<string, object>("@PortalID", orderData.ObjCommonInfo.PortalID));
                    parameter.Add(new KeyValuePair<string, object>("@CultureName", orderData.ObjCommonInfo.CultureName));
                    parameter.Add(new KeyValuePair<string, object>("@AddedBy", orderData.ObjCommonInfo.AddedBy));
                    parameter.Add(new KeyValuePair<string, object>("@CostVariants", objItems.Variants));                 
                  
                    SQLHandler sqlH = new SQLHandler();
                    sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure, "[usp_Aspx_OrderItem]", parameter);
                   
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 //single
 public static void AddOrderItems(OrderDetailsCollection orderData, SqlTransaction tran, int orderID, int shippingAddressID)
 {
     try
     {
         AspxOrderProvider.AddOrderItems(orderData, tran, orderID, shippingAddressID);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
        public void AddOrderDetails(OrderDetailsCollection orderData)
        {
            SQLHandler sqlH = new SQLHandler();
            SqlTransaction tran;
            tran = (SqlTransaction)sqlH.GetTransaction();
            //AspxCommerceSession sn = new AspxCommerceSession();
            if (orderData.ObjOrderDetails.InvoiceNumber == null || orderData.ObjOrderDetails.InvoiceNumber == "")
            {
                orderData.ObjOrderDetails.InvoiceNumber = DateTime.Now.ToString("yyyyMMddhhmmss");
            }
            try
            {
                AspxOrderDetails ObjOrderDetails = new AspxOrderDetails();

                int billingAddressID = 0;
                int shippingAddressId = 0;
                int orderID = 0;
                if (orderData.ObjOrderDetails.IsMultipleCheckOut == false)
                {
                    if (orderData.ObjBillingAddressInfo.IsBillingAsShipping == true)
                    {
                        if (int.Parse(orderData.ObjBillingAddressInfo.AddressID) == 0 &&
                            int.Parse(orderData.ObjShippingAddressInfo.AddressID) == 0)
                        {
                            int addressID = ObjOrderDetails.AddAddress(orderData, tran);
                            billingAddressID = ObjOrderDetails.AddBillingAddress(orderData, tran, addressID);
                            shippingAddressId = ObjOrderDetails.AddShippingAddress(orderData, tran, addressID);
                        }
                    }
                    else
                    {
                        if (int.Parse(orderData.ObjBillingAddressInfo.AddressID) == 0)
                            billingAddressID = ObjOrderDetails.AddBillingAddress(orderData, tran);
                  
                        if (int.Parse(orderData.ObjShippingAddressInfo.AddressID) == 0)
                        {
                            if (!orderData.ObjOrderDetails.IsDownloadable)
                            {
                                shippingAddressId = ObjOrderDetails.AddShippingAddress(orderData, tran);
                            }

                        }
                    }
                }
                int paymentMethodID = ObjOrderDetails.AddPaymentInfo(orderData, tran);

                if (billingAddressID > 0)
                {
                    orderID = ObjOrderDetails.AddOrder(orderData, tran, billingAddressID, paymentMethodID);
                    //sn.SetSessionVariable("OrderID", orderID);
                    SetSessionVariable("OrderID", orderID);
                    orderData.ObjOrderDetails.OrderID = orderID;
                    SetSessionVariable("OrderCollection", orderData);
                }
                else
                {
                    orderID = ObjOrderDetails.AddOrderWithMultipleCheckOut(orderData, tran, paymentMethodID);

                    //sn.SetSessionVariable("OrderID", orderID);
                    SetSessionVariable("OrderID", orderID);
                    orderData.ObjOrderDetails.OrderID = orderID;
                    SetSessionVariable("OrderCollection", orderData);
                }

                if (shippingAddressId > 0)
                    ObjOrderDetails.AddOrderItems(orderData, tran, orderID, shippingAddressId);
                else
                    ObjOrderDetails.AddOrderItemsList(orderData, tran, orderID);

                tran.Commit();
            }
            catch (SqlException sqlEX)
            {

                throw new ArgumentException(sqlEX.Message);
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw ex;
            }
        }
 public static int AddOrderWithMultipleCheckOut(OrderDetailsCollection orderData, SqlTransaction tran, int paymentMethodId)
 {
     try
     {
         int orderID = AspxOrderProvider.AddOrderWithMultipleCheckOut(orderData, tran, paymentMethodId);
         return orderID;
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 46
0
        public static PayPalHandler ParseAfterIPN(string postData, int storeID, int portalID, string userName, int customerID, string sessionCode, string TemplateName, string addressPath)
        {
            String        sKey, sValue;
            PayPalHandler ph      = new PayPalHandler();
            string        transID = string.Empty;

            try
            {
                //split response into string array using whitespace delimeter
                String[] StringArray = postData.Split('\n');

                // NOTE:

                /*
                 * loop is set to start at 1 rather than 0 because first
                 * string in array will be single word SUCCESS or FAIL
                 * Only used to verify post data
                 */
                OrderDetailsCollection ot     = new OrderDetailsCollection();
                OrderDetailsInfo       odinfo = new OrderDetailsInfo();
                CartManageSQLProvider  cms    = new CartManageSQLProvider();
                CommonInfo             cf     = new CommonInfo();
                cf.StoreID  = storeID;
                cf.PortalID = portalID;
                cf.AddedBy  = userName;
                // UpdateOrderDetails
                AspxOrderDetails objad = new AspxOrderDetails();
                SQLHandler       sqlH  = new SQLHandler();
                // use split to split array we already have using "=" as delimiter
                WcfSession ws = new WcfSession();
                odinfo.OrderID = ws.GetSessionVariable("OrderID");
                int i;
                for (i = 1; i < StringArray.Length - 1; i++)
                {
                    String[] StringArray1 = StringArray[i].Split('=');

                    sKey   = StringArray1[0];
                    sValue = HttpUtility.UrlDecode(StringArray1[1]);

                    // set string vars to hold variable names using a switch
                    switch (sKey)
                    {
                    case "payment_status":
                        odinfo.ResponseReasonText = Convert.ToString(sValue);
                        break;

                    case "mc_fee":
                        // ph.PaymentFee = Convert.ToDouble(sValue);
                        break;

                    case "payer_email":
                        // ph.PayerEmail = Convert.ToString(sValue);
                        break;

                    case "Tx Token":
                        // ph.TxToken = Convert.ToString(sValue);
                        break;

                    case "txn_id":
                        odinfo.TransactionID = Convert.ToString(sValue);
                        transID = Convert.ToString(sValue);
                        break;
                    }
                }

                ot.ObjOrderDetails = odinfo;
                ot.ObjCommonInfo   = cf;
                //odinfo.OrderStatusID = 8;
                //objad.UpdateOrderDetails(ot);
                if (odinfo.ResponseReasonText.ToLower().Trim() == "completed")
                {
                    if (HttpContext.Current.Session["OrderCollection"] != null)
                    {
                        OrderDetailsCollection orderdata2 = new OrderDetailsCollection();
                        orderdata2 = (OrderDetailsCollection)HttpContext.Current.Session["OrderCollection"];
                        objad.UpdateItemQuantity(orderdata2);
                    }
                }
                ws.ClearSessionVariable("OrderID");
                cms.ClearCartAfterPayment(customerID, sessionCode, storeID, portalID);

                //invoice  transID
                if (HttpContext.Current.Session["OrderCollection"] != null)
                {
                    OrderDetailsCollection orderdata = new OrderDetailsCollection();
                    orderdata = (OrderDetailsCollection)HttpContext.Current.Session["OrderCollection"];
                    EmailTemplate.SendEmailForOrder(portalID, orderdata, addressPath, TemplateName, transID);
                }
                ws.ClearSessionVariable("OrderCollection");

                return(ph);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 47
0
        public static PayPalHandler Parse(string postData, int storeID, int portalID, string userName, int customerID, string sessionCode)
        {
            String        sKey, sValue;
            PayPalHandler ph      = new PayPalHandler();
            string        transID = string.Empty;

            try
            {
                //split response into string array using whitespace delimeter
                String[] StringArray = postData.Split('\n');

                // NOTE:

                /*
                 * loop is set to start at 1 rather than 0 because first
                 * string in array will be single word SUCCESS or FAIL
                 * Only used to verify post data
                 */
                OrderDetailsCollection ot     = new OrderDetailsCollection();
                OrderDetailsInfo       odinfo = new OrderDetailsInfo();
                CartManageSQLProvider  cms    = new CartManageSQLProvider();
                CommonInfo             cf     = new CommonInfo();
                cf.StoreID  = storeID;
                cf.PortalID = portalID;
                cf.AddedBy  = userName;
                // UpdateOrderDetails
                AspxOrderDetails objad = new AspxOrderDetails();
                SQLHandler       sqlH  = new SQLHandler();
                // use split to split array we already have using "=" as delimiter
                WcfSession ws = new WcfSession();
                odinfo.OrderID = ws.GetSessionVariable("OrderID");
                int i;
                for (i = 1; i < StringArray.Length - 1; i++)
                {
                    String[] StringArray1 = StringArray[i].Split('=');

                    sKey   = StringArray1[0];
                    sValue = HttpUtility.UrlDecode(StringArray1[1]);

                    // set string vars to hold variable names using a switch
                    switch (sKey)
                    {
                    case "payment_status":
                        odinfo.ResponseReasonText = Convert.ToString(sValue);
                        break;

                    case "mc_fee":
                        // ph.PaymentFee = Convert.ToDouble(sValue);
                        break;

                    case "payer_email":
                        // ph.PayerEmail = Convert.ToString(sValue);
                        break;

                    case "Tx Token":
                        // ph.TxToken = Convert.ToString(sValue);
                        break;

                    case "txn_id":
                        odinfo.TransactionID = Convert.ToString(sValue);
                        transID = Convert.ToString(sValue);
                        break;
                    }
                }
                // odinfo.InvoiceNumber = DateTime.Now.ToString("yyyyMMddhhmmss");
                ot.ObjOrderDetails   = odinfo;
                ot.ObjCommonInfo     = cf;
                odinfo.OrderStatusID = 8;
                objad.UpdateOrderDetails(ot);
                if (HttpContext.Current.Session["OrderCollection"] != null)
                {
                    OrderDetailsCollection orderdata2 = new OrderDetailsCollection();
                    orderdata2 = (OrderDetailsCollection)HttpContext.Current.Session["OrderCollection"];
                    objad.UpdateItemQuantity(orderdata2);
                }
                ws.ClearSessionVariable("OrderID");
                cms.ClearCartAfterPayment(customerID, sessionCode, storeID, portalID);

                //invoice  transID
                if (HttpContext.Current.Session["OrderCollection"] != null)
                {
                    //StringBuilder emailbody = new StringBuilder();
                    //emailbody.Append("<div style=\"width:600px;min-height:auto;background-color:#f2f2f2;color:#707070;font:13px/24px Verdana,Geneva,sans-serif;\"><div style=\"color:#49B8F4;  font-size:20px;margin:auto 0; font-family:Verdana,Geneva,sans-serif;\"> <label>Thank you for Order </label></div>");
                    //OrderDetailsCollection orderdata = new OrderDetailsCollection();
                    //orderdata = (OrderDetailsCollection)HttpContext.Current.Session["OrderCollection"];
                    //emailbody.Append("<p> <strong>Dear </strong> " + orderdata.ObjBillingAddressInfo.FirstName.ToString() + "</p>");
                    ////if customer is registered
                    // if (orderdata.ObjCommonInfo.AddedBy.ToString().ToLower() == "anonymoususer" && orderdata.ObjOrderDetails.CustomerID ==0)
                    //{
                    //    emailbody.Append("<div>  You have ordered items from <strong>AspxCommerce</strong>. <br /> Thanks for using <strong>AspxCommerce</strong>. You can now ship any items. To see all the transaction details, log in to your <b>AspxCommerce</b> <a href=" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/Register.aspx?session="+sessionCode +"" + ">account</a>.<br /> It may take a few moments for this transaction to appear in your account.<br /></div> ");
                    //}
                    //else
                    //{//if customer is guest..send session code
                    //    emailbody.Append("<div> You have ordered items from <strong>AspxCommerce</strong>. <br /> Thanks for using <strong>AspxCommerce</strong>. You can now ship any items. To see all the transaction details, Please Resister and log in to your <b>AspxCommerce</b> <a href=" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/Login.aspx" + ">account</a>.<br /> It may take a few moments for this transaction to appear in your account.<br /></div>");
                    //}
                    //emailbody.Append("<div> <strong>Your Order Details </strong><br />  Transaction ID: <strong >" + odinfo.TransactionID.ToString() + "</strong><br />Invoice No: <strong>" + odinfo.InvoiceNumber.ToString() + "</strong><br />Paymenet System Used: <strong>" + orderdata.ObjPaymentInfo.PaymentMethodName + "</strong><br /> </div> ");
                    //emailbody.Append("<div> If you having Issuses with transaction or any further inquiry then you can mail [email protected].</div><div> Please do not reply to this email. This mail is automatic generated after you have ordered .</div><div>Thank You, <br /><a href=\"" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "\"><img src=\"" + "http://www.aspxcommerce.com" + "/Templates/AspxCommerce/images/aspxcommerce.png\" alt=\"AspxCommerce Team\"/></a></div></div>");
                    //string body = emailbody.ToString();
                    //SageFrameConfig pagebase = new SageFrameConfig();
                    //string emailSuperAdmin = pagebase.GetSettingsByKey(SageFrameSettingKeys.SuperUserEmail);//"*****@*****.**";
                    //string emailSiteAdmin =  pagebase.GetSettingsByKey(SageFrameSettingKeys.SiteAdminEmailAddress);
                    //MailHelper.SendMailNoAttachment("*****@*****.**", orderdata.ObjBillingAddressInfo.EmailAddress.ToString(), "Your Order Details", body, emailSuperAdmin, emailSiteAdmin);
                    //ws.ClearSessionVariable("OrderCollection");
                    string sendEmailFrom   = StoreSetting.GetStoreSettingValueByKey(StoreSetting.SendEcommerceEmailsFrom, storeID, portalID, "en-US");
                    string sendOrderNotice = StoreSetting.GetStoreSettingValueByKey(StoreSetting.SendOrderNotification, storeID, portalID, "en-US");
                    if (sendOrderNotice.ToLower() == "true")
                    {
                        StringBuilder          emailbody = new StringBuilder();
                        OrderDetailsCollection orderdata = new OrderDetailsCollection();
                        orderdata = (OrderDetailsCollection)HttpContext.Current.Session["OrderCollection"];
                        emailbody.Append("<table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"5\" bgcolor=\"#e0e0e0\" style=\"font: 12px Arial,Helvetica,sans-serif;\"> <tr><td align=\"center\" valign=\"top\"><table width=\"680\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr> <td><img src=\"" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/blank.gif\" width=\"1\" height=\"10\" alt=\" \" /></td></tr><tr><td><table width=\"680\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr> <td width=\"300\">");
                        emailbody.Append("<a href=\"http://www.aspxcommerce.com\" target=\"_blank\" style=\"outline: none; border: none;\"> <img src=\"http://www.aspxcommerce.com/Templates/AspxCommerce/images/aspxcommerce.png\" width=\"143\" height=\"62\" alt=\"AspxCommerce\" title=\"AspxCommerce\" /></a></td><td width=\"191\" align=\"left\" valign=\"middle\">");
                        emailbody.Append("&nbsp;</td><td width=\"189\" align=\"right\" valign=\"middle\"><b style=\"padding: 0 20px 0 0; text-shadow: 1px 1px 0 #fff;\">" + DateTime.Now.ToString("dd MMMM yyyy ") + "</b>");
                        emailbody.Append("</td> </tr></table> </td> </tr> <tr>  <td bgcolor=\"#fff\"><div style=\"border:1px solid #c7c7c7; background:#fff; padding:20px\">  <img src=\"" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/blank.gif\" width=\"1\" height=\"10\" alt=\" \" /><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#FFFFFF\">  <tr> <td> <p style=\"font-family: Arial, Helvetica, sans-serif; font-size: 17px; line-height: 16px;color: #278ee6; margin: 0; padding: 0 0 5px 0; font-weight: bold;\"> ");
                        emailbody.Append(" Dear " + orderdata.ObjBillingAddressInfo.FirstName.ToString() + "</p> <p style=\"font-family: Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; color: #393939; margin: 0; padding: 0 0 10px 0; font-weight: bold;\">  Thank you for Order</p>");
                        emailbody.Append("<p style=\"font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; color: #393939; margin: 0; padding: 8px 0 15px 0; font-weight: normal;\">You have ordered items from <span style=\"font-weight: bold; font-size: 11px;\">AspxCommerce</span>.<br />");
                        emailbody.Append("Thanks for using <span style=\"font-weight: bold; font-size: 11px;\">AspxCommerce</span>. You can now ship any items. To see all the transaction details,");
                        // emailbody.Append("  Please Register and log in to your <span style=\"font-weight: bold; font-size: 11px;\">AspxCommerce</span>");
                        string account = "";
                        if (orderdata.ObjCommonInfo.AddedBy.ToString().ToLower() == "anonymoususer" && orderdata.ObjOrderDetails.CustomerID == 0)
                        {   // future login process for annoymoususr
                            emailbody.Append("Please Register and log in to your <span style=\"font-weight: bold; font-size: 11px;\">AspxCommerce</span>");

                            account = "<a href=" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/User-Registration.aspx" + ">account</a>";
                        }
                        else
                        {
                            emailbody.Append("  Please log in to your <span style=\"font-weight: bold; font-size: 11px;\">AspxCommerce</span>");

                            account = "<a href=" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/Login.aspx" + ">account</a>";
                        }


                        emailbody.Append(" " + account + ".<br />  It may take a few moments for this transaction to appear in your account</p>  </td></tr>  </table><div style=\"border: 1px solid #cfcfcf; background: #f1f1f1; padding: 10px\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td><h3 style=\"font-size: 15px; font-family: Arial, Helvetica, sans-serif; line-height: 20px; font-weight: bold; margin: 0; text-transform: capitalize; color: #000; text-shadow: 1px 1px 0 #fff;\">  Your Order Details</h3></td></tr><tr><td><img src=\"" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/blank.gif\" width=\"1\" height=\"10\" alt=\" \" /></td>");
                        emailbody.Append(" </tr><tr><td bgcolor=\"#fff\"><div style=\"border: 1px solid #c7c7c7; background: #fff; padding: 10px\">");
                        emailbody.Append("<div style=\"border: 1px solid #cfcfcf; background: #f1f1f1; padding: 10px\">");
                        emailbody.Append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                        emailbody.Append("<tr>  <td height=\"25\" style=\"border-bottom: 1px solid #fff;\">");
                        emailbody.Append("<h3 style=\"font-size: 15px; font-family: Arial, Helvetica, sans-serif; line-height: 20px;");
                        emailbody.Append("font-weight: bold; margin: 0; text-transform: capitalize; color: #000; text-shadow: 1px 1px 0 #fff;\">Order Information</h3>");
                        emailbody.Append("</td></tr><tr> <td> <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                        emailbody.Append(" <tr><td width=\"120\" height=\"20\"><span style=\"font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold;\">");
                        emailbody.Append(" Merchant:</span> </td> <td>");
                        //  merchant Name
                        emailbody.Append("Aspx Commerce");
                        emailbody.Append(" </td> <td width=\"150\" style=\"font-family: Arial, Helvetica, sans-serif; font-size: 11px;");
                        emailbody.Append(" font-weight: bold; border-left: 1px solid #fff; padding-left: 20px;\"> Customer Id:  <td>");
                        // customer ID
                        emailbody.Append("" + customerID.ToString() + "");
                        emailbody.Append(" </td> </tr>  <tr>  <td height=\"20\"> <span style=\"font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold;\">");
                        emailbody.Append(" Description:</span>  </td> <td> Order Remarks</td> <td style=\"font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold;");
                        emailbody.Append(" border-left: 1px solid #fff; padding-left: 20px;\"> Phone No: </td> <td>");
                        // customer Phone No
                        emailbody.Append("" + orderdata.ObjBillingAddressInfo.Phone.ToString() + "");
                        emailbody.Append("  </td> </tr> <td height=\"20\"><span style=\"font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold;\">");
                        emailbody.Append(" Invoice Number:</span> </td><td>");
                        //   invoice no
                        emailbody.Append("" + orderdata.ObjOrderDetails.InvoiceNumber.ToString() + "");
                        // emailbody.Append("" + invoice + "");
                        emailbody.Append(" </td> <td style=\"font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold;  border-left: 1px solid #fff; padding-left: 20px;\">");
                        emailbody.Append("  &nbsp;</td><td> &nbsp;</td></tr></table>  </td> </tr> </table> </div>");
                        emailbody.Append(" <div style=\"border: 1px solid #cfcfcf; background: #f1f1f1; padding: 0; margin: 10px 0 0 0;\">");
                        emailbody.Append(" <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                        emailbody.Append(" <tr> <td width=\"300\" style=\"background: #e0e0e0;\"> <h2 style=\"margin: 0; padding: 0; font-weight: bold; font-family: Arial, Helvetica, sans-serif;");
                        emailbody.Append("  font-size: 15px; padding: 3px 0 3px 10px; text-shadow: 1px 1px 0 #fff;\">");
                        emailbody.Append("  Billing Information</h2>  </td><td style=\"background: #e0e0e0; border-left: 1px solid #fff;\">");
                        emailbody.Append("   <h2 style=\"margin: 0; padding: 0; font-weight: bold; font-family: Arial, Helvetica, sans-serif;");
                        emailbody.Append("  font-size: 15px; padding: 3px 0 3px 10px; text-shadow: 1px 1px 0 #fff;\">");
                        emailbody.Append(" Shipping Information</h2> </td></tr><tr><td valign=\"top\"> <p style=\"margin: 0; padding: 10px; font-family: Arial, Helvetica, sans-serif; font-weight: normal;");
                        emailbody.Append("  line-height: 18px; font-size: 12px;\">");
                        //Milson Munakami<br />
                        //                                                               Bd<br />
                        //                                                               sda<br />
                        //                                                               Dsad, Alberta 3232<br />
                        //                                                               Afghanistan<br />
                        //                                                               [email protected]<br />
                        //                                                               +000 000 0000<br />
                        //                                                               Fax: 2222222</p>
                        //                                                       </td>

                        string billing = orderdata.ObjBillingAddressInfo.FirstName.ToString() + " " +
                                         orderdata.ObjBillingAddressInfo.LastName.ToString() + "<br />";

                        if (orderdata.ObjBillingAddressInfo.CompanyName != null)
                        {
                            billing += orderdata.ObjBillingAddressInfo.CompanyName.ToString() + "<br />";
                        }

                        billing += orderdata.ObjBillingAddressInfo.City.ToString() + ", " + orderdata.ObjBillingAddressInfo.Address.ToString() + "<br />" +
                                   orderdata.ObjBillingAddressInfo.Country.ToString() + "<br />" +
                                   orderdata.ObjBillingAddressInfo.EmailAddress.ToString() + "<br />" +
                                   orderdata.ObjBillingAddressInfo.Phone.ToString() + "<br />" + "<p>";

                        emailbody.Append("" + billing + "");
                        emailbody.Append("</td><td style=\"border-left: 1px solid #fff;\" valign=\"top\"> <p style=\"margin: 0; padding: 10px; font-family: Arial, Helvetica, sans-serif; font-weight: normal;");
                        emailbody.Append("line-height: 18px; font-size: 12px;\">");
                        //Milson Munakami<br />
                        //                                                              Bd<br />
                        //                                                              sda<br />
                        //                                                              Dsad, Alberta 3232<br />
                        //                                                              Afghanistan<br />
                        //                                                              [email protected]<br />
                        //                                                              +000 000 0000<br />
                        //                                                              Fax: 2222222</p>

                        if (!orderdata.ObjOrderDetails.IsDownloadable)
                        {
                            if (orderdata.ObjOrderDetails.IsMultipleCheckOut == false)
                            {
                                string shipping = orderdata.ObjShippingAddressInfo.FirstName.ToString() + " " +
                                                  orderdata.ObjShippingAddressInfo.LastName.ToString() + "<br />";
                                if (orderdata.ObjShippingAddressInfo.CompanyName != null)
                                {
                                    shipping += orderdata.ObjShippingAddressInfo.CompanyName.ToString() + "<br />";
                                }

                                shipping += orderdata.ObjShippingAddressInfo.City.ToString() + ", " + orderdata.ObjShippingAddressInfo.Address.ToString() + "<br />" +
                                            orderdata.ObjShippingAddressInfo.Country.ToString() + "<br />" +
                                            orderdata.ObjShippingAddressInfo.EmailAddress.ToString() + "<br />" +
                                            orderdata.ObjShippingAddressInfo.Phone.ToString() + "<br />" + "<p>";
                                emailbody.Append("" + shipping + "");
                            }
                            else
                            {
                                emailbody.Append("Multiple addresses<br />Plese log in to view.");
                            }
                        }
                        emailbody.Append("</td> </tr> </table></div><div style=\"border: 1px solid #cfcfcf; background: #f1f1f1; padding: 0; margin: 10px 0 0 0;\">");
                        emailbody.Append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                        emailbody.Append("<tr><td style=\"background: #e0e0e0;\" colspan=\"2\"><h2 style=\"margin: 0; padding: 0; font-weight: bold; font-family: Arial, Helvetica, sans-serif;");
                        emailbody.Append("font-size: 15px; padding: 3px 0 3px 10px; text-shadow: 1px 1px 0 #fff;\">");
                        // card type Visa
                        emailbody.Append("" + orderdata.ObjPaymentInfo.PaymentMethodName.ToString() + "");
                        // emailbody.Append("" + orderdata.ObjPaymentInfo.CardType.ToString() + "");
                        emailbody.Append("</h2> </td></tr><tr><td style=\"padding: 5px 10px;\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                        emailbody.Append("<tr><td width=\"100\" height=\"20\" style=\"width: 200\">  <p style=\"font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold;");
                        emailbody.Append(" margin: 0; padding: 0;\"> Date/Time:</p></td><td>");
                        //    order date
                        emailbody.Append("" + DateTime.Now.ToString("dddd, dd MMMM yyyy") + "");
                        emailbody.Append("</td></tr><tr><td height=\"20\"><p style=\"font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold;");
                        emailbody.Append(" margin: 0; padding: 0;\">Transaction Id:</p> </td>  <td>");
                        //     transaction ID
                        emailbody.Append("" + transID + "");
                        //emailbody.Append("" + transID + "");
                        emailbody.Append("</td> </tr></table> </td> </tr> </table></div></div>  </td> </tr>  </table>  </div>");
                        emailbody.Append(" <p style=\"font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; color: #000;\">");
                        emailbody.Append(" if you having Issues with transaction or any further inquiry then you can mail <a");
                        emailbody.Append("href=\"mailto:[email protected]\" style=\"color: #278ee6;\">[email protected]</a></p>");
                        emailbody.Append("<p style=\"margin: 0; padding: 5px 0 0 0; font: bold 11px Arial, Helvetica, sans-serif; color: #666;\">");
                        emailbody.Append("Please do not reply to this email. This mail is automatic generated after you have ordered.</a><br />");
                        emailbody.Append("<br /> Thank You,<br />  <span style=\"font-weight: normal; font-size: 12px; font-family: Arial, Helvetica, sans-serif;\">");
                        emailbody.Append("AXPXCommerce Team </span> </p> </div> </td>  </tr>");
                        emailbody.Append("  <tr> <td>   <img src=\"" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/blank.gif\" width=\"1\" height=\"20\" alt=\" \" /> </td>");
                        emailbody.Append("</tr> <tr> <td align=\"center\" valign=\"top\"> <p style=\"font-size: 11px; color: #4d4d4d\">");
                        emailbody.Append("  © " + DateTime.Now.Year.ToString() + " AspxCommerce. All Rights Reserved.</p></td>  </tr> <tr>");
                        emailbody.Append("  <td align=\"center\" valign=\"top\"> <img src=\"" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/blank.gif\" width=\"1\" height=\"10\" alt=\" \" />");
                        emailbody.Append("   </td>  </tr> </table></div>   </td> </tr> </table>");
                        string          body            = emailbody.ToString();
                        SageFrameConfig pagebase        = new SageFrameConfig();
                        string          emailSuperAdmin = pagebase.GetSettingsByKey(SageFrameSettingKeys.SuperUserEmail);//"*****@*****.**";
                        string          emailSiteAdmin  = pagebase.GetSettingsByKey(SageFrameSettingKeys.SiteAdminEmailAddress);
                        MailHelper.SendMailNoAttachment(sendEmailFrom, orderdata.ObjBillingAddressInfo.EmailAddress.ToString(), "Your Order Details", body, emailSuperAdmin, emailSiteAdmin);
                    }
                    ws.ClearSessionVariable("OrderCollection");
                }

                return(ph);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 48
0
        public void ParseAfterIPNMobile(OrderInfo orderInfo,List<CouponSession> coupons,List<OrderItem> itemsInfo,string postData,UserAddressInfo billingAddress,UserAddressInfo shippingAddress, string templateName, string addressPath)
        {

            string transId = string.Empty;

            try
            {

                String[] stringArray = postData.Split('\n');
                var ot = new OrderDetailsCollection();
                var odinfo = new OrderDetailsInfo();
                var cms = new CartManageSQLProvider();
                var cf = new CommonInfo
                             {StoreID = orderInfo.StoreId, PortalID = orderInfo.PortalId, AddedBy = orderInfo.AddedBy};
                // UpdateOrderDetails
            
                var sqlH = new SQLHandler();
                // use split to split array we already have using "=" as delimiter

                int i;
                for (i = 1; i < stringArray.Length - 1; i++)
                {
                    String[] stringArray1 = stringArray[i].Split('=');

                    String sKey = stringArray1[0];
                    String sValue = HttpUtility.UrlDecode(stringArray1[1]);

                    // set string vars to hold variable names using a switch
                    switch (sKey)
                    {
                        case "payment_status":
                            odinfo.ResponseReasonText = Convert.ToString(sValue);
                            break;

                        case "mc_fee":
                            // ph.PaymentFee = Convert.ToDouble(sValue);
                            break;

                        case "payer_email":
                            // ph.PayerEmail = Convert.ToString(sValue);
                            break;

                        case "Tx Token":
                            // ph.TxToken = Convert.ToString(sValue);
                            break;

                        case "txn_id":
                            odinfo.TransactionID = Convert.ToString(sValue);
                            transId = Convert.ToString(sValue);
                            break;

                    }
                }

                ot.ObjCommonInfo = cf;
                //odinfo.OrderStatusID = 8; var orderInfo = (OrderInfo) HttpContext.Current.Session["OrderCollection"];

                UpdateItemQuantityAndCoupon(orderInfo, itemsInfo, coupons, orderInfo.StoreId, orderInfo.PortalId,
                                            orderInfo.AddedBy);
                AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
                aspxCommonObj.CustomerID = orderInfo.CustomerId;
                aspxCommonObj.SessionCode = orderInfo.SessionCode;
                aspxCommonObj.StoreID = orderInfo.StoreId;
                aspxCommonObj.PortalID = orderInfo.PortalId;
                cms.ClearCartAfterPayment(aspxCommonObj);
                EmailTemplate.SendEmailForOrderMobile(orderInfo, billingAddress, shippingAddress, addressPath,
                                                      templateName, transId);


            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 49
0
      public string SendPaymentInfoAIM(OrderDetailsCollection OrderDetail, string TemplateName, string addressPath)
    {
        WebClient objRequest = new WebClient();
        System.Collections.Specialized.NameValueCollection objInf = new System.Collections.Specialized.NameValueCollection(30);

        string strError;

        //OrderDetail.ObjOrderDetails.CustomerID = int.Parse(Crypto.GenerateCustomerID());
        OrderDetail.ObjOrderDetails.InvoiceNumber = Crypto.GenerateInvoiceNumber();
        OrderDetail.ObjOrderDetails.PurchaseOrderNumber = Crypto.GeneratePurchaseOrderNumber();

        //merchant generated field
        objInf.Add("x_version", OrderDetail.ObjOrderDetails.Version);
        objInf.Add("x_delim_data", OrderDetail.ObjOrderDetails.DelimData);
        objInf.Add("x_login", OrderDetail.ObjOrderDetails.APILogin);
        objInf.Add("x_tran_key", OrderDetail.ObjOrderDetails.TransactionKey);
        objInf.Add("x_relay_response", OrderDetail.ObjOrderDetails.RelayResponse);
        objInf.Add("x_delim_char", OrderDetail.ObjOrderDetails.DelimChar);
        objInf.Add("x_encap_char", OrderDetail.ObjOrderDetails.EncapeChar);
        objInf.Add("x_invoice_num", OrderDetail.ObjOrderDetails.InvoiceNumber);
        objInf.Add("x_cust_id", OrderDetail.ObjOrderDetails.CustomerID.ToString());
        objInf.Add("x_po_num", OrderDetail.ObjOrderDetails.PurchaseOrderNumber);
        //for (int i = 0; i < arr; i++)
        //{

        //}

        // Billing Address
        objInf.Add("x_first_name", OrderDetail.ObjBillingAddressInfo.FirstName);
        objInf.Add("x_last_name", OrderDetail.ObjBillingAddressInfo.LastName);
        objInf.Add("x_company", OrderDetail.ObjBillingAddressInfo.CompanyName);
        objInf.Add("x_email", OrderDetail.ObjBillingAddressInfo.EmailAddress);
        objInf.Add("x_address", OrderDetail.ObjBillingAddressInfo.Address);
        objInf.Add("x_city", OrderDetail.ObjBillingAddressInfo.City);
        objInf.Add("x_state", OrderDetail.ObjBillingAddressInfo.State);
        objInf.Add("x_zip", OrderDetail.ObjBillingAddressInfo.Zip);
        objInf.Add("x_country", OrderDetail.ObjBillingAddressInfo.Country);
        objInf.Add("x_phone", OrderDetail.ObjBillingAddressInfo.Phone);
        objInf.Add("x_fax", OrderDetail.ObjBillingAddressInfo.Fax);
        objInf.Add("x_email_customer", OrderDetail.ObjOrderDetails.IsEmailCustomer);

        if (OrderDetail.ObjOrderDetails.IsMultipleCheckOut == false)
        {
            //shipping address
            objInf.Add("x_ship_to_first_name", OrderDetail.ObjShippingAddressInfo.FirstName);
            objInf.Add("x_ship_to_last_name", OrderDetail.ObjShippingAddressInfo.LastName);
            objInf.Add("x_ship_to_company", OrderDetail.ObjShippingAddressInfo.CompanyName);
            objInf.Add("x_ship_to_address", OrderDetail.ObjShippingAddressInfo.Address);
            objInf.Add("x_ship_to_city", OrderDetail.ObjShippingAddressInfo.City);
            objInf.Add("x_ship_to_state", OrderDetail.ObjShippingAddressInfo.State);
            objInf.Add("x_ship_to_zip", OrderDetail.ObjShippingAddressInfo.Zip);
            objInf.Add("x_ship_to_country", OrderDetail.ObjShippingAddressInfo.Country);
        }
        // Card Details
        objInf.Add("x_card_num", OrderDetail.ObjPaymentInfo.CardNumber);
        objInf.Add("x_card_type", OrderDetail.ObjPaymentInfo.CardType);
        objInf.Add("x_exp_date", OrderDetail.ObjPaymentInfo.ExpireDate);
        if (OrderDetail.ObjPaymentInfo.PaymentMethodCode=="CC")
        {
            // Authorization code of the card (CCV)
            objInf.Add("x_card_code", OrderDetail.ObjPaymentInfo.CardCode.ToString());
            objInf.Add("x_method", OrderDetail.ObjPaymentInfo.PaymentMethodCode);
            objInf.Add("x_type", OrderDetail.ObjPaymentInfo.TransactionType);
            string amount = Regex.Replace(OrderDetail.ObjOrderDetails.GrandTotal.ToString("0.00"), @"[A-Z]", String.Empty);
            objInf.Add("x_amount", amount);
            objInf.Add("x_description", OrderDetail.ObjOrderDetails.Remarks);
            objInf.Add("x_test_request", OrderDetail.ObjOrderDetails.IsTest);
        }
        else
        {


            //bank 
            objInf.Add("x_bank_aba_code", OrderDetail.ObjPaymentInfo.RoutingNumber);
            objInf.Add("x_bank_acct_num", OrderDetail.ObjPaymentInfo.AccountNumber);
            objInf.Add("x_bank_acct_type", OrderDetail.ObjPaymentInfo.AccountType);
            objInf.Add("x_bank_name", OrderDetail.ObjPaymentInfo.BankName);
            objInf.Add("x_bank_acct_name", OrderDetail.ObjPaymentInfo.AccountHolderName);
            objInf.Add("x_echeck_type", OrderDetail.ObjPaymentInfo.ChequeType);
            objInf.Add("x_bank_check_number", OrderDetail.ObjPaymentInfo.ChequeNumber);
        }

        // Currency setting. Check the guide for other supported currencies
        objInf.Add("x_currency_code", OrderDetail.ObjOrderDetails.CurrencyCode);
        objRequest.BaseAddress ="https://test.authorize.net/gateway/transact.dll";

        try
        {
            // POST request
            byte[] objRetBytes;
            string[] objRetVals;

            objRetBytes =
                objRequest.UploadValues(objRequest.BaseAddress, "POST", objInf);
            objRetVals =
                System.Text.Encoding.ASCII.GetString(objRetBytes).Split(",".ToCharArray());

            // Process Return Values
            OrderDetail.ObjOrderDetails.ResponseCode = int.Parse(objRetVals[0].Trim(char.Parse("|")));
            OrderDetail.ObjOrderDetails.ResponseReasonCode = int.Parse(objRetVals[2].Trim(char.Parse("|")));
            if (objRetVals[0].Trim(char.Parse("|")) == "1")
            {
                // Returned Authorisation Code
                //response.AuthorizationCode = objRetVals[4].Trim(char.Parse("|"));
                // Returned Transaction ID
                OrderDetail.ObjOrderDetails.TransactionID = Convert.ToString(objRetVals[6].Trim(char.Parse("|")));
                strError = "Transaction completed successfully.";
               // AspxCommerceWebService asws = new AspxCommerceWebService();
                AspxCoreController asws = new AspxCoreController();
                OrderDetail.ObjOrderDetails.OrderStatusID = 8;
                OrderDetail.ObjOrderDetails.TransactionID = Convert.ToString(objRetVals[6].Trim(char.Parse("|")));
                asws.AddOrderDetails(OrderDetail);
                CartManageSQLProvider cms = new CartManageSQLProvider();
                AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
                aspxCommonObj.CustomerID = OrderDetail.ObjOrderDetails.CustomerID;
                aspxCommonObj.SessionCode = OrderDetail.ObjOrderDetails.SessionCode;
                aspxCommonObj.StoreID = OrderDetail.ObjCommonInfo.StoreID;
                aspxCommonObj.PortalID = OrderDetail.ObjCommonInfo.PortalID;
                cms.ClearCartAfterPayment(aspxCommonObj);

            }
            else
            {
                // Error!
                strError = objRetVals[3].Trim(char.Parse("|")) + " (" +
                           objRetVals[2].Trim(char.Parse("|")) + ")";

                if (objRetVals[2].Trim(char.Parse("|")) == "44")
                {
                    // CCV transaction decline
                    strError += "Our Card Code Verification (CCV) returned " +
                                "the following error: ";

                    switch (objRetVals[38].Trim(char.Parse("|")))
                    {
                        case "N":
                            strError += "Card Code does not match.";
                            break;
                        case "P":
                            strError += "Card Code was not processed.";
                            break;
                        case "S":
                            strError += "Card Code should be on card but was not indicated.";
                            break;
                        case "U":
                            strError += "Issuer was not certified for Card Code.";
                            break;
                    }
                }

                if (objRetVals[2].Trim(char.Parse("|")) == "45")
                {
                    if (strError.Length > 1)
                        strError += "<br />n";

                    // AVS transaction decline
                    strError += "Our Address Verification System (AVS) " +
                                "returned the following error: ";

                    switch (objRetVals[5].Trim(char.Parse("|")))
                    {
                        case "A":
                            strError += " the zip code entered does not match " +
                                        "the billing address.";
                            break;
                        case "B":
                            strError += " no information was provided for the AVS check.";
                            break;
                        case "E":
                            strError += " a general error occurred in the AVS system.";
                            break;
                        case "G":
                            strError += " the credit card was issued by a non-US bank.";
                            break;
                        case "N":
                            strError += " neither the entered street address nor zip " +
                                        "code matches the billing address.";
                            break;
                        case "P":
                            strError += " AVS is not applicable for this transaction.";
                            break;
                        case "R":
                            strError += " please retry the transaction; the AVS system " +
                                        "was unavailable or timed out.";
                            break;
                        case "S":
                            strError += " the AVS service is not supported by your " +
                                        "credit card issuer.";
                            break;
                        case "U":
                            strError += " address information is unavailable for the " +
                                        "credit card.";
                            break;
                        case "W":
                            strError += " the 9 digit zip code matches, but the " +
                                        "street address does not.";
                            break;
                        case "Z":
                            strError += " the zip code matches, but the address does not.";
                            break;
                    }
                }
            }
        }
        catch (Exception ex)
        {
            strError = ex.Message;
        }
        OrderDetail.ObjOrderDetails.ResponseReasonText = strError;       
        return OrderDetail.ObjOrderDetails.ResponseReasonText;
    }
       public static void UpdateItemQuantity(OrderDetailsCollection orderData)
       {
           try
           {
               AspxOrderProvider.UpdateItemQuantity(orderData);
           }
           catch (Exception e)
           {
               throw e;
           }

       }
Ejemplo n.º 51
0
        public int AddOrder(OrderDetailsCollection orderData, SqlTransaction tran,int billingAddressID,int paymentMethodId)
        {
            try
            {
                List<KeyValuePair<string, object>> parameter = new List<KeyValuePair<string, object>>();

                parameter.Add(new KeyValuePair<string, object>("@InvoiceNumber", orderData.ObjOrderDetails.InvoiceNumber));
                if (orderData.ObjOrderDetails.CustomerID == 0)
                {
                    parameter.Add(new KeyValuePair<string, object>("@SessionCode", orderData.ObjOrderDetails.SessionCode));
                    parameter.Add(new KeyValuePair<string, object>("@CustomerID", 0));
                }
                else
                {
                    parameter.Add(new KeyValuePair<string, object>("@SessionCode", ""));
                    parameter.Add(new KeyValuePair<string, object>("@CustomerID", orderData.ObjOrderDetails.CustomerID));
                }
                parameter.Add(new KeyValuePair<string, object>("@TransactionID", orderData.ObjOrderDetails.TransactionID));
                parameter.Add(new KeyValuePair<string, object>("@GrandTotal", orderData.ObjOrderDetails.GrandTotal));
                parameter.Add(new KeyValuePair<string, object>("@DiscountAmount",
                                                               orderData.ObjOrderDetails.DiscountAmount));
                parameter.Add(new KeyValuePair<string, object>("@CouponCode", orderData.ObjOrderDetails.CouponCode));
                parameter.Add(new KeyValuePair<string, object>("@PurchaseOrderNumber",
                                                               orderData.ObjOrderDetails.PurchaseOrderNumber));
                parameter.Add(new KeyValuePair<string, object>("@PaymentGateTypeID",
                                                               orderData.ObjOrderDetails.PaymentGatewayTypeID));
                parameter.Add(new KeyValuePair<string, object>("@PaymentGateSubTypeID",
                                                               orderData.ObjOrderDetails.PaymentGatewaySubTypeID));
                parameter.Add(new KeyValuePair<string, object>("@ClientIPAddress",
                                                               orderData.ObjOrderDetails.ClientIPAddress));
                parameter.Add(new KeyValuePair<string, object>("@UserBillingAddressID",
                                                               billingAddressID));
                parameter.Add(new KeyValuePair<string, object>("@PaymentMethodID",
                                                               paymentMethodId));
                parameter.Add(new KeyValuePair<string, object>("@OrderStatusID", orderData.ObjOrderDetails.OrderStatusID));
                parameter.Add(new KeyValuePair<string, object>("@IsGuestUser", orderData.ObjOrderDetails.IsGuestUser));
                parameter.Add(new KeyValuePair<string, object>("@TaxTotal", orderData.ObjOrderDetails.TaxTotal));
                parameter.Add(new KeyValuePair<string, object>("@CurrencyCode", orderData.ObjOrderDetails.CurrencyCode));
                parameter.Add(new KeyValuePair<string, object>("@ResponseCode", orderData.ObjOrderDetails.ResponseCode));
                parameter.Add(new KeyValuePair<string, object>("@ResponseReasonCode",
                                                               orderData.ObjOrderDetails.ResponseReasonCode));
                parameter.Add(new KeyValuePair<string, object>("@ResponseReasonText",
                                                               orderData.ObjOrderDetails.ResponseReasonText));
                parameter.Add(new KeyValuePair<string, object>("@Remarks", orderData.ObjOrderDetails.Remarks));
                parameter.Add(new KeyValuePair<string, object>("@StoreID", orderData.ObjCommonInfo.StoreID));
                parameter.Add(new KeyValuePair<string, object>("@PortalID", orderData.ObjCommonInfo.PortalID));
                parameter.Add(new KeyValuePair<string, object>("@CultureName", orderData.ObjCommonInfo.CultureName));
                parameter.Add(new KeyValuePair<string, object>("@AddedBy", orderData.ObjCommonInfo.AddedBy));

                SQLHandler sqlH = new SQLHandler();
                int orderID = sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure, "[usp_Aspx_OrderDetails]",
                                                   parameter, "@OrderID");
                return orderID;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 52
0
        public static void SendEmailForOrder(int portalID, OrderDetailsCollection orderdata, string addressPath,
                                             string templateName, string transID)
        {
            StoreSettingConfig ssc = new StoreSettingConfig();
            SageFrameConfig pagebase = new SageFrameConfig();
            // sendEmailFrom = ssc.GetStoreSettingsByKey(StoreSetting.SendEcommerceEmailsFrom, storeID, portalID, "en-US");
            string sendOrderNotice = ssc.GetStoreSettingsByKey(StoreSetting.SendOrderNotification,
                                                               orderdata.ObjCommonInfo.StoreID, portalID,
                                                               orderdata.ObjCommonInfo.CultureName);
            string logosrc = ssc.GetStoreSettingsByKey(StoreSetting.StoreLogoURL, orderdata.ObjCommonInfo.StoreID,
                                                       portalID, orderdata.ObjCommonInfo.CultureName);
            string inquiry = ssc.GetStoreSettingsByKey(StoreSetting.SendEcommerceEmailsFrom,
                                                       orderdata.ObjCommonInfo.StoreID, portalID,
                                                       orderdata.ObjCommonInfo.CultureName);
            string storeName = ssc.GetStoreSettingsByKey(StoreSetting.StoreName, orderdata.ObjCommonInfo.StoreID,
                                                         portalID, orderdata.ObjCommonInfo.CultureName);

            if (bool.Parse(sendOrderNotice))
            {
                List<MessageManagementInfo> template =
                    MessageManagementController.GetMessageTemplateByMessageTemplateTypeID(
                        SystemSetting.ORDER_PLACED, portalID);
                foreach (MessageManagementInfo messageToken in template)
                {
                    string messageTemplate = messageToken.Body;
                    if (template != null)
                    {
                        string[] tokens = GetAllToken(messageTemplate);
                        foreach (string token in tokens)
                        {
                            switch (token)
                            {
                                case "%OrderRemarks%":
                                    messageTemplate = messageTemplate.Replace(token, orderdata.ObjOrderDetails.Remarks);
                                    break;
                                case "%InvoiceNo%":
                                    messageTemplate = messageTemplate.Replace(token,
                                                                              orderdata.ObjOrderDetails.InvoiceNumber);
                                    break;
                                case "%OrderStatus%":
                                    messageTemplate = messageTemplate.Replace(token,
                                                                              orderdata.ObjOrderDetails.OrderStatus);
                                    break;
                                case "%OrderID%":
                                    messageTemplate = messageTemplate.Replace(token,
                                                                              orderdata.ObjOrderDetails.OrderID.ToString
                                                                                  ());
                                    break;
                                case "%BillingAddress%":
                                    string billing = orderdata.ObjBillingAddressInfo.FirstName.ToString() + " " +
                                                     orderdata.ObjBillingAddressInfo.LastName.ToString() +
                                                     "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";

                                    if (orderdata.ObjBillingAddressInfo.CompanyName != null)
                                    {
                                        billing += orderdata.ObjBillingAddressInfo.CompanyName.ToString() +
                                                   "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                    }

                                    billing += orderdata.ObjBillingAddressInfo.City.ToString() + ", " +
                                               orderdata.ObjBillingAddressInfo.Address.ToString() +
                                               "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                               orderdata.ObjBillingAddressInfo.Country.ToString() +
                                               "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                               orderdata.ObjBillingAddressInfo.EmailAddress.ToString() +
                                               "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                               orderdata.ObjBillingAddressInfo.Phone.ToString();
                                    messageTemplate = messageTemplate.Replace(token, billing);
                                    break;
                                case "%ShippingAddress%":
                                    string shipping = "";
                                    if (!orderdata.ObjOrderDetails.IsDownloadable)
                                    {
                                        if (orderdata.ObjOrderDetails.IsMultipleCheckOut == false)
                                        {
                                            shipping = orderdata.ObjShippingAddressInfo.FirstName.ToString() + " " +
                                                       orderdata.ObjShippingAddressInfo.LastName.ToString() +
                                                       "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                            if (orderdata.ObjShippingAddressInfo.CompanyName != null)
                                            {
                                                shipping += orderdata.ObjShippingAddressInfo.CompanyName.ToString() +
                                                            "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                            }

                                            shipping += orderdata.ObjShippingAddressInfo.City.ToString() + ", " +
                                                        orderdata.ObjShippingAddressInfo.Address.ToString() +
                                                        "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                                        orderdata.ObjShippingAddressInfo.Country.ToString() +
                                                        "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                                        orderdata.ObjShippingAddressInfo.EmailAddress.ToString() +
                                                        "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                                        orderdata.ObjShippingAddressInfo.Phone.ToString() +
                                                        "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";

                                        }
                                        else
                                        {
                                            shipping = "Multiple addresses<br />Plese log in to view." +
                                                       "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                        }

                                    }
                                    else
                                    {
                                        shipping = "Your Ordered Item is Downloadable Item." +
                                                   "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                    }

                                    messageTemplate = messageTemplate.Replace(token, shipping);
                                    break;
                                case "%UserFirstName%":
                                    messageTemplate = messageTemplate.Replace(token,
                                                                              orderdata.ObjBillingAddressInfo.FirstName);
                                    break;
                                case "%UserLastName%":
                                    messageTemplate = messageTemplate.Replace(token,
                                                                              orderdata.ObjBillingAddressInfo.LastName);
                                    break;
                                case "%TransactionID%":
                                    messageTemplate = messageTemplate.Replace(token, transID);
                                    break;
                                case "%PaymentMethodName%":
                                    messageTemplate = messageTemplate.Replace(token,
                                                                              orderdata.ObjPaymentInfo.PaymentMethodName);
                                    break;
                                case "%DateTimeDay%":
                                    messageTemplate = messageTemplate.Replace(token,
                                                                              DateTime.Now.ToString("dddd, dd MMMM yyyy"));
                                    break;
                                case "%DateYear%":
                                    messageTemplate = messageTemplate.Replace(token, DateTime.Now.Year.ToString());
                                    break;
                                case "%CustomerID%":
                                    messageTemplate = messageTemplate.Replace(token,
                                                                              orderdata.ObjOrderDetails.CustomerID.
                                                                                  ToString());
                                    break;
                                case "%PhoneNo%":
                                    messageTemplate = messageTemplate.Replace(token,
                                                                              orderdata.ObjBillingAddressInfo.Phone);
                                    break;
                                case "%AccountLogin%":
                                    string account = "";
                                    if (orderdata.ObjCommonInfo.AddedBy.ToString().ToLower() == "anonymoususer" &&
                                        orderdata.ObjOrderDetails.CustomerID == 0)
                                    {
                                        // future login process for annoymoususr 
                                        account +=
                                            "Please Register and log in to your <span style=\"font-weight: bold; font-size: 11px;\">AspxCommerce</span>";

                                        account += "<a  style=\"color: rgb(39, 142, 230);\"  href=" + addressPath +
                                                   "User-Registration.aspx" + ">account</a>";
                                    }
                                    else
                                    {
                                        account +=
                                            "  Please log in to your <span style=\"font-weight: bold; font-size: 11px;\">AspxCommerce</span>";

                                        account += " <a style=\"color: rgb(39, 142, 230);\"  href=" + addressPath +
                                                   "Login.aspx" + ">account</a>";
                                    }
                                    messageTemplate = messageTemplate.Replace(token, account);
                                    break;
                                case "%LogoSource%":
                                    // string src = " http://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/Templates/" + templateName + "/images/aspxcommerce.png";
                                    string src = " http://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] +
                                                 "/" + logosrc;
                                    messageTemplate = messageTemplate.Replace(token, src);
                                    break;
                                case "%DateTime%":
                                    messageTemplate = messageTemplate.Replace(token,
                                                                              DateTime.Now.ToString("dd MMMM yyyy "));

                                    break;
                                case "%InquiryEmail%":
                                    string x =
                                        "<a  target=\"_blank\" style=\"text-decoration: none;color: #226ab7;font-style: italic;\" href=\"mailto:" +
                                        inquiry + "\" >" + inquiry + "</a>";
                                    messageTemplate = messageTemplate.Replace(token, x);
                                    break;
                                case "%StoreName%":
                                    messageTemplate = messageTemplate.Replace(token, storeName);
                                    break;
                            }
                        }
                        // return messageTemplate;
                        string emailStoreAdmin = ssc.GetStoreSettingsByKey(StoreSetting.SendEcommerceEmailsFrom,
                                                                           orderdata.ObjCommonInfo.StoreID
                                                                           , portalID,
                                                                           orderdata.ObjCommonInfo.CultureName);
                        string emailSuperAdmin = pagebase.GetSettingsByKey(SageFrameSettingKeys.SuperUserEmail);
                        string emailSiteAdmin = pagebase.GetSettingsByKey(SageFrameSettingKeys.SiteAdminEmailAddress);
                        MailHelper.SendMailNoAttachment(emailStoreAdmin, orderdata.ObjBillingAddressInfo.EmailAddress,
                                                        messageToken.Subject, messageTemplate, emailSiteAdmin,
                                                        emailSuperAdmin);

                    }
                }
            }
        }
Ejemplo n.º 53
0
        public void UpdateOrderDetails(OrderDetailsCollection orderData)
        {
            try
            {
                List<KeyValuePair<string, object>> parameter = new List<KeyValuePair<string, object>>();

              //  parameter.Add(new KeyValuePair<string, object>("@InvoiceNumber", DateTime.Now.ToString("yyyyMMddhhmmss"))); 
                parameter.Add(new KeyValuePair<string, object>("@TransactionID", orderData.ObjOrderDetails.TransactionID));               
                parameter.Add(new KeyValuePair<string, object>("@OrderStatusID", orderData.ObjOrderDetails.OrderStatusID));         
                parameter.Add(new KeyValuePair<string, object>("@ResponseCode", orderData.ObjOrderDetails.ResponseCode));
                parameter.Add(new KeyValuePair<string, object>("@ResponseReasonCode", orderData.ObjOrderDetails.ResponseReasonCode));
                parameter.Add(new KeyValuePair<string, object>("@ResponseReasonText", orderData.ObjOrderDetails.ResponseReasonText));
                parameter.Add(new KeyValuePair<string, object>("@StoreID", orderData.ObjCommonInfo.StoreID));
                parameter.Add(new KeyValuePair<string, object>("@PortalID", orderData.ObjCommonInfo.PortalID));
                parameter.Add(new KeyValuePair<string, object>("@AddedBy", orderData.ObjCommonInfo.AddedBy));
                parameter.Add(new KeyValuePair<string, object>("@OrderID", orderData.ObjOrderDetails.OrderID));
                SQLHandler sqlH = new SQLHandler();
                sqlH.ExecuteNonQuery("[dbo].[usp_Aspx_UpdateOrderDetails]", parameter);
               
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 54
0
        public void UpdateItemQuantity(OrderDetailsCollection orderData)
        {
            try
            {
                if (orderData.ObjOrderDetails.CouponCode != null && System.Web.HttpContext.Current.Session["CouponApplied"] != null)
                {
                    ReduceCouponUsed(orderData.ObjOrderDetails.CouponCode.Trim(), orderData.ObjCommonInfo.StoreID, orderData.ObjCommonInfo.PortalID, orderData.ObjCommonInfo.AddedBy);
                }

                foreach (OrderItemInfo objItems in orderData.LstOrderItemsInfo)
                {
                    if (objItems.IsDownloadable != true)
                    {
                        List<KeyValuePair<string, object>> parameter = new List<KeyValuePair<string, object>>();
                        parameter.Add(new KeyValuePair<string, object>("@StoreID", orderData.ObjCommonInfo.StoreID));
                        parameter.Add(new KeyValuePair<string, object>("@PortalID", orderData.ObjCommonInfo.PortalID));
                        parameter.Add(new KeyValuePair<string, object>("@AddedBy", orderData.ObjCommonInfo.AddedBy));
                        parameter.Add(new KeyValuePair<string, object>("@ItemID", objItems.ItemID));
                        parameter.Add(new KeyValuePair<string, object>("@Quantity", objItems.Quantity));
                        SQLHandler sqlH = new SQLHandler();
                        sqlH.ExecuteNonQuery("[dbo].[usp_Aspx_UpdateItemQuantitybyOrder]", parameter);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }       
        public void SaveOrderDetails(OrderDetailsCollection orderDetail)
        {
            try
            {
                orderDetail.ObjOrderDetails.OrderStatusID = 7;
                AddOrderDetails(orderDetail);
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
    private static void HandleNewOrderNotification(GCheckout.AutoGen.NewOrderNotification inputNewOrderNotification)
    {


        try
        {
            if (inputNewOrderNotification.shoppingcart.merchantprivatedata != null && inputNewOrderNotification.shoppingcart.merchantprivatedata.Any != null && inputNewOrderNotification.shoppingcart.merchantprivatedata.Any.Length > 0)
            {
                //Retrieve data from MerchantPrivateData
                GCheckout.AutoGen.anyMultiple oneAnyMultiple = inputNewOrderNotification.shoppingcart.merchantprivatedata;
                System.Xml.XmlNode[] oneXmlNodeArray = oneAnyMultiple.Any;
                foreach (XmlNode xn in oneXmlNodeArray)
                {


                    if (xn.Name == "OrderID")
                    {
                        orderID = Int32.Parse(xn.InnerText.ToString());
                    }

                    if (xn.Name == "userName")
                    {
                        userName = xn.InnerText.ToString();
                    }

                    if (xn.Name == "amount")
                    {
                        totalAmount = decimal.Parse(xn.InnerText.ToString());
                    }

                    if (xn.Name == "selectedCurrency")
                    {
                        selectedCurrency = xn.InnerText.ToString();
                    }

                    if (xn.Name == "portalID")
                    {
                        portalID = int.Parse(xn.InnerText.ToString());
                    }
                    if (xn.Name == "customerID")
                    {
                        customerID = int.Parse(xn.InnerText.ToString());
                    }
                    if (xn.Name == "itemIds")
                    {
                        itemIds = xn.InnerText.ToString();
                    }
                    if (xn.Name == "storeID")
                    {
                        storeID = int.Parse(xn.InnerText.ToString());
                    }
                    if (xn.Name == "couponCode")
                    {
                        couponCode = xn.InnerText.ToString();
                    }
                    if (xn.Name == "sessionCode")
                    {
                        sessionCode = xn.InnerText.ToString();
                    }
                    if (xn.Name == "pgID")
                    {
                        pgID = int.Parse(xn.InnerText.ToString());
                    }
                    if (xn.Name == "MerchantID")
                    {
                        MerchantID = xn.InnerText.ToString();
                    }
                    if (xn.Name == "MerchantKey")
                    {
                        MerchantID = xn.InnerText.ToString();
                    }
                }
                paymentStatus = GCNotificationStatus.Succeeded.ToString();
                transID = inputNewOrderNotification.googleordernumber;

                if (paymentStatus == "Succeeded")
                {
                    TransactionLogInfo tinfo = new TransactionLogInfo();
                    TransactionLog Tlog = new TransactionLog();
                    OrderDetailsCollection odc = new OrderDetailsCollection();
                   
                    tinfo.ResponseReasonText = "Succeeded";
                    tinfo.OrderID = orderID;
                    tinfo.StoreID = storeID;
                    tinfo.PortalID = portalID;
                    tinfo.AddedBy = userName;
                    tinfo.CustomerID = customerID;
                    tinfo.SessionCode = sessionCode;
                    tinfo.PaymentGatewayID = pgID;
                    tinfo.PaymentStatus = paymentStatus;
                    tinfo.PayerEmail = "";
                    tinfo.CreditCard = "";
                    tinfo.TotalAmount = totalAmount;
                    tinfo.TransactionID = transID;
                    tinfo.RecieverEmail = "";
                    tinfo.CurrencyCode = selectedCurrency;
                    Tlog.SaveTransactionLog(tinfo);

                    GoogleCheckOutHandler.ParseIPN(orderID, transID, paymentStatus, storeID, portalID, userName, customerID, sessionCode);
                    GoogleCheckOutHandler.UpdateItemQuantity(itemIds, couponCode, storeID, portalID, userName);
                    CartManageSQLProvider cms = new CartManageSQLProvider();
                    AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
                    aspxCommonObj.CustomerID = customerID;
                    aspxCommonObj.SessionCode = sessionCode;
                    aspxCommonObj.StoreID = storeID;
                    aspxCommonObj.PortalID = portalID;
                    aspxCommonObj.CultureName = null;
                    aspxCommonObj.UserName = null;                    
                    cms.ClearCartAfterPayment(aspxCommonObj);

                   
                   

                }

            }
        }
        catch (Exception ex)
        {

            throw ex;
        }
        
        // TODO: Process the MerchantPrivateData if provided

        foreach (GCheckout.AutoGen.Item oneItem in inputNewOrderNotification.shoppingcart.items)
        {
            // TODO: Get MerchantItemId from shopping cart item (oneItem.merchantitemid) and process it
        }

        // TODO: Add custom processing for this notification type
    }
    protected void SendConfrimMessage()
    {
        try
        {
            if (Session["OrderID"] != null)
            {
                const int responseCode = 1;                const string responsereasontext = "Transaction occured successfully";
                const int responsereasonCode = 1;
                string paymentmethod = string.Empty;
                var orderdata2 = new OrderDetailsCollection();
                if (HttpContext.Current.Session["OrderCollection"] != null)
                {
                  
                    orderdata2 = (OrderDetailsCollection)HttpContext.Current.Session["OrderCollection"];
                   
                }
                string invoice = orderdata2.ObjOrderDetails.InvoiceNumber;
                var random = new Random();
                string purchaseorderNo = (random.Next(0, 1000)).ToString();
                string timeStamp = ((int)(DateTime.UtcNow - new DateTime(2011, 1, 1)).TotalSeconds).ToString();
                string transID = (random.Next(9999999, 111111111)).ToString();
                lblTransaction.Text = transID;
                lblInvoice.Text = invoice;
                lblPaymentMethod.Text = "Gift Card";
                lblPaymentStatus.Text = "Successfull";
                lblDateTime.Text = DateTime.Now.ToString("dddd, dd MMMM yyyy ");
                lblOrderNo.Text = "#" + Session["OrderID"].ToString();
                AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
                aspxCommonObj.StoreID = GetStoreID;
                aspxCommonObj.PortalID = GetPortalID;
                aspxCommonObj.UserName = GetUsername;
                aspxCommonObj.CustomerID = GetCustomerID;
                aspxCommonObj.SessionCode = HttpContext.Current.Session.SessionID;
                aspxCommonObj.CultureName = GetCurrentCultureName;
                string result = AspxGiftCardController.Parse(orderdata2.ObjOrderDetails.OrderID,transID, invoice, purchaseorderNo, responseCode,
                                                         responsereasonCode, responsereasontext, aspxCommonObj);

                AspxGiftCardController.IssueGiftCard(orderdata2.LstOrderItemsInfo, orderdata2.ObjOrderDetails.OrderID, true, aspxCommonObj);
                      
                if (orderdata2.GiftCardDetail != null && CheckOutSessions.Get<List<GiftCardUsage>>("UsedGiftCard").Count > 0)
                {
                    AspxGiftCardController.UpdateGiftCardUsage(orderdata2.GiftCardDetail, orderdata2.ObjCommonInfo.StoreID,
                                         orderdata2.ObjCommonInfo.PortalID, orderdata2.ObjOrderDetails.OrderID, orderdata2.ObjCommonInfo.AddedBy,
                                         orderdata2.ObjCommonInfo.CultureName);
                   
                }
                lblerror.Text = result;
                lblerror.Text = GetSageMessage("Payment", "PaymentProcessed"); 
                var tinfo = new TransactionLogInfo();
                var tlog = new TransactionLog();

                tinfo.TransactionID = transID;
                tinfo.AuthCode = "";
                               tinfo.TotalAmount = orderdata2.ObjOrderDetails.GrandTotal* currencyRate;
                tinfo.ResponseCode = responseCode.ToString();
                tinfo.ResponseReasonText = responsereasontext;
                tinfo.OrderID = orderdata2.ObjOrderDetails.OrderID;
                tinfo.StoreID =  orderdata2.ObjCommonInfo.StoreID;
                tinfo.PortalID = orderdata2.ObjCommonInfo.PortalID;
                tinfo.AddedBy = orderdata2.ObjCommonInfo.AddedBy;
                tinfo.CustomerID = orderdata2.ObjOrderDetails.CustomerID;
                tinfo.SessionCode = orderdata2.ObjOrderDetails.SessionCode;
                tinfo.PaymentGatewayID = orderdata2.ObjOrderDetails.PaymentGatewayTypeID;
                tinfo.PaymentStatus = "Processed";
                tinfo.CreditCard = "";
                tinfo.CurrencyCode = SelectedCurrency;
                tlog.SaveTransactionLog(tinfo);

                CheckOutHelper cHelper = new CheckOutHelper();
                cHelper.ClearSessions();
               
               
                if (Session["OrderCollection"] != null)
                {
                   
                  var orderdata = (OrderDetailsCollection)Session["OrderCollection"];
                    try
                    {
                        orderdata.ObjOrderDetails.OrderStatus = "Processed";
                        EmailTemplate.SendEmailForOrder(GetPortalID, orderdata, _addressPath, TemplateName, transID);
                    }
                    catch (Exception ex)
                    {
                        lblerror.Text = "";
                        lblerror.Text= GetSageMessage("Payment", "EmailSendOrderProblem");
                        ProcessException(ex);
                    }
                    Session.Remove("OrderCollection");
                }
            }
            else
            {
                Response.Redirect(_sageRedirectPath, false);
            }
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
Ejemplo n.º 58
0
        public static void SendEmailForOrder(int portalID, OrderDetailsCollection orderdata, string addressPath, string templateName, string transID)
        {
            StoreSettingConfig ssc = new StoreSettingConfig();
            // sendEmailFrom = ssc.GetStoreSettingsByKey(StoreSetting.SendEcommerceEmailsFrom, storeID, portalID, "en-US");
            string sendOrderNotice = ssc.GetStoreSettingsByKey(StoreSetting.SendOrderNotification, orderdata.ObjCommonInfo.StoreID, portalID, orderdata.ObjCommonInfo.CultureName);
            string logosrc         = ssc.GetStoreSettingsByKey(StoreSetting.StoreLogoURL, orderdata.ObjCommonInfo.StoreID, portalID, orderdata.ObjCommonInfo.CultureName);
            string inquiry         = ssc.GetStoreSettingsByKey(StoreSetting.SendEcommerceEmailTo, orderdata.ObjCommonInfo.StoreID, portalID, orderdata.ObjCommonInfo.CultureName);
            string storeName       = ssc.GetStoreSettingsByKey(StoreSetting.StoreName, orderdata.ObjCommonInfo.StoreID, portalID, orderdata.ObjCommonInfo.CultureName);

            if (bool.Parse(sendOrderNotice))
            {
                MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
                MessageTokenDataContext    messageTokenDB    = new MessageTokenDataContext(SystemSetting.SageFrameConnectionString);
                SageFrameConfig            pagebase          = new SageFrameConfig();
                var    template        = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ORDER_PLACED, portalID).SingleOrDefault();
                string messageTemplate = template.Body;
                if (template != null)
                {
                    string[] tokens = GetAllToken(messageTemplate);
                    foreach (string token in tokens)
                    {
                        switch (token)
                        {
                        case "%OrderRemarks%":
                            messageTemplate = messageTemplate.Replace(token, orderdata.ObjOrderDetails.Remarks);
                            break;

                        case "%InvoiceNo%":
                            messageTemplate = messageTemplate.Replace(token, orderdata.ObjOrderDetails.InvoiceNumber);
                            break;

                        case "%OrderID%":
                            messageTemplate = messageTemplate.Replace(token, orderdata.ObjOrderDetails.OrderID.ToString());
                            break;

                        case "%BillingAddress%":
                            string billing = orderdata.ObjBillingAddressInfo.FirstName.ToString() + " " +
                                             orderdata.ObjBillingAddressInfo.LastName.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";

                            if (orderdata.ObjBillingAddressInfo.CompanyName != null)
                            {
                                billing += orderdata.ObjBillingAddressInfo.CompanyName.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                            }

                            billing += orderdata.ObjBillingAddressInfo.City.ToString() + ", " + orderdata.ObjBillingAddressInfo.Address.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                       orderdata.ObjBillingAddressInfo.Country.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                       orderdata.ObjBillingAddressInfo.EmailAddress.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                       orderdata.ObjBillingAddressInfo.Phone.ToString();
                            messageTemplate = messageTemplate.Replace(token, billing);
                            break;

                        case "%ShippingAddress%":
                            string shipping = "";
                            if (!orderdata.ObjOrderDetails.IsDownloadable)
                            {
                                if (orderdata.ObjOrderDetails.IsMultipleCheckOut == false)
                                {
                                    shipping = orderdata.ObjShippingAddressInfo.FirstName.ToString() + " " +
                                               orderdata.ObjShippingAddressInfo.LastName.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                    if (orderdata.ObjShippingAddressInfo.CompanyName != null)
                                    {
                                        shipping += orderdata.ObjShippingAddressInfo.CompanyName.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                    }

                                    shipping += orderdata.ObjShippingAddressInfo.City.ToString() + ", " + orderdata.ObjShippingAddressInfo.Address.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                                orderdata.ObjShippingAddressInfo.Country.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                                orderdata.ObjShippingAddressInfo.EmailAddress.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                                orderdata.ObjShippingAddressInfo.Phone.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                }
                                else
                                {
                                    shipping = "Multiple addresses<br />Plese log in to view." + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                }
                            }
                            else
                            {
                                shipping = "Your Ordered Item is Downloadable Item." + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                            }

                            messageTemplate = messageTemplate.Replace(token, shipping);
                            break;

                        case "%UserFirstName%":
                            messageTemplate = messageTemplate.Replace(token, orderdata.ObjBillingAddressInfo.FirstName);
                            break;

                        case "%UserLastName%":
                            messageTemplate = messageTemplate.Replace(token, orderdata.ObjBillingAddressInfo.LastName);
                            break;

                        case "%TransactionID%":
                            messageTemplate = messageTemplate.Replace(token, transID);
                            break;

                        case "%PaymentMethodName%":
                            messageTemplate = messageTemplate.Replace(token, orderdata.ObjPaymentInfo.PaymentMethodName);
                            break;

                        case "%DateTimeDay%":
                            messageTemplate = messageTemplate.Replace(token, DateTime.Now.ToString("dddd, dd MMMM yyyy"));
                            break;

                        case "%DateYear%":
                            messageTemplate = messageTemplate.Replace(token, DateTime.Now.Year.ToString());
                            break;

                        case "%CustomerID%":
                            messageTemplate = messageTemplate.Replace(token, orderdata.ObjOrderDetails.CustomerID.ToString());
                            break;

                        case "%PhoneNo%":
                            messageTemplate = messageTemplate.Replace(token, orderdata.ObjBillingAddressInfo.Phone);
                            break;

                        case "%AccountLogin%":
                            string account = "";
                            if (orderdata.ObjCommonInfo.AddedBy.ToString().ToLower() == "anonymoususer" && orderdata.ObjOrderDetails.CustomerID == 0)
                            {       // future login process for annoymoususr
                                account += "Please Register and log in to your <span style=\"font-weight: bold; font-size: 11px;\">AspxCommerce</span>";

                                account += "<a  style=\"color: rgb(39, 142, 230);\"  href=" + addressPath + "User-Registration.aspx" + ">account</a>";
                            }
                            else
                            {
                                account += "  Please log in to your <span style=\"font-weight: bold; font-size: 11px;\">AspxCommerce</span>";

                                account += " <a style=\"color: rgb(39, 142, 230);\"  href=" + addressPath + "Login.aspx" + ">account</a>";
                            }
                            messageTemplate = messageTemplate.Replace(token, account);
                            break;

                        case "%LogoSource%":
                            // string src = " http://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/Templates/" + templateName + "/images/aspxcommerce.png";
                            string src = " http://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/" + logosrc;
                            messageTemplate = messageTemplate.Replace(token, src);
                            break;

                        case "%DateTime%":
                            messageTemplate = messageTemplate.Replace(token, DateTime.Now.ToString("dd MMMM yyyy "));

                            break;

                        case "%InquiryEmail%":
                            string x =
                                "<a  target=\"_blank\" style=\"text-decoration: none;color: #226ab7;font-style: italic;\" href=\"mailto:" +
                                inquiry + "\" >" + inquiry + "</a>";
                            messageTemplate = messageTemplate.Replace(token, x);
                            break;

                        case "%StoreName%":
                            messageTemplate = messageTemplate.Replace(token, storeName);
                            break;
                        }
                    }
                    // return messageTemplate;
                    MailHelper.SendMailNoAttachment(template.MailFrom, orderdata.ObjBillingAddressInfo.EmailAddress, template.Subject, messageTemplate, string.Empty, string.Empty);
                }
            }
        }