⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ordersbl.cs

📁 简单的cI真的是很简单 你想要就下载吧
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VinciDataAccess.DataAccess;
using VinciDataAccess.Entity;
using System.Collections;
using System.Data;
namespace VinciBusinessLogic.BusinessLogic
{
    public class OrdersBL
    {
        private  OrdersStore  _ordersStore= null;
        public OrdersBL()
        {
            _ordersStore = new OrdersStore();
        }
        public OrdersCollection GetOrdersList()
        {
            return this._ordersStore.GetOrdersList();
        }
        public OrdersCollection GetCreateOrderListLogic(int employeeID)
        {
            return this._ordersStore.GetCreateOrderList(employeeID);
        }
        public void AddOrders(OrdersEntity _ordersEntity)
        {
            this._ordersStore.AddOrders(_ordersEntity);            
        }
        public OrdersEntity GetOrderInfo(int orderID)//Coder:Tom
        {
            return this._ordersStore.GetOrderInfo(orderID);
        }
        public OrdersCollection GetStorehouseOrdersList()
        {
            return this._ordersStore.GetStorehouseOrdersList();
        }
        public OrderDetailsCollection GetAllOrderDetailsList(int orderID)//Coder:Tom
        {
            OrderDetailsStore newOrderdetai=new OrderDetailsStore();
            return newOrderdetai.GetAllOrderDetailsList(orderID);
        }
        public string GetProductNameBL(int _productID)       //By Abel
        {
            ProductsStore _productsStore = new ProductsStore();
            ProductsEntity _productsEntity = _productsStore.GetProdcutInfo(_productID);
            return _productsEntity.ProductName;
        }
        public string GetCustomersCompanyName(int _customerID) //By Abel
        {
            CustomersStore _customersStore = new CustomersStore();
            CustomersEntity _customersEntity = _customersStore.GetCustomerInfo(_customerID);
            return _customersEntity.CompanyName;
        }
        public string GetCustomersName(int _customerID) //By Abel
        {
            CustomersStore _customersStore = new CustomersStore();
            CustomersEntity _customersEntity = _customersStore.GetCustomerInfo(_customerID);
            return _customersEntity.ContactName;
        }
        public OrdersCollection GetCurrentSurelyOrdersBL(int _orgID) //By Abel
        {
            OrdersCollection ordersInfo = _ordersStore.GetCurrentSurelyOrders(_orgID);           
            return ordersInfo;
        }

        public OrdersCollection GetNeedCloseOrders(int orgID) //By Abel
        {
            return _ordersStore.GetNeedCloseOrder(orgID);
        }
        #region//待备货订单条数


        public int GetStorehouseOrdersNum()                  //By Abel
        {
            int _num = 0;
            OrdersCollection _ordersCollection = _ordersStore.GetStorehouseOrdersList();
            foreach (OrdersEntity order in _ordersCollection)
            {
                _num++;
            }
            return _num;
        }
        #endregion
        #region//待发货订单条数


        public int GetTransportOrdersNum(int _orderID)       //By Abel
        {
            int _num = 0;
            OrdersCollection _ordersCollection = _ordersStore.GetTransportOrdersInfo(_orderID);
            foreach (OrdersEntity order in _ordersCollection)
            {
                _num++;
            }
            return _num;
        }
        #endregion
        #region//待确认订单条数


        public int GetGetCurrentSurelyOrdersNum(int _orgID)  //By Abel
        {
            int _num = 0;
            OrdersCollection _ordersCollection = _ordersStore.GetCurrentSurelyOrders(_orgID);
            foreach (OrdersEntity order in _ordersCollection)
            {
                _num++;
            }
            return _num;
        }
        #endregion
        #region//待关闭订单条数


        public int GetNeedCloseOrdersNum(int _orgID)  //By Abel
        {
            int _num = 0;
            OrdersCollection _ordersCollection = _ordersStore.GetNeedCloseOrder(_orgID);
            foreach (OrdersEntity order in _ordersCollection)
            {
                _num++;
            }
            return _num;
        }
#endregion
        /// <summary>
        /// 搜索字符串


        /// </summary>
        /// <param name="sqlStr"></param>
        /// <returns></returns>
        public OrdersCollection GetSearchOrders(string sqlStr)
        {
            return this._ordersStore.SearchOrders(sqlStr);
        }
        //public OrdersCollection GetOrderInfo02(int orderID)
        //{
        //    OrdersStore ordersStore = new OrdersStore();
        //    return ordersStore.GetOrderInfo02(orderID);
        //}
        public ProductsEntity GetProdcutInfo(int productID)//Coder:Tom
        {
            ProductsStore newProducts=new ProductsStore();
            return newProducts.GetProdcutInfo(productID);
        }
        public CategoriesEntity GetCategoryInfo(int categoryID)//Coder:Tom
        {
            CategoriesStore newCate = new CategoriesStore();
            return newCate.GetCategoryInfo(categoryID);
        }
        public OrdersCollection GetAllowOrderList()
        {
            return this._ordersStore.GetAllowOrderList();
        }
        public OrdersCollection GetOutOrderList()
        {
            return this._ordersStore.GetOutOrderList();
        }
        public OrdersCollection GetConfirmOrderList()
        {
            return this._ordersStore.GetConfirmOrderList();
        }
        public OrdersCollection GetCloseOrderList()
        {
            return this._ordersStore.GetCloseOrderList();
        }
        public void DeleteOrder(OrdersEntity ordersEntity)//Coder:Tom
        {
            _ordersStore.DeleteOrder(ordersEntity);
        }
        public OrderDetailsEntity GetOrderDetailInfoOnePar(int orderID)//Coder:Tom
        {
            OrderDetailsStore neworderDet = new OrderDetailsStore();
            return neworderDet.GetOrderDetailInfoOnePar(orderID);
        }
        public void DeleteOrderDetail(OrderDetailsEntity orderDetailsEntity)//Coder:Tom
        {
            OrderDetailsStore neworderDet = new OrderDetailsStore();
            neworderDet.DeleteOrderDetail(orderDetailsEntity);
        }
        public OrdersCollection GetOrdersInfoByEmployeeID(int[] employeesIDList)
        {
            return _ordersStore.GetOrdersInfoByEmployeeID(employeesIDList);
        }

       //  Chark.Xu // po06

        #region 根据产品ID返回该产品的单价的方法



        public double GetPrdPrice(int PrdID)
        {
            double _dprice = 0;
            VinciDataAccess.DataAccess.ProductsStore products = new ProductsStore();
            VinciDataAccess.Entity.ProductsEntity prdInfo = new ProductsEntity();
            prdInfo = products.GetProdcutInfo(PrdID);
            _dprice = Convert.ToDouble(prdInfo.UnitPrice);

            return _dprice;

        }
        #endregion

        #region 插入order数据记录,生成订单 , 返回一个bool值



       
        public bool AddOrders(int CustomerID, int UserID, DateTime dtNow, DateTime RequireDate, string OderNote, int OrderCreaterID, int OrgID)
        {

            bool _isOrder = false;
            VinciDataAccess.DataAccess.OrdersStore OrdStore = new OrdersStore();
            VinciDataAccess.Entity.OrdersEntity OrdEntity = new OrdersEntity();
            OrdEntity.CustomerID = CustomerID;
            OrdEntity.EmployeeID = UserID;
            OrdEntity.OrderDate = dtNow;
            OrdEntity.RequiredDate = RequireDate;
            OrdEntity.OrderNote = OderNote;
            OrdEntity.OrderCreaterID = OrderCreaterID;
            OrdEntity.OrgID = OrgID;
            try
            {
                //在数据库中插入



                OrdStore.AddOrders(OrdEntity);
                _isOrder = true;
                return _isOrder;
            }
            catch
            {

                return _isOrder;
            }
        }
        #endregion

        #region 插入orderDetails数据方法,返回bool值



       
        public bool AddorderDetails(DataTable dt)
        {
            bool _isOrdDetail = false;
            VinciDataAccess.DataAccess.OrdersStore ordStore = new OrdersStore();
            int _getOrderID = ordStore.getOrderID();
            OrderDetailsCollection ordDetailsCollection = new OrderDetailsCollection();
            foreach (DataRow pr in dt.Rows)
            {
                VinciDataAccess.Entity.OrderDetailsEntity ordDetailsEntity = new OrderDetailsEntity();
                ordDetailsEntity.OrderID = _getOrderID;
                ordDetailsEntity.ProductID = Convert.ToInt32(pr["商品编号"]);
                ordDetailsEntity.Discount = Convert.ToDouble(pr["商品折扣"]);
                ordDetailsEntity.UnitPrice = Convert.ToDecimal(pr["商品单价"]);
                ordDetailsEntity.Quantity = Convert.ToInt32(pr["商品数量"]);
                ordDetailsCollection.Add(ordDetailsEntity);
            }
            VinciDataAccess.DataAccess.OrderDetailsStore orddtsStore = new OrderDetailsStore();
            try
            {
                foreach (OrderDetailsEntity ordDetailsEntity in ordDetailsCollection)
                {
                    orddtsStore.AddOrderDetails(ordDetailsEntity);
                }
                _isOrdDetail = true;
                return _isOrdDetail;
            }
            catch
            {
                return _isOrdDetail;
            }

        }
        #endregion

        #region 由商品类别参数返回该类商品的集合
        
        public ProductsCollection RetProductbyCategoryID(int _CategoryID)
        {
            VinciDataAccess.DataAccess.ProductsStore products = new ProductsStore();
            VinciDataAccess.Entity.ProductsCollection prdCollection = new ProductsCollection();
            prdCollection = products.GetPrdListByCagryID(_CategoryID);
            return prdCollection;

        }
        #endregion

        #region 返回数据库中Categories表类别字段方法



       
        public CategoriesCollection RetCatagoris()
        {

            CategoriesStore categtories = new CategoriesStore();
            VinciDataAccess.Entity.CategoriesCollection cgrCotin = new CategoriesCollection();
            cgrCotin = categtories.GetCategoriesList();
            return cgrCotin;

        }
        #endregion
      

       // Chark po09

        #region 更新Order表 返回bool值,是否成功
        public bool UpdateOrder(int CustomerID,
                                int EmployeeID,
                           DateTime OrderDate,
                           DateTime RequireDate,
                            string  OrderNote,
                                int OrderCreaterID, 
                           DateTime StorehouseReadyDate,
                                int StorehouseAccepterID,
                             string StorehouseNote,
                             string Carrier,
                                int TransportOrderID,
                           DateTime TransportDate,
                             string TransportNote,
                                int TransportInfoInputerID,                                                                    
                           DateTime ArrivalDate,
                             string Receiver,
                             string ReceiveNote,
                                int ReceiveInfoInputerID,
                           DateTime OrderCloseDate,
                                int OrderCloseAccepterID,                                                                    
                                int OrgID,
                                int OrderID) 
        {
            bool _isUpdate = false;
            VinciDataAccess.DataAccess.OrdersStore ordStore = new OrdersStore();
            VinciDataAccess.Entity.OrdersEntity _ordersEntity = new OrdersEntity();
            _ordersEntity.OrderID = OrderID;
            _ordersEntity.CustomerID = CustomerID;
            _ordersEntity.EmployeeID = EmployeeID;
            _ordersEntity.OrderDate = OrderDate;
            _ordersEntity.RequiredDate = RequireDate;
            _ordersEntity.OrderNote = OrderNote;
            _ordersEntity.OrderCreaterID = OrderCreaterID;
            _ordersEntity.StorehouseReadyDate = StorehouseReadyDate;
            _ordersEntity.StorehouseAccepterID = StorehouseAccepterID;
            _ordersEntity.StorehouseNote = StorehouseNote;
            _ordersEntity.Carrier = Carrier;
            _ordersEntity.TransportOrderID = TransportOrderID;
            _ordersEntity.TransportDate = TransportDate;
            _ordersEntity.TransportNote = TransportNote;
            _ordersEntity.TransportInfoInputerID = TransportInfoInputerID;
            _ordersEntity.ArrivalDate = ArrivalDate;
            _ordersEntity.Receiver = Receiver;
            _ordersEntity.ReceiveNote = ReceiveNote;
            _ordersEntity.ReceiveInfoInputerID = ReceiveInfoInputerID;
            _ordersEntity.OrderCloseDate = OrderCloseDate;
            _ordersEntity.OrderCloseAccepterID = OrderCloseAccepterID;
            _ordersEntity.OrgID = OrgID;
            try
            {
                ordStore.UpdateOrder(_ordersEntity);
                _isUpdate = true;
                return _isUpdate;
            }
            catch(Exception ex) 
            {
                throw ex;
                
                return _isUpdate;
            }

        }
        #endregion

        #region 更新Order Details表,返回bool值,是否成功
        public bool UpdateOrdDetails(int ordID,int prdID,decimal price,int count,double discount) 
        {
            bool _isUpdate = false;
            VinciDataAccess.DataAccess.OrderDetailsStore ordDetsStore = new  OrderDetailsStore();
            VinciDataAccess.Entity.OrderDetailsEntity _ordDetsEntity = new  OrderDetailsEntity();
             _ordDetsEntity.OrderID=ordID;
             _ordDetsEntity.ProductID=prdID;
             _ordDetsEntity.UnitPrice=price;
             _ordDetsEntity.Quantity=count;
             _ordDetsEntity.Discount =discount;
             try
             {
                 ordDetsStore.UpdateOrderDetail(_ordDetsEntity);
                 _isUpdate = true;
                 return _isUpdate;
             }
             catch(Exception ex)
             {
                 throw ex;
                 return _isUpdate;
             }
        }
        #endregion

      

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -