public ForecastResult GetForecastResults(ForecastSearchCriteria searchCriteria)
        {
            int branchId = searchCriteria.BranchId;
            int productId = searchCriteria.ProductId;
            string method = searchCriteria.Method.ForecastIdentifier.ToString();
            string dataType = searchCriteria.DatePeriod.DatePeriod.ToString();
            int periods = searchCriteria.ForecastPeriod;

            //service.Resource = "api/Forecast/ForecastByMethod/1";
            service.Resource = String.Format("api/Forecast/ForecastByMethod/{0}/{1}/{2}/{3}/{4}", branchId, productId, method, dataType, periods);
            var result = service.GetData();
            return result;
        }
 public ForecastResult GetForecastResults(ForecastSearchCriteria searchCriteria)
 {
     return new ForecastServiceFacade().GetForecastResults(searchCriteria);
 }
Exemple #3
0
        public ActionResult Index(ForecastModel model)
        {
            try
            {

                ViewBag.Branches = new SelectList(db.Branches, "BranchID", "BranchName");
                ViewBag.Products = new SelectList(db.Products, "ProductID", "ProductName");
                ViewBag.ForecastMethods = new SelectList(db.Forecast_Methods, "ForecastIdentifier", "ForecastMethod");
                ViewBag.DateTypes = new SelectList(db.Forecast_DatePeriods, "DatePeriod", "DatePeriod");

                ForecastBusinessManger fcastManager = new ForecastBusinessManger();

                ForecastSearchCriteria fcastSearchCriteria = new ForecastSearchCriteria();
                fcastSearchCriteria.BranchId = model.ForecastSearchCriteria.BranchId;
                fcastSearchCriteria.ProductId = model.ForecastSearchCriteria.ProductId;
                fcastSearchCriteria.Method = new Forecast_Methods() { ForecastIdentifier = model.ForecastSearchCriteria.Method.ForecastIdentifier };
                fcastSearchCriteria.DatePeriod = new Forecast_DatePeriods(){DatePeriod = model.ForecastSearchCriteria.DatePeriod.DatePeriod};
                fcastSearchCriteria.ForecastPeriod = model.ForecastSearchCriteria.ForecastPeriod;

                var result = fcastManager.GetForecastResults(fcastSearchCriteria);

                model.ForecastResult = result;

                return View("Index", model);
            }
            catch
            {
                return View();
            }
        }