Exemplo n.º 1
0
        public Lector Clone()
        {
            var lector = new Lector();

            lector = (Lector)this.MemberwiseClone();
            return(lector);
        }
Exemplo n.º 2
0
        public Lector createLector(string fullname, string auditory, string department)
        {
            Lector lector = new Lector();

            lector.fullname   = fullname;
            lector.auditory   = auditory;
            lector.department = department;
            return(lector);
        }
Exemplo n.º 3
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            if (
                LectorsFullname.Text.Length > 0 && LectorsDepartment.Text.Length > 0 &&
                LectorsAuditory.Text.Length > 0 && DisciplineName.Text.Length > 0 &&
                (ExamRadioBtn.Checked || OffsetRadioBtn.Checked) &&
                DisciplineCours.Text.Length > 0 && DisciplineSpeciality.Text.Length > 0 &&
                NumberOfLectures.Text.Length > 0 &&
                NumberOfLabratoryExercises.Text.Length > 0 &&
                (FirstSemestrRadioBtn.Checked || SecondSemestrRadioBtn.Checked) && LectorsAuditory.Text.Length == 5
                )
            {
                completenessFlag = true;
            }


            if (completenessFlag)
            {
                DisciplineFactory disFactory = new DisciplineFactory();

                LectorBuilder  lectorBuilder  = new LectorBuilder();
                LectorDirector lectorDirector = new LectorDirector(lectorBuilder);
                lectorDirector.makeStandartLector(LectorsFullname.Text, LectorsAuditory.Text, LectorsDepartment.Text);
                Lector lector = lectorBuilder.getLector();

                //Lector lector = disFactory.createLector(LectorsFullname.Text, LectorsAuditory.Text, LectorsDepartment.Text);
                Discipline discipline = disFactory.createDiscipline(DisciplineName.Text, DisciplineCours.Text, DisciplineSpeciality.Text, NumberOfLectures.Text, NumberOfLabratoryExercises.Text);
                foreach (RadioButton rb in SemestrPanel.Controls)
                {
                    if (rb.Checked)
                    {
                        discipline.semestr = rb.Text;
                    }
                }
                foreach (RadioButton rb in TypeOfControlPanel.Controls)
                {
                    if (rb.Checked)
                    {
                        discipline.typeOfControl = rb.Text;
                    }
                }

                Serialize(lector, discipline);
            }
            else
            {
                MessageBox.Show(
                    "Вы не заполнили все необходимые поля!",
                    "Сообщение об ошибке",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning
                    );
            }
        }
Exemplo n.º 4
0
        public void Serialize(Lector lector, Discipline discipline)
        {
            DisciplineForSerialize        serializeMe = new DisciplineForSerialize(lector, discipline);
            List <DisciplineForSerialize> disciplinesForSerialize;

            if (File.Exists("data.xml"))
            {
                disciplinesForSerialize = Deserialize();
            }
            else
            {
                disciplinesForSerialize = new List <DisciplineForSerialize>();
            }
            disciplinesForSerialize.Add(serializeMe);
            XmlSerializer xmlf = new XmlSerializer(disciplinesForSerialize.GetType());

            using (FileStream fs = new FileStream("data.xml", FileMode.OpenOrCreate))
            {
                xmlf.Serialize(fs, disciplinesForSerialize);
            }
        }
Exemplo n.º 5
0
 public void reset()
 {
     _lector = new Lector();
 }
Exemplo n.º 6
0
 public DisciplineForSerialize(Lector lector, Discipline discipline)
 {
     Lector     = lector;
     Discipline = discipline;
 }