public AddOrEditLessonForm(DBManager aDBManager, int aID)
        {
            InitializeComponent();

            mFormState = FormState.Editing;
            mDBManager = aDBManager;
            mID = aID;
            this.Text = FormTitles.LessonForm.Edit;

            foreach (var l in mDBManager.Lessons)
            {
                if (l.ID == aID)
                {
                    mLesson = l;
                    break;
                }
            }

            addDefaultControlsInformationWhenEditing();
        }
Beispiel #2
0
 private void ImportCurriculum(ref OleDbConnection connection)
 {
     string CurriculumSelect = @"SELECT cl.[Hours weekly1] AS HoursPerWeek, cl.CurricID AS [CurricID], cl.[Class] AS [Class], cl.Subject AS Subject, cl.[Group] AS [Group], p.[ID number] AS [TeacherID] FROM [CurriculumL] AS [cl] INNER JOIN [CurriculumTeachers] AS [p] ON [cl].[CurricID] = [p].[CurricID] WHERE cl.[Class] IS NOT NULL";
     //string CurriculumSelect = "SELECT * FROM CurriculumL "; //+
                               //"JOIN CurriculumTeachers ct ON ct.CurricID = CurriculumL.CurricID ORDER BY CurricID";
     OleDbCommand command = new OleDbCommand(CurriculumSelect, connection);
     using (OleDbDataReader CurriculumReader = command.ExecuteReader())
     {
         while (CurriculumReader.Read())
         {
             int id = int.Parse(CurriculumReader["CurricID"].ToString());
             int classid = int.Parse(CurriculumReader["Class"].ToString());
             int groupid = int.Parse(CurriculumReader["Group"].ToString());
             int subjectid = int.Parse(CurriculumReader["Subject"].ToString());
             int hoursPerWeek = (int)double.Parse(CurriculumReader["HoursPerWeek"].ToString());
             long teacherid = long.Parse(CurriculumReader["TeacherID"].ToString());
             Class c = this.mClasses.SingleOrDefault(x => x.ID == classid);
             ClassDetails group = c.Details.SingleOrDefault(x => x.Group == groupid);
             Subject subject = this.mSubjects.SingleOrDefault(x => x.ID == subjectid);
             Teacher teacher = this.mTeachers.SingleOrDefault(x => x.ID == teacherid);
             Curriculum curric = new Curriculum(id, subject, c, group, teacher, hoursPerWeek);
             this.mCurriculums.Add(curric);
         }
     }
 }