Exemple #1
0
        public static void Read()
        {
            dataSet.Clear();
            _dataSet.Clear();

            DbDataContext.ClearCollections();

            dataAdapterDis.Fill(dataSet);
            dataAdapterLect.Fill(_dataSet);

            DataTable dt  = dataSet.Tables[0];
            DataTable _dt = _dataSet.Tables[0];

            foreach (DataRow row in dt.Rows)
            {
                var obj = new Discipline(
                    (int)row["id"],
                    (string)row["name"],
                    (string)row["speciality"],
                    (string)row["testing"],
                    (int)row["course"],
                    (int)row["semester"],
                    (int)row["amount_of_students"]
                    );
                dataContext.Disciplines.Add(obj);
            }

            foreach (DataRow row in _dt.Rows)
            {
                var obj = new Lector(
                    (int)row["id"],
                    (string)row["name_of_lector"],
                    (string)row["lectrum"],
                    (int)row["auditorium"]
                    );
                dataContext.Lectors.Add(obj);
            }
        }
 public MainWindow()
 {
     InitializeComponent();
     DataContext = new DbDataContext();
 }