private void executeFittingsCommand()
 {
     if (IsEnableButton == false && _corpus != null)
     {
         Fittings?.Invoke(this, new EventArgs());
     }
 }
Exemplo n.º 2
0
        public void TryParse()
        {
            //Парсим цену
            var priceCell = XlsRow.GetCell(ColumnsMap[ColumnType.Price]);

            if (priceCell == null)
            {
                Status = RowStatus.Skiped;
                return;
            }
            if (priceCell.CellType == CellType.Numeric)
            {
                Price = (decimal)priceCell.NumericCellValue;
            }
            else if (priceCell.CellType == CellType.String)
            {
                decimal price;
                if (Decimal.TryParse(priceCell.StringCellValue, out price))
                {
                    Price = price;
                }
            }
            else
            {
                Price = null;
            }

            //Парсим диаметр
            var dnCell = XlsRow.GetCell(ColumnsMap[ColumnType.DN]);

            if (dnCell == null)
            {
                Status = RowStatus.Skiped;
                return;
            }

            string dnAsString = null;

            if (dnCell.CellType == CellType.Numeric)
            {
                dnAsString = dnCell.NumericCellValue.ToString();
            }
            else if (dnCell.CellType == CellType.String)
            {
                dnAsString = dnCell.StringCellValue;
            }

            if (!String.IsNullOrWhiteSpace(dnAsString))
            {
                WC.ParseDiameter(dnAsString, this);
            }
            else
            {
                Status = RowStatus.Skiped;
                return;
            }

            if (Diameter == null)
            {
                Status = RowStatus.BadDiameter;
            }

            //Находим номенклатуру.
            if (ColumnsMap.ContainsKey(ColumnType.Model))
            {
                var    modelCell = XlsRow.GetCell(ColumnsMap[ColumnType.Model]);
                string model     = null;
                if (modelCell.CellType == CellType.String)
                {
                    model = modelCell.StringCellValue;
                }
                else if (modelCell.CellType == CellType.Numeric)
                {
                    model = modelCell.NumericCellValue.ToString();
                }

                Code = model;
                if (Diameter == null)
                {
                    return;
                }

                if (!String.IsNullOrWhiteSpace(model))
                {
                    var foundList = Repository.FittingRepository.GetFittings(WC.UoW, model, Diameter);
                    if (foundList.Count > 0)
                    {
                        Status   = RowStatus.OnlyModelFound;
                        Fittings = foundList.ToList();

                        Prices = Repository.PriceRepository.GetLastPrices(WC.UoW, Fittings.ToArray()).ToList();

                        if (Prices.Count == 1)
                        {
                            Status        = RowStatus.AutoNewPrice;
                            SelectedPrice = Prices.First();
                            ChangePrice   = CanChangePrice;
                        }
                        else if (Prices.Count > 1)
                        {
                            Status       = RowStatus.MultiFound;
                            IsMultiFound = true;
                        }
                        return;
                    }
                }
                Status = RowStatus.NotFound;
            }
            else
            {
                Status = RowStatus.Skiped;
            }
        }
Exemplo n.º 3
0
 // ReSharper disable once InconsistentNaming
 private void initializeAPI()
 {
     Alliance = new Alliance(dataSource)
     {
         HTTP = http
     };
     Assets = new Assets(dataSource)
     {
         HTTP = http
     };
     Bookmarks = new Bookmarks(dataSource)
     {
         HTTP = http
     };
     Calendar = new Calendar(dataSource)
     {
         HTTP = http
     };
     Character = new Character(dataSource)
     {
         HTTP = http
     };
     Clones = new Clones(dataSource)
     {
         HTTP = http
     };
     Contacts = new Contacts(dataSource)
     {
         HTTP = http
     };
     Contracts = new Contracts(dataSource)
     {
         HTTP = http
     };
     Corporation = new Corporation(dataSource)
     {
         HTTP = http
     };
     Dogma = new Dogma(dataSource)
     {
         HTTP = http
     };
     FactionWarfare = new FactionWarfare(dataSource)
     {
         HTTP = http
     };
     Fittings = new Fittings(dataSource)
     {
         HTTP = http
     };
     Fleets = new Fleets(dataSource)
     {
         HTTP = http
     };
     Incursion = new Incursions(dataSource)
     {
         HTTP = http
     };
     Industry = new Industry(dataSource)
     {
         HTTP = http
     };
     Insurance = new Insurance(dataSource)
     {
         HTTP = http
     };
     Killmails = new Killmails(dataSource)
     {
         HTTP = http
     };
     Location = new Location(dataSource)
     {
         HTTP = http
     };
     Loyalty = new Loyalty(dataSource)
     {
         HTTP = http
     };
     Mail = new Mail(dataSource)
     {
         HTTP = http
     };
     Market = new Market(dataSource)
     {
         HTTP = http
     };
     Opportunities = new Opportunities(dataSource)
     {
         HTTP = http
     };
     PlanetaryInteraction = new PlanetaryInteraction(dataSource)
     {
         HTTP = http
     };
     Routes = new Routes(dataSource)
     {
         HTTP = http
     };
     Search = new Search(dataSource)
     {
         HTTP = http
     };
     Skills = new Skills(dataSource)
     {
         HTTP = http
     };
     Sovereignty = new Sovereignty(dataSource)
     {
         HTTP = http
     };
     Status = new Status(dataSource)
     {
         HTTP = http
     };
     Universe = new Universe(dataSource)
     {
         HTTP = http
     };
     UserInterface = new UserInterface(dataSource)
     {
         HTTP = http
     };
     Wallet = new Wallet(dataSource)
     {
         HTTP = http
     };
     Wars = new Wars(dataSource)
     {
         HTTP = http
     };
 }