public IList <BarcodeDTO> GetBarcodeList(GlobalVariables.FillingLine fillingLineID, int cartonID, int palletID, int batchID) { try { IList <BarcodeDTO> barcodeList = new List <BarcodeDTO>(); if (cartonID > 0) { IList <Pack> packs = this.packRepository.GetPacks(fillingLineID, (int)GlobalVariables.BarcodeStatus.Freshnew + "," + (int)GlobalVariables.BarcodeStatus.Readytoset + "," + (int)GlobalVariables.BarcodeStatus.Wrapped, cartonID); if (packs.Count > 0) { packs.Each(pack => { PackDTO packDTO = Mapper.Map <Pack, PackDTO>(pack); barcodeList.Add(packDTO); }); } } else if (palletID > 0) { IList <Carton> cartons = this.cartonRepository.GetCartons(fillingLineID, (int)GlobalVariables.BarcodeStatus.Freshnew + "," + (int)GlobalVariables.BarcodeStatus.Readytoset + "," + (int)GlobalVariables.BarcodeStatus.Wrapped + "," + (int)GlobalVariables.BarcodeStatus.Pending + "," + (int)GlobalVariables.BarcodeStatus.Noread, palletID); if (cartons.Count > 0) { cartons.Each(carton => { CartonDTO cartonDTO = Mapper.Map <Carton, CartonDTO>(carton); barcodeList.Add(cartonDTO); }); } } else if (batchID > 0) { IList <Pallet> pallets = this.palletRepository.GetPallets(fillingLineID, batchID, (int)GlobalVariables.BarcodeStatus.Freshnew + "," + (int)GlobalVariables.BarcodeStatus.Readytoset + "," + (int)GlobalVariables.BarcodeStatus.Wrapped); if (pallets.Count > 0) { pallets.Each(pallet => { PalletDTO palletDTO = Mapper.Map <Pallet, PalletDTO>(pallet); barcodeList.Add(palletDTO); }); } } return(barcodeList); } catch (Exception exception) { throw exception; } }
public static PackEN Convert(PackDTO dto) { PackEN newinstance = null; try { if (dto != null) { newinstance = new PackEN(); newinstance.IdPack = dto.IdPack; newinstance.Nombre = dto.Nombre; newinstance.Familia = dto.Familia; newinstance.Descripción = dto.Descripción; newinstance.Color = dto.Color; newinstance.Codigo = dto.Codigo; if (dto.Variable_oid != null) { PersonalHomeGenNHibernate.CAD.PersonalHome.IVariableCAD variableCAD = new PersonalHomeGenNHibernate.CAD.PersonalHome.VariableCAD(); newinstance.Variable = new System.Collections.Generic.List <PersonalHomeGenNHibernate.EN.PersonalHome.VariableEN>(); foreach (int entry in dto.Variable_oid) { newinstance.Variable.Add(variableCAD.ReadOIDDefault(entry)); } } if (dto.FamiliaPack_oid != null) { PersonalHomeGenNHibernate.CAD.PersonalHome.IFamiliaPackCAD familiaPackCAD = new PersonalHomeGenNHibernate.CAD.PersonalHome.FamiliaPackCAD(); newinstance.FamiliaPack = new System.Collections.Generic.List <PersonalHomeGenNHibernate.EN.PersonalHome.FamiliaPackEN>(); foreach (int entry in dto.FamiliaPack_oid) { newinstance.FamiliaPack.Add(familiaPackCAD.ReadOIDDefault(entry)); } } } } catch (Exception ex) { throw ex; } return(newinstance); }
public static PackDTO Convert(PackEN en) { PackDTO newinstance = null; if (en != null) { newinstance = new PackDTO(); newinstance.IdPack = en.IdPack; newinstance.Nombre = en.Nombre; newinstance.Familia = en.Familia; newinstance.Descripción = en.Descripción; newinstance.Color = en.Color; newinstance.Codigo = en.Codigo; if (en.Variable != null) { newinstance.Variable_oid = new System.Collections.Generic.List <Int32>(); foreach (PersonalHomeGenNHibernate.EN.PersonalHome.VariableEN entry in en.Variable) { newinstance.Variable_oid.Add(entry.IdVariable); } } if (en.FamiliaPack != null) { newinstance.FamiliaPack_oid = new System.Collections.Generic.List <Int32>(); foreach (PersonalHomeGenNHibernate.EN.PersonalHome.FamiliaPackEN entry in en.FamiliaPack) { newinstance.FamiliaPack_oid.Add(entry.IdFamPack); } } } return(newinstance); }