예제 #1
0
 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;
 }
예제 #3
0
        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;
        }
예제 #5
0
 public void SaveDB(Database db)
 {
     XmlHandler.SaveDB(db);
 }