public ActionResult FuelAndLubricant() { IPumpstationService pumpstationService = new PumpstationService(); ViewBag.PumpStations = ModelMapper.GetPumpStationModelList(pumpstationService.GetAllPumpstations()); return View(); }
public ActionResult Print(int id) { IVehicleService vehicleServcie = new VehicleService(); IProjectService projectService = new ProjectService(); IPumpstationService pumpstationService = new PumpstationService(); var pumpstations = pumpstationService.GetAllPumpstations(); var projects = projectService.GetAllActiveProjects(); var lubricants = vehicleServcie.GetAllLubricantTypes(); var vehicles = vehicleServcie.GetAllVehicles(); var chart = runningchartService.GetRunningChart(id); dsRunningchart ds = new dsRunningchart(); DataTable runningchartTable = ds.Tables["Runningchart"].Clone(); DataTable runningchartDetailsTable = ds.Tables["RunningchartDetails"].Clone(); DataTable runningchartPumpstationsTable = ds.Tables["RunningchartPumpstation"].Clone(); DataTable runningchartLubricantsTable = ds.Tables["RunningchartLubricant"].Clone(); PopulateRunningchartTable(chart, runningchartTable, vehicles); PopulateRunningchartDetailsTable(chart.RunningchartDetails, runningchartDetailsTable, projects); PopulateRunningchartPumpstationTable(chart.RunningchartPumpstation, runningchartPumpstationsTable, pumpstations); PopulateRunningchartLubricantTable(chart.RunningchartLubricants, runningchartLubricantsTable, pumpstations, lubricants); ReportClass reportClass = new ReportClass(); reportClass.FileName = Server.MapPath("~/Reports/Runningchart.rpt"); reportClass.Load(); reportClass.SummaryInfo.ReportTitle = "Running Chart"; reportClass.Database.Tables["Runningchart"].SetDataSource(runningchartTable); reportClass.Database.Tables["RunningchartDetails"].SetDataSource(runningchartDetailsTable); reportClass.Database.Tables["RunningchartPumpstation"].SetDataSource(runningchartPumpstationsTable); reportClass.Database.Tables["RunningchartLubricant"].SetDataSource(runningchartLubricantsTable); Stream compStream = reportClass.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return File(compStream, "application/pdf"); }
private RunningchartModel GetRunningchartModel(int runningChartId) { IVehicleService vehicleServcie = new VehicleService(); IProjectService projectService = new ProjectService(); IPumpstationService pumpstationService = new PumpstationService(); var chart = runningchartService.GetRunningChart(runningChartId); var model = ModelMapper.GetRunningchartModel(chart); model.Vehicles = ModelMapper.GetVehicleModelList(vehicleServcie.GetAllVehicles()); model.Lubricants = ModelMapper.GetLubricantModelList(vehicleServcie.GetAllLubricantTypes()); model.Projects = ModelMapper.GetProjectModelList(projectService.GetAllActiveProjects()); model.Pumpstations = ModelMapper.GetPumpStationModelList(pumpstationService.GetAllPumpstations()); model.VehicleRentalTypes = new List<VehicleRentalTypeModel>() { new VehicleRentalTypeModel() { Id = (int)RentalType.Company, RentalTypeName = StringEnum.GetEnumStringValue(RentalType.Company) }, new VehicleRentalTypeModel() { Id = (int)RentalType.CompanyHired, RentalTypeName = StringEnum.GetEnumStringValue(RentalType.CompanyHired) }, new VehicleRentalTypeModel() { Id = (int)RentalType.Hired, RentalTypeName = StringEnum.GetEnumStringValue(RentalType.Hired) } }; // Not worth to do a DB call since this is very static return model; }
public ActionResult PoulatePumpstationItems(bool isAddingNewItem) { RunningchartModel model = new RunningchartModel(); List<ChartPumpstationItemModel> existingPumpstationItems = new List<ChartPumpstationItemModel>(); UpdateModel<List<ChartPumpstationItemModel>>(existingPumpstationItems); IPumpstationService pumpstationService = new PumpstationService(); model.Pumpstations = ModelMapper.GetPumpStationModelList(pumpstationService.GetAllPumpstations()); model.SelectedPumpstations = new List<ChartPumpstationItemModel>(); // Add existing chart items foreach (var item in existingPumpstationItems) { if (!item.IsRemoving) { model.SelectedPumpstations.Add(item); } } // Add new chart item if (isAddingNewItem) { model.SelectedPumpstations.Add(new ChartPumpstationItemModel() { SelectedPumpstationId = 0, PumpAmount = 0 }); } return PartialView("_Pumpstations", model); }