public void BindDDLs(LegalEntityBranchView legalEntityBranchView, ObjectContext db) { //countries ddl ICountriesRepository countriesRepository = new CountriesRepository(db); legalEntityBranchView.Countries = new SelectList(countriesRepository.GetValid().OrderBy("Name ASC").ToList(), "CountryPK", "Name"); //counties ddl ICountiesRepository countiesRepository = new CountiesRepository(db); legalEntityBranchView.Counties = new SelectList(countiesRepository.GetCountiesByCountry((int)legalEntityBranchView.CountryFK).OrderBy("Name ASC").ToList(), "CountyPK", "Name"); //citiesCommunities dll if (legalEntityBranchView.CountyFK != null) { ICitiesCommunitiesRepository citiesCommunitiesRepository = new CitiesCommunitiesRepository(db); legalEntityBranchView.CitiesCommunities = new SelectList(citiesCommunitiesRepository.GetCitiesCommunitiesByCounty(Convert.ToInt32(legalEntityBranchView.CountyFK)).OrderBy("Name ASC"), "CityCommunityPK", "Name", legalEntityBranchView.CityCommunityFK); } else { legalEntityBranchView.CitiesCommunities = new SelectList(new List <CityCommunity>(), "CityCommunityPK", "Name"); } //postal offices dll if (legalEntityBranchView.CountyFK != null) { IPostalOfficesRepository postalOfficesRepository = new PostalOfficesRepository(db); legalEntityBranchView.PostalOffices = new SelectList(postalOfficesRepository.GetValidByCounty(Convert.ToInt32(legalEntityBranchView.CountyFK)).OrderBy("Name ASC"), "PostalOfficePK", "Name", legalEntityBranchView.PostalOfficeFK); } else { legalEntityBranchView.PostalOffices = new SelectList(new List <PostalOffice>(), "PostalOfficePK", "Name"); } //places dll if (legalEntityBranchView.PostalOfficeFK != null) { IPlacesRepository placesRepository = new PlacesRepository(db); legalEntityBranchView.Places = new SelectList(placesRepository.GetPlacesByPostalOffice(Convert.ToInt32(legalEntityBranchView.PostalOfficeFK)).OrderBy("Name ASC"), "PlacePK", "Name", legalEntityBranchView.PlaceFK); } else { legalEntityBranchView.Places = new SelectList(new List <Place>(), "PlacePK", "Name"); } }
public void ConvertTo(LegalEntityBranchView legalEntityBranchView, LegalEntityBranch legalEntityBranch) { legalEntityBranch.LegalEntityBranchPK = legalEntityBranchView.LegalEntityBranchPK; legalEntityBranch.Name = legalEntityBranchView.Name; legalEntityBranch.LegalEntityFK = legalEntityBranchView.LegalEntityFK; legalEntityBranch.CountryFK = legalEntityBranchView.CountryFK; legalEntityBranch.CountyFK = legalEntityBranchView.CountyFK; legalEntityBranch.CityCommunityFK = legalEntityBranchView.CityCommunityFK; legalEntityBranch.PostalOfficeFK = legalEntityBranchView.PostalOfficeFK; legalEntityBranch.PlaceFK = legalEntityBranchView.PlaceFK; legalEntityBranch.StreetName = legalEntityBranchView.StreetName; legalEntityBranch.Phone = legalEntityBranchView.Phone; legalEntityBranch.Fax = legalEntityBranchView.Fax; legalEntityBranch.Mobile = legalEntityBranchView.Mobile; legalEntityBranch.EMail = legalEntityBranchView.EMail; legalEntityBranch.ChangeDate = legalEntityBranchView.ChangeDate; legalEntityBranch.Deleted = legalEntityBranchView.Deleted; }
public void ConvertFrom(LegalEntityBranch legalEntityBranch, LegalEntityBranchView legalEntityBranchView, ObjectContext db) { legalEntityBranchView.LegalEntityBranchPK = legalEntityBranch.LegalEntityBranchPK; legalEntityBranchView.Name = legalEntityBranch.Name; legalEntityBranchView.LegalEntityFK = legalEntityBranch.LegalEntityFK; legalEntityBranchView.CountryFK = legalEntityBranch.CountryFK; legalEntityBranchView.CountyFK = legalEntityBranch.CountyFK; legalEntityBranchView.CityCommunityFK = legalEntityBranch.CityCommunityFK; legalEntityBranchView.PostalOfficeFK = legalEntityBranch.PostalOfficeFK; legalEntityBranchView.PlaceFK = legalEntityBranch.PlaceFK; legalEntityBranchView.StreetName = legalEntityBranch.StreetName; legalEntityBranchView.Phone = legalEntityBranch.Phone; legalEntityBranchView.Fax = legalEntityBranch.Fax; legalEntityBranchView.Mobile = legalEntityBranch.Mobile; legalEntityBranchView.EMail = legalEntityBranch.EMail; legalEntityBranchView.Deleted = legalEntityBranch.Deleted; ILegalEntitiesRepository legalEntitiesRepository = new LegalEntitiesRepository(db); LegalEntity legalEntity = legalEntitiesRepository.GetLegalEntityByPK((int)legalEntityBranchView.LegalEntityFK); legalEntityBranchView.LegalEntityName = legalEntity.Name + " (" + legalEntity.OIB + ")"; }