private void ShowClasses() { getClasses = new List<string>(); List<Classes> lst = new List<Classes>(); Classes sd = new Classes(); try { getClasses = database.getAlldata("classes","name"); string[] tempArray = new string[3]; char split = ';'; foreach (string item in getClasses) { tempArray = item.Split(split); sd.id = tempArray[0]; sd.name = tempArray[1]; sd.description = tempArray[2]; sd.Marks = tempArray[1] + " - " + tempArray[2]; sd.delBtn = sd.name; lst.Add(sd); sd = new Classes(); } MyPanel.DataContext = lst; } catch (Exception e) { MessageBox.Show(e.ToString()); } }
private void showClasses() { getRooms = new List<string>(); List<Classes> lst = new List<Classes>(); Classes sr = new Classes(); try { getRooms = database.getRooms(); string[] tempArray = new string[4]; char split = ';'; foreach (string item in getRooms) { tempArray = item.Split(split); sr.name = tempArray[1]; sr.Marks = tempArray[1] + " - " + tempArray[3]; if (selectedRoom == null) { selectedRoom = sr.name; ClassesView.SelectedIndex = 0; } lst.Add(sr); sr = new Classes(); } MyPanel.DataContext = lst; } catch (Exception) { return; } }