//public override void ReadStockFromCSV(string FileName = JSON_FILENAME)
        //{
        //    using (var sr = new StreamReader(FileName))
        //    {
        //        var reader = new CsvReader(sr);
        //        reader.Configuration.Delimiter = ",";
        //        IEnumerable<NashStockRecord> records = reader.GetRecords<NashStockRecord>();
        //        this.records = records.ToList();
        //    }
        //}

        public override void ReadStockFromCSV(string fileName = null)
        {
            //todo проверить
            if (fileName == null)
            {
                fileName = FILENAME;
            }

            //string JSON_FILENAME = @"C:\SneakerIcon\CSV\NashStock.csv";
            string[] stockArray = File.ReadAllLines(fileName);
            List <NashStockRecord> stockList = new List <NashStockRecord>();

            for (int i = 1; i < stockArray.Length; i++)
            {
                if (i == 188)
                {
                    bool test = true;
                }
                string[]        stockStringRecords = stockArray[i].Split(',');
                NashStockRecord stockRecord        = new NashStockRecord();
                stockRecord.brand     = stockStringRecords[0].Trim();
                stockRecord.condition = stockStringRecords[1].Trim();
                stockRecord.sku       = stockStringRecords[2].Trim();
                if (!String.IsNullOrWhiteSpace(stockRecord.sku))
                {
                    stockRecord.size  = stockStringRecords[3].Trim();
                    stockRecord.sku2  = stockStringRecords[4].Trim();
                    stockRecord.upc   = stockStringRecords[5].Trim();
                    stockRecord.price = Convert.ToDouble(stockStringRecords[6].Trim());
                    if (!String.IsNullOrWhiteSpace(stockStringRecords[7]))
                    {
                        stockRecord.sellPrice = Convert.ToDouble(stockStringRecords[7].Trim());
                    }
                    stockRecord.quantity = Convert.ToInt32(stockStringRecords[8].Trim());
                    stockRecord.capacity = Convert.ToDouble(stockStringRecords[9].Trim());
                    stockRecord.category = stockStringRecords[10].Trim();
                    stockRecord.title    = stockStringRecords[11].Trim();
                    stockRecord.comment  = stockStringRecords[12].Trim();

                    bool isValidate = stockRecord.Validate();

                    if (isValidate)
                    {
                        stockList.Add(stockRecord);
                    }
                }
            }
            records = stockList;
        }
        public bool Validate()
        {
            NashStockRecord stockRecord = this;

            //brand
            if (String.IsNullOrWhiteSpace(stockRecord.brand))
            {
                Program.Logger.Warn("Empty brand sku:" + stockRecord.sku2);
                return(false);
            }

            //condition
            if (!SneakerSize.ValidateCondition(stockRecord.condition))
            {
                Program.Logger.Warn("Wrong condition sku:" + stockRecord.sku2);
                return(false);
            }

            //sku
            if (String.IsNullOrWhiteSpace(stockRecord.sku))
            {
                Program.Logger.Warn("Empty sku sku:" + stockRecord.sku2);
                return(false);
            }

            //sizeUS
            if (String.IsNullOrWhiteSpace(stockRecord.size))
            {
                Program.Logger.Warn("Empty size sku:" + stockRecord.sku2);
                return(false);
            }

            //sku2
            if (String.IsNullOrWhiteSpace(stockRecord.sku2))
            {
                Program.Logger.Warn("Empty sku2 sku:" + stockRecord.sku2);
                return(false);
            }

            //upc
            string upc = stockRecord.upc;

            if (!String.IsNullOrEmpty(upc))
            {
                if (upc.Count() == 11)
                {
                    if (stockRecord.brand == "Nike" || stockRecord.brand == "Jordan")
                    {
                        stockRecord.upc = "0" + upc;
                    }
                }
            }

            //price
            if (stockRecord.price <= 0)
            {
                return(false);
            }

            //quantity
            if (stockRecord.quantity == 0)
            {
                return(false);
            }

            //categorySneakerFullCatalog
            if (stockRecord.category != "men" && stockRecord.category != "women" && stockRecord.category != "kids")
            {
                Program.Logger.Warn("Wrong category. SKU2:" + stockRecord.sku2);
                return(false);
            }
            if (stockRecord.category == "men")
            {
                stockRecord.category = Settings.CATEGORY_MEN;
            }
            if (stockRecord.category == "women")
            {
                stockRecord.category = Settings.CATEGORY_WOMEN;
            }
            if (stockRecord.category == "kids")
            {
                stockRecord.category = Settings.CATEGORY_KIDS;
            }

            //title
            if (String.IsNullOrWhiteSpace(stockRecord.title))
            {
                Program.Logger.Warn("Empty title SKU2:" + stockRecord.sku2);
                return(false);
            }

            return(true);
            //throw new NotImplementedException();
        }