private void UpdateGridCarrierData() { var totalRow = 0; ViewData["CarrierTypes"] = CarrierTypes; var page = carriedGrid.Pager; var sort = new SSM.Services.SortField(string.IsNullOrEmpty(page.Sidx) ? "CarrierAirLineName" : page.Sidx, page.Sord == "asc"); //IEnumerable<ca> customers = customerServices.GetAll(_customerGrid.SearchCriteria, sort, out totalRow, page.CurrentPage, page.PageSize); var qr = carrierService.GetAll(carriedGrid.SearchCriteria); if (!CurrenUser.IsAdmin()) { qr = qr.Where(x => x.IsHideUser == false); } qr = qr.OrderBy(sort); totalRow = qr.Count(); carriedGrid.Pager.Init(totalRow); if (totalRow == 0) { carriedGrid.Data = new List <CarrierAirLine>(); return; } carriedGrid.Data = carrierService.GetListPager(qr, page.CurrentPage, page.PageSize); }
public IList <Carrier> GetCarrierToRating(string userId) { var carrierList = _carrierService.GetAll(); var ratingList = _repositoryBase.GetAll().Where(x => x.User.GetStringId().Equals(userId)); return(carrierList); }
public ActionResult Index() { var carriers = _carrierService.GetAll(); var carrierViewModel = new CarrierViewModel(); carrierViewModel.SetCarriersList(carriers); return(View(carrierViewModel)); }
// GET: Transport/Create public IActionResult Create() { log.Info(nameof(TransportsController.Create)); try { ViewData["RouteId"] = new SelectList(routeService.GetRoutes().Select(a => new { a.Id, a.Number }), "Id", "Number"); ViewData["CarrierId"] = new SelectList(carrierService.GetAll().Select(a => new { a.Id, a.Name }), "Id", "Name"); return(View()); } catch (Exception e) { log.Error(e); return(BadRequest()); } }
public override ActionResult Edit(long?id, string redirectUrl) { ViewBag.RedirectUrl = redirectUrl; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EntityViewModel = Service.GetById((long)id); if (EntityViewModel == null) { return(HttpNotFound()); } ViewBag.CarrierId = new SelectList(CarrierService.GetAll(), "Id", "Name", EntityViewModel.CarrierId); return(View(EntityViewModel)); }
protected override void Initialize(RequestContext requestContext) { base.Initialize(requestContext); _freightService = new FreightServicesImpl(); _shipmentService = new ShipmentServicesImpl(); carrierService = new CarrierService(); agentService = new AgentService(); areaService = new AreaService(); servicesType = new ServicesTypeServices(); ViewData["CountryList"] = new SelectList(agentService.GetAllCountry(), "Id", "CountryName"); ViewData["AirlineList"] = carrierService.GetAll(x => x.Type == CarrierType.AirLine.ToString()); ViewData["CarrierList"] = carrierService.GetAll(x => x.Type == CarrierType.ShippingLine.ToString()); ViewData["AgentList"] = agentService.GetAll(); List <String> List1 = new List <String>(); ViewData["AreaListDep"] = new SelectList(List1); ViewData["AreaListDes"] = new SelectList(List1); ViewData["ServiceList"] = Services; User1 = (User)Session[AccountController.USER_SESSION_ID]; }
// GET: Carrier public IActionResult Index(int?page) { int pageSize = 8; int pageNumber = (page ?? 1); double averageRate = 0; int sum = 0; var carrier = Mapper.Map <IEnumerable <CarrierDto>, IEnumerable <CarrierViewModel> >(_carrierService.GetAll()); foreach (var item in carrier) { var rate = _feedbackService.GetAll(x => x.CarrierId == item.Id); foreach (var k in rate) { sum += k.Rating; } if (rate.Count() != 0) { averageRate = sum / rate.Count(); } ViewData.Add($"{item.Id}", averageRate); averageRate = 0; sum = 0; } return(View(carrier.ToPagedList(pageNumber, pageSize))); }
public override Result <IEnumerable <SelectListItem> > GetSelectList() { try { return(Result.Ok(service.GetAll().Where(c => c.Active).Select(c => new SelectListItem { Text = c.Name, Value = c.Id.ToString() }))); } catch (Exception e) { return(Result.Fail <IEnumerable <SelectListItem> >(e.Message)); } }
public IActionResult GetAll() { log.Info(nameof(GetAll)); try { return(Ok(carrierService.GetAll())); } catch (Exception e) { log.Error(e); return(BadRequest()); } }
public async Task <IActionResult> GetCarriers() { const string loggerHeader = "GetCarriers -"; _logService.Info($"{loggerHeader} Start"); var result = new ApiJsonResult(); try { var userLogin = await _userService.GetCurrentUserLogin(HttpContext); _logService.Info($"{loggerHeader} with tenantId {userLogin?.TenantId}"); result.Data = await _carrierService.GetAll(userLogin?.TenantId); } catch (Exception ex) { _logService.Error($"{loggerHeader} Throw error {ex.Message}"); result.Code = CodeModel.Fail; result.Message = ex.Message; } return(Ok(result)); }
public ActionResult EditFreight(int id) { Freight Freight1 = _freightService.getFreightById(id); FreightModel FreightModel1 = null; if (Freight1 == null) { return(RedirectToAction("ListFreight", new { Id = 0, FreightType = FreightModel.FreightTypes.OceanFreight.ToString() })); } else { FreightModel1 = FreightModel.ConvertFreight(Freight1); FreightModel1.CountryNameDep = Freight1.Area.CountryId == null ? 0 : Freight1.Area.CountryId.Value; FreightModel1.CountryNameDes = Freight1.Area1.CountryId == null ? 0 : Freight1.Area1.CountryId.Value; IEnumerable <Area> AreaListDep = _shipmentService.getAllAreaByCountry(FreightModel1.CountryNameDep); IEnumerable <Area> AreaListDes = _shipmentService.getAllAreaByCountry(FreightModel1.CountryNameDes); ViewData["AreaListDep"] = new SelectList(AreaListDep, "Id", "AreaAddress"); ViewData["AreaListDes"] = new SelectList(AreaListDes, "Id", "AreaAddress"); viewServerFiles(Freight1); } if (FreightModel1.Type.Equals(CarrierType.AirLine.ToString())) { ViewData["ALLCarrierList"] = carrierService.GetAllByType(CarrierType.AirLine.ToString()); } else if (FreightModel1.Type.Equals(CarrierType.ShippingLine.ToString())) { ViewData["ALLCarrierList"] = carrierService.GetAllByType(CarrierType.ShippingLine.ToString()); } else { ViewData["ALLCarrierList"] = carrierService.GetAll(); } ViewData["FreightTypes"] = FreightTypes; return(View(FreightModel1)); }
public IEnumerable <Carrier> GetAll() { return(_carrierService.GetAll()); }