コード例 #1
0
        public string Save(DAL.Entity.StockIn stockIn)
        {
            string message = "";

            bool itemExist = stockInGateway.DoesItemExist(stockIn.ItemId);

            if (itemExist)
            {
                int rowAffected = stockInGateway.Update(stockIn);
                if (rowAffected > 0)
                {
                    message = "Saved Successfully";
                }
                else
                {
                    message = "Could not be saved";
                }
            }
            else
            {
                int rowAffected = stockInGateway.Save(stockIn);

                if (rowAffected > 0)
                {
                    message = "Saved Successfully";
                }
                else
                {
                    message = "Could not be saved";
                }
            }

            return(message);
        }
コード例 #2
0
        public string SaveManager(StockIn stockIn)
        {
            if (stockIn.StockQuantity == 0)
            {
                return("Stock Quantity should be filled");
            }
            else if (stockInGateway.IsStockExist(stockIn))
            {
                int stockQuantityAvailable = stockInGateway.StockQuantityAvailable(stockIn);

                stockIn.StockQuantity = stockIn.StockQuantity + stockQuantityAvailable;
                int row = stockInGateway.Update(stockIn);
                if (row > 0)
                {
                    return("Save Successful !");
                }
                else
                {
                    return("Saving Failed !");
                }
            }
            else
            {
                int row = stockInGateway.SaveGateway(stockIn);
                if (row > 0)
                {
                    return("Save Successful !");
                }
                else
                {
                    return("Saving Failed !");
                }
            }
        }
コード例 #3
0
        public string Update(StockIn stockIn)
        {
            int rowAffected = stockInGateway.Update(stockIn);

            if (rowAffected > 0)
            {
                return("Stock in Updated successfully");
            }
            return("Stock in Updated failed");
        }
コード例 #4
0
        public string Update(int itemId, int quantity)
        {
            int availablequantity = stockInGateway.GetStockInById(itemId);

            availablequantity -= quantity;
            StockIn stockIn = new StockIn();

            stockIn.ItemId            = itemId;
            stockIn.AvailableQuantity = availablequantity;

            int rowAffect = stockInGateway.Update(stockIn);

            if (rowAffect > 0)
            {
                return("Update Successful");
            }
            else
            {
                return("Update Failed");
            }
        }