Exemplo n.º 1
0
        public void ReportCloud(string userid, string url1)
        {
            string colortext;
            string Text = userid;

            url1 += "/machine/privateCloudReportHandler.ashx";
            string        url  = @url1;
            List <string> list = new List <string>();

            list.Add("reports");
            list.Add(Text);
            ReportOrder report = new ReportOrder(url);

            report.sendMsgToServer(list, "post");   // report
        }
Exemplo n.º 2
0
        /// <summary>
        /// Print the order
        /// </summary>
        /// <param name="actor"></param>
        /// <param name="item"></param>
        public void UpdatePrintCount(User actor, Order item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            try
            {
                using (XRMSEntities context = new XRMSEntities())
                {
                    _uow = new UnitOfWork(context, new RepositoryProvider(RepositoryFactories.Instance()));

                    Order order = _uow.OrderRepository.GetById(item.Id);
                    if (order.State > OrderState.Printed)
                    {
                        // update order
                        order.PrintCount++;
                    }
                    else
                    {
                        order.State = OrderState.Printed;
                        order.PrintCount++;
                    }
                    _uow.OrderRepository.Update(order);

                    // get order report, useful for writing report
                    ReportOrder report = _uow.ReportOrderRepository.GetByOrderCode(item.Code);

                    // add event report
                    ReportEvent reportEvent1 = new ReportEvent();
                    reportEvent1.ReportCounter = report.ReportCounter;
                    reportEvent1.EventClass    = 0;
                    reportEvent1.EventDate     = _uow.GetDbCurrentDatetime();
                    reportEvent1.Text          = actor.Fullname + " printed order " + item.Code + " for table \"" + item.Table.Name + "\"";

                    reportEvent1 = _uow.ReportEventRepository.Add(reportEvent1);

                    // commit
                    _uow.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(this.GetType().FullName + System.Reflection.MethodBase.GetCurrentMethod().Name + ": " + ex.Message);
            }
        }
Exemplo n.º 3
0
        private void AppendOrder(ReportOrder rOrder)
        {
            if (order != null)
            {
                throw new Exception("Only one order element can exist in the dialog.");
            }

            uint rows = tblFilters.NRows;

            order = rOrder;

            VBox da = new VBox {
                WidthRequest = 4
            };

            tblFilters.Attach(rOrder.LabelWidget, 0, 1, rows, rows + 1,
                              AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 1);
            tblFilters.Attach(da, 1, 2, rows, rows + 1);
            tblFilters.Attach(rOrder.EntryWidget, 2, 3, rows, rows + 1,
                              AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 1);
        }
Exemplo n.º 4
0
        public List <ReportOrderItemEdition> GetEdititonReportOfOrder(Order order)
        {
            List <ReportOrderItemEdition> list = null;

            try
            {
                if (order == null)
                {
                    throw new ArgumentNullException("order");
                }

                using (XRMSEntities context = new XRMSEntities())
                {
                    _uow = new UnitOfWork(context, new RepositoryProvider(RepositoryFactories.Instance()));
                    // get report of order
                    ReportOrder report = _uow.ReportOrderRepository.GetByOrderCode(order.Code);

                    // get edition report of order base on report counter
                    list = _uow.ReportOrderItemEditionRepository.GetBy(o => o.ReportCounter == report.ReportCounter).ToList();
                    if (list != null)
                    {
                        foreach (ReportOrderItemEdition item in list)
                        {
                            item.OrderEdition = _uow.ReportOrderEditionRepository
                                                .GetBy(o => o.ReportCounter == item.ReportCounter && o.EditionCounter == item.EditionCounter)
                                                .FirstOrDefault();;
                            item.MarkOld();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(this.GetType().FullName + System.Reflection.MethodBase.GetCurrentMethod().Name + ": " + ex.Message);
            }
            return(list);
        }
Exemplo n.º 5
0
        private void ReportButton_Click(object sender, RoutedEventArgs e)
        {
            ReportOrder reportOrder = new ReportOrder(db);

            reportOrder.Show();
        }
Exemplo n.º 6
0
        /// <summary>
        /// Cancel the order.
        /// </summary>
        /// <param name="actor"></param>
        /// <param name="item"></param>
        public void CancelOrder(User actor, Order item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            try
            {
                using (XRMSEntities context = new XRMSEntities())
                {
                    _uow = new UnitOfWork(context, new RepositoryProvider(RepositoryFactories.Instance()));

                    Order order = _uow.OrderRepository.GetById(item.Id);
                    // update order
                    order.IsCancelled  = true;
                    order.CancelReason = item.CancelReason;
                    _uow.OrderRepository.Update(order);

                    // set table state to free, and reset order id matched with table
                    Table table = _uow.TableRepository.GetById(order.TableId);
                    table.State = TableState.Free;
                    //table.State = 0;
                    table.CurrentOrderId = 0;
                    _uow.TableRepository.Update(table);

                    // get order report, useful for writing report
                    ReportOrder report = _uow.ReportOrderRepository.GetByOrderCode(item.Code);
                    report.TableCode        = item.Table.Code;
                    report.TableName        = item.Table.Name;
                    report.State            = order.State;
                    report.OrderDatetime    = order.OrderDatetime;
                    report.EditDatetime     = order.EditDatetime;
                    report.BillDatetime     = order.BillDatetime;
                    report.CheckoutDatetime = order.CheckoutDatetime;
                    report.SubTotalPrice    = order.SubTotalPrice;
                    report.TotalPrice       = order.TotalPrice;
                    report.ServiceCharge    = order.ServiceCharge;
                    report.VatEnable        = order.VatEnable;
                    report.VatPrice         = order.VatPrice;
                    report.DiscountPercent  = order.DiscountPercent;
                    report.DiscountPrice    = order.DiscountPrice;
                    report.SpecialDiscount  = order.SpecialDiscount;
                    report.Cash             = order.Cash;
                    report.Change           = order.Change;
                    report.PrintCount       = order.PrintCount;
                    report.IsCancelled      = order.IsCancelled;
                    report.CancelReason     = order.CancelReason;
                    _uow.ReportOrderRepository.Update(report);

                    // report order item
                    foreach (OrderItem orderItem in item.OrderItems)
                    {
                        ReportOrderItem reportOrderItem = new ReportOrderItem();
                        reportOrderItem.ReportCounter             = report.ReportCounter;
                        reportOrderItem.Sequence                  = orderItem.Sequence;
                        reportOrderItem.ProductCode               = orderItem.ProductInfo.Code;
                        reportOrderItem.ProductName               = orderItem.ProductInfo.Name;
                        reportOrderItem.ProductGroup              = _uow.ProductGroupRepository.GetById(orderItem.ProductInfo.GroupId).Name;
                        reportOrderItem.UnitName                  = _uow.UnitRepository.GetById(orderItem.ProductInfo.UnitId).Name;
                        reportOrderItem.UnitPrice                 = orderItem.ProductInfo.Price;
                        reportOrderItem.Quantity                  = orderItem.Quantity;
                        reportOrderItem.State                     = orderItem.State;
                        reportOrderItem.CreateDatetime            = orderItem.CreateDatetime;
                        reportOrderItem.StartDatetime             = orderItem.StartDatetime;
                        reportOrderItem.StopDatetime              = orderItem.StopDatetime;
                        reportOrderItem.ServeDatetime             = orderItem.ServeDatetime;
                        reportOrderItem.IsCancelled               = orderItem.IsCancelled;
                        reportOrderItem.IsKitchenProcessCompleted = orderItem.IsKitchenProcessCompleted;

                        _uow.ReportOrderItemRepository.Add(reportOrderItem);
                    }


                    // add event report
                    ReportEvent reportEvent1 = new ReportEvent();
                    reportEvent1.ReportCounter = report.ReportCounter;
                    reportEvent1.EventClass    = 0;
                    reportEvent1.EventDate     = _uow.GetDbCurrentDatetime();
                    reportEvent1.Text          = actor.Fullname + " cancelled order " + item.Code + " for table \"" + item.Table.Name + "\"";

                    reportEvent1 = _uow.ReportEventRepository.Add(reportEvent1);

                    // delete real time order
                    _uow.OrderRepository.Remove(order);

                    // commit
                    _uow.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(this.GetType().FullName + System.Reflection.MethodBase.GetCurrentMethod().Name + ": " + ex.Message);
            }
        }
Exemplo n.º 7
0
        public override bool Create(Order item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            bool result = false;

            try
            {
                using (XRMSEntities context = new XRMSEntities())
                {
                    _uow = new UnitOfWork(context, new RepositoryProvider(RepositoryFactories.Instance()));

                    // add order
                    // get latest order code definition
                    XRMS.Data.EntityFramework.CodeDefinitionEntity code = (_uow.GetDbContext() as XRMS.Data.EntityFramework.XRMSEntities).CodeDefinitionEntities.Where(o => o.Type == "ORDER").FirstOrDefault();

                    // set order data
                    item.Code = code.Prefix + (code.LastIndex + 1).ToString().PadLeft(7, '0');
                    // temporarily set id of user is 1
                    //item.CreatorId = 1;
                    // set order time
                    item.OrderDatetime = _uow.GetDbCurrentDatetime();
                    Order resultItem = _uow.OrderRepository.Add(item);
                    resultItem.CreatorUser = _uow.UserRepository.GetById(item.CreatorId);

                    // add order report
                    ReportOrder report = new ReportOrder();
                    report.Code        = resultItem.Code;
                    report.CreatorName = resultItem.CreatorUser.Fullname;
                    report             = _uow.ReportOrderRepository.Add(report);

                    // add order edition history
                    ReportOrderEdition orderEdition = new ReportOrderEdition();
                    orderEdition.ReportCounter = report.ReportCounter;
                    orderEdition.EditionUser   = resultItem.CreatorUser.Fullname;
                    orderEdition.EditionDate   = resultItem.OrderDatetime;
                    orderEdition = _uow.ReportOrderEditionRepository.Add(orderEdition);

                    foreach (OrderItem orderItem in item.OrderItems)
                    {
                        // assign order id and sequence
                        orderItem.OrderId        = item.Id;
                        orderItem.CreateDatetime = _uow.GetDbCurrentDatetime();
                        _uow.OrderItemRepository.Add(orderItem);

                        // add order item edition history
                        ReportOrderItemEdition itemEdition = new ReportOrderItemEdition();
                        itemEdition.ReportCounter   = orderEdition.ReportCounter;
                        itemEdition.EditionCounter  = orderEdition.EditionCounter;
                        itemEdition.Sequence        = orderItem.Sequence;
                        itemEdition.ProductCode     = orderItem.ProductInfo.Code;
                        itemEdition.ProductName     = orderItem.ProductInfo.Name;
                        itemEdition.EditionType     = 0;
                        itemEdition.EdittedQuantity = orderItem.EdittedQuantity;

                        itemEdition = _uow.ReportOrderItemEditionRepository.Add(itemEdition);
                    }

                    // create order report and order item report
                    // ...

                    // update last index
                    code.LastIndex++;
                    (_uow.GetDbContext() as XRMS.Data.EntityFramework.XRMSEntities).Set <CodeDefinitionEntity>().AddOrUpdate(code);

                    // set table state to busy, and order id matched with table
                    Table table = _uow.TableRepository.GetById(item.TableId);
                    table.State = TableState.Busy;
                    //table.State = 1;
                    table.CurrentOrderId = item.Id;
                    _uow.TableRepository.Update(table);

                    // add event report
                    ReportEvent reportEvent = new ReportEvent();
                    reportEvent.ReportCounter = report.ReportCounter;
                    reportEvent.EventClass    = 0;
                    reportEvent.EventDate     = _uow.GetDbCurrentDatetime();
                    reportEvent.Text          = resultItem.CreatorUser.Fullname + " created order " + resultItem.Code + " for table \"" + table.Name + "\"";

                    reportEvent = _uow.ReportEventRepository.Add(reportEvent);

                    // commit
                    _uow.SaveChanges();
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(this.GetType().FullName + System.Reflection.MethodBase.GetCurrentMethod().Name + ": " + ex.Message);
            }
            return(result);
        }
Exemplo n.º 8
0
        public void CheckOutOrder(User actor, Order item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            try
            {
                using (XRMSEntities context = new XRMSEntities())
                {
                    _uow = new UnitOfWork(context, new RepositoryProvider(RepositoryFactories.Instance()));

                    Order order = _uow.OrderRepository.GetById(item.Id);
                    // update order
                    order.State            = OrderState.Finished;
                    order.CheckoutDatetime = _uow.GetDbCurrentDatetime();
                    _uow.OrderRepository.Update(order);

                    // set table state to free, and reset order id matched with table
                    Table table = _uow.TableRepository.GetById(order.TableId);
                    table.State = TableState.Free;
                    //table.State = 0;
                    table.CurrentOrderId = 0;
                    _uow.TableRepository.Update(table);

                    // get order report, useful for writing report
                    ReportOrder report = _uow.ReportOrderRepository.GetByOrderCode(item.Code);
                    report.TableCode        = item.Table.Code;
                    report.TableName        = item.Table.Name;
                    report.State            = order.State;
                    report.OrderDatetime    = order.OrderDatetime;
                    report.EditDatetime     = order.EditDatetime;
                    report.BillDatetime     = order.BillDatetime;
                    report.CheckoutDatetime = order.CheckoutDatetime;
                    report.SubTotalPrice    = order.SubTotalPrice;
                    report.TotalPrice       = order.TotalPrice;
                    report.ServiceCharge    = order.ServiceCharge;
                    report.VatEnable        = order.VatEnable;
                    report.VatPrice         = order.VatPrice;
                    report.DiscountPercent  = order.DiscountPercent;
                    report.DiscountPrice    = order.DiscountPrice;
                    report.SpecialDiscount  = order.SpecialDiscount;
                    report.Cash             = order.Cash;
                    report.Change           = order.Change;
                    report.PrintCount       = order.PrintCount;
                    report.IsCancelled      = order.IsCancelled;
                    report.CancelReason     = order.CancelReason;
                    _uow.ReportOrderRepository.Update(report);

                    // report order item
                    foreach (OrderItem orderItem in item.OrderItems)
                    {
                        ReportOrderItem reportOrderItem = new ReportOrderItem();
                        reportOrderItem.ReportCounter             = report.ReportCounter;
                        reportOrderItem.Sequence                  = orderItem.Sequence;
                        reportOrderItem.ProductCode               = orderItem.ProductInfo.Code;
                        reportOrderItem.ProductName               = orderItem.ProductInfo.Name;
                        reportOrderItem.ProductGroup              = _uow.ProductGroupRepository.GetById(orderItem.ProductInfo.GroupId).Name;
                        reportOrderItem.UnitName                  = _uow.UnitRepository.GetById(orderItem.ProductInfo.UnitId).Name;
                        reportOrderItem.UnitPrice                 = orderItem.ProductInfo.Price;
                        reportOrderItem.Quantity                  = orderItem.Quantity;
                        reportOrderItem.State                     = orderItem.State;
                        reportOrderItem.CreateDatetime            = orderItem.CreateDatetime;
                        reportOrderItem.StartDatetime             = orderItem.StartDatetime;
                        reportOrderItem.StopDatetime              = orderItem.StopDatetime;
                        reportOrderItem.ServeDatetime             = orderItem.ServeDatetime;
                        reportOrderItem.IsCancelled               = orderItem.IsCancelled;
                        reportOrderItem.IsKitchenProcessCompleted = orderItem.IsKitchenProcessCompleted;

                        _uow.ReportOrderItemRepository.Add(reportOrderItem);
                    }

                    // report material
                    List <Material> usedMaterials = new List <Material>();
                    foreach (OrderItem orderItem in item.OrderItems.Where(o => o.IsCancelled != true))
                    {
                        List <RecipeItem> recipeItems = _uow.RecipeItemRepository.GetBy(o => o.ProductId == orderItem.ProductInfo.Id).ToList();
                        foreach (RecipeItem recipeItem in recipeItems)
                        {
                            Material searchMaterial = usedMaterials.Where(o => o.Id == recipeItem.MaterialId).FirstOrDefault();
                            if (searchMaterial == null)
                            {
                                searchMaterial = _uow.MaterialRepository.GetById(recipeItem.MaterialId);
                                usedMaterials.Add(searchMaterial);
                            }
                            //Material searchMaterial = _uow.MaterialRepository.GetById(recipeItem.MaterialId);
                            ReportMaterial reportMaterial = new ReportMaterial();
                            reportMaterial.ReportCounter     = report.ReportCounter;
                            reportMaterial.OrderItemSequence = orderItem.Sequence;
                            reportMaterial.MaterialCode      = searchMaterial.Code;
                            reportMaterial.MaterialName      = searchMaterial.Name;
                            reportMaterial.UnitName          = "Test";
                            reportMaterial.Amount            = orderItem.Quantity * recipeItem.UsedAmount;
                            _uow.ReportMaterialRepository.Add(reportMaterial);

                            // update material amount in storage
                            searchMaterial.UsageAmount += reportMaterial.Amount;
                            //_uow.MaterialRepository.Update(searchMaterial);
                        }
                    }

                    // update material amount in storage
                    foreach (Material material in usedMaterials)
                    {
                        _uow.MaterialRepository.Update(material);
                    }


                    // add event report
                    ReportEvent reportEvent1 = new ReportEvent();
                    reportEvent1.ReportCounter = report.ReportCounter;
                    reportEvent1.EventClass    = 0;
                    reportEvent1.EventDate     = _uow.GetDbCurrentDatetime();
                    reportEvent1.Text          = actor.Fullname + " checked out order " + item.Code + " for table \"" + item.Table.Name + "\"";

                    reportEvent1 = _uow.ReportEventRepository.Add(reportEvent1);

                    // delete real time order
                    _uow.OrderRepository.Remove(order);

                    // commit
                    _uow.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(this.GetType().FullName + System.Reflection.MethodBase.GetCurrentMethod().Name + ": " + ex.Message);
            }
        }
Exemplo n.º 9
0
        public override bool Update(Order item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            bool result = false;

            try
            {
                using (XRMSEntities context = new XRMSEntities())
                {
                    _uow = new UnitOfWork(context, new RepositoryProvider(RepositoryFactories.Instance()));
                    // get order report, useful for writing report
                    ReportOrder report = _uow.ReportOrderRepository.GetByOrderCode(item.Code);
                    item.Table = _uow.TableRepository.GetById(item.TableId);

                    Order order = _uow.OrderRepository.GetById(item.Id);


                    // change table
                    if (order.TableId != item.TableId)
                    {
                        // assign order to new table and free old table
                        // set table state to busy, and order id matched with table
                        Table oldTable = _uow.TableRepository.GetById(order.TableId);
                        oldTable.State = TableState.Free;
                        //oldTable.State = 0;
                        oldTable.CurrentOrderId = 0;
                        _uow.TableRepository.Update(oldTable);

                        Table newTable = item.Table;
                        newTable.State = TableState.Busy;
                        //newTable.State = 1;
                        newTable.CurrentOrderId = item.Id;
                        _uow.TableRepository.Update(newTable);

                        // add event report
                        ReportEvent reportEvent = new ReportEvent();
                        reportEvent.ReportCounter = report.ReportCounter;
                        reportEvent.EventClass    = 0;
                        reportEvent.EventDate     = _uow.GetDbCurrentDatetime();
                        //reportEvent.Text = "Test";
                        reportEvent.Text = item.LockKeeper.Fullname + " changed order " + item.Code + " from table \"" + oldTable.Name + "\"" + " to \"" + newTable.Name + "\"";
                        reportEvent      = _uow.ReportEventRepository.Add(reportEvent);
                    }

                    // update order
                    item.EditDatetime = _uow.GetDbCurrentDatetime();
                    _uow.OrderRepository.Update(item);

                    /*item.EditDatetime = _uow.GetDbCurrentDatetime();
                     * _uow.OrderRepository.Update(item);*/

                    // add order edition history
                    ReportOrderEdition orderEdition = new ReportOrderEdition();
                    orderEdition.ReportCounter = report.ReportCounter;
                    orderEdition.EditionUser   = item.CreatorUser.Fullname;
                    orderEdition.EditionDate   = _uow.GetDbCurrentDatetime();
                    orderEdition = _uow.ReportOrderEditionRepository.Add(orderEdition);

                    // process deleted list first
                    foreach (OrderItem orderItem in (List <OrderItem>)(item.OrderItems as IEditableCollection).GetDeletedList())
                    {
                        if (!orderItem.IsNew)
                        {
                            _uow.OrderItemRepository.Remove(orderItem);
                        }
                    }

                    foreach (OrderItem orderItem in item.OrderItems)
                    {
                        if (orderItem.IsDirty)
                        {
                            byte editionType = 0;
                            if (orderItem.IsNew == false)
                            {
                                try
                                {
                                    _uow.OrderItemRepository.Update(orderItem);
                                    if (orderItem.IsCancelled == true)
                                    {
                                        // cancel
                                        editionType = 3;
                                    }
                                    else
                                    {
                                        if (orderItem.EdittedQuantity > 0)
                                        {
                                            // increase
                                            editionType = 1;
                                        }
                                        else
                                        {
                                            // decrease
                                            editionType = 2;
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    throw new Exception(ex.Message + "\nOrderItem: " + orderItem.OrderId.ToString() + " " + orderItem.Sequence.ToString());
                                }
                            }
                            else
                            {
                                // assign order id and sequence
                                orderItem.OrderId        = item.Id;
                                orderItem.CreateDatetime = _uow.GetDbCurrentDatetime();
                                _uow.OrderItemRepository.Add(orderItem);
                            }

                            // add order item edition history
                            ReportOrderItemEdition itemEdition = new ReportOrderItemEdition();
                            itemEdition.ReportCounter   = orderEdition.ReportCounter;
                            itemEdition.EditionCounter  = orderEdition.EditionCounter;
                            itemEdition.Sequence        = orderItem.Sequence;
                            itemEdition.ProductCode     = orderItem.ProductInfo.Code;
                            itemEdition.ProductName     = orderItem.ProductInfo.Name;
                            itemEdition.EditionType     = editionType;
                            itemEdition.EdittedQuantity = orderItem.EdittedQuantity;

                            itemEdition = _uow.ReportOrderItemEditionRepository.Add(itemEdition);
                        }
                    }

                    // error when insert event report 2 times, need one more commit
                    _uow.SaveChanges();

                    // add event report
                    ReportEvent reportEvent1 = new ReportEvent();
                    reportEvent1.ReportCounter = report.ReportCounter;
                    reportEvent1.EventClass    = 0;
                    reportEvent1.EventDate     = _uow.GetDbCurrentDatetime();
                    reportEvent1.Text          = item.LockKeeper.Fullname + " editted order " + item.Code + " for table \"" + item.Table.Name + "\"";

                    reportEvent1 = _uow.ReportEventRepository.Add(reportEvent1);

                    // commit
                    _uow.SaveChanges();
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(this.GetType().FullName + System.Reflection.MethodBase.GetCurrentMethod().Name + ": " + ex.Message);
            }
            return(result);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 获取一个订单的完全信息
        /// </summary>
        /// <param name="orderId">订单ID</param>
        /// <param name="viewOriginal">查看原始订购信息</param>
        /// <returns></returns>
        public Common.Entity.ReportOrder GetOrderFullInfo(int orderId, bool viewOriginal)
        {
            Common.Entity.ReportOrder ordersInfo = new ReportOrder();
            // 订单基本信息
            BLL.Order           bll   = new Order();
            Common.Entity.Order oInfo = bll.GetOrderByPKID(orderId);
            if (oInfo != null)
            {
                ordersInfo.BaseRemark = oInfo.BaseRemark;
                ordersInfo.IsApplyMaxCustomerResources = oInfo.IsApplyMaxCustomerResources == 1 ? "是" : "否";
                ordersInfo.BuyWay             = oInfo.BuyWay;
                ordersInfo.CarUse             = oInfo.CarUse;
                ordersInfo.CreateTime         = oInfo.CreateTime == null ? new DateTime(1990, 1, 1) : (DateTime)oInfo.CreateTime;
                ordersInfo.CustomerName       = oInfo.CustomerName;
                ordersInfo.CustomerSuggestion = oInfo.CustomerSuggestion;

                ordersInfo.DealerName             = oInfo.DealerName;
                ordersInfo.DifferentPlace         = oInfo.DifferentPlace == 1 ? "是" : "否";
                ordersInfo.CustomerID             = oInfo.CustomerID;
                ordersInfo.DealerID               = oInfo.DealerID;
                ordersInfo.PKID                   = oInfo.PKID;
                ordersInfo.Watchmaker             = oInfo.Watchmaker;
                ordersInfo.Code                   = oInfo.Code;
                ordersInfo.ReComment1             = oInfo.ReComment1;
                ordersInfo.ReComment2             = oInfo.ReComment2;
                ordersInfo.ReComment3             = oInfo.ReComment3;
                ordersInfo.RecordName             = oInfo.RecordName;
                ordersInfo.ReDate1                = oInfo.ReDate1;
                ordersInfo.ReDate2                = oInfo.ReDate2;
                ordersInfo.ReDate3                = oInfo.ReDate3;
                ordersInfo.ReRemark1              = oInfo.ReRemark1;
                ordersInfo.ReRemark2              = oInfo.ReRemark2;
                ordersInfo.ReRemark3              = oInfo.ReRemark3;
                ordersInfo.Replyer1               = oInfo.Replyer1;
                ordersInfo.Replyer2               = oInfo.Replyer2;
                ordersInfo.Replyer3               = oInfo.Replyer3;
                ordersInfo.OrderState             = oInfo.OrderState;
                ordersInfo.SubmitType             = oInfo.SubmitType;
                ordersInfo.BearUser               = oInfo.BearUser;
                ordersInfo.FN_Email               = oInfo.Email;
                ordersInfo.OffAddressOnCardReport = oInfo.OffAddressOnCardReport == 1 ? "是" : "否";
                ordersInfo.FN_InvoiceDiffer       = oInfo.InvoiceAndCustomerAtypism == 1 ? "是" : "否";
                ordersInfo.FN_InvoiceName         = oInfo.InvoiceCustomerInfo;
            }

            // 客户基本信息
            BLL.Customer           customer = new Customer();
            Common.Entity.Customer cInfo    = customer.GetCustomerByPKID(ordersInfo.CustomerID);
            if (cInfo != null)
            {
                ordersInfo.CustomerAddress       = cInfo.Address;
                ordersInfo.CustomerChargeDept    = cInfo.CompetentDepartment;
                ordersInfo.CustomerExecutiveDept = cInfo.ExecutiveDepartment;
                ordersInfo.CustomerMainBusiness  = cInfo.MainBusiness;
                ordersInfo.CustomerProfiles      = cInfo.CustomerProfiles;
                ordersInfo.CustomerUseDept       = cInfo.UseDepartment;
                ordersInfo.CustomerZipCode       = cInfo.Zip;
                ordersInfo.Customer_Type         = cInfo.CustomerNatureName;
                ordersInfo.Customer_Type2        = cInfo.CustomerNatureName2;
                ordersInfo.Customer_Memo         = cInfo.Remark;
                ordersInfo.CustomerNo            = cInfo.EnterpriseCode;
            }

            if (oInfo.ToExamineState > 0)
            {
                ordersInfo.CustomerContact = customer.GetListByOrdersID(ordersInfo.PKID);
            }
            else
            {
                ordersInfo.CustomerContact = customer.GetListByCustomerID(ordersInfo.CustomerID);
            }

            if (viewOriginal)
            {
                BLL.CarPurchase cdBll = new CarPurchase();
                ordersInfo.CarPurchase = cdBll.GetOriginalList(ordersInfo.Code.Substring(0, ordersInfo.Code.IndexOf('.')));
            }
            else
            {
                BLL.CarPurchase cdBll = new CarPurchase();
                ordersInfo.CarPurchase = cdBll.GetList(ordersInfo.PKID);
            }

            // 经销店联系人
            BLL.DealerContact dcBLL = new DealerContact();
            if (oInfo.ToExamineState > 0)
            {
                ordersInfo.DealerContact = dcBLL.GetListByOrdersID(ordersInfo.PKID);
            }
            else
            {
                ordersInfo.DealerContact = dcBLL.GetListByDealerID(ordersInfo.DealerID);
            }

            return(ordersInfo);
        }