public async Task <IEnumerable <PackageTypes> > SearchPackageTypes(List <string> lst, List <string> includeLst = null) { using (var ctx = new PackageTypesService()) { return(await ctx.GetPackageTypesByExpressionLst(lst, includeLst).ConfigureAwait(false)); } }
public async Task SavePackageTypes(PackageTypes i) { if (i == null) { return; } using (var ctx = new PackageTypesService()) { await ctx.UpdatePackageTypes(i).ConfigureAwait(false); } }
private async Task <Container> ConfigureContainer(string wStr, AsycudaDocumentSet docSet) { try { var cnt = new Container() { TrackingState = TrackingState.Added }; var invoiceTotalMat = GetMatchFromPattern(wStr, InvoiceTotalPat); var palletTotalMat = GetMatchFromPattern(wStr, palletTotalPat); var containerIdentityMat = GetMatchFromPattern(wStr, containerIdentityPat); var shipDateSealMat = GetMatchFromPattern(wStr, shipDateSealPat); var WeightTotalsMat = GetMatchFromPattern(wStr, WeightTotalsPat); var cubicPat = GetMatchFromPattern(wStr, cubicMeasurementsPat); if (containerIdentityPat != null) { var cid = containerIdentityMat.Groups["ContainerIdentity"].Value; using (var ctx = new ContainerService()) { var res = await ctx.GetContainersByExpression(string.Format("Container_Identity == \"{0}\"", cid), new List <string>() { "ContainerAsycudaDocumentSets" }) .ConfigureAwait(false); if (res.FirstOrDefault() != null) { cnt = res.FirstOrDefault(); cnt.StartTracking(); } } cnt.Container_identity = cid; cnt.DeliveryDate = Convert.ToDateTime(containerIdentityMat.Groups["DeliveryDate"].Value); } if (invoiceTotalMat != null) { cnt.TotalValue = Convert.ToDouble(invoiceTotalMat.Groups["InvoiceTotal"].Value); } if (palletTotalPat != null) { cnt.Packages_number = palletTotalMat.Groups["PalletTotal"].Value; using (var ctx = new PackageTypesService()) { var pklst = await ctx.GetPackageTypesByExpression("PackageDescription == \"Pallet\"") .ConfigureAwait(false); cnt.Packages_type = pklst.FirstOrDefault().PackageType; } } if (shipDateSealMat != null) { cnt.ShipDate = Convert.ToDateTime(shipDateSealMat.Groups["ShipDate"].Value); cnt.Seal = shipDateSealMat.Groups["Seal"].Value; } if (WeightTotalsMat != null) { cnt.Gross_weight = Convert.ToDouble(WeightTotalsMat.Groups["TotalKGS"].Value); cnt.Packages_weight = Convert.ToDouble(WeightTotalsMat.Groups["TotalKGS"].Value); } cnt.Goods_description = "Food Stuff"; if (cubicPat != null) { var m3 = Convert.ToDouble(cubicPat.Groups["CubicMeters"].Value); cnt.Container_type = m3 > 34 ? "40RG" : "20RG"; } if (!cnt.ContainerAsycudaDocumentSets.Any(x => x.AsycudaDocumentSetId == docSet.AsycudaDocumentSetId)) { cnt.ContainerAsycudaDocumentSets.Add(new ContainerAsycudaDocumentSet() { AsycudaDocumentSetId = docSet.AsycudaDocumentSetId, Container = cnt, TrackingState = TrackingState.Added }); } using (var ctx = new ContainerService()) { cnt = await ctx.UpdateContainer(cnt).ConfigureAwait(false); } return(cnt); } catch (Exception) { throw; } }