public List <Product> Get()
        {
            Feeds     = importerService.GetFeeds();
            Companies = importerService.GetCompanies();

            //return Ok();
            foreach (Company company in Companies)
            {
                int companyCount = 0;

                foreach (Feed feed in Feeds)
                {
                    companyCount++;
                    if (company.Id.ToString().Substring(0, 1) == feed.Id.ToString().Substring(0, 1))
                    {
                        //Get Product for Company Feed
                        foreach (Product product in ProdService.GetProducts(company, feed))
                        {
                            Products.Add(product);
                        }
                    }
                }
            }

            //The data importer should import Product Feed data in the CSV file form and
            //persist them to the Product table in the database.



            using (var ctx = new DataImporter.Api.Models.DataImporterContext())
            {
                foreach (Product product in Products)
                {
                    ctx.Products.Add(product);
                }

                try
                {
                    //comment out to save
                    //ctx.SaveChanges();
                }
                catch (System.Exception ex)
                {
                    string ErrorMessage = ex.Message;
                }
            }


            return(Products);
        }
        public static DateTime GetCurrentDateTime()
        {
            DateTime currentDT;

            try
            {
                currentDT = ProdService.GetServerDateTime();
            }
            catch
            {
                try
                {
                    currentDT = ProdServiceDev.GetServerDateTime();
                }

                catch
                {
                    currentDT = DateTime.Now;
                }
            }

            return(currentDT);
        }
        public static bool AddCommandsTransaction(Byte[] fileBinaryArray)
        {
            bool result = false;

            try
            {
                ProdService.AddCommandsTransaction(fileBinaryArray);
                result = true;
            }
            catch
            {
                try
                {
                    ProdServiceDev.AddCommandsTransaction(fileBinaryArray);
                    result = true;
                }
                catch
                {
                    result = false;
                }
            }

            return(result);
        }
Esempio n. 4
0
 public ValuesController(ProdService pp)
 {
     this.pp = pp;
 }