public static ReportPeriodRange GetRange(ReportPeriod period, DateTime to) { var data = new ReportPeriodRange() { Period = period, To = to }; if (period == ReportPeriod.Hour) { data.From = data.To.AddHours(-1); } else if (period == ReportPeriod.Day) { data.From = data.To.AddDays(-1); } else if (period == ReportPeriod.Week) { data.From = data.To.AddDays(-7); } else if (period == ReportPeriod.Month) { data.From = data.To.AddMonths(-1); } else { throw new Exception("Неизвестное значение period: " + period); } return(data); }
public async Task DeleteHistoricReportsAsync(string iaocCode, ReportPeriod reportPeriod, string reportType, int year) { _logger.LogInformation($"Called Historic Report Deletion for :{iaocCode} period:{reportPeriod} type:{reportType} year:{year}"); await _historicDocumentProcessor.DeleteHistoricReportsAsync(iaocCode, reportPeriod, reportType, year); _logger.LogInformation($"Completed Historic Report Deletion for :{iaocCode} period:{reportPeriod} type:{reportType} year:{year}"); }
public static List <ReportPeriod> GetReportPeriods() { List <ReportPeriod> result = CommonDAL <ReportPeriod> .GetObjects(null); for (int i = 0; i < result.Count; i++) { ReportPeriod item = result[i]; if (item.StartTime == DateTime.MinValue) { item.StartTime = null; } if (item.EndTime == DateTime.MinValue) { item.EndTime = null; } if (rpList.Keys.Contains <Common.MonthRank>(item.Month)) { rpList[item.Month] = item; } else { rpList.Add(item.Month, item); } } return(result); }
/// <summary> /// Get Reports /// </summary> /// <param name="iaocCode">Airline IAOC Code</param> /// <param name="reportPeriod">Report Period</param> /// <param name="reportType">Report Type/Schema</param> /// <param name="year">Year</param> /// <returns>List of Report</returns> public async Task <IEnumerable <Report> > GetReportsAsync(string iaocCode, ReportPeriod reportPeriod, string reportType, int year) { IEnumerable <Report> data = null; _logger.LogInformation("Starting Report Data Fetch"); try { if (string.IsNullOrEmpty(_sqlConnection)) { throw new Exception("No SQL Server Connection String"); } using (var sqlConnection = new SqlConnection(_sqlConnection)) { await sqlConnection.OpenAsync(); var dynParams = new DynamicParameters(); dynParams.Add("@AirlineCode", iaocCode, DbType.String); dynParams.Add("@ReportPeriod", reportPeriod.ToString(), DbType.String); dynParams.Add("@ReportType", reportType, DbType.String); dynParams.Add("@Year", year, DbType.Int32); var results = await sqlConnection.QueryMultipleAsync("usp_Report_Select", dynParams, commandType : CommandType.StoredProcedure); data = await results.ReadAsync <Report>(); } } catch (Exception ex) { _logger.LogError(ex.Message); } _logger.LogInformation("Completed Data Fetch"); return(data); }
TableRow addCompletedReportPeriodRow(ReportPeriod rp, string termString, string schoolName) { TableRow newRow = new TableRow(); TableCell cellTerm = new TableCell(); TableCell cellID = new TableCell(); TableCell cellName = new TableCell(); TableCell cellSchool = new TableCell(); TableCell cellStartDate = new TableCell(); TableCell cellEndDate = new TableCell(); TableCell cellOpenDate = new TableCell(); TableCell cellCloseDate = new TableCell(); cellTerm.Text = termString; cellID.Text = rp.ID.ToString(); cellName.Text = rp.name; cellSchool.Text = schoolName; cellStartDate.Text = rp.startDate.ToShortDateString(); cellEndDate.Text = rp.endDate.ToShortDateString(); cellOpenDate.Text = rp.DateOpens.ToShortDateString(); cellCloseDate.Text = rp.DateCloses.ToShortDateString(); newRow.Cells.Add(cellTerm); newRow.Cells.Add(cellID); newRow.Cells.Add(cellName); newRow.Cells.Add(cellSchool); newRow.Cells.Add(cellStartDate); newRow.Cells.Add(cellOpenDate); newRow.Cells.Add(cellCloseDate); newRow.Cells.Add(cellEndDate); return(newRow); }
public static ShowReportPeriodReportPeriod ToShowReportPeriodReportPeriod(this ReportPeriod p) { switch (p) { case ReportPeriod.LastMonth: return(ShowReportPeriodReportPeriod.LastMonth); case ReportPeriod.LastWeek: return(ShowReportPeriodReportPeriod.LastWeek); case ReportPeriod.Yesterday: return(ShowReportPeriodReportPeriod.Yesterday); case ReportPeriod.Today: return(ShowReportPeriodReportPeriod.Today); case ReportPeriod.ThisWeek: return(ShowReportPeriodReportPeriod.ThisWeek); case ReportPeriod.ThisMonth: return(ShowReportPeriodReportPeriod.ThisMonth); case ReportPeriod.ThisYear: return(ShowReportPeriodReportPeriod.ThisYear); case ReportPeriod.LastYear: return(ShowReportPeriodReportPeriod.LastYear); default: return(ShowReportPeriodReportPeriod.Unknown); } }
public static string ToHumanReadableString(this ReportPeriod p) { switch (p) { case ReportPeriod.LastMonth: return(Resources.LastMonth); case ReportPeriod.LastWeek: return(Resources.LastWeek); case ReportPeriod.Yesterday: return(Resources.Yesterday); case ReportPeriod.Today: return(Resources.Today); case ReportPeriod.ThisWeek: return(Resources.ThisWeek); case ReportPeriod.ThisMonth: return(Resources.ThisMonth); case ReportPeriod.ThisYear: return(Resources.ThisYear); case ReportPeriod.LastYear: return(Resources.LastYear); default: return(Resources.Unknown); } }
public ReportPeriod Get(int reportPeriodID) { ReportPeriod returnMe = null; using (SqlConnection connection = new SqlConnection(Settings.DatabaseConnectionString)) { // Now we can load the actual report periods SqlCommand sqlCommand = new SqlCommand { Connection = connection, CommandType = CommandType.Text, CommandText = SQLQueryStart + " WHERE ReportPeriod.iReportPeriodID=@REPORTPERIODID;" }; sqlCommand.Parameters.AddWithValue("REPORTPERIODID", reportPeriodID); sqlCommand.Connection.Open(); SqlDataReader dataReader = sqlCommand.ExecuteReader(); if (dataReader.HasRows) { while (dataReader.Read()) { ReportPeriod parsedReportPeriod = sqlDataReaderToReportPeriod(dataReader); if (parsedReportPeriod != null) { returnMe = parsedReportPeriod; } } } sqlCommand.Connection.Close(); return(LoadAdditionalReportPeriodData(returnMe)); } }
public Report GenerateReport(ReportPeriod reportPeriod) { MemoryStream stream = new MemoryStream(); UserActionLog[] logs = applicationDbContext.UserActionLogs.Where(x => x.Date >= reportPeriod.Start && x.Date <= reportPeriod.End && x.ApplicationUser.Id == reportPeriod.ApplicationUserId).ToArray(); return(new CsvReport(stream.GetBuffer())); }
protected void btnGrade_Click(object sender, EventArgs e) { string selectedGrade = drpGrades.SelectedValue; chkReportPeriods.Items.Clear(); // Parse the selected school ID int schoolID = -1; if (int.TryParse(drpSchools.SelectedValue, out schoolID)) { School selectedSchool = null; using (SqlConnection connection = new SqlConnection(sqlConnectionString)) { // Load the school selectedSchool = School.loadThisSchool(connection, schoolID); } if (selectedSchool != null) { // Get some report periods to display List <Track> schoolTracks = new List <Track>(); List <ReportPeriod> schoolReportPeriod = new List <ReportPeriod>(); using (SqlConnection connection = new SqlConnection(sqlConnectionString)) { schoolTracks = Track.loadAllTracksFromThisSchool(connection, selectedSchool); foreach (Track track in schoolTracks) { track.terms = Term.loadTermsFromThisTrack(connection, track); foreach (Term term in track.terms) { term.ReportPeriods = ReportPeriod.loadReportPeriodsFromThisTerm(connection, term); } } schoolReportPeriod = ReportPeriod.loadReportPeriodsFromThisSchool(connection, selectedSchool); } foreach (Track track in schoolTracks) { foreach (Term term in track.terms) { foreach (ReportPeriod rp in term.ReportPeriods) { ListItem newItem = new ListItem(); newItem.Text = track.name + " - " + term.name + " - " + rp.name; newItem.Value = rp.ID.ToString(); chkReportPeriods.Items.Add(newItem); } } } btnGrade.Visible = false; tblrow_ReportPeriod.Visible = true; tblrow_Options.Visible = true; tblrow_Options2.Visible = true; tblrow_Options3.Visible = true; } } }
public void SelectPeriod(ReportPeriod period) { reportPeriod = period; if (isInitialized) { var initialShortcut = QuickSelectShortcuts.Single(shortcut => shortcut.Period == period); changeDateRange(initialShortcut.GetDateRange().WithSource(ReportsSource.Initial)); } }
public void DonateShowReport(ReportPeriod period) { if (!UIDevice.CurrentDevice.CheckSystemVersion(12, 0)) { return; } var intent = new ShowReportPeriodIntent(); switch (period) { case ReportPeriod.Today: intent.Period = ShowReportPeriodReportPeriod.Today; intent.SuggestedInvocationPhrase = $"Show {Resources.Today.ToLower()}'s time"; break; case ReportPeriod.Yesterday: intent.Period = ShowReportPeriodReportPeriod.Yesterday; intent.SuggestedInvocationPhrase = $"Show {Resources.Yesterday.ToLower()}'s time"; break; case ReportPeriod.LastWeek: intent.Period = ShowReportPeriodReportPeriod.LastWeek; intent.SuggestedInvocationPhrase = $"Show {Resources.LastWeek.ToLower()}'s time"; break; case ReportPeriod.LastMonth: intent.Period = ShowReportPeriodReportPeriod.LastMonth; intent.SuggestedInvocationPhrase = $"Show {Resources.LastMonth.ToLower()}'s time"; break; case ReportPeriod.ThisMonth: intent.Period = ShowReportPeriodReportPeriod.ThisMonth; intent.SuggestedInvocationPhrase = $"Show {Resources.ThisMonth.ToLower()}'s time"; break; case ReportPeriod.ThisWeek: intent.Period = ShowReportPeriodReportPeriod.ThisWeek; intent.SuggestedInvocationPhrase = $"Show {Resources.ThisWeek.ToLower()}'s time"; break; case ReportPeriod.ThisYear: intent.Period = ShowReportPeriodReportPeriod.ThisYear; intent.SuggestedInvocationPhrase = $"Show {Resources.ThisYear.ToLower()}'s time"; break; case ReportPeriod.Unknown: intent.Period = ShowReportPeriodReportPeriod.Unknown; break; } var interaction = new INInteraction(intent, null); interaction.DonateInteraction(trackError); }
protected ReportsCalendarBaseQuickSelectShortcut( ITimeService timeService, string title, ReportPeriod reportPeriod) { Ensure.Argument.IsNotNull(title, nameof(title)); Ensure.Argument.IsNotNull(timeService, nameof(timeService)); Ensure.Argument.IsNotNull(reportPeriod, nameof(reportPeriod)); Title = title; Period = reportPeriod; TimeService = timeService; }
public async Task LoadReport(long?workspaceId, ReportPeriod period) { var getWorkspaceInteractor = workspaceId.HasValue ? interactorFactory.GetWorkspaceById(this.workspaceId) : interactorFactory.GetDefaultWorkspace(); workspace = await getWorkspaceInteractor.Execute(); workspaceId = workspace.Id; CalendarViewModel.SelectPeriod(period); }
public void DonateShowReport(ReportPeriod period) { if (!UIDevice.CurrentDevice.CheckSystemVersion(12, 0)) { return; } var intent = new ShowReportPeriodIntent(); switch (period) { case ReportPeriod.Today: intent.Period = ShowReportPeriodReportPeriod.Today; break; case ReportPeriod.Yesterday: intent.Period = ShowReportPeriodReportPeriod.Yesterday; break; case ReportPeriod.LastWeek: intent.Period = ShowReportPeriodReportPeriod.LastWeek; break; case ReportPeriod.LastMonth: intent.Period = ShowReportPeriodReportPeriod.LastMonth; break; case ReportPeriod.ThisMonth: intent.Period = ShowReportPeriodReportPeriod.ThisMonth; break; case ReportPeriod.ThisWeek: intent.Period = ShowReportPeriodReportPeriod.ThisWeek; break; case ReportPeriod.ThisYear: intent.Period = ShowReportPeriodReportPeriod.ThisYear; break; case ReportPeriod.Unknown: intent.Period = ShowReportPeriodReportPeriod.Unknown; break; } intent.SuggestedInvocationPhrase = string.Format( Resources.SiriShowReportSuggestedInvocationPhrase, period.ToHumanReadableString().ToLower()); var interaction = new INInteraction(intent, null); interaction.DonateInteraction(trackError); }
protected void Page_Load(object sender, EventArgs e) { List<ReportPeriod> allReportPeriods = new List<ReportPeriod>(); List<Term> allTerms = new List<Term>(); List<Track> allTracks = new List<Track>(); List<School> allSchools = new List<School>(); using (SqlConnection connection = new SqlConnection(LSKYCommon.dbConnectionString_SchoolLogic)) { allReportPeriods = ReportPeriod.loadAllReportPeriods(connection); allTracks = Track.loadAllTracks(connection); allTerms = Term.loadAllTerms(connection); allSchools = School.loadAllSchools(connection); } allReportPeriods.Sort(); foreach (ReportPeriod rp in allReportPeriods) { // Find this report period's term string termString = "Unknown"; string schoolString = ""; foreach (Term term in allTerms) { if (term.ID == rp.termID) { foreach (Track track in allTracks) { if (term.trackID == track.ID) { termString = track.name + " - " + term.name; } } } } // Find the school foreach (School school in allSchools) { if (rp.schoolID == int.Parse(school.getSchoolLogicID())) { schoolString = school.getName(); } } tblReportPeriodsUpcoming.Rows.Add(addReportPeriodRow(rp, termString, schoolString)); } }
public void DonateShowReport(ReportPeriod period) { if (!UIDevice.CurrentDevice.CheckSystemVersion(12, 0)) { return; } var intent = new ShowReportPeriodIntent(); switch (period) { case ReportPeriod.Today: intent.Period = ShowReportPeriodReportPeriod.Today; break; case ReportPeriod.Yesterday: intent.Period = ShowReportPeriodReportPeriod.Yesterday; break; case ReportPeriod.LastWeek: intent.Period = ShowReportPeriodReportPeriod.LastWeek; break; case ReportPeriod.LastMonth: intent.Period = ShowReportPeriodReportPeriod.LastMonth; break; case ReportPeriod.ThisMonth: intent.Period = ShowReportPeriodReportPeriod.ThisMonth; break; case ReportPeriod.ThisWeek: intent.Period = ShowReportPeriodReportPeriod.ThisWeek; break; case ReportPeriod.ThisYear: intent.Period = ShowReportPeriodReportPeriod.ThisYear; break; case ReportPeriod.Unknown: intent.Period = ShowReportPeriodReportPeriod.Unknown; break; } var interaction = new INInteraction(intent, null); interaction.DonateInteraction(onCompletion); }
TableRow addUpcomingReportPeriodRow(ReportPeriod rp, string termString, string schoolName) { TableRow newRow = new TableRow(); TableCell cellTerm = new TableCell(); TableCell cellID = new TableCell(); TableCell cellName = new TableCell(); TableCell cellSchool = new TableCell(); TableCell cellStartDate = new TableCell(); TableCell cellEndDate = new TableCell(); TableCell cellOpenDate = new TableCell(); TableCell cellCloseDate = new TableCell(); TableCell cellDaysUntilOpen = new TableCell(); TableCell cellDaysUntilClose = new TableCell(); cellTerm.Text = termString; cellID.Text = rp.ID.ToString(); cellName.Text = rp.name; cellSchool.Text = schoolName; cellStartDate.Text = rp.startDate.ToShortDateString(); cellEndDate.Text = rp.endDate.ToShortDateString(); cellOpenDate.Text = rp.DateOpens.ToShortDateString(); cellCloseDate.Text = rp.DateCloses.ToShortDateString(); TimeSpan daysUntilClose = rp.DateCloses.Subtract(DateTime.Today); TimeSpan daysUntilOpen = rp.DateOpens.Subtract(DateTime.Today); cellDaysUntilOpen.Text = daysUntilOpen.Days.ToString(); cellDaysUntilClose.Text = daysUntilClose.Days.ToString(); cellDaysUntilClose.HorizontalAlign = HorizontalAlign.Center; cellDaysUntilOpen.HorizontalAlign = HorizontalAlign.Center; newRow.Cells.Add(cellTerm); newRow.Cells.Add(cellID); newRow.Cells.Add(cellName); newRow.Cells.Add(cellSchool); newRow.Cells.Add(cellStartDate); newRow.Cells.Add(cellEndDate); newRow.Cells.Add(cellOpenDate); newRow.Cells.Add(cellCloseDate); newRow.Cells.Add(cellDaysUntilOpen); newRow.Cells.Add(cellDaysUntilClose); return(newRow); }
/// <summary> /// Get Report Detail /// </summary> /// <param name="iaocCode">Airline Code</param> /// <param name="reportPeriod">Report Period</param> /// <param name="reportType">Report Type</param> /// <param name="year">Report Year</param> /// <returns>Report</returns> public Report GetReportDetail(string iaocCode, ReportPeriod reportPeriod, string reportType, int year) { Report report = null; // Fetch Matching Reports from Data Base var data = _reportDAL.GetReportsAsync(iaocCode, reportPeriod, reportType, year).GetAwaiter().GetResult(); if (data != null) { // Create List (returned in Created Date Order DESC) var reports = data.ToList(); // Return First Entry if (reports != null && reports.Count > 0) { report = reports[0]; } } return(report); }
public async Task <IHttpActionResult> GetReportPeriodByCode(string code) { if (bfsConfig.Logging.TraceEnabled) { Configuration.Services.GetTraceWriter().Info(Request, "Контроллер " + GetType().Name, MethodBase.GetCurrentMethod().Name); } ReportPeriod reportPeriod = await _db.ReportPeriods .Where(rp => rp.Code == code) .Include(rp => rp.ReportPeriodComponents) .FirstOrDefaultAsync(); if (reportPeriod == null) { return(NotFound()); } return(Ok(reportPeriod)); }
public List <ReportPeriod> GetBySchool(int schoolDatabaseID) { List <ReportPeriod> workingReportPeriodList = new List <ReportPeriod>(); using (SqlConnection connection = new SqlConnection(Settings.DatabaseConnectionString)) { // Now we can load the actual report periods SqlCommand sqlCommand = new SqlCommand { Connection = connection, CommandType = CommandType.Text, CommandText = SQLQueryStart + " WHERE ReportPeriod.iSchoolID=@SCHOOLID;" }; sqlCommand.Parameters.AddWithValue("SCHOOLID", schoolDatabaseID); sqlCommand.Connection.Open(); SqlDataReader dataReader = sqlCommand.ExecuteReader(); if (dataReader.HasRows) { while (dataReader.Read()) { ReportPeriod parsedReportPeriod = sqlDataReaderToReportPeriod(dataReader); if (parsedReportPeriod != null) { workingReportPeriodList.Add(parsedReportPeriod); } } } sqlCommand.Connection.Close(); } List <ReportPeriod> returnMe = new List <ReportPeriod>(); foreach (ReportPeriod rp in workingReportPeriodList) { returnMe.Add(LoadAdditionalReportPeriodData(rp)); } return(returnMe); }
public HttpResponseMessage GenerateCsv(ReportPeriod reportPeriod) { ReportCreator csvCreator = new CsvCreator(); Report rep = csvCreator.GenerateReport(reportPeriod); var result = new HttpResponseMessage(HttpStatusCode.OK) { Content = new ByteArrayContent(rep.Data) }; result.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment") { FileName = "Report" + DateTime.Now + ".csv" }; result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); return(result); }
TableRow addReportPeriodRow(ReportPeriod rp, string termString, string schoolName) { TableRow newRow = new TableRow(); TableCell cellTerm = new TableCell(); TableCell cellID = new TableCell(); TableCell cellName = new TableCell(); TableCell cellSchool = new TableCell(); TableCell cellStartDate = new TableCell(); TableCell cellEndDate = new TableCell(); TableCell cellDaysLeft = new TableCell(); TableCell cellOpenDate = new TableCell(); TableCell cellCloseDate = new TableCell(); cellTerm.Text = termString; cellID.Text = rp.ID.ToString(); cellName.Text = rp.name; cellSchool.Text = schoolName; cellStartDate.Text = rp.startDate.ToShortDateString(); cellEndDate.Text = rp.endDate.ToShortDateString(); cellOpenDate.Text = rp.DateOpens.ToShortDateString(); cellCloseDate.Text = rp.DateCloses.ToShortDateString(); TimeSpan daysLeft = rp.DateCloses.Subtract(DateTime.Today); cellDaysLeft.Text = daysLeft.Days.ToString(); newRow.Cells.Add(cellTerm); newRow.Cells.Add(cellID); newRow.Cells.Add(cellName); newRow.Cells.Add(cellSchool); newRow.Cells.Add(cellStartDate); newRow.Cells.Add(cellEndDate); newRow.Cells.Add(cellDaysLeft); newRow.Cells.Add(cellOpenDate); newRow.Cells.Add(cellCloseDate); return newRow; }
public List <ReportPeriod> GetAll() { List <ReportPeriod> workingReportPeriodList = new List <ReportPeriod>(); using (SqlConnection connection = new SqlConnection(Settings.DatabaseConnectionString)) { SqlCommand sqlCommand = new SqlCommand { Connection = connection, CommandType = CommandType.Text, CommandText = SQLQueryStart }; sqlCommand.Connection.Open(); SqlDataReader dataReader = sqlCommand.ExecuteReader(); if (dataReader.HasRows) { while (dataReader.Read()) { ReportPeriod parsedReportPeriod = sqlDataReaderToReportPeriod(dataReader); if (parsedReportPeriod != null) { workingReportPeriodList.Add(parsedReportPeriod); } } } sqlCommand.Connection.Close(); } List <ReportPeriod> returnMe = new List <ReportPeriod>(); foreach (ReportPeriod rp in workingReportPeriodList) { returnMe.Add(LoadAdditionalReportPeriodData(rp)); } return(returnMe); }
public override void ReadReportParams() { base.ReadReportParams(); if (Interval) { ReportPeriod = ReportPeriod.ByInterval; Begin = From; End = To; End = End.Date.AddDays(1); } else if (ReportPeriod == ReportPeriod.ByPrevMonth) { End = DateTime.Today; End = End.AddDays(-(End.Day - 1)).Date; // Первое число текущего месяца Begin = End.AddMonths(-1).Date; } else if (ReportPeriod == ReportPeriod.ByToday) { Begin = DateTime.Today; End = DateTime.Now; } else { End = DateTime.Today; //От текущей даты вычитаем интервал - дата начала отчета Begin = End.AddDays(-ReportInterval).Date; } Header.Add($"Период дат: {Begin:dd.MM.yyyy HH:mm:ss} - {End:dd.MM.yyyy HH:mm:ss}"); LoadFilters(); CheckAfterLoadFields(); SortFields(); if (ReportPeriod == ReportPeriod.ByToday) { OrdersSchema = "Orders"; } }
protected override void OnPreRender(EventArgs e) { int reportType = Utils.GetIntegerOnly(ddlReportType.SelectedValue); if (reportType > 0) { endDateContainer.Visible = true; startDateContainer.Visible = true; buttonsContainer.Visible = true; if (reportType == 1) { lstProductReport.Visible = false; lstStockReport.Visible = false; groupByContainer.Visible = true; lstHistoricSales.Visible = true; if (txtStartDate.Text.Length > 0) { DateTime startDT = DateTime.Parse(txtStartDate.Text); DateTime endDT = DateTime.Now; if (txtEndDate.Text.Length > 0) { endDT = DateTime.Parse(txtEndDate.Text); } ReportPeriod period = new ReportPeriod(); period.FromDate = startDT; period.ToDate = endDT; lstHistoricSales.Query = WebshopStatistics.GetGroupSalesData(period, GetDateTimePart()); } else { lstHistoricSales.Query = WebshopStatistics.GetGroupSalesData(this.GetReportPeriod(DefaultReportPeriod.AllTime), GetDateTimePart()); } } else if (reportType == 2) { //stocklist lstProductReport.Visible = false; lstStockReport.Visible = true; lstHistoricSales.Visible = false; groupByContainer.Visible = false; endDateContainer.Visible = false; startDateContainer.Visible = false; buttonsContainer.Visible = true; if (txtStartDate.Text.Length > 0) { DateTime startDT = DateTime.Parse(txtStartDate.Text); DateTime endDT = DateTime.Now; if (txtEndDate.Text.Length > 0) { endDT = DateTime.Parse(txtEndDate.Text); } ReportPeriod period = new ReportPeriod(); period.FromDate = startDT; period.ToDate = endDT; lstStockReport.Query = WebshopStatistics.GetProductStockReportData(period, null); } else { lstStockReport.Query = WebshopStatistics.GetProductStockReportData(this.GetReportPeriod(DefaultReportPeriod.AllTime), null); } } else if (reportType == 3) { //product report lstProductReport.Visible = true; lstStockReport.Visible = false; lstHistoricSales.Visible = false; groupByContainer.Visible = false; endDateContainer.Visible = true; startDateContainer.Visible = true; buttonsContainer.Visible = true; if (txtStartDate.Text.Length > 0) { DateTime startDT = DateTime.Parse(txtStartDate.Text); DateTime endDT = DateTime.Now; if (txtEndDate.Text.Length > 0) { endDT = DateTime.Parse(txtEndDate.Text); } ReportPeriod period = new ReportPeriod(); period.FromDate = startDT; period.ToDate = endDT; lstProductReport.Query = WebshopStatistics.GetProductSalesData(period, null); } else { lstProductReport.Query = WebshopStatistics.GetProductSalesData(this.GetReportPeriod(DefaultReportPeriod.AllTime), null); } } lstSalesSummary.Visible = false; } else { lstHistoricSales.Visible = false; lstProductReport.Visible = false; lstStockReport.Visible = false; lstSalesSummary.BorderWidth = 0; lstSalesSummary.Visible = true; lstSalesSummary.IQuery = new DataQuery(GetSalesSummaryQuery()); endDateContainer.Visible = false; startDateContainer.Visible = false; buttonsContainer.Visible = false; groupByContainer.Visible = false; } base.OnPreRender(e); }
protected ReportPeriod GetReportPeriod(DefaultReportPeriod period) { DateTime dtStart = new DateTime(); DateTime dtEnd = new DateTime(); switch (period) { case DefaultReportPeriod.Today: dtStart = DateTime.Now.Date; dtEnd = DateTime.Now.Date.AddDays(1); break; case DefaultReportPeriod.Yesterday: dtStart = DateTime.Now.Date.AddDays(-1); dtEnd = DateTime.Now.Date; break; case DefaultReportPeriod.Last7days: //debatable if this should be 7 days ago from now, or if it's 7 days from the start of todays date, so it's 7 days + the hours in the current day. Decided to use exactly 7 days from now. Might change later dtStart = DateTime.Now.AddDays(-7); dtEnd = DateTime.Now; break; case DefaultReportPeriod.Last30Days: //see previous comment for decision dtStart = DateTime.Now.AddDays(-30); dtEnd = DateTime.Now; break; case DefaultReportPeriod.ThisMonth: dtStart = new DateTime(DateTime.Now.Year,DateTime.Now.Month, 1); dtEnd = DateTime.Now; break; case DefaultReportPeriod.LastMonth: dtEnd = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); dtStart = dtEnd.AddMonths(-1); break; case DefaultReportPeriod.ThisYear: dtStart = new DateTime(DateTime.Now.Year,1,1); dtEnd = DateTime.Now; break; case DefaultReportPeriod.LastYear: dtEnd = new DateTime(DateTime.Now.Year, 1, 1); dtStart = dtEnd.AddYears(-1); break; case DefaultReportPeriod.AllTime: dtStart = new DateTime(1800, 1, 1); dtEnd = DateTime.Now; break; default: break; } ReportPeriod reportPeriod = new ReportPeriod(); reportPeriod.FromDate = dtStart; reportPeriod.ToDate = dtEnd; return reportPeriod; }
/// <summary> /// Get List of Document Ids for Deletion /// </summary> /// <param name="iaocCode">Airline Code</param> /// <param name="reportPeriod">Report Period</param> /// <param name="reportType">Report Type</param> /// <param name="year">Report Year</param> /// <returns>List of Document ID</returns> public IEnumerable <Guid> GetReportDocumentsForDeletions(string iaocCode, ReportPeriod reportPeriod, string reportType, int year) { return(_reportDAL.GetReportDocumentIdsForDeletionAsync(iaocCode, reportPeriod, reportType, year).GetAwaiter().GetResult()); }
protected void btnExport_Click(object sender, EventArgs e) { int reportType = Utils.GetIntegerOnly(ddlReportType.SelectedValue); CsvExport export = new CsvExport(); string fileName = "export"; if(reportType==0){ //Sales summary QueryData qd = GetSalesSummaryQuery(); UniqueList<string> values = lstSalesSummary.GetAllValues(); //IAqlQuery IAqlQuery q = new DataQuery(qd); List<string> fieldNames = q.GetFieldNames(); AqlResultSet rs = q.Execute(true); while(rs.Read()){ export.AddRow(); export[fieldNames[0]] = rs[0]; //Period export[fieldNames[1]] = rs[1]; //Number of orders export[fieldNames[2]] = rs[2]; //Total revenue export[fieldNames[3]] = rs[3]; // Average order value export[fieldNames[4]] = rs[4]; //biggest order int mostSoldProductRevenue = Utils.GetIntegerOnly(rs[5].ToString()); if (mostSoldProductRevenue > 0) { ProductBase pMostSoldRevenue = WAFContext.Session.GetContent<ProductBase>(mostSoldProductRevenue); export[fieldNames[5]] = pMostSoldRevenue.Name + " (" + mostSoldProductRevenue + ")"; //MostPopularProductRevenue } else { export[fieldNames[5]] = ""; } int mostSoldProductNumItems = Utils.GetIntegerOnly(rs[5].ToString()); if (mostSoldProductNumItems > 0) { ProductBase pMostSoldItems = WAFContext.Session.GetContent<ProductBase>(mostSoldProductNumItems); export[fieldNames[6]] = pMostSoldItems.Name + " (" + mostSoldProductNumItems + ")"; //MostPopularProductNumItems } else { export[fieldNames[6]] = ""; } } fileName = "sales_summary"; }else if(reportType ==1){ //Sales over time AqlQuery q = null; if (txtStartDate.Text.Length > 0) { DateTime startDT = DateTime.Parse(txtStartDate.Text); DateTime endDT = DateTime.Now; if (txtEndDate.Text.Length > 0) { endDT = DateTime.Parse(txtEndDate.Text); } ReportPeriod period = new ReportPeriod(); period.FromDate = startDT; period.ToDate = endDT; q = WebshopStatistics.GetGroupSalesData(period, GetDateTimePart()); } else { q = WebshopStatistics.GetGroupSalesData(this.GetReportPeriod(DefaultReportPeriod.AllTime), GetDateTimePart()); } List<string> fieldNames = q.GetFieldNames(); AqlResultSet rs = q.Execute(true); while (rs.Read()) { export.AddRow(); export["Period"] = GetPeriodDescription(Utils.GetIntegerOnly(rs[0]), Utils.GetIntegerOnly(rs[3])); //DateTimePart export["Revenue in period"] = ((double)rs[1]).ToString("N2"); //Revenue export["Number of orders in period"] = rs[2]; //NumOrders } fileName = "sales_over_time"; }else if(reportType == 2){ //stock list AqlQuery q = null; if (txtStartDate.Text.Length > 0) { DateTime startDT = DateTime.Parse(txtStartDate.Text); DateTime endDT = DateTime.Now; if (txtEndDate.Text.Length > 0) { endDT = DateTime.Parse(txtEndDate.Text); } ReportPeriod period = new ReportPeriod(); period.FromDate = startDT; period.ToDate = endDT; q = WebshopStatistics.GetProductStockReportData(period, null); } else { q = WebshopStatistics.GetProductStockReportData(this.GetReportPeriod(DefaultReportPeriod.AllTime), null); } List<string> fieldNames = q.GetFieldNames(); AqlResultSet rs = q.Execute(true); while (rs.Read()) { export.AddRow(); export["NodeId"] = rs[0]; export["Item number"] = rs[1]; export["Product name"] = rs[2]; export["Number in stock"] = rs[3]; } fileName = "stock_list"; }else if(reportType == 3){ //product sales report AqlQuery q = null; if (txtStartDate.Text.Length > 0) { DateTime startDT = DateTime.Parse(txtStartDate.Text); DateTime endDT = DateTime.Now; if (txtEndDate.Text.Length > 0) { endDT = DateTime.Parse(txtEndDate.Text); } ReportPeriod period = new ReportPeriod(); period.FromDate = startDT; period.ToDate = endDT; q = WebshopStatistics.GetProductSalesData(period, null); } else { q = WebshopStatistics.GetProductSalesData(this.GetReportPeriod(DefaultReportPeriod.AllTime), null); } List<string> fieldNames = q.GetFieldNames(); q.IncludeUnpublished = true; AqlResultSet rs = q.Execute(true); while (rs.Read()) { export.AddRow(); export["NodeId"] = rs[0]; export["Item number"] = rs[1]; export["Product name"] = rs[2]; export["Numberof items sold"] = rs[3]; export["Revenue"] = rs[4]; export["Last sale"] = rs[5]; export["First sale"] = rs[6]; } fileName = "products"; }else if(reportType == 4){ //customers fileName = "customers"; } //foreach (ProductBase p in products) { // export.AddRow(); // export["Name"] = p.Name; // export["NodeId"] = p.NodeId; // export["SiteId"] = p.SiteId; // export["Currency5PriceExVat"] = p.Currency5PriceExVat; //} Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.AddHeader("content-disposition", "attachment;filename="+fileName+"_" + DateTime.Now.Day + "_" + DateTime.Now.Month + "_" + DateTime.Now.Year + ".csv"); //Response.Charset = "UTF-8"; Response.ContentEncoding = Encoding.Default;//Encoding.GetEncoding("iso-8859-1"); //Encoding.GetEncoding(System.Globalization.CultureInfo.CurrentCulture.TextInfo.OEMCodePage); //Encoding.Default; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "text/csv"; Response.Write(export.Export()); Response.End(); }
protected void btnGenerate_Click(object sender, EventArgs e) { // Parse the selected school ID int schoolID = -1; if (int.TryParse(drpSchools.SelectedValue, out schoolID)) { School selectedSchool = null; using (SqlConnection connection = new SqlConnection(sqlConnectionString)) { // Load the school selectedSchool = School.loadThisSchool(connection, schoolID); if (selectedSchool != null) { // Load the selected student Student selectedStudent = Student.loadThisStudent(connection, drpStudents.SelectedValue); if (selectedStudent != null) { List <Student> selectedStudents = new List <Student>(); selectedStudents.Add(selectedStudent); // Load checked report periods List <int> selectedReportPeriodIDs = new List <int>(); List <ReportPeriod> selectedReportPeriods = new List <ReportPeriod>(); foreach (ListItem item in chkReportPeriods.Items) { if (item.Selected) { int parsedValue = -1; if (int.TryParse(item.Value, out parsedValue)) { if (!selectedReportPeriodIDs.Contains(parsedValue)) { selectedReportPeriodIDs.Add(parsedValue); } } } } if (selectedReportPeriodIDs.Count > 0) { foreach (int reportPeriodID in selectedReportPeriodIDs) { ReportPeriod loadedReportPeriod = ReportPeriod.loadThisReportPeriod(connection, reportPeriodID); if (loadedReportPeriod != null) { selectedReportPeriods.Add(loadedReportPeriod); } } // Load student mark data List <Student> studentsWithMarks = new List <Student>(); foreach (Student student in selectedStudents) { studentsWithMarks.Add(LSKYCommon.loadStudentMarkData(connection, student, selectedReportPeriods)); } // Options bool doubleSidedMode = false; if (chkDoubleSidedMode.Checked) { doubleSidedMode = true; } bool anonymize = false; if (chkAnonymize.Checked) { anonymize = true; } bool showPhotos = false; if (chkShowPhotos.Checked) { showPhotos = true; } bool showClassAttendance = false; if (chkClassAttendance.Checked) { showClassAttendance = true; } bool showLegends = true; bool showAttendanceSummary = false; if (chkShowAttendanceSummary.Checked) { showAttendanceSummary = true; } string adminComment = txtAdminComment.Text; // Send the report card String fileName = "ReportCards_" + selectedStudent.getStudentID() + "_" + DateTime.Today.Year + "_" + DateTime.Today.Month + "_" + DateTime.Today.Day + ".pdf"; if ((selectedReportPeriods.Count > 0) && (selectedStudents.Count > 0)) { sendPDF(PDFReportCardParts.GeneratePDF(selectedStudents, selectedReportPeriods, anonymize, showPhotos, doubleSidedMode, showClassAttendance, showLegends, showAttendanceSummary, adminComment), fileName); } } else { // No report periods were selected - should display some kind of error here } } } } } }
protected void Page_Load(object sender, EventArgs e) { List <Student> students = new List <Student>(); List <Student> displayedStudents = new List <Student>(); List <ReportPeriod> selectedReportPeriods = new List <ReportPeriod>(); bool anonymize = false; if (!string.IsNullOrEmpty(Request.QueryString["anon"])) { anonymize = true; } using (SqlConnection connection = new SqlConnection(sqlConnectionString)) { // Parse student IDs if (!string.IsNullOrEmpty(Request.QueryString["students"])) { foreach (string student in Request.QueryString["students"].Split(';')) { if (!string.IsNullOrEmpty(student)) { int student_id = -1; if (int.TryParse(student, out student_id)) { students.Add(Student.loadThisStudent(connection, student_id.ToString())); } } } foreach (string rp in Request.QueryString["reportperiods"].Split(';')) { if (!string.IsNullOrEmpty(rp)) { int rp_id = -1; if (int.TryParse(rp, out rp_id)) { selectedReportPeriods.Add(ReportPeriod.loadThisReportPeriod(connection, rp_id)); } } } } } selectedReportPeriods.Sort(); using (SqlConnection connection = new SqlConnection(sqlConnectionString)) { foreach (Student student in students) { if (student != null) { Stopwatch studentStopWatch = new Stopwatch(); studentStopWatch.Start(); displayedStudents.Add(LSKYCommon.loadStudentMarkData(connection, student, selectedReportPeriods)); studentStopWatch.Stop(); } } students.Clear(); } // Display data Response.Write("<BR><B>DEBUG DATA</b>"); foreach (Student student in displayedStudents) { Response.Write("<BR><hr><BR><b>" + student + "</B>"); Response.Write("<BR><b>Absense entries: </b>" + student.absences.Count); Response.Write("<BR> <b>Track:</b> " + student.track); foreach (Term term in student.track.terms) { Response.Write("<BR> <b>Term:</b> " + term); foreach (ReportPeriod rp in term.ReportPeriods) { Response.Write("<BR> <b>Report Period:</b> " + rp); Response.Write("<BR> <b>Marks: </b> " + rp.marks.Count); foreach (Mark mark in rp.marks) { Response.Write("<BR> <b>Mark: </b> " + mark); } } Response.Write("<BR><BR> <b>Classes:</b> " + term.Courses.Count); foreach (SchoolClass c in term.Courses) { Response.Write("<BR><BR> <b>Class:</b> " + c); Response.Write("<BR> <b>Teacher:</b> " + c.teacherName); Response.Write("<BR> <b>Marks:</b> " + c.Marks.Count); Response.Write("<BR> <b>Outcomes:</b> " + c.Outcomes.Count); Response.Write("<BR> <b>Outcome Marks:</b> " + c.OutcomeMarks.Count); Response.Write("<BR> <b>Life Skills:</b> " + c.LifeSkills.Count); Response.Write("<BR> <b>Life Skills Marks:</b> " + c.LifeSkillMarks.Count); foreach (ReportPeriod rp in term.ReportPeriods) { Response.Write("<BR> <b>Report Period:</b> " + rp); foreach (Mark m in c.Marks) { if (m.reportPeriodID == rp.ID) { Response.Write("<BR> <b>Mark</b> " + m); } } foreach (OutcomeMark om in c.OutcomeMarks) { if (om.reportPeriodID == rp.ID) { Response.Write("<BR> <b>OutcomeMark:</b> " + om); } } } Response.Write("<BR> <b>Outcomes:</b> " + c.Outcomes.Count); foreach (Outcome o in c.Outcomes) { Response.Write("<BR> <b>Outcome:</b> " + o); foreach (OutcomeMark om in o.marks) { Response.Write("<BR> <b>OutcomeMark:</b> " + om); } } Response.Write("<BR> <b>Life Skills / SLBs:</b> " + c.LifeSkills.Count); foreach (Outcome o in c.LifeSkills) { Response.Write("<BR> <b>Outcome</b> " + o); foreach (OutcomeMark om in o.marks) { Response.Write("<BR> <b>OutcomeMark:</b> " + om); } } } } } }
public Report GenerateReport(ReportPeriod reportPeriod) { return(new CsvReport(Encoding.ASCII.GetBytes("sadsad"))); }
protected void btnGetMostPopularProducts_Click(object sender, EventArgs e) { ReportPeriod period = new ReportPeriod(); period.FromDate = DateTime.Now.Date.AddMonths(-3); period.ToDate = DateTime.Now; DateTime start = DateTime.Now; Dictionary<int, int> products = WebshopStatistics.GetMostPopularProductsNumberOfItemsSold(period,10,0); StringBuilder sb = new StringBuilder(); sb.AppendLine("<h2>Most popular product - Number Of Items Sold</h2>"); foreach (int id in products.Keys) { ProductBase p = WAFContext.Session.GetContent<ProductBase>(id); sb.AppendLine(p.Name); sb.Append(" - "); sb.Append(products[id]); sb.Append("<br>"); } sb.AppendLine("<h2>Most popular product - Revenue</h2>"); Dictionary<int, double> productsRev = WebshopStatistics.GetMostPopularProductsRevenue(period, 10, 0); foreach (int id in productsRev.Keys) { ProductBase p = WAFContext.Session.GetContent<ProductBase>(id); sb.AppendLine(p.Name); sb.Append(" - "); sb.Append(productsRev[id].ToString("N2")); sb.Append("<br>"); } DateTime end = DateTime.Now; // litNumItemsSold.Text = sb.ToString(); TimeSpan timeSpan = end -start; //litTime.Text = timeSpan.TotalMilliseconds.ToString(); }
public async Task <IActionResult> PublishReportStorageNotificationAsync(string schemaId, string iaocCode, ReportPeriod reportPeriod, string year, string currency = "native") { try { currency = currency.Trim().ToLowerInvariant(); var adjustedSchema = schemaId; if (currency != "native") { // adjustedSchema += "-" + currency.ToLowerInvariant(); } // Recover Document Details from DB var report = _reportDataService.GetReportDetail(iaocCode, reportPeriod, adjustedSchema, Convert.ToInt32(year, CultureInfo.InvariantCulture)); if (report != null) { var documentId = report.DocumentId.ToString(); var gcpToken = _clientTokenHandler.GetValidToken(); var documentURI = $"{_gcpAserviceAPI}{schemaId}/{documentId}"; // Get Stored Document direct from GCP var storedDocument = await GCPDocumentHelper.GetGCPDocumentAsync(documentURI, gcpToken, CancellationToken.None); // Upsert Document - (Same URI but with a PUT) var response = await _documentUpsertProcessor.UpsertDocumentAsync(documentURI, gcpToken, storedDocument, CancellationToken.None); if (response) { return(Ok()); } } else { return(NotFound()); } } catch (Exception ex) { _logger.LogCritical(ex, "FAILED trying to Publish Report Storage Notification", iaocCode, reportPeriod); } return(BadRequest()); }
public static Report ParseReport(string selector, StreamReader content) { var htmlDocument = new HtmlDocument(); htmlDocument.Load(content); var html = htmlDocument.DocumentNode; var report = new Report(); var trans = new List<AccountTransaction>(); // <td width=\"55\" colspan=\"3\" rowspan=\"2\"> <td width=361 colspan=26 rowspan=2> var reportPeriodRows = html.CssSelect("tr") .Where(r => (r.InnerHtml.Contains("<td width=\"361\" colspan=\"26\" rowspan=\"2\">") && r.InnerHtml.Contains("<td height=\"9\" colspan=\"22\">")) || (r.InnerHtml.Contains("<td width=\"361\" colspan=\"16\" rowspan=\"2\">") && r.InnerHtml.Contains("<td height=\"9\" colspan=\"15\">")) || (r.InnerHtml.Contains("<td width=\"361\" colspan=\"31\" rowspan=\"2\">") && r.InnerHtml.Contains("<td height=\"9\" colspan=\"29\">"))); var reportPeriodCells = reportPeriodRows.Select(record => record.CssSelect("tt")); var period = new ReportPeriod(); foreach (var reportPeriodCell in reportPeriodCells) { if (reportPeriodCell == null) continue; var local = reportPeriodCell.ToList(); if (!local.Any()) continue; var count = local.Count(); if (count == 4) { if (local[0].InnerHtml == "Отчетный период: ") { period.StartDate = DateTime.Parse(local[1].InnerText.Trim(), CultureInfo.CreateSpecificCulture("ru-RU")); period.EndDate = DateTime.Parse(local[3].InnerText.Trim(), CultureInfo.CreateSpecificCulture("ru-RU")); report.ReportPeriod = period; } } } var cardRows = html.CssSelect("tr") .Where(r => r.InnerHtml.Contains("<td width=\"284\" colspan=\"10\" rowspan=\"2\">")); var cardCells = cardRows.Select(record => record.CssSelect("tt")); foreach (var cardCell in cardCells) { if (cardCell == null) continue; var local = cardCell.ToList(); if (!local.Any()) continue; var count = local.Count(); if (count == 2) { if (local[0].InnerHtml == "Контракт # ") report.CardNumber = local[1].InnerHtml.Replace(" ", " ").Trim(); } } var stateRows = html.CssSelect("tr") .Where(r => r.InnerHtml.Contains("<td height=\"9\"></td>") && (r.InnerHtml.Contains("<td width=\"100\" colspan=\"10\">") || (r.InnerHtml.Contains("<td width=\"100\" colspan=\"4\">")))); var stateCells = stateRows.Select(record => record.CssSelect("tt")); var stateOnDate = new StateOnDate(); foreach (var stateCell in stateCells) { if (stateCell == null) continue; var local = stateCell.ToList(); if (!local.Any()) continue; var count = local.Count(); if (count == 4) { if (local[0].InnerHtml != "На Дату") { stateOnDate.Date = DateTime.Parse(local[0].InnerText.Trim(), CultureInfo.CreateSpecificCulture("ru-RU")); stateOnDate.Available = Decimal.Parse(local[1].InnerText.Replace(" ", "").Trim()); stateOnDate.BlockedAmount = Decimal.Parse(local[2].InnerText.Replace(" ", "").Trim()); stateOnDate.CreditLimit = Decimal.Parse(local[3].InnerText.Replace(" ", "").Trim()); report.StateOnDate = stateOnDate; } } } var transcationRows = html.CssSelect("tr") .Where(r => r.InnerHtml.Contains("<td height=\"9\" colspan=\"2\"></td>") || r.InnerHtml.Contains("<td height=\"9\" colspan=\"28\">") || r.InnerHtml.Contains("<td width=\"69\" colspan=\"2\" rowspan=\"2\">")); var transactionCells = transcationRows.Select(record => record.CssSelect("tt")); var transactionDate = DateTime.MinValue; // fixed bug with html report from sbsibank (the transaction date is on another row) foreach (var values in transactionCells) { if (values == null) continue; var local = values.ToList(); if (!local.Any()) continue; var count = local.Count(); switch (count) { case 1: transactionDate = DateTime.Parse(local[0].InnerText.Trim(), CultureInfo.CreateSpecificCulture("ru-RU")); break; case 2: if (local[0].InnerHtml == "Валюта Контракта: ") report.Currency = local[1].InnerText.Replace(" ", " ").Trim(); if (local[0].InnerHtml == "BYR" || local[0].InnerHtml == "USD" || local[0].InnerHtml == "EUR") report.StartBalance = Decimal.Parse(local[1].InnerText.Replace(" ", " ").Replace(" ", "").Trim()); break; case 3: if (local[0].InnerHtml == "Операции по Card # ") report.CardNumber = local[1].InnerHtml.Replace(" ", " ").Trim(); break; case 6: if (local[0].InnerText.Trim() == "Дата") continue; var transaction1 = new AccountTransaction { OperationDate = DateTime.Parse(local[0].InnerText.Trim(), CultureInfo.CreateSpecificCulture("ru-RU")), OperationDescription = HttpUtility.HtmlDecode(local[1].InnerText.Replace(" ", " ").Trim()), OperationAmount = Decimal.Parse(local[2].InnerText.Replace(" ", "").Trim()), Currency = local[3].InnerText.Trim(), TransactionDate = transactionDate, Commission = Decimal.Parse(local[4].InnerText.Replace(" ", "").Trim()), TransactionAmount = Decimal.Parse(local[5].InnerText.Replace(" ", "").Trim()), Status = "F" }; Log.Info(transaction1); trans.Add(transaction1); break; case 7: if (local[0].InnerText.Trim() == "Дата") continue; DateTime date; if (DateTime.TryParse(local[1].InnerText.Trim(), out date)) { // operations waiting authorization var transaction3 = new AccountTransaction { OperationDate = DateTime.Parse(local[0].InnerText.Trim(), CultureInfo.CreateSpecificCulture("ru-RU")), OperationDescription = HttpUtility.HtmlDecode(local[2].InnerText.Replace(" ", " ").Trim()), OperationAmount = Decimal.Parse(local[3].InnerText.Replace(" ", "").Trim()), Currency = local[4].InnerText.Trim(), //TransactionDate = DateTime.Parse(local[4].InnerText.Trim(), CultureInfo.CreateSpecificCulture("ru-RU")), //Commission = Decimal.Parse(local[5].InnerText.Replace(" ", "").Trim()), TransactionAmount = Decimal.Parse(local[5].InnerText.Replace(" ", "").Trim()), Status = "A" }; Log.Info(transaction3); trans.Add(transaction3); break; } var transaction2 = new AccountTransaction { OperationDate = DateTime.Parse(local[0].InnerText.Trim(), CultureInfo.CreateSpecificCulture("ru-RU")), OperationDescription = HttpUtility.HtmlDecode(local[1].InnerText.Replace(" ", " ").Trim()), OperationAmount = Decimal.Parse(local[2].InnerText.Replace(" ", "").Trim()), Currency = local.ElementAt(3).InnerText.Trim(), TransactionDate = DateTime.Parse(local[4].InnerText.Trim(), CultureInfo.CreateSpecificCulture("ru-RU")), Commission = Decimal.Parse(local[5].InnerText.Replace(" ", "").Trim()), TransactionAmount = Decimal.Parse(local[6].InnerText.Replace(" ", "").Trim()), Status = "F" }; Log.Info(transaction2); trans.Add(transaction2); break; } } report.Transactions = trans; return report; }