Exemplo n.º 1
0
 public static int DeleteClinician(string hcpId)
 {
     return(SqlDataAccess.Execute <ClinicianModel>
            (
                @"DELETE FROM dbo.Clinician
             WHERE HCPId = @HCPId",
                new ClinicianModel {
         HCPId = hcpId
     }
            ));
 }
Exemplo n.º 2
0
        public static int RemoveProduct(int productID)
        {
            ProductModel data = new ProductModel
            {
                ProductID = productID
            };

            string sql = @"delete from dbo.product 
                          WHERE ProductID = @ProductID;";

            return(SqlDataAccess.Execute(sql, data));
        }
Exemplo n.º 3
0
        public static int RemoveBin(int binID)
        {
            BinModel data = new BinModel
            {
                BinID = binID
            };

            string sql = @"delete from dbo.bins 
                          WHERE BinID = @BinID;";

            return(SqlDataAccess.Execute(sql, data));
        }
Exemplo n.º 4
0
        public static int RemoveOrder(int orderID)
        {
            OrderModel data = new OrderModel
            {
                OrderID = orderID
            };

            string sql = @"delete from dbo.orders 
                          WHERE OrderID = @OrderID;";

            return(SqlDataAccess.Execute(sql, data));
        }
Exemplo n.º 5
0
        public static void RemoveInventory(int inventoryID)
        {
            InventoryModel data = new InventoryModel
            {
                InventoryID = inventoryID
            };

            string sql = @"delete from dbo.inventory 
                          WHERE InventoryID = @InventoryID;";

            SqlDataAccess.Execute(sql, data);
        }
Exemplo n.º 6
0
        public static int CreateProduct(string sku, string description)
        {
            ProductModel data = new ProductModel
            {
                SKU = sku,
                ProductDescription = description
            };

            string sql = @"insert into dbo.product (SKU, ProductDescription)
                           values (@SKU, @ProductDescription);";

            return(SqlDataAccess.Execute(sql, data));
        }
Exemplo n.º 7
0
        public static int CreateBin(int binID, string binName)
        {
            BinModel data = new BinModel
            {
                BinID   = binID,
                BinName = binName
            };

            string sql = @"insert into dbo.bins (BinName)
                           values (@BinName);";

            return(SqlDataAccess.Execute(sql, data));
        }
Exemplo n.º 8
0
        public static int UpdateBin(int binID, string binName)
        {
            BinModel data = new BinModel
            {
                BinID   = binID,
                BinName = binName
            };

            string sql = @"update dbo.bins 
                        set BinName = @BinName WHERE BinID = @BinID;";

            return(SqlDataAccess.Execute(sql, data));
        }
Exemplo n.º 9
0
        public static int UpdateProduct(int productID, string sku, string description)
        {
            ProductModel data = new ProductModel
            {
                ProductID          = productID,
                SKU                = sku,
                ProductDescription = description
            };

            string sql = @"update dbo.product 
                        set SKU = @SKU, ProductDescription = @ProductDescription
                        WHERE ProductID = @ProductID;";

            return(SqlDataAccess.Execute(sql, data));
        }
Exemplo n.º 10
0
        public static void CreateInventory(int inventoryID, int productID, int binID, int qty)
        {
            InventoryModel data = new InventoryModel
            {
                InventoryID = inventoryID,
                ProductID   = productID,
                BinID       = binID,
                QTY         = qty
            };

            string sql = @"insert into dbo.inventory (ProductID, BinID, QTY)
                           values (@ProductID, @BinID, @QTY);";

            SqlDataAccess.Execute(sql, data);
        }
Exemplo n.º 11
0
        public static int RemoveOrderLine(int orderLineID)
        {
            var previousState = LoadOrderLine(orderLineID);

            AdjustInventory(previousState.ProductID, previousState.QTY * -1);

            OrderLinesModel data = new OrderLinesModel
            {
                OrderLineID = orderLineID
            };

            string sql = @"delete from dbo.orderlines 
                          WHERE OrderLineID = @OrderLineID;";

            return(SqlDataAccess.Execute(sql, data));
        }
Exemplo n.º 12
0
        public static int UpdateOrderLines(int orderLineID, int orderID, int productID, int qty)
        {
            OrderLinesModel data = new OrderLinesModel
            {
                OrderLineID = orderLineID,
                OrderID     = orderID,
                ProductID   = productID,
                QTY         = qty
            };

            string sql = @"update dbo.orderlines 
                           set ProductID = @ProductID, QTY = @QTY 
                           WHERE OrderLineID = @OrderLineID;";

            return(SqlDataAccess.Execute(sql, data));
        }
Exemplo n.º 13
0
        public static void UpdateInventory(int inventoryID, int productID, int binID, int qty)
        {
            InventoryModel data = new InventoryModel
            {
                InventoryID = inventoryID,
                ProductID   = productID,
                BinID       = binID,
                QTY         = qty
            };

            string sql = @"update dbo.inventory 
                        set ProductID = @ProductID, BinID = @BinID, 
                        QTY = @qty 
                        WHERE InventoryID = @InventoryID;";

            SqlDataAccess.Execute(sql, data);
        }
Exemplo n.º 14
0
        public static int UpdateOrder(int orderID, string orderNumber, DateTime dateordered, string customerName, string customerAddress)
        {
            OrderModel data = new OrderModel
            {
                OrderID         = orderID,
                OrderNumber     = orderNumber,
                DateOrdered     = dateordered,
                CustomerName    = customerName,
                CustomerAddress = customerAddress
            };

            string sql = @"update dbo.orders 
                        set OrderNumber = @OrderNumber, DateOrdered = @DateOrdered, 
                        CustomerName = @CustomerName, CustomerAddress = @CustomerAddress 
                        WHERE OrderID = @OrderID;";

            return(SqlDataAccess.Execute(sql, data));
        }
Exemplo n.º 15
0
        public static void CreateOrderLine(int orderID, int productID, int totalQuantity)
        {
            AdjustInventory(productID, totalQuantity);

            OrderLinesModel data = new OrderLinesModel
            {
                OrderID   = orderID,
                ProductID = productID,
                QTY       = totalQuantity
            };

            string sql = @"insert into dbo.orderlines (OrderID, ProductID, QTY)
                          values (@OrderID, @ProductID, @QTY);";

            try
            {
                SqlDataAccess.Execute(sql, data);
            }
            catch (System.Exception)
            {
                AdjustInventory(productID, totalQuantity * -1);
                throw;
            }
        }