Ejemplo n.º 1
0
        public ActionResult q4_1(int setID, int eventID, int daysBefore, int daysAfter)
        {
            Q4_1_Model model = new Q4_1_Model();

            model.SetID   = setID;
            model.EventID = eventID;

            using (ArgaamAnalyticsDataContext aadc = new ArgaamAnalyticsDataContext())
            {
                var eventDate = (from p in aadc.Events
                                 where p.EventID == eventID
                                 select new
                {
                    StartDate = p.StartsOn,
                    EndDate = p.EndsOn
                }).FirstOrDefault();

                model.IsRangeEvent = eventDate.EndDate.HasValue ? true : false;

                model.Result = FintechService.GetAllStockEntityPricesAroundDates(setID, null, eventDate.StartDate, eventDate.EndDate.HasValue ? eventDate.EndDate : null, daysBefore, daysAfter);

                model.DaysBefore = daysBefore;
                model.DaysAfter  = daysAfter;
            }

            return(View("q4_1", model));
        }
Ejemplo n.º 2
0
        public ActionResult q4(int setID, int seID, int eventID, int daysBefore, int daysAfter, bool isPartial = false)
        {
            List <TableRowViewModel> model     = null;
            Q4_ViewModel             newResult = null;

            using (ArgaamAnalyticsDataContext aadc = new ArgaamAnalyticsDataContext())
            {
                var eventDate = (from p in aadc.Events
                                 where p.EventID == eventID
                                 select new
                {
                    StartDate = p.StartsOn,
                    EndDate = p.EndsOn
                }).FirstOrDefault();
                try
                {
                    //model = FintechService.GetStockEntityPricesAroundDates_UI(setID, seID, eventDate.StartDate, eventDate.EndDate.HasValue ? eventDate.EndDate : null, daysBefore, daysAfter);
                    newResult = FintechService.GetStockEntityPricesAroundDates(setID, seID, eventDate.StartDate, eventDate.EndDate, daysBefore, daysAfter);
                }
                catch (Exception ex)
                {
                }
            }

            ViewBag.isPartial = isPartial;

            if (isPartial)
            {
                return(PartialView("q4_pivoted", newResult));
            }
            else
            {
                return(View("q4_pivoted", newResult));
            }
        }
Ejemplo n.º 3
0
        // Months in which a Stock entity was up or down in a date range
        public ActionResult q3(int setID, int seID, int from_year, int to_year, bool isPartial)
        {
            ViewData["RESULT"] = FintechService.StockEntityWasUpOrDownMonths(setID, seID, from_year, to_year);
            ViewData["SE"]     = FintechService.GetStockEntity(setID, seID);

            ViewBag.isPartial = isPartial;

            return(PartialView());
        }
Ejemplo n.º 4
0
        public ActionResult q4_2(int seID, int companyEventType, int daysBefore, int daysAfter)
        {
            DataTable result;

            using (ArgaamAnalyticsDataContext aadc = new ArgaamAnalyticsDataContext())
            {
                result = FintechService.GetPricesChangeBasedOnCompanyEvent(seID, companyEventType, daysBefore, daysAfter);
            }

            return(PartialView("q4_2", result));
        }
Ejemplo n.º 5
0
        // Which companies were up more than n percent in selected date range
        public ActionResult q5(int setID, int from_year, int to_year, decimal percent)
        {
            ViewBag.result = FintechService.StockEntityTypesWhichWereUpMoreThanEnnPercentOfTheTime(setID, from_year, to_year, percent);

            ViewBag.percent  = percent;
            ViewBag.fromYear = from_year;
            ViewBag.toYear   = to_year;
            ViewBag.setID    = setID;

            using (ArgaamAnalyticsDataContext aadc = new ArgaamAnalyticsDataContext())
            {
                ViewData["SELECTED_SET"] = (from p in aadc.StockEntityTypes where p.StockEntityTypeID == setID select p).First();
            }

            return(PartialView());
        }
Ejemplo n.º 6
0
        // On what dates was the Stock of an entity up and or down by 'n' percent in a Date Range
        public ActionResult q1(int setID /* StockEntityTypeID */, int seID /* StockEntityID */, string upOrDown, decimal percent, int fromYear, int toYear)
        {
            var result = FintechService.StockEntityWasUpOrDownByPercent(setID, seID, upOrDown, percent, fromYear, toYear);

            ViewBag.result = result;

            ViewBag.years = (from p in result
                             group p by p.year into g
                             select new KeyAndCount
            {
                Key = g.Key.ToString(),
                Count = g.Count()
            }).ToList();

            return(PartialView());
        }
Ejemplo n.º 7
0
        public ActionResult AddEvent()
        {
            using (ArgaamAnalyticsDataContext aadc = new ArgaamAnalyticsDataContext())
            {
                var eventCatSLI = EventsService.GetAllParentEventCategories().AsEnumerable().Select((item, index) => new SelectListItem()
                {
                    Value = item.EventCategoryID.ToString(), Text = item.EventCategoryName
                }).ToList();
                ViewData["parentEventCategories_SL"] = new SelectList(eventCatSLI, "Value", "Text");
                ViewData["companies_SL"]             = new SelectList(FintechService.GetStockEntities(1).AsEnumerable().Select((item, index) => new SelectListItem()
                {
                    Value = item.StockEntityID.ToString(), Text = item.NameEn
                }), "Value", "Text");
            }

            return(View());
        }