示例#1
0
 private void btnAddLesson_Click(object sender, EventArgs e)
 {
     var entityClass = new ClassBUS().GetByID(Convert.ToInt32(this.dgvListClasses.SelectedRows[0].Cells[6].Value));
     frmNewStudent.txtCodeClass.Text = entityClass.Id.ToString();
     frmNewStudent.txtNameClass.Text = entityClass.Name;
     this.Close();
 }
示例#2
0
        private void btnAddLesson_Click(object sender, EventArgs e)
        {
            var entityClass = new ClassBUS().GetByID(Convert.ToInt32(this.dgvListClasses.SelectedRows[0].Cells[6].Value));

            frmNewStudent.txtCodeClass.Text = entityClass.Id.ToString();
            frmNewStudent.txtNameClass.Text = entityClass.Name;
            this.Close();
        }
        private void BinCmbFilter(String t, String w, String o)
        {
            List <Class> lst = new ClassBUS().Class_GetByTop(t, w, o);

            lst.Insert(0, new Entity.Class("0", "Select an option", ""));
            cmbFilter.DataSource    = lst;
            cmbFilter.DisplayMember = "className";
            cmbFilter.ValueMember   = "id";
            cmbFilter.SelectedIndex = 0;
        }
示例#4
0
 private void lvwFaculty_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lvwFaculty.SelectedItems.Count > 0)
     {
         txtFaculty.Text     = lvwFaculty.SelectedItems[0].SubItems[0].Text;
         ClassBUS.id_faculty = txtFaculty.Text;
         ClassBUS.RenderListViewWithCourseAndFaculty(lvwClass);
     }
     SelectListView.SelectListViewColorForMultipleListView(lvwFaculty);
 }
示例#5
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (txtClassId.Text.Length <= 0)
            {
                MessageBox.Show(MessageBoxText.NotSelectListView, MessageBoxText.CaptionInformation, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Class classModel = new Class(txtClassId.Text, txtClassName.Text, new Faculty(txtFaculty.Text, ""), new Course(txtCourse.Text, ""));

            ClassBUS.HandleUpdateClass(lvwClass, classModel);
        }
示例#6
0
        /* METHODS */

        #region * RENDER COMBOBOX CLASSES
        private void RenderComboBoxClasses()
        {
            cboClass.Items.Clear();
            cboClass.SelectedIndex = -1;
            cboClass.Text          = String.Empty;
            if (cboFaculty.SelectedIndex != -1 && cboCourse.SelectedIndex != -1)
            {
                string id_course  = ((Course)cboCourse.SelectedItem).IdCourse;
                string id_faculty = ((Faculty)cboFaculty.SelectedItem).IdFaculty;
                ClassBUS.RenderComboBoxDataClasses(cboClass, id_course, id_faculty);
            }
        }
示例#7
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (txtClassId.Text.Length <= 0)
            {
                MessageBox.Show(MessageBoxText.NotSelectListView, MessageBoxText.CaptionInformation, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            ClassBUS.HandleDeleteClass(lvwClass, txtClassId.Text);

            txtClassId.Text   = String.Empty;
            txtClassName.Text = String.Empty;
        }
示例#8
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (CodeNumExists())
            {
                return;
            }
            if (txtClassId.Text.Length <= 0)
            {
                lblClassId.ForeColor = ColorTheme.getTheme("danger");
                txtClassId.Focus();
                MessageBox.Show(MessageBoxText.RequiredInput, MessageBoxText.CaptionInformation, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Class classModel = new Class(txtClassId.Text, txtClassName.Text, new Faculty(txtFaculty.Text, ""), new Course(txtCourse.Text, ""));

            ClassBUS.HandleAddClass(lvwClass, classModel);

            txtClassId.Text   = String.Empty;
            txtClassName.Text = String.Empty;
        }
示例#9
0
        private void frmClass_Load(object sender, EventArgs e)
        {
            new ClassBUS();
            CourseBUS.RenderListViewDataCourses(lvwCourse);
            FacultyBUS.RenderListViewDataFaculty(lvwFaculty);
            ClassBUS.RenderListViewFromState(lvwClass);

            // Select Default
            if (lvwCourse.Items.Count > 0)
            {
                lvwCourse.Items[0].Selected = true;
                lvwCourse.Select();
            }

            if (lvwFaculty.Items.Count > 0)
            {
                lvwFaculty.Items[0].Selected = true;
                lvwFaculty.Select();
            }

            // Load Initial Config
            FormSetup.FormLoad(this);
        }
示例#10
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("Realmente deseja apagar este item", "Apagar Curso", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    var entityClass = new ClassBUS().GetByID(Convert.ToInt32(this.dgvListClasses.SelectedRows[0].Cells[6].Value));

                    var listClassLessons = new ClassLessonsBUS().GetByIDClass(entityClass.Id);
                    var listLessons = from cl in listClassLessons
                                      join l in new LessonsBUS().GetAll() on cl.IdLessons equals l.Id
                                      select l;

                    //delete class
                    new ClassBUS().Delete(entityClass);

                    //delete class lessons
                    foreach (var item in listClassLessons)
                    {
                        new ClassLessonsBUS().Delete(item);
                    }

                    //delete lessons
                    foreach (var item in listLessons)
                    {
                        new LessonsBUS().Delete(item);
                    }

                    MessageBox.Show("Curso apagado com sucesso", "Apagar Curso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    PopulateGrid();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Ocorreu um erro ao tentar apagar o item", "Apagar Curso", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#11
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("Realmente deseja apagar este item", "Apagar Curso", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    var entityClass = new ClassBUS().GetByID(Convert.ToInt32(this.dgvListClasses.SelectedRows[0].Cells[6].Value));

                    var listClassLessons = new ClassLessonsBUS().GetByIDClass(entityClass.Id);
                    var listLessons      = from cl in listClassLessons
                                           join l in new LessonsBUS().GetAll() on cl.IdLessons equals l.Id
                                           select l;

                    //delete class
                    new ClassBUS().Delete(entityClass);

                    //delete class lessons
                    foreach (var item in listClassLessons)
                    {
                        new ClassLessonsBUS().Delete(item);
                    }

                    //delete lessons
                    foreach (var item in listLessons)
                    {
                        new LessonsBUS().Delete(item);
                    }

                    MessageBox.Show("Curso apagado com sucesso", "Apagar Curso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    PopulateGrid();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Ocorreu um erro ao tentar apagar o item", "Apagar Curso", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }