예제 #1
0
        private void GetWorkParametr(int number, int curriculumId, int disciplineId, int journalCurriculumId)
        {
            var disciplineService        = new DisciplineService(_unit, _unit);
            var curriculumService        = new CurriculumService(_unit, _unit);
            var journalCurriculumService = new JournalCurriculumService(_unit, _unit);

            if (disciplineId != -1)
            {
                _discipline = disciplineService.GetDisciplineById(disciplineId);
            }
            if (journalCurriculumId != -1)
            {
                _journalCurriculum = journalCurriculumService.GetJournalCurriculumById(journalCurriculumId);
            }
            if (curriculumId != -1)
            {
                _curriculum = curriculumService.GetCurriculumById(curriculumId);
            }
            this.GetFormReportFromDb();
            textBox1.Text = _discipline.Name;
            if (number == 1)
            {
                btn_addDiscipline.Visible = true;
            }
            if (number == 2)
            {
                btn_updateDiscipline.Visible = true;
                TimeText = _journalCurriculum.Time;
                comboBox3.SelectedItem = _journalCurriculum.FormReport;
            }
        }
예제 #2
0
        private void GetAllDataFromDb()
        {
            var disciplineService = new DisciplineService(_unit, _unit);
            var discipline        = disciplineService.GetDisciplineById(_entityId);

            IdText   = discipline.Id.ToString();
            NameText = discipline.Name;
        }
예제 #3
0
        private void btn_update_Click(object sender, EventArgs e)
        {
            var disciplineService = new DisciplineService(_unit, _unit);
            var discipline        = disciplineService.GetDisciplineById(_entityId);

            discipline.Name = NameText;
            disciplineService.UpdateDiscipline(discipline);
            _unit.Commit();
            _context.Dispose();
            this.Close();
        }
예제 #4
0
 private void SearchDiscipline(int code, string value)
 {
     if (code == 13 && cmBox_search.SelectedIndex == 0 && value != "" && EntitiesIndex == 4)
     {
         var disciplineService = new DisciplineService(_unit, _unit);
         var discipline        = disciplineService.GetDisciplineById(Convert.ToInt32(_tBox_searchValue));
         disciplineGV.DataSource = new List <Discipline>()
         {
             discipline
         };
     }
     if (code == 13 && cmBox_search.SelectedIndex == 1 && value != "")
     {
         var disciplineService = new DisciplineService(_unit, _unit);
         var discipline        = disciplineService.GetDisciplineByName(_tBox_searchValue);
         disciplineGV.DataSource = new List <Discipline>()
         {
             discipline
         };
     }
 }