Exemple #1
0
        public FileResult GetProtocolFile(string auctionDate, string auctionNumber)
        {
            var protocolFile = DataBaseClient.ReadDocument((int)DataBaseClient.ReadAuctions().FirstOrDefault(a => a.siteid == 5 && a.number == auctionNumber).fileslistid, (int)DocumentTypeEnum.Protocol);

            if (protocolFile != null)
            {
                var filePath = @"Y:\Auctions\KazETS\" + auctionDate + "\\" + auctionNumber.Replace("/", "_") + "\\";

                string[] files = Directory.GetFiles(filePath, protocolFile.name + "." + protocolFile.extension);
                if (files.Length > 0)
                {
                    filePath = files[0];

                    if (System.IO.File.Exists(filePath))
                    {
                        LogService.LogInfo("Report file for auction date " + auctionDate + " with № " + auctionNumber + " successfuly downloaded");
                        return(File(filePath, System.Net.Mime.MediaTypeNames.Application.Octet, "Протокол по аукциону №" + auctionNumber.Replace("/", "_") + "." + protocolFile.extension));
                    }
                    else
                    {
                        LogService.LogInfo("Report file loading error");
                        return(null);
                    }
                }
            }

            return(null);
        }
        private void UpdateAuctionsList(DateTime fromDate, DateTime toDate, int site, int statusId, int traderId, string searchText = null)
        {
            AppJournal.Write("Auctions List", "Update get auctions and check new orders from base", true);

            try {
                if (string.IsNullOrEmpty(searchText))
                {
                    AuctionsList = DataBaseClient.ReadAuctions(fromDate.AddDays(-1), toDate, site, statusId, traderId);
                }
                else
                {
                    AuctionsList = DataBaseClient.ReadAuctions(fromDate.AddDays(-1), toDate, site, statusId, traderId, searchText);
                }
            } catch (Exception ex) { AppJournal.Write("Auctions List", "Get auctions list from base error: " + ex.ToString(), true); }

            try {
                NewOrders = DataBaseClient.GetOrders(site, 1);
            } catch (Exception ex) { AppJournal.Write("Orders List", "Get new orders list from error: " + ex.ToString(), true); }

            if (NewOrders.Count > 0)
            {
                NewOrdersVis = System.Windows.Visibility.Visible;
            }
            else
            {
                NewOrdersVis = System.Windows.Visibility.Collapsed;
            }
        }
Exemple #3
0
        public ActionResult AuctionsList()
        {
            try {
                /*ordersList = DataBaseClient.GetKarazhiraAuctions(1);
                 * ordersList.AddRange(DataBaseClient.GetKarazhiraAuctions(4));*/

                // Some new realisation
                var auctionsList = DataBaseClient.ReadAuctions();

                if (auctionsList != null)
                {
                    ordersList = new List <Order>();

                    foreach (var item in auctionsList.Where(a => a.siteid == 5 && a.statusid == 4 && a.customerid == 2))
                    {
                        Order order = new Order();
                        order.Auction = new Auction()
                        {
                            Id     = item.id,
                            Date   = item.date,
                            Number = item.number,
                            Status = item.status.name
                        };

                        order.Date = item.regulation.opendate;

                        var lot = DataBaseClient.ReadLots(item.id);
                        order.Auction.Lots = new ObservableCollection <Lot>();

                        order.Auction.Lots.Add(new Lot()
                        {
                            Name = lot != null ? lot[0].description : "",
                            Sum  = lot != null ? lot[0].sum : 0
                        });

                        ordersList.Add(order);
                    }
                }
                //

                LogService.LogInfo("AuctionList page opened");
            } catch (Exception ex) {
                LogService.LogInfo("AuctionList page opened with error: " + ex);
                return(null);
            }

            return(View(ordersList));
        }
Exemple #4
0
        public ActionResult EndedAuctionsList()
        {
            try {
                /*ordersList = DataBaseClient.GetKarazhiraAuctions(2);
                 * ordersList.AddRange(DataBaseClient.GetKarazhiraAuctions(3));*/

                // Some new realisation
                var auctionsList = DataBaseClient.ReadAuctions();

                if (auctionsList != null)
                {
                    ordersList = new List <Order>();

                    foreach (var item in auctionsList.Where(a => a.siteid == 5 && a.statusid == 2 && a.customerid == 2))
                    {
                        Order order = new Order();
                        order.Auction = new Auction()
                        {
                            Id     = item.id,
                            Date   = item.date,
                            Number = item.number,
                            Status = item.status.name
                        };

                        order.Date = item.regulation.opendate;

                        var lot = DataBaseClient.ReadLots(item.id);
                        order.Auction.Lots = new ObservableCollection <Lot>();

                        order.Auction.Lots.Add(new Lot()
                        {
                            Name = (lot != null && lot.Count > 0) ? lot[0].description : "",
                            Sum  = (lot != null && lot.Count > 0) ? lot[0].sum : 0
                        });

                        var procuratory = DataBaseClient.ReadProcuratories(item.id);

                        order.Auction.Procuratories = new ObservableCollection <Procuratory>();

                        decimal minimalPrice = 0;
                        string  supplierName = "";

                        try {
                            minimalPrice = (procuratory != null && procuratory.Count > 0) ? procuratory.FirstOrDefault(p => p.supplierid != 3).minimalprice : 0;
                            supplierName = (procuratory != null && procuratory.Count > 0) ? procuratory.FirstOrDefault(p => p.supplierid != 3).supplier.company.name : "Нет данных";
                        } catch (Exception) {
                            minimalPrice = 0;
                            supplierName = "";
                        }

                        order.Auction.Procuratories.Add(new Procuratory()
                        {
                            MinimalPrice = minimalPrice,
                            SupplierName = supplierName.Replace("Товарищество с ограниченной ответственностью", "ТОО").Replace("Индивидуальный предприниматель", "ИП")
                        });

                        ordersList.Add(order);
                    }
                }
                //

                LogService.LogInfo("EndedAuctionList page opened");
            } catch (Exception ex) {
                LogService.LogInfo("EndedAuctionList page opened with error: " + ex);
                return(null);
            }

            return(View(ordersList));
        }
 public void UpdateAuctionsList()
 {
     AuctionsList = DataBaseClient.ReadAuctions();
     CheckForEllapsedAuctions();
 }