public TerritoryRegion GetTerritoryRegion(Guid UserGUID) { TerritoryRegion lTerritoryRegion = new TerritoryRegion(); ITerritoryRepository _ITerritoryRepository = new TerritoryRepository(new WorkersInMotionDB()); IRegionRepository _IRegionRepository = new RegionRepository(new WorkersInMotionDB()); IOrganizationRepository _IOrganizationRepository = new OrganizationRepository(new WorkersInMotionDB()); Guid OrganizationGUID = _IOrganizationRepository.GetOrganizationIDByUserGUID(UserGUID); List <Territory> TerritoryList = _ITerritoryRepository.GetTerritoryByOrganizationGUID(OrganizationGUID).ToList(); if (TerritoryList != null && TerritoryList.Count > 0) { lTerritoryRegion.Territories = new List <MobileTerritory>(); foreach (Territory item in TerritoryList) { MobileTerritory lterritory = new MobileTerritory(); lterritory = convertTerritoryToMobileTerritory(item); lTerritoryRegion.Territories.Add(lterritory); } } List <Region> RegionList = _IRegionRepository.GetRegionByOrganizationGUID(OrganizationGUID).ToList(); if (RegionList != null && RegionList.Count > 0) { lTerritoryRegion.Regions = new List <MobileRegion>(); foreach (Region item in RegionList) { MobileRegion lregion = convertRegionToMobileRegion(item); lTerritoryRegion.Regions.Add(lregion); } } return(lTerritoryRegion); }
private MobileRegion convertRegionToMobileRegion(Region item) { MobileRegion lregion = new MobileRegion(); lregion.RegionGUID = item.RegionGUID; lregion.OrganizationGUID = item.OrganizationGUID; lregion.Name = item.Name; lregion.IsDefault = item.IsDefault; lregion.Description = item.Description; return(lregion); }
private MobileRegion convertRegionToMobileRegion(Region item) { MobileRegion lregion = new MobileRegion(); lregion.RegionGUID = item.RegionGUID; lregion.OrganizationGUID = item.OrganizationGUID; lregion.Name = item.Name; lregion.IsDefault = item.IsDefault; lregion.Description = item.Description; return lregion; }