Exemplo n.º 1
0
 public static DataTable GetAllProductFromShopDB(string productsTableName, string ShopIDColumn, string OrderIDColumn, string DescriptionColumn, string ShopProductCodeColumn, string PriceColumn, string ImageColumn)
 {
     try
     {
         return(DalShopDB.GetAllProductFromShopDB(productsTableName, ShopIDColumn, OrderIDColumn, DescriptionColumn, ShopProductCodeColumn, PriceColumn, ImageColumn));
     }
     catch
     {
         return(null);
     }
 }
Exemplo n.º 2
0
 public static int GetAmountByProductId(int productId, string TotalAmountTableName, string TotalAmountColumn,
                                        string idColumnName)
 {
     try
     {
         return(DalShopDB.GetAmountByProductId(productId, TotalAmountTableName, TotalAmountColumn, idColumnName));
     }
     catch
     {
         return(-1);
     }
 }
Exemplo n.º 3
0
 public static bool UpdateProductAmountAtShop(string TotalAmountTableName, string TotalAmountColumn, string idColumnName, List <BLOrderDetail> orderDetails)
 {
     try
     {
         foreach (var orderDetail in orderDetails)
         {
             int  productId     = orderDetail.Product.Id;
             int  currentAmount = GetAmountByProductId(productId, TotalAmountTableName, TotalAmountColumn, idColumnName);
             int  newAmount     = currentAmount - orderDetail.Amount;
             bool isUpdated     = DalShopDB.UpdateProductAmountAtShop(productId, newAmount, TotalAmountTableName, TotalAmountColumn, idColumnName);
             if (!isUpdated)//do something else because what heppend if jast part of the amount is updated?
             {
                 return(false);
             }
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 4
0
 public static DataTable ShopAndManagerTable()
 {
     return(DalShopDB.ShopAndManagerTable());
 }