コード例 #1
0
        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);
        }
コード例 #2
0
        public static DateTime GetCurrentDateTime()
        {
            DateTime currentDT;

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

                catch
                {
                    currentDT = DateTime.Now;
                }
            }

            return(currentDT);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 public ValuesController(ProdService pp)
 {
     this.pp = pp;
 }