Example #1
0
        // GET: /Warehouse/Create
        public ActionResult Create()
        {
            if (!caSession.AuthoriseSession())
            {
                return(Redirect((string)Session["ErrorUrl"]));
            }
            ViewBag.TenantLocations = LookupServices.GetAllWarehousesForTenant(CurrentTenantId).Select(m => new SelectListItem()
            {
                Value = m.WarehouseId.ToString(), Text = m.WarehouseName
            });

            ViewBag.AllTerminals = _terminalServices.GetAllTerminalsWithoutMobileLocationLinks(CurrentTenantId).Select(m => new SelectListItem()
            {
                Value = m.TerminalId.ToString(), Text = m.TerminalName + " " + m.TermainlSerial
            });
            ViewBag.AllDrivers = _employeeServices.GetAllEmployeesWithoutResourceLinks(CurrentTenantId).Select(m => new SelectListItem()
            {
                Value = m.AuthUserId.ToString(), Text = m.SurName + " " + m.FirstName
            });

            ViewBag.CountryId   = new SelectList(LookupServices.GetAllGlobalCountries(), "CountryId", "CountryName");
            ViewBag.AllVehicles = _marketServices.GetAllValidMarketVehicles(CurrentTenantId).MarketVehicles.Select(m => new SelectListItem()
            {
                Value = m.Id.ToString(), Text = m.Name
            });
            return(View());
        }
        public ActionResult Vehicles()
        {
            var results = _marketServices.GetAllValidMarketVehicles(CurrentTenantId);

            if (!caSession.AuthoriseSession())
            {
                return(Redirect((string)Session["ErrorUrl"]));
            }

            return(View("~/Views/MarketsVehicle/Index.cshtml", results));
        }
Example #3
0
        // GET http://localhost:8005/api/sync/vehicles/{reqDate}/{serialNo}
        public IHttpActionResult GetAllVehicles(DateTime reqDate, string serialNo)
        {
            serialNo = serialNo.Trim().ToLower();

            var terminal = TerminalServices.GetTerminalBySerial(serialNo);

            if (terminal == null)
            {
                return(Unauthorized());
            }

            var result = new MarketVehiclesSyncCollection();

            var allVehicles = _marketServices.GetAllValidMarketVehicles(terminal.TenantId, reqDate, true).MarketVehicles;

            var results = new List <MarketVehiclesSync>();

            foreach (var p in allVehicles)
            {
                var sync   = new MarketVehiclesSync();
                var mapped = AutoMapper.Mapper.Map(p, sync);
                results.Add(mapped);
            }

            result.Count         = results.Count;
            result.TerminalLogId = TerminalServices.CreateTerminalLog(reqDate, terminal.TenantId, results.Count, terminal.TerminalId,
                                                                      TerminalLogTypeEnum.MarketVehiclesSync).TerminalLogId;
            result.Vehicles = results;
            return(Ok(result));
        }
 public ActionResult DispatchPallets(PalletDispatchViewModel model)
 {
     model.AllVehicles = _marketServices.GetAllValidMarketVehicles(CurrentTenantId).MarketVehicles
                         .Select(m => new SelectListItem()
     {
         Text = m.Name, Value = m.Id.ToString()
     });
     model.AllDrivers = _employeeServices.GetAllEmployees(CurrentTenantId)
                        .Select(m => new SelectListItem()
     {
         Text = m.Name, Value = m.ResourceId.ToString()
     });
     model.AllSentMethods = _palletingService.GetAllSentMethods()
                            .Select(m => new SelectListItem()
     {
         Text = m.Name, Value = m.SentMethodID.ToString()
     });
     model.DispatchRefrenceNumber       = GaneStaticAppExtensions.GenerateDateRandomNo();
     ViewBag.ControllerName             = "Pallets";
     Session["UploadedPalletEvidences"] = null;
     return(PartialView("_PalletDisptachDetail", model));
 }
        public ActionResult Edit(int? id, int vehicleId=0)
        {
            if (!caSession.AuthoriseSession()) { return Redirect((string)Session["ErrorUrl"]); }

            var model = new VehicleInspectionViewModel { MarketVehicleId = vehicleId };
            if (id.HasValue && id > 0)
            {
                model = _inspectionService.GetVehicleInspectionById(id.Value);
                if (model.Id < 1) return HttpNotFound();
            }
            model.CheckList = _inspectionService.GetAllInspectionCheckLists(CurrentTenantId);
            model.AllEmployees = _inspectionService.GetAllVehicleDrivers(CurrentTenantId);
            model.AllVehicles = _marketServices.GetAllValidMarketVehicles(CurrentTenantId).MarketVehicles;
           
            return View("_CreateEdit", model);
        }