Esempio n. 1
0
 public FrmNewClass(ClassEntity entityClass)
 {
     frmNewClass = this;
     InitializeComponent();
     SetValuesInFields(entityClass);
 }
Esempio n. 2
0
        private void UpdateLessonOfClass(ClassEntity entityClass, int idClass)
        {
            var listClassLessonAdded = new ClassLessonsBUS().GetByIDClass(idClass);

            foreach (var item in listClassLessonAdded)
            {
                new LessonsBUS().Delete(new LessonsBUS().GetByID(item.IdLessons)); // delete lesson
                new ClassLessonsBUS().Delete(item); // delete join class lessons
            }

            //create news lessons for this class
            SaveLessonOfClass(entityClass, idClass);
        }
Esempio n. 3
0
        private void SaveLessonOfClass(ClassEntity entityClass, int idClassAdded)
        {
            foreach (var item in entityClass.ListLessons)
            {
                new LessonsBUS().Add(item);

                new ClassLessonsBUS().Add(new ClassLessonsEntity()
                {
                    IdClass = idClassAdded,
                    IdLessons = new LessonsBUS().GetAll().Max(x => x.Id)
                });
            }
        }
Esempio n. 4
0
        private void SetValuesInFields(ClassEntity entityClass)
        {
            this.idClass.Text = entityClass.Id.ToString();
            this.txtLocal.Text = entityClass.Local;
            this.txtNameClass.Text = entityClass.Name;
            this.txtValueClass.Text = entityClass.ValueCourse.ToString();
            this.dtpDtInicial.Value = entityClass.StartDate;
            this.dtpDtFinal.Value = entityClass.FinishDate;
            this.cbTypeClass.SelectedIndex = this.cbTypeClass.FindString(entityClass.Type);

            this.dgvListLessons.DataSource = (from cl in new ClassLessonsBUS().GetAll()
                                             join l in new LessonsBUS().GetAll() on cl.IdLessons equals l.Id
                                             where cl.IdClass == entityClass.Id
                                             select new {
                                                            Nome = l.Name,
                                                            Tipo = l.Type,
                                                            Codigo = l.Id,
                                                            Data = l.DateLesson
                                                         }).ToList();

            this.dgvListLessons.Columns[2].HeaderText = "Código";
            this.dgvListLessons.Columns[0].HeaderText = "Nome";
            this.dgvListLessons.Columns[0].MinimumWidth = 250;
            this.dgvListLessons.Columns[1].HeaderText = "Tipo";
            this.dgvListLessons.Columns[3].HeaderText = "Data Aula";
        }
Esempio n. 5
0
 private void PopolateFieldsClass(ClassEntity classEntity,string obs)
 {
     this.txtCodeClass.Text = classEntity.Id.ToString();
     this.txtNameClass.Text = classEntity.Name;
     this.txtObservation.Text = obs;
 }