public static List <AreaList2> GetCountryListDSForPJ(List <String> areaID) { List <AreaList2> lstresponse = new List <AreaList2>(); using (PJEntities entity = new PJEntities()) { var countryData = entity.Country_Master.ToList(); var areaData = entity.Area_Master.ToList(); for (int i = 0; i < areaID.Count; i++) { AreaList2 _area = new AreaList2(); _area.AreaId = Convert.ToInt32(areaID[i]); _area.AreaName = areaData.Where(x => x.Area_Master_Id == _area.AreaId).FirstOrDefault().Area_Name.ToString(); var countrylist = (from h in countryData where h.Area_Master_Id == _area.AreaId where h.Is_Active == true select new CountryList() { CountryId = h.Country_Master_Id, CountryName = h.Country_Name, AreaId = h.Area_Master_Id }).OrderBy(x => x.CountryName).ToList(); _area.CountryList = countrylist; lstresponse.Add(_area); } } return(lstresponse); }
public static GetBrandAndAreaListPJ GetBrandAndAreaListDSForPJ() { GetBrandAndAreaListPJ listresponse = new GetBrandAndAreaListPJ(); using (PJEntities entity = new PJEntities()) { var therapeuticAreaData = from r in entity.Therapeutic_Area_Master select r; var areaData = from r in entity.Area_Master select r; var countryData = entity.Country_Master.ToList(); var archetypeData = entity.Archetype_Master.ToList(); listresponse.TherapeuticList = (from a in therapeuticAreaData where a.Is_Active == true select new TherapeuticAreaList() { TherapeuticId = a.Therapeutic_Area_Master_Id, TherapeuticName = a.Therapeutic_Area_Name }).OrderBy(x => x.TherapeuticName).ToList(); listresponse.ArchetypeLists = (from a in archetypeData where a.Is_Active == true select new ArchetypeList() { ArchetypeId = a.Archetype_Master_Id, ArchetypeName = a.Archetype_Name }).OrderBy(x => x.ArchetypeName).ToList(); listresponse.AreaList = (from a in areaData where a.Is_Active == true select new AreaList() { AreaId = a.Area_Master_Id, AreaName = a.Area_Name }).OrderBy(x => x.AreaName).ToList(); List <AreaList2> areaListFinal = new List <AreaList2>(); for (int i = 0; i < listresponse.AreaList.Count; i++) { AreaList2 _area = new AreaList2(); _area.AreaId = Convert.ToInt32(listresponse.AreaList[i].AreaId); _area.AreaName = areaData.Where(x => x.Area_Master_Id == _area.AreaId).FirstOrDefault().Area_Name.ToString(); var countrylist = (from h in countryData where h.Area_Master_Id == _area.AreaId where h.Is_Active == true select new CountryList() { CountryId = h.Country_Master_Id, CountryName = h.Country_Name, AreaId = h.Area_Master_Id }).OrderBy(x => x.CountryName).ToList(); _area.CountryList = countrylist; areaListFinal.Add(_area); } listresponse.AreaList2 = areaListFinal; } return(listresponse); }
public static GetArchitypeListPJ GetAreaandCountryDataPJ(List <String> architypeID) { GetArchitypeListPJ lstresponse = new GetArchitypeListPJ(); using (PJEntities entity = new PJEntities()) { var countryData = entity.Country_Master.ToList(); var areaData = entity.Area_Master.ToList(); for (int i = 0; i < architypeID.Count; i++) { int archetypeID = Convert.ToInt32(architypeID[i]); AreaList _area = new AreaList(); lstresponse.AreaList = (from a in areaData where a.Archetype_Master_Id == archetypeID where a.Is_Active == true select new AreaList() { AreaId = a.Area_Master_Id, AreaName = a.Area_Name }).OrderBy(x => x.AreaName).ToList(); } List <AreaList2> areaListFinal = new List <AreaList2>(); for (int j = 0; j < lstresponse.AreaList.Count; j++) { int archetypeID = Convert.ToInt32(architypeID[j]); for (int i = 0; i < lstresponse.AreaList.Count; i++) { AreaList2 _area = new AreaList2(); _area.AreaId = Convert.ToInt32(lstresponse.AreaList[i].AreaId); _area.AreaName = areaData.Where(x => x.Area_Master_Id == _area.AreaId).FirstOrDefault().Area_Name.ToString(); var countrylist = (from h in countryData where h.Area_Master_Id == _area.AreaId where h.Archetype_Master_Id == archetypeID where h.Is_Active == true select new CountryList() { CountryId = h.Country_Master_Id, CountryName = h.Country_Name, AreaId = h.Area_Master_Id, AreaName = _area.AreaName }).OrderBy(x => x.CountryName).ToList(); _area.CountryList = countrylist; areaListFinal.Add(_area); } } lstresponse.AreaCountryList = areaListFinal; } return(lstresponse); }