public static void SaveDB(Database db) { using (TextWriter writer = new StreamWriter(Filename)) { var b = new XmlSerializer(db.GetType()); b.Serialize(writer, db); } }
public static DataGridView ShowBooksGrid(DataGridView dgv, Database db) { dgv.Columns.Clear(); dgv.Rows.Clear(); dgv = MakeColumns(dgv); foreach (var book in db.BookList) { dgv.Rows.Add(FillRow(book)); } return dgv; }
public static Database GetDB() { var db = new Database(); using (TextReader reader = new StreamReader(Filename)) { var s = new XmlSerializer(typeof(Database)); db = (Database)s.Deserialize(reader); } return db; }
public static DataGridView ShowStudentsGrid(DataGridView dgv, Database db) { dgv.Columns.Clear(); dgv.Rows.Clear(); dgv = MakeColumns(dgv); int index = 1; foreach (var student in db.StudentsList.OrderBy(x => x.Id)) { dgv.Rows.Add(FillRow(student,index)); index++; } dgv.Columns[0].Visible = false; return dgv; }
public void SaveDB(Database db) { XmlHandler.SaveDB(db); }