public SummaryReport GetFiscalYearSummary() { const string COMMAND_TEXT = "usp_TaxonomyFiscalYearTotals_Select"; SummaryReport summaryReport = new SummaryReport(); try { summaryReport.Title = "FY 2020 Annual Totals"; using (SqlConnection cn = DataContext.GetConnection(this.GetConnectionStringKey(_context))) { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = cn; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = COMMAND_TEXT; using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { summaryReport.SummaryReportRecords.Add(new SummaryReportRecord { Title = reader["category"].ToString(), Total = GetInt(reader["fiscal_year_total"].ToString()) }); } } } } } catch (Exception ex) { throw ex; } return(summaryReport); }
private void SummaryCrystalReportForm_Load(object sender, EventArgs e) { #region Summary Computations //COUNT COMPUTATIONS var carwashCount = _dataList.Where(a => a.ServiceType == ServiceTypeConstants.Carwash).Count(); var detailingCount = _dataList.Where(a => a.ServiceType == ServiceTypeConstants.Detailing).Count(); var paintjobCount = _dataList.Where(a => a.ServiceType == ServiceTypeConstants.PaintJob).Count(); var backtozeroCount = _dataList.Where(a => a.ServiceType == ServiceTypeConstants.BackToZero).Count(); var overallTotalCount = carwashCount + detailingCount + paintjobCount + backtozeroCount; //COST COMPUTATIONS var carwashTotalCost = _dataList.Where(a => a.ServiceType == ServiceTypeConstants.Carwash).Sum(a => a.Cost); var detailingTotalCost = _dataList.Where(a => a.ServiceType == ServiceTypeConstants.Detailing).Sum(a => a.Cost); var paintjobTotalCost = _dataList.Where(a => a.ServiceType == ServiceTypeConstants.PaintJob).Sum(a => a.Cost); var backtozeroTotalCost = _dataList.Where(a => a.ServiceType == ServiceTypeConstants.BackToZero).Sum(a => a.Cost); var overallTotalCost = carwashTotalCost + detailingTotalCost + paintjobTotalCost + backtozeroTotalCost; //EXPENSE COMPUTATIONS var carwashTotalExpense = _dataList.Where(a => a.ServiceType == ServiceTypeConstants.Carwash).Sum(a => a.Expense); var detailingTotalExpense = _dataList.Where(a => a.ServiceType == ServiceTypeConstants.Detailing).Sum(a => a.Expense); var paintjobTotalExpense = _dataList.Where(a => a.ServiceType == ServiceTypeConstants.PaintJob).Sum(a => a.Expense); var backtozeroTotalExpense = _dataList.Where(a => a.ServiceType == ServiceTypeConstants.BackToZero).Sum(a => a.Expense); var overallTotalExpense = carwashTotalExpense + detailingTotalExpense + paintjobTotalExpense + backtozeroTotalExpense; //PROFIT COMPUTATIONS var grossProfit = overallTotalCost - overallTotalExpense; var netProfit = grossProfit - (grossProfit * TaxConstants.BusinessTax); #endregion _dataList.ForEach(a => a.CarwashCount = carwashCount); _dataList.ForEach(a => a.DetailingCount = detailingCount); _dataList.ForEach(a => a.PaintjobCount = paintjobCount); _dataList.ForEach(a => a.BackToZeroCount = backtozeroCount); _dataList.ForEach(a => a.OverallTotalCount = overallTotalCount); _dataList.ForEach(a => a.CarwashTotalCost = carwashTotalCost); _dataList.ForEach(a => a.DetailingTotalCost = detailingTotalCost); _dataList.ForEach(a => a.PaintjobTotalCost = paintjobTotalCost); _dataList.ForEach(a => a.BackToZeroTotalCost = backtozeroTotalCost); _dataList.ForEach(a => a.OverallTotalCost = overallTotalCost); _dataList.ForEach(a => a.CarwashTotalExpense = carwashTotalExpense); _dataList.ForEach(a => a.DetailingTotalExpense = detailingTotalExpense); _dataList.ForEach(a => a.PaintjobTotalExpense = paintjobTotalExpense); _dataList.ForEach(a => a.BackToZeroTotalExpense = backtozeroTotalExpense); _dataList.ForEach(a => a.OverallTotalExpense = overallTotalExpense); _dataList.ForEach(a => a.GrossProfit = grossProfit); _dataList.ForEach(a => a.NetProfit = netProfit); var summaryDataSet = _dataList.ToDataSet(); var summaryReport = new SummaryReport(); summaryReport.SetDataSource(summaryDataSet.Tables[0]); this.crystalReportViewer1.ReportSource = summaryReport; this.crystalReportViewer1.Zoom(2); this.crystalReportViewer1.ShowGroupTreeButton = false; this.crystalReportViewer1.ShowParameterPanelButton = false; this.crystalReportViewer1.ToolPanelView = ToolPanelViewType.None; }
//generate the report when requested (30 minutes) public SummaryReport generateReport() { var all_crisis = crisisRepository.getCrisisByTime(DateTime.Now); var new_report = new SummaryReport(); if (all_crisis == null) { Console.WriteLine("no report submitted during time frame"); } else { string add = ""; foreach (var item in all_crisis) { add += "Caller Name: " + item.CallerName + "\nCaller Number: " + item.CallerNumber + "\nLocation: " + item.Location + "'nDescription: " + item.Description + "\nCategory: " + item.Category.Description + "\nAssistance Required: " + item.AssistanceRequired.Assistance + "\nEmergency Level: " + item.Emergency.Level + "\nDate and Time: " + item.TimeStamp; } new_report.ReportDetails = add; new_report.TimeStamp = DateTime.Now; new_report.Approved = true; } summaryReportRepository.addNewReport(new_report); return(new_report); }
//send the report by email public void sendReport(SummaryReport report) { try { //api usage var httpWebRequest = (HttpWebRequest)WebRequest.Create("http://cmsntu.herokuapp.com/email"); httpWebRequest.ContentType = "application/json"; httpWebRequest.Method = "POST"; using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { string json = "{\"To: \":" + "\"" + report.ReportDetails + "\"}"; System.Diagnostics.Debug.WriteLine(json); System.Diagnostics.Debug.WriteLine("==============================================================="); streamWriter.Write(json); streamWriter.Flush(); streamWriter.Close(); var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) { var result = streamReader.ReadToEnd(); } } } catch (Exception ex) { Console.WriteLine(ex); } }
public ActionResult LoadReport2() { var Consumptions = from emp2 in empRepository2.GetAllData() select emp2; SummaryReport rpt = new SummaryReport(); List <SummaryRep> model = new List <SummaryRep>(); model = (List <SummaryRep>)AutoMapper.Mapper.Map(Consumptions, model, typeof(IEnumerable <Consumption>), typeof(List <SummaryRep>)); var gv = new GridView(); gv.DataSource = model; gv.DataBind(); Response.ClearContent(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment; filename=DemoExcel.xls"); Response.ContentType = "application/ms-excel"; Response.Charset = ""; StringWriter objStringWriter = new StringWriter(); HtmlTextWriter objHtmlTextWriter = new HtmlTextWriter(objStringWriter); gv.RenderControl(objHtmlTextWriter); Response.Output.Write(objStringWriter.ToString()); Response.Flush(); Response.End(); return(RedirectToAction("Index")); }
public void ProcessRequest(HttpContext httpContext) { Assert.ArgumentNotNull(httpContext, "httpContext"); string action = httpContext.Request.Params["action"]; if (action == "SummaryReport") { SummaryReport emailInfoRep = new SummaryReport(httpContext.Request.Params["managerroot"]); IEnumerable<SummaryReportMessageInfo> dataItems = emailInfoRep.GetRecentlyDispatched("anything","Updated DESC",0,50); string detailListId = "{2F6E3CBB-0B13-4254-9018-0423D7D4D5DB}"; // an ID of the item to format csv string export = CsvExport.ExportDetailsListToCsv(dataItems, detailListId); string filename = "SummaryReport_Latest_50_Emails_" + DateTime.UtcNow.ToString("yyyyMMddTHHmmssZ"); try { HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ContentType = "text/csv"; HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + filename + ".csv"); HttpContext.Current.Response.Write(export); } catch (Exception exception) { Log.Error(exception.Message, exception, this); } return; } }
//send the report by email public void sendReport(SummaryReport report) { try { //api usage var httpWebRequest = (HttpWebRequest)WebRequest.Create("http://cmsntu.herokuapp.com/email"); httpWebRequest.ContentType = "application/json"; httpWebRequest.Method = "POST"; using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { string json = new JavaScriptSerializer().Serialize(new { to = "*****@*****.**", subject = "Summary Report at: " + DateTime.Now.ToString(), message = report.ReportDetails }); Console.WriteLine(json); streamWriter.Write(json); streamWriter.Flush(); streamWriter.Close(); } var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) { var result = streamReader.ReadToEnd(); } } catch (Exception ex) { Console.WriteLine(ex); } }
public async Task RegisterTradeAsync(Trade trade) { IReadOnlyCollection <SummaryReport> summaryReports = await GetAllAsync(); SummaryReport summaryReport = summaryReports.SingleOrDefault(o => o.AssetPairId == trade.AssetPairId); bool isNew = false; if (summaryReport == null) { summaryReport = new SummaryReport { AssetPairId = trade.AssetPairId }; isNew = true; } summaryReport.ApplyTrade(trade); if (isNew) { await _summaryReportRepository.InsertAsync(summaryReport); } else { await _summaryReportRepository.UpdateAsync(summaryReport); } _cache.Set(summaryReport); }
public FileResult BookSummaryReportExportToExcel(string startDate, string endDate) { List <SummaryReport> objBookSummaryReport = new List <SummaryReport>(); string report_name = string.Empty; try { DataTable dt = objDbTrx.GetBookSummaryRpt(Convert.ToDateTime(startDate + " 00:00:00.000"), Convert.ToDateTime(endDate + " 23:59:59.999")); if (dt.Rows.Count > 0) { for (int iCnt = 0; iCnt < dt.Rows.Count; iCnt++) { /* * long a = default(long); * long.TryParse(dt.Rows[iCnt]["Total_Requisition_QUantity"], out a); */ try { SummaryReport bksr = new SummaryReport(); bksr.DistrictId = Convert.ToInt32(dt.Rows[iCnt]["DISTRICT_ID"].ToString()); bksr.CircleId = Convert.ToInt32(dt.Rows[iCnt]["ID"].ToString()); bksr.CIRCLE_NAME = Convert.ToString(dt.Rows[iCnt]["CIRCLE_NAME"].ToString()); bksr.DistrictName = Convert.ToString(dt.Rows[iCnt]["DISTRICT"].ToString()); bksr.Total_Requisition_Quantity = Convert.ToInt64(dt.Rows[iCnt]["Total_Requisition_QUantity"].ToString()); bksr.recvd_challan_qty = Convert.ToInt64(dt.Rows[iCnt]["recvd_challan_qty"].ToString()); bksr.books_delivered = Convert.ToInt64(dt.Rows[iCnt]["books_delivered"].ToString()); bksr.school_challan_Quantity = Convert.ToInt64(!string.IsNullOrWhiteSpace(dt.Rows[iCnt]["school_challan_Quantity"].ToString()) ? dt.Rows[iCnt]["school_challan_Quantity"].ToString() : "0"); objBookSummaryReport.Add(bksr); } catch { continue; } } } if (objBookSummaryReport != null && objBookSummaryReport.Count() > default(int)) { report_name = DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".xls"; ReportDocument rd = new ReportDocument(); rd.Load(Path.Combine(Server.MapPath("~/Reports"), "rptBookSummaryReport.rpt")); rd.SetDataSource(objBookSummaryReport); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/octet", report_name)); } } catch (Exception ex) { objDbTrx.SaveSystemErrorLog(ex, Request.UserHostAddress); } return(null); }
public StatisticSummaryReportWindow(List <SummaryModel> records, List <SummaryModel> records2, StatisticModel Model) { this.Model = Model; InitializeComponent(); List <SummaryModel> removeRecord = new List <SummaryModel>(); foreach (var item in records) { if (item.Income == 0 && item.Spend == 0 && item.Profit == 0) { removeRecord.Add(item); } } foreach (var item in removeRecord) { records.Remove(item); } removeRecord.Clear(); foreach (var item in records2) { if (item.Income == 0 && item.Spend == 0 && item.Profit == 0) { removeRecord.Add(item); } } foreach (var item in removeRecord) { records2.Remove(item); } this.Text = Model.Title; Assembly asm = Assembly.LoadFrom(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Res.dll")); this.Icon = new Icon(asm.GetManifestResourceStream(@"Oybab.Res.Resources.Images.PC.Statistic.ico")); krpbPrint.Click += (x, y) => { Print(); }; Model.DetailReport = records; Model.DetailReport2 = records2; SummaryReport report = new SummaryReport(Model.Parameters["PriceSymbol"].ToString()); webBrowser1.Refresh(); string htmlContent = report.ProcessHTMLContent(Model); webBrowser1.DocumentText = htmlContent; }
public async Task UpdateAsync(SummaryReport summaryReport) { await _storage.MergeAsync(GetPartitionKey(summaryReport.AssetPairId), GetRowKey(summaryReport.TradeAssetPairId), entity => { Mapper.Map(summaryReport, entity); return(entity); }); }
public async Task InsertAsync(SummaryReport summaryReport) { var entity = new SummaryReportEntity(GetPartitionKey(summaryReport.AssetPairId), GetRowKey(summaryReport.TradeAssetPairId)); Mapper.Map(summaryReport, entity); await _storage.InsertAsync(entity); }
public ActionResult UploadReport(int?SummaryReportID) { SummaryReport sr = db.SummaryReports.Find(SummaryReportID); ViewBag.WorkOrderID = sr.WorkOrderID; ViewBag.SummaryReportID = sr.SummaryReportID; return(View()); }
public SummaryReport GetSummary() { SummaryReport sr = new SummaryReport(); foreach (var item in Categories) { sr.Add(item.GetSummary()); } return(sr); }
public void GetSummary_AssetTest() { Account acc = Init.CreateAccountAsset1(); SummaryReport summ = acc.GetSummary(); Assert.IsTrue( summ.Count == 1 && summ.Get(Init.Asset1()) == acc.Amount ); }
public SummaryReport GetSummary() { SummaryReport sr = new SummaryReport(); foreach (var item in Institutions) { sr.Add(item.GetSummary()); } return(sr); }
public async Task <SummaryReport> GetSummaryReport(int year = 0, int month = 0) { SummaryReport result = null; year = year.Equals(0) ? DateTime.Today.Year : year; month = month.Equals(0) ? DateTime.Today.Month : month; result = await Server.GetSummaryReport(year, month); return(result); }
public ActionResult DeleteConfirmed(int id) { if (Session["userId"] == null) { return(Redirect("/login/index")); } SummaryReport summaryReport = db.SummaryReports.Find(id); db.SummaryReports.Remove(summaryReport); db.SaveChanges(); return(RedirectToAction("Index")); }
public void addNewReport(SummaryReport report) { try { db.SummaryReports.Add(report); db.SaveChanges(); } catch (Exception ex) { Console.WriteLine(ex); } }
public async Task Write(SummaryReport report) { var json = JsonConvert.SerializeObject(report); try { var path = Path.Combine(GetAbsolutePath(), "data.json"); await File.WriteAllTextAsync(path, json); } catch (Exception) { // do nothing } }
public static Bitmap CreateBitmap(TmxMap tmxMap, float scale) { SummaryReport report = new SummaryReport(); report.Capture("Previewing"); // What is the boundary of the bitmap we are creating? RectangleF bounds = CalculateBoundary(tmxMap); Bitmap bitmap = null; try { int width = (int)Math.Ceiling(bounds.Width * scale) + 1; int height = (int)Math.Ceiling(bounds.Height * scale) + 1; bitmap = TmxHelper.CreateBitmap32bpp(width, height); } catch (System.ArgumentException) { StringBuilder warning = new StringBuilder(); warning.AppendFormat("Map cannot be previewed at '{0}' scale. Try a smaller scale.\n", scale); warning.AppendLine("Image will be constructed on a 1024x1024 canvas. Parts of your map may be cropped."); Logger.WriteWarning(warning.ToString()); bitmap = TmxHelper.CreateBitmap32bpp(1024, 1024); } using (Pen pen = new Pen(Color.Black, 1.0f)) using (Graphics g = Graphics.FromImage(bitmap)) { g.InterpolationMode = InterpolationMode.NearestNeighbor; #if !TILED2UNITY_MAC g.PixelOffsetMode = PixelOffsetMode.HighQuality; #endif g.ScaleTransform(scale, scale); g.FillRectangle(Brushes.WhiteSmoke, 0, 0, bounds.Width, bounds.Height); g.DrawRectangle(pen, 1, 1, bounds.Width - 1, bounds.Height - 1); g.TranslateTransform(-bounds.X, -bounds.Y); DrawBackground(g, tmxMap); DrawGrid(g, tmxMap, scale); DrawTiles(g, tmxMap); DrawColliders(g, tmxMap, scale); DrawObjectColliders(g, tmxMap); } report.Report(); return(bitmap); }
public ActionResult Edit([Bind(Include = "Id,ReportDetails")] SummaryReport summaryReport) { if (Session["userId"] == null) { return(Redirect("/login/index")); } if (ModelState.IsValid) { db.Entry(summaryReport).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(summaryReport)); }
public static Bitmap CreateBitmap(TmxMap tmxMap, float scale) { SummaryReport report = new SummaryReport(); report.Capture("Previewing"); // What is the boundary of the bitmap we are creating? RectangleF bounds = CalculateBoundary(tmxMap); Bitmap bitmap = null; try { int width = (int)Math.Ceiling(bounds.Width * scale) + 1; int height = (int)Math.Ceiling(bounds.Height * scale) + 1; bitmap = TmxHelper.CreateBitmap32bpp(width, height); } catch (System.ArgumentException) { StringBuilder warning = new StringBuilder(); warning.AppendFormat("Map cannot be previewed at '{0}' scale. Try a smaller scale.\n", scale); warning.AppendLine("Image will be constructed on a 1024x1024 canvas. Parts of your map may be cropped."); Logger.WriteWarning(warning.ToString()); bitmap = TmxHelper.CreateBitmap32bpp(1024, 1024); } using (Pen pen = new Pen(Color.Black, 1.0f)) using (Graphics g = Graphics.FromImage(bitmap)) { g.InterpolationMode = InterpolationMode.NearestNeighbor; #if !TILED2UNITY_MAC g.PixelOffsetMode = PixelOffsetMode.HighQuality; #endif g.ScaleTransform(scale, scale); g.FillRectangle(Brushes.WhiteSmoke, 0, 0, bounds.Width, bounds.Height); g.DrawRectangle(pen, 1, 1, bounds.Width - 1, bounds.Height - 1); g.TranslateTransform(-bounds.X, -bounds.Y); DrawBackground(g, tmxMap); DrawGrid(g, tmxMap); DrawTiles(g, tmxMap); DrawColliders(g, tmxMap, scale); DrawObjectColliders(g, tmxMap); } report.Report(); return bitmap; }
public ActionResult FileUploadSuccess(int?AssayID) { List <WorkOrder> woList = new List <WorkOrder>(); List <Assay> assayList = new List <Assay>(); assayList = db.Assays.ToList(); List <DataReport> drList = new List <DataReport>(); Assay a = db.Assays.Find(AssayID); List <Assay> assaysInThisWorkOrder = new List <Assay>(); foreach (Assay assay in assayList) { if (assay.WorkOrderID == a.WorkOrderID) { assaysInThisWorkOrder.Add(assay); } } bool AllDRAreFinished = true; foreach (Assay assay in assaysInThisWorkOrder) { var dr = db.DataReports.Where(x => x.AssayID == assay.AssayID).FirstOrDefault(); if (dr == null) { AllDRAreFinished = false; } else { if (dr.DataReportPath == null) { AllDRAreFinished = false; } } } if (AllDRAreFinished) { SummaryReport sr = new SummaryReport(); sr.WorkOrderID = a.WorkOrderID; db.SummaryReports.Add(sr); db.SaveChanges(); } WorkOrder wo = db.WorkOrders.Find(a.WorkOrderID); ViewBag.AssayID = AssayID; return(View()); }
static void Main(string[] args) { var key = DataImporter.ImportKey(); Console.WriteLine($"The Key has {key.Answers.Count} answers"); var testResults = DataImporter.ImportTestData(); SummaryReport.GenerateTestSummaryReport(BaseReportPath, key, testResults); //ISchoolReport schoolReport = new SchoolCsvReport(); ISchoolReport schoolReport = new SchoolExcelReport(); schoolReport.GenerateSchoolReports(BaseReportPath, testResults, key); }
public static SKBitmap CreatePreviewBitmap(TmxMap tmxMap, float scale) { SummaryReport report = new SummaryReport(); report.Capture("Previewing"); // Set our scale to be used throughout the image Scale = scale; // What is the boundary of the bitmap we are creating? SKRect bounds = CalculateBoundary(tmxMap); SKBitmap bitmap = null; try { int width = (int)Math.Ceiling(bounds.Width * scale); int height = (int)Math.Ceiling(bounds.Height * scale); bitmap = new SKBitmap(width, height); } catch { StringBuilder warning = new StringBuilder(); warning.AppendFormat("Map cannot be previewed at '{0}' scale. Try a smaller scale.\n", scale); warning.AppendLine("Image will be constructed on a 2048x2048 canvas. Parts of your map may be cropped."); Logger.WriteWarning(warning.ToString()); bitmap = new SKBitmap(2048, 2048); } using (SKCanvas canvas = new SKCanvas(bitmap)) using (SKPaint paint = new SKPaint()) using (new SKAutoCanvasRestore(canvas)) { // Apply scale then translate canvas.Clear(SKColors.WhiteSmoke); canvas.Scale(scale, scale); canvas.Translate(-bounds.Left, -bounds.Top); // Draw all the elements of the previewer DrawBackground(canvas, bounds); DrawGrid(canvas, tmxMap); DrawAllTilesInLayerNodes(canvas, tmxMap, tmxMap.LayerNodes); DrawAllCollidersInLayerNodes(canvas, tmxMap, tmxMap.LayerNodes); } report.Report(); return(bitmap); }
public ActionResult LoadReport() { var Consumptions = from emp2 in empRepository2.GetAllData() select emp2; SummaryReport rpt = new SummaryReport(); List <SummaryRep> model = new List <SummaryRep>(); model = (List <SummaryRep>)AutoMapper.Mapper.Map(Consumptions, model, typeof(IEnumerable <Consumption>), typeof(List <SummaryRep>)); rpt.Load(); rpt.SetDataSource(model); DataSet ds = new DataSet(); Stream s = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return(File(s, "application/pdf")); }
public ActionResult SummaryReport() { UserStatistics userStats = new UserStatistics(); ProfitSummary profit = new ProfitSummary(); userStats.calculateUserStats(); profit.CalculateGrossIncome(); SummaryReport summary = new SummaryReport() { userStatistics = userStats, profit = profit }; return(View(summary)); }
/// <summary> /// Populates the SummaryReport template. /// </summary> /// <param name="templateData"></param> private static void WriteSummaryReport(SummaryReportSharedData templateData) { var htmlWriterForSummaryReport = new HtmlTextWriter(new StreamWriter(SUMMARY_FILENAME)); var template = new SummaryReport(); template.Session = new Dictionary <string, object>() { { "SharedDataObject", templateData } }; template.Initialize(); htmlWriterForSummaryReport.WriteLine(template.TransformText()); htmlWriterForSummaryReport.Close(); htmlWriterForSummaryReport.Dispose(); htmlWriterForSummaryReport = null; }
// GET: SummaryReports/Edit/5 public ActionResult Edit(int?id) { if (!loginHelper.isAuthorized(Convert.ToInt32(Session["userRole"]), roleRequired)) { return(RedirectToAction("NotAuthorized", "Error")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SummaryReport summaryReport = db.SummaryReports.Find(id); if (summaryReport == null) { return(HttpNotFound()); } return(View(summaryReport)); }
// GET: SummaryReports/Delete/5 public ActionResult Delete(int?id) { if (Session["userId"] == null) { return(Redirect("/login/index")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SummaryReport summaryReport = db.SummaryReports.Find(id); if (summaryReport == null) { return(HttpNotFound()); } return(View(summaryReport)); }
//sendcrisis for approval when a level 3 crisis is made public void sendCrisis(Crisis crisis) { Console.WriteLine("Crisis Level 3"); var new_report = new SummaryReport(); string add = ""; add += "Caller Name: " + crisis.CallerName + "\nCaller Number: " + crisis.CallerNumber + "\nLocation: " + crisis.Location + "'nDescription: " + crisis.Description + "\nCategory: " + crisis.Category.Description + "\nAssistance Required: " + crisis.AssistanceRequired.Assistance + "\nEmergency Level: " + crisis.Emergency.Level + "\nDate and Time: " + crisis.TimeStamp; new_report.ReportDetails = add; summaryReportRepository.addNewReport(new_report); new_report.TimeStamp = DateTime.Now; }
/// <summary> /// Get Summary Report of Travel /// </summary> /// <param name="airtravelDetail"></param> /// <returns></returns> private string GetSummaryReport(AirTravelDetail airtravelDetail) { try { var summaryReport = new SummaryReport(airtravelDetail) { TotalPassengerCount = airtravelDetail.PassengerDetails.Count, GeneralPassengerCount = airtravelDetail.PassengerDetails.Count(x => x.Type == PassengerType.general), AirlinePassengerCount = airtravelDetail.PassengerDetails.Count(x => x.Type == PassengerType.airline), LoyaltyPassengerCount = airtravelDetail.PassengerDetails.Count(x => x.Type == PassengerType.loyalty), TotalLoyaltyPointsRedeemed = airtravelDetail.PassengerDetails.Where(x => x.IsRedeemed).Sum(x => x.LoyaltyPoints), }; return summaryReport.ToString(); } catch (CustomException) { throw; } }