//for pagination// public IQueryable <SectorSalesReportModel> GetSectorSalesReportByPagination(SectorSalesReportModel m, int pageNo, out int currentPageNo, out int numberOfPages, int?flag) { int pageSize = 30; //(int)AirLines.Helpers.PageSize.JePageSize; int rowCount = m.SegmentSalesReportList.Count(); numberOfPages = (int)Math.Ceiling((decimal)rowCount / (decimal)pageSize); if (flag != null)//Checking for next/Previous { if (flag == 1) { if (pageNo != 1) //represents previous { pageNo -= 1; } } if (flag == 2) { if (pageNo != numberOfPages)//represents next { pageNo += 1; } } } currentPageNo = pageNo; int rowsToSkip = (pageSize * currentPageNo) - pageSize; IQueryable <SectorSalesReportModel> pagingdata = m.SegmentSalesReportList.Skip(rowsToSkip).Take(pageSize).AsQueryable(); return(pagingdata.AsQueryable()); }
public ActionResult Index(int?pageNo, int?flag) { SectorSalesReportModel model = new SectorSalesReportModel(); //if (Request.IsAjaxRequest()) //{ // model.SegmentSalesReportList = ser.ListSegmentSalesReport(model.FromDate, model.ToDate, model.DepartCityId, model.ArriveCityId, model.AgentId, model.AirlineTypesId); // return PartialView("ListPartial", model); //} ViewData["AgentList"] = new SelectList(defaultProvider.GetAgentList(), "AgentId", "AgentName"); ViewData["CityList"] = new SelectList(ser.GetCityList(model.AirlineTypesId), "CityID", "CityName"); ViewData["AirlineTypes"] = new SelectList(ser.GetAirlineTypesList(), "AirineTypeId", "TypeName"); model.FromDate = DateTime.Now.AddDays(-15); model.ToDate = DateTime.Now; int?DCity; if (model.DepartCityId == 0) { DCity = null; } else { DCity = model.DepartCityId; } int?ACity; if (model.ArriveCityId == 0) { ACity = null; } else { ACity = model.ArriveCityId; } model.SegmentSalesReportList = ser.ListSegmentSalesReport(model.FromDate, model.ToDate, DCity, ACity, model.AgentId, model.AirlineTypesId); //int currentPageNo = 0; int numberOfPage = 0; //if (pageNo == null) // pageNo = 1; //model.SegmentSalesReportList = ser.GetSectorSalesReportByPagination(model, pageNo.Value, out currentPageNo, out numberOfPage, flag); return(View(model)); }
public ActionResult Detail(int DepartCityId, int ArriveCityId, DateTime FromDate, DateTime Todate) { if (Request.IsAjaxRequest()) { var viewModel = new SectorSalesReportModel { SegmentSalesDetailsReportList = ser.GetSegmentSalesDetailsReport(FromDate, Todate, DepartCityId, ArriveCityId) }; return(PartialView("Detail", viewModel)); } else { return(View()); } }
public List <SectorSalesReportModel> ListSegmentSalesReport(DateTime fromdate, DateTime todate, int?departsId, int?arriveId, int?agentId, int airlinetypeId) { var data = ent.Air_GetSegmentSalesReport(fromdate, todate, departsId, arriveId, agentId); List <SectorSalesReportModel> model = new List <SectorSalesReportModel>(); foreach (var item in data.Select(x => x)) { var SectorSalesReportModel = new SectorSalesReportModel(); SectorSalesReportModel.TicketStatusName = item.TicketStatusName; SectorSalesReportModel.DepartCityId = item.DepartCityId; SectorSalesReportModel.ArriveCityId = item.ArriveCityId; SectorSalesReportModel.DepartCity = item.Depart; SectorSalesReportModel.ArriveCity = item.Arrive; SectorSalesReportModel.SegmentId = item.Segment_; TotalMainSegment = TotalMainSegment + (Decimal)item.Segment_; SectorSalesReportModel.txtSumMainSegment = TotalMainSegment; if (SectorSalesReportModel.TicketStatusName == "Booked") { TotalBookedTicketStatus = TotalBookedTicketStatus + (Decimal)item.Segment_; } else if (SectorSalesReportModel.TicketStatusName == "Cancelled") { TotalCancelledTicketStatus = TotalCancelledTicketStatus + (Decimal)item.Segment_; } SectorSalesReportModel.txtSumTotalBookedTicketStatus = TotalBookedTicketStatus; SectorSalesReportModel.txtSumTotalCancelledTicketStatus = TotalCancelledTicketStatus; Difference = TotalBookedTicketStatus - TotalCancelledTicketStatus; SectorSalesReportModel.txtDifference = Difference; model.Add(SectorSalesReportModel); } return(model); }
public IEnumerable <SectorSalesReportModel> GetSegmentSalesDetailsReport(DateTime?fromdate, DateTime?todate, int?departcityId, int?arrivecityId) { IEnumerable <Air_GetSegmentSalesDetailsReport_Result> result = ent.Air_GetSegmentSalesDetailsReport(fromdate, todate, departcityId, arrivecityId).AsQueryable(); List <SectorSalesReportModel> model = new List <SectorSalesReportModel>(); foreach (var item in result.Select(x => x)) { var obj = new SectorSalesReportModel(); obj.TicketStatusName = item.TicketStatusName; obj.Agent = item.AgentName; obj.SegmentId = item.Segment_; TotalSegment = TotalSegment + (Decimal)item.Segment_; obj.txtSumSegment = TotalSegment; if (obj.TicketStatusName == "Booked") { TotalBookedTicketStatus = TotalBookedTicketStatus + (Decimal)item.Segment_; } else if (obj.TicketStatusName == "Cancelled") { TotalCancelledTicketStatus = TotalCancelledTicketStatus + (Decimal)item.Segment_; } obj.txtSumTotalBookedTicketStatus = TotalBookedTicketStatus; obj.txtSumTotalCancelledTicketStatus = TotalCancelledTicketStatus; Difference = TotalBookedTicketStatus - TotalCancelledTicketStatus; obj.txtDifference = Difference; model.Add(obj); } return(model.AsEnumerable()); }
public ActionResult Index(ExportModel Expmodel, SectorSalesReportModel model, FormCollection frm, int?pageNo, int?flag) { //if (Request.IsAjaxRequest()) //{ int?DCity; if (model.hdfDepartCityId == 0) { DCity = null; } else { DCity = model.hdfDepartCityId; } int?ACity; if (model.hdfArriveCityId == 0) { ACity = null; } else { ACity = model.hdfArriveCityId; } var AgentList = ent.Agents.ToList(); ViewData["AgentList"] = new SelectList(AgentList, "AgentId", "AgentName", 0); //int? agentId; // if (model.AgentId == 0) // agentId = null; //else // agentId = model.AgentId; var viewModel = new SectorSalesReportModel { SegmentSalesReportList = ser.ListSegmentSalesReport(model.FromDate, model.ToDate, DCity, ACity, model.AgentId, model.AirlineTypesId) }; //int currentPageNo = 0; int numberOfPage = 0; //if (pageNo == null) // pageNo = 1; //model.SegmentSalesReportList = ser.GetSectorSalesReportByPagination(viewModel, pageNo.Value, out currentPageNo, out numberOfPage, flag); //ViewData["TotalPages"] = numberOfPage; //ViewData["CurrentPage"] = currentPageNo; //export ctrBKT.GetExportTypeClicked(Expmodel, frm); if (Expmodel != null && (Expmodel.ExportTypeExcel != null || Expmodel.ExportTypeWord != null || Expmodel.ExportTypeCSV != null || Expmodel.ExportTypePdf != null)) { try { if (Expmodel.ExportTypeExcel != null) { Expmodel.ExportTypeExcel = Expmodel.ExportTypeExcel; } else if (Expmodel.ExportTypeWord != null) { Expmodel.ExportTypeWord = Expmodel.ExportTypeWord; } else if (Expmodel.ExportTypePdf != null) { Expmodel.ExportTypePdf = Expmodel.ExportTypePdf; } var exportData = viewModel.SegmentSalesReportList.Select(m => new { Departure_City = m.DepartCity, Arrival_City = m.ArriveCity, Segment = m.SegmentId }); App_Class.AppCollection.Export(Expmodel, exportData, "SectorSales "); } catch (Exception ex) { TempData["ActionResponse"] = ex.Message; } } viewModel.FromDate = model.FromDate; viewModel.ToDate = model.ToDate; // return PartialView("ListPartial", viewModel); // } //return View(); ViewData["AgentList"] = new SelectList(defaultProvider.GetAgentList(), "AgentId", "AgentName"); ViewData["CityList"] = new SelectList(ser.GetCityList(model.AirlineTypesId), "CityID", "CityName"); ViewData["AirlineTypes"] = new SelectList(ser.GetAirlineTypesList(), "AirineTypeId", "TypeName"); return(View(viewModel)); }