public OrderDetailResponse( bool HasOrder, List <ITaxOrderDetailsByProduct> ProductList, IOrderDetailsDateAndStatus OrderDateAndStatusObj, IAddress AddressObj, IComputedTaxPrice ComputedObj, ICardDetails CardDetails) { this.HasOrder = HasOrder; this.ProductList = ProductList; this.OrderDateAndStatusObj = OrderDateAndStatusObj; this.AddressObj = AddressObj; this.ComputedObj = ComputedObj; this.CardDetails = CardDetails; }
public DataSet CreateOrderID(IAddress AddressObj, ICardDetails CardObj, IUserProfile UserProfileObj) { string Source = "sp_CreateOrderID"; try { object[] paramToken = { new MySqlParameter("@aID", AddressObj.GetAddressID()), new MySqlParameter("@caID", CardObj.GetCardID()), new MySqlParameter("@paramToken", UserProfileObj.GetToken()) }; return(MySQLCommands.Instance().ExecuteQuery(Source, CommandType.StoredProcedure, paramToken)); } catch (Exception ex) { Logger.Instance().Log(Fatal.Instance(), ex); throw ex; } }
public IOrderCreaterStatus CreateOrder(IAddress AddressObj, ICardDetails CardObj, IUserProfile UserProfileObj, ICart CartObj) { try { TaxManagement TaxManagementObj = new TaxManagement(); int orderID = int.Parse(new OrderCreatorDataLayer().CreateOrderID(AddressObj, CardObj, UserProfileObj).Tables[0].Rows[0]["OrderID"].ToString()); List <ITaxProducts> ProductList = TaxManagementObj.CalculateTaxByProduct(CartObj, AddressObj, UserProfileObj); // insert all the values to the database OrderCreatorDataLayer OrderDataLayerObj = new OrderCreatorDataLayer(); foreach (CartItems Items in CartObj.GetCartItems()) { OrderDataLayerObj.InsertValuesToDatabase(orderID, Items.ProductObj.pbsID, Items.ProductObj.Quantity, Items.ProductObj.Price, TaxManagementObj.GetTaxAmount(Items.ProductObj.pbsID, ProductList)); } IOrderCreaterStatus ResponseObj = new OrderCreaterStatus(true, orderID); return(ResponseObj); } catch (Exception ex) { Logger.Instance().Log(Fatal.Instance(), ex); throw ex; } }