/// <summary> /// This will take the dateParameters and return a list of all the GroupDataTypes with the year data /// </summary> /// <param name="list"></param> /// <param name="minDate"></param> /// <param name="maxDate"></param> /// <returns></returns> public DashBoardSingle GetFinalData(DateParameter dateParam, DateTime dateOfTrx, string showDataBelongingTo, string groupBy, string name) { //DashBoardSingle dbs = new DashBoardSingle(); PageViewData pvd = new PageViewData(); pvd.Heading = dateParam.Heading; //this gets the data filtered by the date List <PageView> lstWithinDate = filterForBeginEndDate(dateParam); lstWithinDate = fix_RawData(dateOfTrx, groupBy, name, lstWithinDate); //string dataType = GroupByConstants.MAIN; //now insert all the data in pvd.AllData var dbs = pvd.InitializePageViews(lstWithinDate, dateParam, groupBy, showDataBelongingTo); long noOfPageViews = lstWithinDate.Count(); //if name has been passed... trim the overall data noOfPageViews = trimDataForNameAndBelongingTo(showDataBelongingTo, name, dbs, noOfPageViews); var dbsFixed = pvd.Controller_FixKey(dbs, groupBy); var dbsGrouped = pvd.Controller_SQL(dbsFixed, groupBy); var dbsGroupedFixed = pvd.FixDateInGroupAndChild(dbsGrouped, groupBy); dbs.Amount = noOfPageViews; dbs.TotalAmount = noOfPageViews; return(dbsGroupedFixed); }
public async Task <ActionResult> Display(string surveySlug, SurveyAnswer contentModel) { var surveyAnswer = await this.CallGetSurveyAndCreateSurveyAnswerAsync(surveySlug); if (surveyAnswer.QuestionAnswers.Count != contentModel.QuestionAnswers.Count) { throw new ArgumentException("The survey answers received have different amount of questions than the survey to be filled."); } for (int i = 0; i < surveyAnswer.QuestionAnswers.Count; i++) { surveyAnswer.QuestionAnswers[i].Answer = contentModel.QuestionAnswers[i].Answer; } if (!this.ModelState.IsValid) { var model = new PageViewData <SurveyAnswer>(surveyAnswer); model.Title = surveyAnswer.Title; return(this.View(model)); } await this.surveyResponseService.SaveSurveyResponseAsync(surveyAnswer.ToSurveyAnswer()); return(this.RedirectToAction("ThankYou")); }
/// <summary> /// Initializes a new instance of the <see cref="PageViewTelemetry"/> class by cloning an existing instance. /// </summary> /// <param name="source">Source instance of <see cref="PageViewTelemetry"/> to clone from.</param> private PageViewTelemetry(PageViewTelemetry source) { this.Data = source.Data.DeepClone(); this.context = source.context.DeepClone(this.Data.properties); this.extension = source.extension?.DeepClone(); this.Timestamp = source.Timestamp; }
/// <summary> /// Initializes a new instance of the <see cref="PageViewTelemetry"/> class by cloning an existing instance. /// </summary> /// <param name="source">Source instance of <see cref="PageViewTelemetry"/> to clone from.</param> private PageViewTelemetry(PageViewTelemetry source) { this.Data = source.Data.DeepClone(); this.context = source.context.DeepClone(this.Data.properties); this.extension = source.extension?.DeepClone(); this.Timestamp = source.Timestamp; this.samplingPercentage = source.samplingPercentage; this.IsSampledOutAtHead = source.IsSampledOutAtHead; }
/// <summary> /// Initializes a new instance of the <see cref="PageViewTelemetry"/> class by cloning an existing instance. /// </summary> /// <param name="source">Source instance of <see cref="PageViewTelemetry"/> to clone from.</param> private PageViewTelemetry(PageViewTelemetry source) { this.Data = source.Data.DeepClone(); this.context = source.context.DeepClone(this.Data.properties); this.extension = source.extension?.DeepClone(); this.Timestamp = source.Timestamp; this.samplingPercentage = source.samplingPercentage; this.ProactiveSamplingDecision = source.ProactiveSamplingDecision; }
public async Task <ActionResult> Index() { var recentSurveys = await this.surveyManagementService.GetLatestSurveysAsync(); var model = new PageViewData <IEnumerable <Survey> >(recentSurveys.Select(s => s.ToSurvey()).ToList()); model.Title = "Existing surveys"; return(this.View(model)); }
public async Task <ActionResult> Display(string surveySlug) { var surveyAnswer = await this.CallGetSurveyAndCreateSurveyAnswerAsync(surveySlug); var model = new PageViewData <SurveyAnswer>(surveyAnswer); model.Title = surveyAnswer.Title; return(this.View(model)); }
/// <summary> /// Create handler for page view telemetry. /// </summary> private Action <ITelemetry> CreateHandlerForPageViewTelemetry(EventSource eventSource, MethodInfo writeGenericMethod, Type eventSourceOptionsType, PropertyInfo eventSourceOptionsKeywordsProperty) { var eventSourceOptions = Activator.CreateInstance(eventSourceOptionsType); var keywords = Keywords.PageViews; eventSourceOptionsKeywordsProperty.SetValue(eventSourceOptions, keywords); var dummyPageViewData = new PageViewData(); var writeMethod = writeGenericMethod.MakeGenericMethod(new { PartA_iKey = this.dummyPartAiKeyValue, PartA_Tags = this.dummyPartATagsValue, PartB_PageViewData = new { // The properties and layout should be the same as PageViewData_types.cs (EventData_types.cs) dummyPageViewData.url, dummyPageViewData.duration, dummyPageViewData.id, dummyPageViewData.ver, dummyPageViewData.name, dummyPageViewData.properties, dummyPageViewData.measurements, }, PartA_flags = this.dummyPartAFlagsValue, }.GetType()); return((item) => { if (this.EventSourceInternal.IsEnabled(EventLevel.Verbose, keywords)) { var telemetryItem = item as PageViewTelemetry; CopyGlobalPropertiesIfRequired(item, telemetryItem.Properties); item.Sanitize(); var data = telemetryItem.Data; var extendedData = new { // The properties and layout should be the same as the anonymous type in the above MakeGenericMethod PartA_iKey = telemetryItem.Context.InstrumentationKey, PartA_Tags = telemetryItem.Context.SanitizedTags, PartB_PageViewData = new { data.url, data.duration, data.id, data.ver, data.name, data.properties, data.measurements, }, PartA_flags = telemetryItem.Context.Flags, }; writeMethod.Invoke(eventSource, new object[] { PageViewTelemetry.TelemetryName, eventSourceOptions, extendedData }); } }); }
public ActionResult Page(string shortcut = "", string id = "") { if (shortcut == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (string.IsNullOrEmpty(id)) { return(Index(shortcut)); } RouteEntity entity = Context.Routes.SingleOrDefault(x => x.Shortcut == shortcut); if (entity == null) { return(HttpNotFound()); } this.SetTheme(entity); if (entity is Photoshop) { var link = entity as Photoshop; var model = entity.As <PhotoshopViewModel.WhiteLabel>(); var page = Context.TextPages.FirstOrDefault(x => x.RouteID == model.ID && x.Slug == id); var mmodel = new PageViewData() { Route = model, PageView = page.As <TextPageViewModel.Details>() }; return(View("Page", mmodel)); } if (entity is Photorent) { var link = entity as Photorent; var model = entity.As <PhotorentViewModel.Details>(); var page = Context.TextPages.FirstOrDefault(x => x.RouteID == model.ID && x.Slug == id); var mmodel = new PageViewData() { Route = model, PageView = page.As <TextPageViewModel.Details>() }; return(View("Page", mmodel)); } return(View("Page")); }
public ActionResult Pagewl(string whitelabel = "", string id = "") { if (whitelabel == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (string.IsNullOrEmpty(id)) { return(Index(whitelabel)); } RouteEntity entity = Context.Routes.SingleOrDefault(x => x.Domain == whitelabel); if (entity == null) { return(HttpNotFound()); } this.SetTheme(entity); if (entity is Photoshop) { var model = entity.As <PhotoshopViewModel.WhiteLabel>(); var page = Context.TextPages.FirstOrDefault(x => x.RouteID == model.ID && x.Slug == id); var mmodel = new PageViewData() { Menu = _menuService.GetMenuForRoute(page.ID), Route = model, PageView = page.As <TextPageViewModel.Details>() }; return(View("Page", mmodel)); } if (entity is Photorent) { var model = entity.As <PhotorentViewModel.Details>(); var page = Context.TextPages.FirstOrDefault(x => x.RouteID == model.ID && x.Slug == id); var mmodel = new PageViewData() { Menu = _menuService.GetMenuForRoute(page.ID), Route = model, PageView = page.As <TextPageViewModel.Details>() }; return(View("Page", mmodel)); } return(View("Page")); }
public PageViewData <TEntity> GetPagedData <TFirst, TSecond, TReturn>(PageCriteria criteria, Func <TFirst, TSecond, TReturn> func) where TReturn : EntityBase { var data = new PageViewData <TEntity>(); string table = string.IsNullOrEmpty(criteria.Table) ? typeof(TEntity).GetTableName() : criteria.Table; string fields = string.IsNullOrEmpty(criteria.Fields) ? "*" : criteria.Fields; string sql = @"SELECT {0} FROM {1} WHERE {2} ORDER BY {3} OFFSET ({4} * ({5}-1)) ROW FETCH NEXT {4} ROWS ONLY"; sql = string.Format(sql, fields, table, string.IsNullOrEmpty(criteria.Where) ? " 1=1 " : criteria.Where, string.IsNullOrEmpty(criteria.Order) ? "Id DESC" : criteria.Order, criteria.PageSize, criteria.PageIndex); data.Items = (IEnumerable <TEntity>)Conn.Query <TFirst, TSecond, TReturn>(sql, func, criteria.Parameter); sql = "SELECT COUNT(1) FROM {0} WHERE {1}"; sql = string.Format(sql, table, string.IsNullOrEmpty(criteria.Where) ? " 1=1 " : criteria.Where); data.TotalCount = Conn.QueryFirstOrDefault <int>(sql, criteria.Parameter); data.PageIndex = criteria.PageIndex; data.PageSize = criteria.PageSize; return(data); }
private PageViewData CreatePageViewData(string repositoryName = null, string id = null) { var pageViewData = new PageViewData { Menu = new MenuViewData(_dbContextInfo, _routeAlias, repositoryName) }; if (!string.IsNullOrWhiteSpace(repositoryName)) { var repositoryInfo = _dbContextInfo.GetRepository(repositoryName); var dataRepository = new EasyCrudRepository(_dbContextInfo.DbContext, repositoryInfo); pageViewData.Name = repositoryName; pageViewData.MainComponent = CreateMainComponentViewData(repositoryInfo, dataRepository, id); if (!string.IsNullOrWhiteSpace(id)) { pageViewData.Components = CreateChildrenComponentViewData(repositoryInfo, dataRepository, id); } } return(pageViewData); }
private PageViewData <T> CreatePageViewData <T>(T contentModel) { var pageViewData = new PageViewData <T>(contentModel); return(pageViewData); }
/// <summary> /// Initializes a new instance of the <see cref="PageViewTelemetry"/> class. /// </summary> public PageViewTelemetry() { this.Data = new PageViewData(); this.context = new TelemetryContext(this.Data.properties); }
/// <summary> /// Initializes a new instance of the <see cref="PageViewTelemetry"/> class. /// </summary> public PageViewTelemetry() { this.Data = new PageViewData(); this.context = new TelemetryContext(this.Data.properties, new Dictionary <string, string>()); }
/// <summary> /// Initializes a new instance of the <see cref="PageViewTelemetry"/> class. /// </summary> public PageViewTelemetry() { this.Data = new PageViewData(); this.context = new TelemetryContext(this.Data.properties, new Dictionary<string, string>()); }
/// <summary> /// Constructor /// </summary> /// <param name="session">UserSession class</param> /// <param name="page"></param> public UserPageViewArgs(UserSession session, PageViewData page) { Page = page; Session = session; }
/// <summary> /// Initializes a new instance of the <see cref="PageViewTelemetry"/> class by cloning an existing instance. /// </summary> /// <param name="source">Source instance of <see cref="PageViewTelemetry"/> to clone from.</param> private PageViewTelemetry(PageViewTelemetry source) { this.Data = source.Data.DeepClone(); this.context = source.context.DeepClone(this.Data.properties); }