// GET: Shipment public ActionResult Index() { var shipmentBL = _service.GetAll().ToList(); var shipment = _mapper.Map <IEnumerable <ShipmentViewModel> >(shipmentBL); return(View(shipment)); }
public async Task <IEnumerable <ShipmentModel> > GetAll(int customerId, int filterType, bool inPending, int startItem, int numberOfRetrievedItems, string language) { var currentUser = await _authenticationService.GetUser(User.Identity.Name); if (currentUser.CustomerId != customerId) { throw new HttpResponseException(HttpStatusCode.InternalServerError, "Provided customer is not assigned to your account"); } language.ConvertLocaleStringToServerLanguage(); if (currentUser.CustomerId != customerId) { throw new HttpResponseException(HttpStatusCode.InternalServerError, "Provided customer is not assigned to your account"); } var searchFilter = new FilterShipment { CustomerId = currentUser.CustomerId.Value, StartItem = startItem, Amount = numberOfRetrievedItems, TransporterStatus = (ShipmentTransporterStatus)filterType, Pending = inPending, Declined = !inPending }; var shipments = await _shipmentService.GetAll(searchFilter); return(shipments.OrderByDescending(item => item.Id)); }
public async Task Test_GetShipmentAll_Is_Ok() { try { List <ShipmentModel> currentAddressModel = await _shipmentService.GetAll(new FilterShipment { CustomerId = 1, StartItem = 0, Amount = 50 }); } catch (Exception ex) { Assert.IsFalse(true); } Assert.IsTrue(true); }
public static string GenerateDeliveryNum(OrderShipmentModel model) { var currentDocument = service.GetAll(AuthenticationHelper.CompanyId.Value, SessionHelper.SOBId).OrderByDescending(rec => rec.Id).FirstOrDefault(); string newDocNo = ""; if (currentDocument != null) { int outVal; bool isNumeric = int.TryParse(currentDocument.DeliveryNo, out outVal); if (isNumeric && currentDocument.DeliveryNo.Length == 8) { newDocNo = (int.Parse(currentDocument.DeliveryNo) + 1).ToString(); return(newDocNo); } } //Create New DocNum.. string yearDigit = model.DeliveryDate.ToString("yy"); string monthDigit = model.DeliveryDate.ToString("MM"); string docNo = int.Parse("1").ToString().PadLeft(4, '0'); return(yearDigit + monthDigit + docNo); }