示例#1
0
 public bool AssignSupplierToOrder(Order order)
 {
     SqlParameter[] Params = new SqlParameter[]
     {
         new SqlParameter("@OrderNo", order.OrderNo),
         new SqlParameter("@SupplierID", order.SupplierID)
     };
     return DataProvider.ExecuteNonQuery("sp_AssignSupplier", CommandType.StoredProcedure,
         Params);
 }
示例#2
0
        public OrderItem CreateOrder(Order order)
        {
            OrderItem OrderLine;
            SqlParameter[] Params = { new SqlParameter("@DateCreated", order.DateCreated),
                                      new SqlParameter("@DateLastModified", order.DateLastModified),
                                      new SqlParameter("@InvoiceID", order.InvoiceID),
                                      new SqlParameter("@Status", order.Status),
                                      new SqlParameter("@SupplierID",order.SupplierID)
                                    };
            using (DataTable table = DataProvider.ExecuteParamatizedSelectCommand("sp_CreateOrder", CommandType.StoredProcedure, Params))
            {
                OrderLine = new OrderItem();
                if (table.Rows.Count == 1)
                {
                    DataRow row = table.Rows[0];
                    OrderLine.OrderNo = Convert.ToInt32(row["OrderNumber"]);
                }

            }
            return OrderLine;
        }
示例#3
0
        public List<Order> GetAllCompletedOrders()
        {
            List<Order> OrdersList = null;

            using (DataTable table = DataProvider.ExecuteSelectCommand("sp_ViewAllCompletedOrders", //*Note
                CommandType.StoredProcedure))
            {
                if (table.Rows.Count > 0)
                {
                    OrdersList = new List<Order>();
                    foreach (DataRow row in table.Rows)
                    {
                        Order order = new Order();
                        order.OrderNo = Convert.ToInt32(row["OrderNo"]);
                        order.DateCreated = Convert.ToDateTime(row["DateCreated"]);
                        order.DateLastModified = Convert.ToDateTime(row["DateLastModified"]);
                        order.InvoiceID = Convert.ToInt32(row["InvoiceID"]);
                        order.Status = Convert.ToBoolean(row["Status"]);
                        OrdersList.Add(order);
                    }
                }
            }
            return OrdersList;
        }
 public OrderItem AddOrder(Order order)
 {
     OrderHandler myHandler = new OrderHandler(); return myHandler.CreateOrder(order);
 }
 public bool UpdateOrder(Order order)
 {
     OrderHandler myHandler = new OrderHandler(); return myHandler.UpdateOrder(order);
 }
 public bool AssignOrderToSupplier(Order ord)
 {
     OrderHandler myHandler = new OrderHandler(); return myHandler.AssignSupplierToOrder(ord);
 }
示例#7
0
 public bool UpdateOrder(Order order)
 {
     SqlParameter[] Params = new SqlParameter[]
     {
         new SqlParameter("@OrderNo", order.OrderNo),
         new SqlParameter("@DateLastModified", order.DateLastModified ),
         new SqlParameter("@Status", true)
     };
     return DataProvider.ExecuteNonQuery("sp_UpdateOrder", CommandType.StoredProcedure,
         Params);
 }
示例#8
0
        public List<Order> GetOrdersInRasnge(string from, string to, int SupplierID)
        {
            List<Order> SupplierOrders = null;

            SqlParameter[] Params = {
                                        new SqlParameter("@From", from),
                                        new SqlParameter("@To", to),
                                        new SqlParameter("@SupplierID", SupplierID)
                                    };
            using (DataTable table = DataProvider.ExecuteParamatizedSelectCommand("sp_ViewAllSupplierOrdersByDateRange",
                CommandType.StoredProcedure, Params))
            {
                if (table.Rows.Count > 0)
                {
                    SupplierOrders = new List<Order>();
                    foreach (DataRow row in table.Rows)
                    {
                        Order order = new Order();
                        order.OrderNo = Convert.ToInt32(row["OrderNo"]);
                        order.Status = Convert.ToBoolean(row["Status"]);
                        order.DateCreated = Convert.ToDateTime(row["DateCreated"]);
                        order.InvoiceID = Convert.ToInt32(row["InvoiceID"]);
                        order.SupplierID = Convert.ToInt32(row["SupplierID"]);
                        SupplierOrders.Add(order);
                    }
                }
            }
            return SupplierOrders;
        }
示例#9
0
        public List<Order> GetOrdersForSupplier(int SupplierID)
        {
            List<Order> SupplierOrders = null;

            SqlParameter[] Params = { new SqlParameter("@SupplierID", SupplierID) };
            using (DataTable table = DataProvider.ExecuteParamatizedSelectCommand("sp_ViewAllSupplierOrders",
                CommandType.StoredProcedure, Params))
            {
                if (table.Rows.Count > 0)
                {
                    SupplierOrders = new List<Order>();
                    foreach (DataRow row in table.Rows)
                    {
                        Order order = new Order();
                        order.OrderNo = Convert.ToInt32(row["OrderNo"]);
                        order.Status = Convert.ToBoolean(row["Status"]);
                        order.DateCreated = Convert.ToDateTime(row["DateCreated"]);
                        order.DateLastModified = Convert.ToDateTime(row["DateLastModified"]);
                        SupplierOrders.Add(order);
                    }
                }
            }
            return SupplierOrders;
        }
示例#10
0
        public Order GetOrder(int orderNo)
        {
            Order order = null;

            SqlParameter[] Params = { new SqlParameter("@OrderNo", orderNo) };
            using (DataTable table = DataProvider.ExecuteParamatizedSelectCommand("sp_ViewSpecificOrder",
                CommandType.StoredProcedure, Params))
            {
                if (table.Rows.Count == 1)
                {
                    DataRow row = table.Rows[0];
                    order = new Order();
                    order.OrderNo = Convert.ToInt32(row["OrderNo"]);
                    order.DateCreated = Convert.ToDateTime(row["DateCreated"]);
                    order.SupplierID = Convert.ToInt32(row["SupplierID"]);
                    order.InvoiceID = Convert.ToInt32(row["InvoiceID"]);
                    order.Status = Convert.ToBoolean(row["Status"]);

                }
            }
            return order;
        }