private TrendInfoForTaf CreateTafSubReport(Info info, TrendReport tr) { TrendInfoForTaf ret = new TrendInfoForTaf(); tr.CopyPropertiesTo(ret); switch (info.Type) { case TrendType.Becmg: ret.Interval = new TafIntervalNonFM( TafIntervalType.BECMG, info.FromToFlag); break; case TrendType.Fm: ret.Interval = new TafIntervalFM(info.DayTimeFlag); break; case TrendType.None: throw new NotSupportedException("At this place the type must be something different from \"None\""); case TrendType.Prob30: ret.Interval = new TafIntervalNonFM( TafIntervalType.PROB30, info.FromToFlag); break; case TrendType.Prob40: ret.Interval = new TafIntervalNonFM( TafIntervalType.PROB40, info.FromToFlag); break; case TrendType.Tempo: ret.Interval = new TafIntervalNonFM( TafIntervalType.TEMPO, info.FromToFlag); break; case TrendType.Tempo30: ret.Interval = new TafIntervalNonFM( TafIntervalType.TEMPO_PROB30, info.FromToFlag); break; case TrendType.Tempo40: ret.Interval = new TafIntervalNonFM( TafIntervalType.TEMPO_PROB40, info.FromToFlag); break; default: throw new NotImplementedException(); } return(ret); }
private static string Get(TrendReport trendReport) { StringBuilder ret = new StringBuilder(); if (trendReport.Wind != null) { ret.Append(Get(trendReport.Wind) + R.Dot); } if (trendReport.Visibility != null) { ret.Append(Get(trendReport.Visibility) + R.Dot); } ret.Append(Get(trendReport.Phenomens) + R.Dot); ret.Append(Get(trendReport.Clouds) + R.Dot); return(ret.ToString()); }
public async Task EnsureSeedDataAsync() { if (await _userManager.FindByEmailAsync("*****@*****.**") == null) { // Add the user var newUser = new PuddebtUser() { UserName = "******" , Email = "*****@*****.**" }; await _userManager.CreateAsync(newUser, "P@ssw0rd!"); } if (!_context.TrendReports.Any()) { // Add new data var debt = new TrendReport() { Name = "Pudder Debt", Description = "Keeping track of personal debt over time.", UserName = "******", Trends = new List<Trend>() { new Trend() { Name = "Ariel LOC", DataPoints = new List<DataPoint>() { new DataPoint(){Date = new DateTime(2015, 9, 1), Value = 2300.00}, new DataPoint(){Date = new DateTime(2015, 10, 1), Value = 2000.00}, new DataPoint(){Date = new DateTime(2015, 11, 1), Value = 1800.00} } }, new Trend() { Name = "Trailblazer", DataPoints = new List<DataPoint>() { new DataPoint(){Date = new DateTime(2015, 9, 1), Value = 2400.00}, new DataPoint(){Date = new DateTime(2015, 10, 1), Value = 2250.00}, new DataPoint(){Date = new DateTime(2015, 11, 1), Value = 2000.00} } } } }; _context.TrendReports.Add(debt); _context.Trends.AddRange(debt.Trends); _context.DataPoints.AddRange( debt.Trends.Single(t => t.Name == "Ariel LOC").DataPoints ); _context.DataPoints.AddRange( debt.Trends.Single(t => t.Name == "Trailblazer").DataPoints ); var nba = new TrendReport() { Name = "NBA Points", Description = "Tracking select NBA team scores through a period", UserName = "******", Trends = new List<Trend>() { new Trend() { Name = "Portland Trail Blazers", DataPoints = new List<DataPoint>() { new DataPoint(){Date = new DateTime(2015, 11, 2), Value = 105}, new DataPoint(){Date = new DateTime(2015, 11, 5), Value = 115}, new DataPoint(){Date = new DateTime(2015, 11, 9), Value = 89} } }, new Trend() { Name = "Los Angeles Lakers", DataPoints = new List<DataPoint>() { new DataPoint(){Date = new DateTime(2015, 11, 1), Value = 90}, new DataPoint(){Date = new DateTime(2015, 11, 2), Value = 120}, new DataPoint(){Date = new DateTime(2015, 11, 6), Value = 99} } } } }; _context.TrendReports.Add(nba); _context.Trends.AddRange(nba.Trends); _context.DataPoints.AddRange( nba.Trends.Single(t => t.Name == "Portland Trail Blazers").DataPoints ); _context.DataPoints.AddRange( nba.Trends.Single(t => t.Name == "Los Angeles Lakers").DataPoints ); _context.SaveChanges(); } }
public void AddTrendReport(TrendReport newTrendReport) { _context.Add(newTrendReport); }
protected void BtnGenerate_Click(object sender, EventArgs e) { try { bool areAllFieldsValid = VerifyAllCustomFieldsAreValid(); ReportToSelect = Request.QueryString["type"]; if (ReportToSelect == "RTR") { if (areAllFieldsValid) { GenerateRequisitionTrendController genRTC = new GenerateRequisitionTrendController(); List <string> deptSelected = GetSelectedDepartments(); List <string> catSelected = GetSelectedCategories(); List <string> duratnSelected = GetSelectedDuration(); List <TrendReport> basicReportObjects = new List <TrendReport>(); int splitBySelected = RBtnLSplit.SelectedIndex; if (splitBySelected == 0) { foreach (string dept in deptSelected) { string categoryName; string departmentName = dept; int month1 = 0, month2 = 0, month3 = 0; foreach (string cat in catSelected) { categoryName = cat; TrendReport input; if (duratnSelected.Count == 1) { month1 = genRTC.GetTotalRequisitionByCategoryGivenMonth(duratnSelected[0], dept, cat); input = new TrendReport(departmentName, categoryName, month1, duratnSelected[0]); basicReportObjects.Add(input); } else if (duratnSelected.Count == 2) { month1 = genRTC.GetTotalRequisitionByCategoryGivenMonth(duratnSelected[0], dept, cat); month2 = genRTC.GetTotalRequisitionByCategoryGivenMonth(duratnSelected[1], dept, cat); input = new TrendReport(departmentName, categoryName, month1, month2, duratnSelected[0], duratnSelected[1]); basicReportObjects.Add(input); } else { month1 = genRTC.GetTotalRequisitionByCategoryGivenMonth(duratnSelected[0], dept, cat); month2 = genRTC.GetTotalRequisitionByCategoryGivenMonth(duratnSelected[1], dept, cat); month3 = genRTC.GetTotalRequisitionByCategoryGivenMonth(duratnSelected[2], dept, cat); input = new TrendReport(departmentName, categoryName, month1, month2, month3, duratnSelected[0], duratnSelected[1], duratnSelected[2]); basicReportObjects.Add(input); } } } } else { foreach (string cat in catSelected) { string categoryName = cat; string departmentName = ""; int month1 = 0, month2 = 0, month3 = 0; foreach (string dept in deptSelected) { departmentName = dept; TrendReport input; if (duratnSelected.Count == 1) { month1 = genRTC.GetTotalRequisitionByCategoryGivenMonth(duratnSelected[0], dept, cat); input = new TrendReport(departmentName, categoryName, month1, duratnSelected[0]); basicReportObjects.Add(input); } else if (duratnSelected.Count == 2) { month1 = genRTC.GetTotalRequisitionByCategoryGivenMonth(duratnSelected[0], dept, cat); month2 = genRTC.GetTotalRequisitionByCategoryGivenMonth(duratnSelected[1], dept, cat); input = new TrendReport(departmentName, categoryName, month1, month2, duratnSelected[0], duratnSelected[1]); basicReportObjects.Add(input); } else { month1 = genRTC.GetTotalRequisitionByCategoryGivenMonth(duratnSelected[0], dept, cat); month2 = genRTC.GetTotalRequisitionByCategoryGivenMonth(duratnSelected[1], dept, cat); month3 = genRTC.GetTotalRequisitionByCategoryGivenMonth(duratnSelected[2], dept, cat); input = new TrendReport(departmentName, categoryName, month1, month2, month3, duratnSelected[0], duratnSelected[1], duratnSelected[2]); basicReportObjects.Add(input); } } } } Session["reportsToDisplay"] = basicReportObjects; Session["typeOfReport"] = splitBySelected; Response.Redirect("~/Store/TrendReportDisplay.aspx"); } else { //Utility.DisplayAlertMessage(Message.CustomFieldsNotSelected); if ((int)ViewState["catSel"] == 1 && GVCategory.Rows.Count == 0) { LblCatAlert.Visible = true; } if ((int)ViewState["durSel"] == 2 && GVDuration.Rows.Count == 0) { LblDurAlert.Visible = true; } if ((int)ViewState["sharedListSel"] == 1 && GVShared.Rows.Count == 0) { LblSharedAlert.Visible = true; } } } else if (ReportToSelect == "ROR") { if (areAllFieldsValid) { GenerateReorderTrendController genRTC = new GenerateReorderTrendController(); List <string> duratnSelected = GetSelectedDuration(); List <string> catSelected = GetSelectedCategories(); List <string> supplierSelected = GetSelectedSuppliers(); List <TrendReport> basicReportObjects = new List <TrendReport>(); int splitBySelected = RBtnLSplitROR.SelectedIndex; if (splitBySelected == 0) { foreach (string suppl in supplierSelected) { string categoryName; string supplierName = suppl; int month1 = 0, month2 = 0, month3 = 0; foreach (string cat in catSelected) { categoryName = cat; TrendReport input; if (duratnSelected.Count == 1) { month1 = genRTC.GetTotalReorderByCategoryGivenMonth(duratnSelected[0], suppl, cat); input = new TrendReport(supplierName, categoryName, month1, duratnSelected[0]); basicReportObjects.Add(input); } else if (duratnSelected.Count == 2) { month1 = genRTC.GetTotalReorderByCategoryGivenMonth(duratnSelected[0], suppl, cat); month2 = genRTC.GetTotalReorderByCategoryGivenMonth(duratnSelected[1], suppl, cat); input = new TrendReport(supplierName, categoryName, month1, month2, duratnSelected[0], duratnSelected[1]); basicReportObjects.Add(input); } else { month1 = genRTC.GetTotalReorderByCategoryGivenMonth(duratnSelected[0], suppl, cat); month2 = genRTC.GetTotalReorderByCategoryGivenMonth(duratnSelected[1], suppl, cat); month3 = genRTC.GetTotalReorderByCategoryGivenMonth(duratnSelected[2], suppl, cat); input = new TrendReport(supplierName, categoryName, month1, month2, month3, duratnSelected[0], duratnSelected[1], duratnSelected[2]); basicReportObjects.Add(input); } } } Session["typeOfReport"] = 2; } else { foreach (string cat in catSelected) { string categoryName = cat; string supplierName = ""; int month1 = 0, month2 = 0, month3 = 0; foreach (string suppl in supplierSelected) { supplierName = suppl; TrendReport input; if (duratnSelected.Count == 1) { month1 = genRTC.GetTotalReorderByCategoryGivenMonth(duratnSelected[0], suppl, cat); input = new TrendReport(supplierName, categoryName, month1, duratnSelected[0]); basicReportObjects.Add(input); } else if (duratnSelected.Count == 2) { month1 = genRTC.GetTotalReorderByCategoryGivenMonth(duratnSelected[0], suppl, cat); month2 = genRTC.GetTotalReorderByCategoryGivenMonth(duratnSelected[1], suppl, cat); input = new TrendReport(supplierName, categoryName, month1, month2, duratnSelected[0], duratnSelected[1]); basicReportObjects.Add(input); } else { month1 = genRTC.GetTotalReorderByCategoryGivenMonth(duratnSelected[0], suppl, cat); month2 = genRTC.GetTotalReorderByCategoryGivenMonth(duratnSelected[1], suppl, cat); month3 = genRTC.GetTotalReorderByCategoryGivenMonth(duratnSelected[2], suppl, cat); input = new TrendReport(supplierName, categoryName, month1, month2, month3, duratnSelected[0], duratnSelected[1], duratnSelected[2]); basicReportObjects.Add(input); } } } Session["typeOfReport"] = 3; } Session["reportsToDisplay"] = basicReportObjects; Response.Redirect("~/Store/TrendReportDisplay.aspx"); } else { //Utility.DisplayAlertMessage(Message.CustomFieldsNotSelected); if ((int)ViewState["catSel"] == 1 && GVCategory.Rows.Count == 0) { LblCatAlert.Visible = true; } if ((int)ViewState["durSel"] == 2 && GVDuration.Rows.Count == 0) { LblDurAlert.Visible = true; } if ((int)ViewState["sharedListSel"] == 1 && GVShared.Rows.Count == 0) { LblSharedAlert.Visible = true; } } } } catch (Exception) { Utility.DisplayAlertMessage(Message.GeneralError); } }
internal void UpdateTrendReport(string[] trendReport) { TrendReport?.Invoke(this, trendReport); }