Exemplo n.º 1
0
        private void browseForDBFileButtonClick(object sender, EventArgs e)
        {
            OpenFileDialog openDialog = new OpenFileDialog();
            openDialog.InitialDirectory = @"c:\";
            openDialog.Filter = "Access database files (*.mdb)|*.mdb";
            openDialog.FilterIndex = 2;
            openDialog.RestoreDirectory = true;
            openDialog.Multiselect = false;

            string filePath = "";
            if (openDialog.ShowDialog() == DialogResult.OK)
            {
                filePath = openDialog.FileName.ToString();
                filePathLabel.Text = filePath;

                Import import = new Import(filePath);

                foreach (Curriculum c in import.Curriculums)
                {
                    mDBManager.Lessons.Add(c);
                }
                foreach (Teacher t in import.Teachers)
                {
                    if (t.Color == Color.Empty)
                    {
                        t.Color = RandomColor.GetRandomColor();
                    }
                    mDBManager.Teachers.Add(t);
                }
                foreach (Subject s in import.Subjects)
                {
                    if (s.Color == Color.Empty)
                    {
                        s.Color = RandomColor.GetRandomColor();
                    }
                    mDBManager.Subjects.Add(s);
                }
                foreach (Class c in import.Classes)
                {
                    if (c.Color == Color.Empty)
                    {
                        c.Color = RandomColor.GetRandomColor();
                    }
                    mDBManager.Classes.Add(c);
                }
            }
        }
Exemplo n.º 2
0
 public static void Main()
 {
     Import import = new Import(@"D:\ScheduleWorks\Data.mdb");
     Console.WriteLine("hey: {0}", import.Subjects.Count);
     /*BasicClass b = new BasicClass(1, "1", "first", "I");
     EducationForm e = new EducationForm(1, "day'n'night", "dnn");
     Class shit = new Class(1, "a", b);
     List<ClassDetails> details = new List<ClassDetails> { new ClassDetails(2, 0, new ClassType(1, "die", "die"), b, e) };
     details[0].SetDetailed(shit);
     shit.SetDetails(details);
     Console.WriteLine(shit.Division);
     shit.Details[0].Detailed.Division = "die, m**********r!";
     Console.WriteLine(shit.Division);*/
     foreach (var item in import.Curriculums)
     {
         Console.WriteLine("{0}\n{1} {2}\n{3} {4}",
             item.ID,
             item.Class.Division, item.Class.Grade,
             item.Subject.Name,
             item.HoursPerWeek);
     }
 }