void LoadSecondary() { ClassesDrop2.Items.Clear(); Schools.SchoolInformation SKuinfo = new Schools.SchoolInformation(); SKuinfo = GetSchool(Convert.ToInt32(SchoolsDrop2.SelectedItem.Value), 5); BioName2.InnerText = SKuinfo.SchoolName; BioReg2.InnerText = SKuinfo.RegistrationNumber; BioMotto2.InnerText = SKuinfo.Moto; BioWebsite2.InnerText = SKuinfo.WebSite; BioLink2.HRef = "http://" + SKuinfo.WebSite; BioLink2.Target = "_blank"; Geography SkulGeog = new Geography(); SkulGeog.Country = new Geography.Countries(); SkulGeog.City = new Geography.Cities(); SkulGeog.Country = SKuinfo.SchoolGeography.Country; SkulGeog.City = SKuinfo.SchoolGeography.City; SkulGeog.Town = SKuinfo.SchoolGeography.Town; System.Diagnostics.Debug.WriteLine(SkulGeog.Country.Name); if (SKuinfo.LogoString != null) { BioImage2.Src = "data:image/jpg;base64," + SKuinfo.LogoString; } else { BioImage2.Src = "Users/Images/NoImage.png"; } BioAddr2.InnerHtml = String.Format("{0}, {1}, {2}", SkulGeog.Country.Name, SkulGeog.City.Name, SkulGeog.Town); foreach (Schools.Classes Class in SKuinfo.ClassInformation) { ListItem Li = new ListItem(Class.ClassName, Class.ClassId.ToString()); ClassesDrop2.Items.Add(Li); } }
public List <Schools> GetSchools(int UserId) { List <Schools> SkoolList = new List <Schools>(); using (var Con = new SqlConnection(GC.ConnectionString)) { Con.Open(); Query = "Select * from SchoolsView inner join StudentsView on SchoolsView.Id=StudentsView.School_id where User_id='" + UserId + "'"; using (var Com = new SqlCommand(Query, Con)) { Reader = Com.ExecuteReader(); while (Reader.Read()) { Schools.SchoolInformation Sku = new Schools.SchoolInformation(); Schools School = new Schools(); Sku.SchoolId = Convert.ToInt32(Reader["id"].ToString()); Sku.SchoolName = Reader["sch_name"].ToString(); Sku.Moto = Reader["Moto"].ToString(); Sku.RegistrationNumber = Reader["sch_reg_no"].ToString(); School.Info = Sku; SkoolList.Add(School); } Com.Dispose(); } Con.Close(); } return(SkoolList); }