public async Task <ActionResult> InternationalConnote(string crId, string cId) { LoadData <ConsigmentRequest> lo = await GetConsigmentRequest(crId); var item = lo.Source; var connote = new Consignment(); foreach (var consignment in item.Consignments) { if (consignment.WebId == cId) { connote = consignment; break; } } connote.Pemberi.Address.Postcode = int.Parse(Regex.Replace(connote.Pemberi.Address.Postcode, @"\D", "")).ToString("D5"); UserProfile userProfile = await GetDesignation(); var pcm = new printConnoteModel { referenceNo = item.ReferenceNo, consignment = connote, accountNo = item.UserId, pickupDate = (item.Payment.IsPickupScheduled ? item.Pickup.DateReady : item.ChangedDate), designation = userProfile.Designation, }; return(View(pcm)); }
public async Task <ActionResult> CommercialInvoice(string crId, string cId) { LoadData <ConsigmentRequest> lo = await GetConsigmentRequest(crId); var item = lo.Source; var connote = new Consignment(); foreach (var consignment in item.Consignments) { if (consignment.WebId == cId) { connote = consignment; break; } } var query = $@"{{ ""filter"": {{ ""query"": {{ ""bool"": {{ ""must"": [ {{ ""term"": {{ ""Abbreviation"": ""{connote.Penerima.Address.Country}"" }} }} ] }} }} }} }}"; var repos = ObjectBuilder.GetObject <IReadonlyRepository <Country> >(); var response = await repos.SearchAsync(query); var json = JObject.Parse(response).SelectToken("$.hits.hits"); var searchedCountry = json.First.SelectToken("_source").ToObject <Country>(); connote.Penerima.Address.Country = searchedCountry.Name; var printCommercialInvoiceModel = new printConnoteModel { referenceNo = item.ReferenceNo, consignment = connote, accountNo = item.UserId, amountPaid = item.Payment.TotalPrice, pickupDate = (item.Payment.IsPickupScheduled ? item.Pickup.DateReady : item.ChangedDate), designation = item.Designation, volMetricWeight = (connote.Produk.Width * connote.Produk.Length * connote.Produk.Height) / 6000, }; return(View(printCommercialInvoiceModel)); }