示例#1
0
        private void DefaultParametrs(LotEF lot = null, bool refresh = false)
        {
            if (!refresh)
            {
                UnitList = DataBaseClient.ReadUnits();
            }

            if (lot == null)
            {
                Lot               = new LotEF();
                Lot.auctionid     = _auctionId;
                Lot.number        = DataBaseClient.ReadAuction(_auctionId).siteid == 4 ? "0G" : "";
                Lot.deliveryplace = "Согласно договору";
                Lot.deliverytime  = "Согласно договору";
                Lot.paymentterm   = "Согласно договору";
                Lot.step          = 1;
                Lot.warranty      = 0.1;
                SelectedUnit      = UnitList[0];
            }
            else
            {
                try {
                    SelectedUnit = UnitList.FirstOrDefault(x => x.id == lot.unitid);
                } catch (Exception) {
                    SelectedUnit = UnitList[0];
                }

                Quantity = Lot.amount;
                Price    = Lot.price;
                Sum      = Lot.sum;
                Lot      = Lot;
            }
        }
        public static void CreateReports(Order orderInfo)
        {
            order = orderInfo;

            reportFileNames = ArchiveTransport.PutUTBReports(orderInfo);

            FillTemplate();

            // Put file to base
            var fileListId = DataBaseClient.ReadAuction(order.Auction.Id);

            if (fileListId != null)
            {
                DocumentRequisite docReq = new DocumentRequisite()
                {
                    date     = order.Auction.Date,
                    fileName = reportFileNames[0].Substring(reportFileNames[0].LastIndexOf("\\")),
                    market   = AltaBO.specifics.MarketPlaceEnum.UTB,
                    number   = order.Auction.Number,
                    section  = AltaBO.specifics.DocumentSectionEnum.Auction,
                    type     = AltaBO.specifics.DocumentTypeEnum.CustomerReport
                };

                // Customer file
                // Check for exist
                if (DataBaseClient.ReadDocument((int)fileListId.fileslistid, (int)AltaBO.specifics.DocumentTypeEnum.CustomerReport) == null)
                {
                    archiveManager.SaveFile(docReq, (int)fileListId.fileslistid);

                    docReq.fileName = reportFileNames[1].Substring(reportFileNames[1].LastIndexOf("\\"));
                }

                // Supplier file
                // Check for exist
                if (DataBaseClient.ReadDocument((int)fileListId.fileslistid, (int)AltaBO.specifics.DocumentTypeEnum.SupplierReport) == null)
                {
                    docReq.type = AltaBO.specifics.DocumentTypeEnum.SupplierReport;

                    archiveManager.SaveFile(docReq, (int)fileListId.fileslistid);
                }
            }
            //
        }