示例#1
0
        public SalesOrderDTO GetOneOrderByOrderID(int id)
        {
            SalesOrderDTO dto = new SalesOrderDTO();

            DataTable dt = _SqlDa.GetDataTable("select * from Sales.SalesOrderHeader where SalesOrderID = " + id.ToString(), "SalesOrder");

            if (dt != null && dt.Rows.Count > 0)
            {
                DataRow dr = dt.Rows[0];
                LoadRowToDto(ref dto, dr, id, true);
            }

            return dto;
        }
示例#2
0
        private void LoadRowToDto(ref SalesOrderDTO dto, DataRow dr, int id, bool loadDetails = false)
        {
            dto.SalesOrderID = RowFieldLoader.GetInt(dr, "SalesOrderID");
            dto.RevisionNumber = RowFieldLoader.GetInt(dr, "RevisionNumber");
            dto.OrderDate = RowFieldLoader.GetDateTime(dr, "OrderDate");
            dto.DueDate = RowFieldLoader.GetDateTime(dr, "DueDate");
            dto.ShipDate = RowFieldLoader.GetDateTime(dr, "ShipDate");
            dto.SubTotal = RowFieldLoader.GetDecimal(dr, "SubTotal");
            dto.TaxAmt = RowFieldLoader.GetDecimal(dr, "TaxAmt");
            dto.Freight = RowFieldLoader.GetDecimal(dr, "Freight");
            dto.TotalDue = RowFieldLoader.GetDecimal(dr, "TotalDue");
            dto.Comment = RowFieldLoader.GetString(dr, "Comment");
            dto.ModifiedDate = RowFieldLoader.GetDateTime(dr, "ModifiedDate");

            if (loadDetails) dto.OrderDetails = GetOrderDetailsBySalesOrderID(id);
        }
示例#3
0
        public List<SalesOrderDTO> GetOrdersBySalesPersonID(int id)
        {
            List<SalesOrderDTO> dtos = new List<SalesOrderDTO>();

            DataTable dt = _SqlDa.GetDataTable("select * from Sales.SalesOrderHeader where SalesPersonID = " + id.ToString(), "SalesOrders");
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    SalesOrderDTO dto = new SalesOrderDTO();
                    LoadRowToDto(ref dto, dr, id);
                    dtos.Add(dto);
                }
            }

            return dtos;
        }