Exemple #1
0
        protected override void GetSource()
        {
            using (PriemEntities context = new PriemEntities())
            {
                var query = from ob in context.extOlympBook
                            orderby ob.Number, ob.OlympNameName, ob.OlympLevelId
                    select new
                {
                    ob.Id,
                    ob.OlympTypeId,
                    ob.Number,
                    ob.OlympTypeName,
                    ob.OlympNameName,
                    ob.OlympSubjectName,
                    ob.OlympLevelName
                };

                int?olTypeId = ComboServ.GetComboIdInt(cbOlympType);
                if (olTypeId != null)
                {
                    query = query.Where(c => c.OlympTypeId == olTypeId);
                }

                Dgv.DataSource = query;
                SetVisibleColumnsAndNameColumns();
            }
        }
Exemple #2
0
        void cbStudyLevelGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            using (PriemEntities context = new PriemEntities())
            {
                var ent = MainClass.GetEntry(context);

                if (StudyLevelGroupId.HasValue)
                {
                    ent = ent.Where(x => x.StudyLevelGroupId == StudyLevelGroupId.Value);
                }

                ent = ent.Where(c => c.IsSecond == IsSecond && c.IsReduced == IsReduced && c.IsParallel == IsParallel);

                if (StudyBasisId != null)
                {
                    ent = ent.Where(c => c.StudyBasisId == StudyBasisId);
                }
                if (StudyFormId != null)
                {
                    ent = ent.Where(c => c.StudyFormId == StudyFormId);
                }

                List <KeyValuePair <string, string> > lst = ent.ToList()
                                                            .Select(u => new KeyValuePair <string, string>(u.FacultyId.ToString(), u.FacultyName)).Distinct().ToList();

                ComboServ.FillCombo(cbFaculty, lst, false, false);
            }
        }
        //обновление списка
        public void UpdateVedList()
        {
            try
            {
                using (PriemEntities context = new PriemEntities())
                {
                    List <KeyValuePair <string, string> > lst = ((from ent in context.extExamsVed
                                                                  where ent.StudyLevelGroupId == StudyLevelGroupId &&
                                                                  ent.FacultyId == FacultyId &&
                                                                  (StudyBasisId != null ? ent.StudyBasisId == StudyBasisId : true == true)

                                                                  select new
                    {
                        ent.Id,
                        ent.ExamName,
                        ent.Date,
                        StBasis = ent.StudyBasisId == null ? "" : ent.StudyBasisAcr,
                        AddVed = ent.IsAddVed ? " дополнительная" : "",
                        ent.AddCount
                    }).Distinct()).ToList().Select(u => new KeyValuePair <string, string>(u.Id.ToString(),
                                                                                          u.ExamName + ' ' + u.Date.ToShortDateString() + ' ' + u.StBasis + u.AddVed +
                                                                                          (u.AddCount > 1 ? "(" + Convert.ToString(u.AddCount) + ")" : ""))).ToList();

                    ComboServ.FillCombo(cbExamVed, lst, true, false);
                }
            }
            catch (Exception ex)
            {
                WinFormsServ.Error("Ошибка при обновлении списка ведомостей: " + ex.Message);
            }
        }
Exemple #4
0
        //дополнительная инициализация контролов
        private void InitControls()
        {
            try
            {
                InitFocusHandlers();

                this.CenterToScreen();
                this.MdiParent = MainClass.mainform;
                _bdc           = MainClass.Bdc;
                _drh           = new DataRefreshHandler(UpdateDataGrid);
                MainClass.AddHandler(_drh);

                Dgv = dgvAbitList;

                lblCount.Text = dgvAbitList.RowCount.ToString();
                if (!MainClass.IsOwner())
                {
                    btnRemove.Visible = false;
                }

                using (PriemEntities context = new PriemEntities())
                {
                    ComboServ.FillCombo(cbFaculty, HelpClass.GetComboListByTable("ed.qFaculty", "ORDER BY Acronym"), false, true);
                }
            }
            catch (Exception exc)
            {
                WinFormsServ.Error("Ошибка при инициализации формы " + exc.Message);
            }
        }
Exemple #5
0
        private void FillProfile()
        {
            using (PriemEntities context = new PriemEntities())
            {
                List <KeyValuePair <string, string> > lst = ((from ent in MainClass.GetEntry(context)
                                                              where ent.FacultyId == FacultyId &&
                                                              ent.StudyLevelId == StudyLevelId &&
                                                              (LicenseProgramId.HasValue ? ent.LicenseProgramId == LicenseProgramId : true) &&
                                                              (ObrazProgramId.HasValue ? ent.ObrazProgramId == ObrazProgramId : true) &&
                                                              ent.ProfileId != null
                                                              select new
                {
                    Id = ent.ProfileId,
                    Name = ent.ProfileName
                }).Distinct()).ToList().Select(u => new KeyValuePair <string, string>(u.Id.ToString(), u.Name)).ToList();

                if (lst.Count() > 0)
                {
                    ComboServ.FillCombo(cbProfile, lst, false, true);
                    cbProfile.Enabled = true;
                }
                else
                {
                    ComboServ.FillCombo(cbProfile, new List <KeyValuePair <string, string> >(), true, false);
                    cbProfile.Enabled = false;
                }
            }
        }
Exemple #6
0
        private void FillComboOtherObrazProgram()
        {
            using (PriemEntities context = new PriemEntities())
            {
                var src = (from x in context.extEntry
                           join y in context.StudyLevel
                           on x.StudyLevelId equals y.Id
                           where y.LevelGroupId == MainClass.studyLevelGroupId && x.FacultyId == OtherFacultyId
                           orderby x.ObrazProgramNumber
                           select new
                {
                    x.LicenseProgramId,
                    x.ObrazProgramId,
                    ObrazProgramName = x.ObrazProgramName,
                    ObrazProgramCrypt = x.ObrazProgramCrypt
                }).Distinct();
                if (OtherLicenseProgramId.HasValue)
                {
                    src = src.Where(x => x.LicenseProgramId == OtherLicenseProgramId);
                }
                var bind = src.ToList()
                           .Select(x => new KeyValuePair <string, string>(x.ObrazProgramId.ToString(), x.ObrazProgramCrypt + " " + x.ObrazProgramName)).ToList();

                ComboServ.FillCombo(cbOtherObrazProgram, bind, false, true);
            }
        }
Exemple #7
0
        private void FillComboOtherStudyBasis()
        {
            using (PriemEntities context = new PriemEntities())
            {
                var src = (from x in context.Entry
                           join y in context.StudyLevel
                           on x.StudyLevelId equals y.Id
                           join sb in context.StudyBasis
                           on x.StudyBasisId equals sb.Id
                           where y.LevelGroupId == MainClass.studyLevelGroupId && x.FacultyId == OtherFacultyId && x.StudyFormId == OtherStudyFormId
                           orderby sb.Id
                           select new
                {
                    x.LicenseProgramId,
                    x.ObrazProgramId,
                    sb.Id,
                    sb.Name
                }).Distinct();
                if (OtherLicenseProgramId.HasValue)
                {
                    src = src.Where(x => x.LicenseProgramId == OtherLicenseProgramId);
                }
                if (OtherObrazProgramId.HasValue)
                {
                    src = src.Where(x => x.ObrazProgramId == OtherObrazProgramId);
                }
                var bind = src.Distinct().ToList()
                           .Select(x => new KeyValuePair <string, string>(x.Id.ToString(), x.Name)).Distinct().ToList();

                ComboServ.FillCombo(cbOtherStudyBasis, bind, false, false);
            }
        }
Exemple #8
0
        private void FillLicenseProgram()
        {
            using (PriemEntities context = new PriemEntities())
            {
                var ent = MainClass.GetEntry(context)
                          .Where(c => c.FacultyId == FacultyId);

                if (StudyLevelGroupId.HasValue)
                {
                    ent = ent.Where(x => x.StudyLevelGroupId == StudyLevelGroupId.Value);
                }

                ent = ent.Where(c => c.IsSecond == IsSecond && c.IsReduced == IsReduced && c.IsParallel == IsParallel);

                if (StudyBasisId != null)
                {
                    ent = ent.Where(c => c.StudyBasisId == StudyBasisId);
                }
                if (StudyFormId != null)
                {
                    ent = ent.Where(c => c.StudyFormId == StudyFormId);
                }

                List <KeyValuePair <string, string> > lst = ent.ToList()
                                                            .Select(u => new KeyValuePair <string, string>(u.LicenseProgramId.ToString(), u.LicenseProgramName)).Distinct().ToList();

                ComboServ.FillCombo(cbLicenseProgram, lst, false, true);
            }
        }
Exemple #9
0
        //дополнительная инициализация контролов
        private void InitControls()
        {
            InitFocusHandlers();
            _bdc = MainClass.Bdc;

            //ComboServ.FillCombo(cbFaculty, HelpClass.GetComboListByTable("ed.qFaculty", "ORDER BY Acronym"), false, false);
            ComboServ.FillCombo(cbStudyBasis, HelpClass.GetComboListByTable("ed.StudyBasis", "ORDER BY Name"), false, false);

            cbStudyBasis.SelectedIndex = 0;
            FillStudyLevelGroup();
            FillStudyForm();
            cbStudyLevelGroup_SelectedIndexChanged(null, null);
            FillLicenseProgram();

            UpdateDataGrid();

            cbStudyLevelGroup.SelectedIndexChanged += cbStudyLevelGroup_SelectedIndexChanged;
            cbFaculty.SelectedIndexChanged         += new EventHandler(cbFaculty_SelectedIndexChanged);
            cbStudyForm.SelectedIndexChanged       += new EventHandler(cbStudyForm_SelectedIndexChanged);
            cbStudyBasis.SelectedIndexChanged      += new EventHandler(cbStudyBasis_SelectedIndexChanged);
            cbLicenseProgram.SelectedIndexChanged  += new EventHandler(cbLicenseProgram_SelectedIndexChanged);

            prh = new ProtocolRefreshHandler(UpdateDataGrid);
            MainClass.AddProtocolHandler(prh);
        }
Exemple #10
0
        protected override void ExtraInit()
        {
            base.ExtraInit();

            btnFixieren.Visible = btnFixieren.Enabled = false;
            gbPasha.Visible     = gbPasha.Enabled = false;
            chbFix.Visible      = false;

            if (MainClass.RightsFacMain() || MainClass.IsPasha())
            {
                btnFixieren.Visible = btnFixieren.Enabled = true;
            }

            if (MainClass.IsPasha())
            {
                gbPasha.Visible = gbPasha.Enabled = true;
                chbFix.Visible  = true;
            }

            if (!chbFix.Checked)
            {
                gbPasha.Visible = gbPasha.Enabled = false;
            }

            ComboServ.FillCombo(cbFaculty, HelpClass.GetComboListByTable("ed.qFaculty", "ORDER BY Acronym"), false, false);
            ComboServ.FillCombo(cbStudyBasis, HelpClass.GetComboListByTable("ed.StudyBasis", "ORDER BY Name"), false, false);

            cbStudyBasis.SelectedIndex = 0;

            FillStudyLevelGroup();
            FillStudyForm();
            FillLicenseProgram();
            FillObrazProgram();
            FillProfile();
        }
Exemple #11
0
        protected override void ExtraInit()
        {
            base.ExtraInit();
            Dgv.ReadOnly = false;

            using (PriemEntities context = new PriemEntities())
            {
                ComboServ.FillCombo(cbFaculty, HelpClass.GetComboListByTable("ed.qFaculty", "ORDER BY Acronym"), false, false);
                ComboServ.FillCombo(cbStudyBasis, HelpClass.GetComboListByTable("ed.StudyBasis", "ORDER BY Name"), false, true);
                cbStudyBasis.SelectedIndex = 0;

                ComboServ.FillCombo(cbStudyForm, HelpClass.GetComboListByTable("ed.StudyForm", "ORDER BY Id"), false, true);
                cbStudyForm.SelectedIndex = 0;

                FillLicenseProgram();

                ComboServ.FillCombo(cbCompetition, HelpClass.GetComboListByTable("ed.Competition"), false, true);

                UpdateDataGrid();

                if (MainClass.IsFacMain() || MainClass.IsOwner())
                {
                    btnLists.Enabled = true;
                }
                else
                {
                    btnLists.Enabled = false;
                }
            }
        }
        private void FillComboStudyForm()
        {
            using (PriemEntities context = new PriemEntities())
            {
                var SF = from x in context.qEntry
                         where x.StudyLevelGroupId == 1 && x.FacultyId == FacultyId
                         select new { x.LicenseProgramId, x.ObrazProgramId, x.ProfileId, x.StudyFormId, x.StudyFormName };
                if (LicenseProgramId != null)
                {
                    SF = SF.Where(x => x.LicenseProgramId == LicenseProgramId);
                }
                if (ObrazProgramId != null)
                {
                    SF = SF.Where(x => x.ObrazProgramId == ObrazProgramId);
                }
                if (ProfileId != null)
                {
                    SF = SF.Where(x => x.ProfileId == ProfileId);
                }

                List <KeyValuePair <string, string> > lst = SF.Distinct().ToList().
                                                            Select(x => new KeyValuePair <string, string>(x.StudyFormId.ToString(), x.StudyFormName)).Distinct().ToList();
                ComboServ.FillCombo(cbStudyForm, lst, false, true);
            }
        }
Exemple #13
0
        public void UpdateVedRoomList()
        {
            try
            {
                if (ExamVedId == null)
                {
                    ComboServ.FillCombo(cbExamVedRoom, new List <KeyValuePair <string, string> >(), false, false);
                    cbExamVedRoom.Enabled = false;
                }
                else
                {
                    using (PriemEntities context = new PriemEntities())
                    {
                        List <KeyValuePair <string, string> > lst = ((from ent in context.ExamsVedRoom
                                                                      where ent.ExamsVedId == ExamVedId
                                                                      orderby ent.Number, ent.RoomNumber
                                                                      select new
                        {
                            ent.Id,
                            ent.Number,
                            ent.RoomNumber
                        }).Distinct()).ToList().Select(u => new KeyValuePair <string, string>(u.Id.ToString(),
                                                                                              u.Number + ": " + u.RoomNumber)).ToList();

                        ComboServ.FillCombo(cbExamVedRoom, lst, true, false);
                        cbExamVedRoom.Enabled = true;
                    }
                }
            }
            catch (Exception ex)
            {
                WinFormsServ.Error("Ошибка при обновлении списка ведомостей: " + ex.Message);
            }
        }
Exemple #14
0
        protected override void ExtraInit()
        {
            base.ExtraInit();
            Dgv.ReadOnly      = false;
            btnRemove.Visible = btnAdd.Visible = false;

            //this.Width = 774;

            try
            {
                using (PriemEntities context = new PriemEntities())
                {
                    ComboServ.FillCombo(cbFaculty, HelpClass.GetComboListByTable("ed.qFaculty", "ORDER BY Acronym"), false, false);
                    ComboServ.FillCombo(cbStudyLevelGroup, HelpClass.GetComboListByTable("ed.StudyLevelGroup", "ORDER BY Acronym"), false, false);
                    ComboServ.FillCombo(cbStudyBasis, HelpClass.GetComboListByTable("ed.StudyBasis", "ORDER BY Name"), false, true);

                    cbStudyBasis.SelectedIndex = 0;
                    FillStudyForm();
                    FillLicenseProgram();
                    FillObrazProgram();

                    FillExams();

                    ComboServ.FillCombo(cbOlympType, HelpClass.GetComboListByTable("ed.OlympType", " ORDER BY Id"), false, true);
                    ComboServ.FillCombo(cbOlympName, HelpClass.GetComboListByTable("ed.OlympName"), false, true);
                    ComboServ.FillCombo(cbOlympSubject, HelpClass.GetComboListByTable("ed.OlympSubject"), false, true);
                    ComboServ.FillCombo(cbOlympValue, HelpClass.GetComboListByTable("ed.OlympValue"), false, true);
                    ComboServ.FillCombo(cbOlympLevel, HelpClass.GetComboListByTable("ed.OlympLevel"), false, true);
                }
            }
            catch (Exception exc)
            {
                WinFormsServ.Error("Ошибка при инициализации формы " + exc.Message);
            }
        }
        protected override void ExtraInit()
        {
            base.ExtraInit();

            loadClass = new LoadFromInet();
            _bdcInet  = loadClass.BDCInet;

            if (MainClass.IsReadOnly())
            {
                btnLoad.Enabled = false;
            }

            btnAdd.Visible = btnCard.Visible = btnRemove.Visible = false;

            try
            {
                using (PriemEntities context = new PriemEntities())
                {
                    ComboServ.FillCombo(cbChangeType, HelpClass.GetComboListByTable("ed.ChangeType", "ORDER BY Id"), false, false);
                    ComboServ.FillCombo(cbFaculty, HelpClass.GetComboListByTable("ed.qFaculty", "ORDER BY Acronym"), false, false);
                    ComboServ.FillCombo(cbStudyBasis, HelpClass.GetComboListByTable("ed.StudyBasis", "ORDER BY Name"), false, true);

                    cbStudyBasis.SelectedIndex = 0;
                    FillLicenseProgram();
                    FillObrazProgram();
                    FillProfile();

                    UpdateDataGrid();
                }
            }
            catch (Exception exc)
            {
                WinFormsServ.Error("Ошибка при инициализации формы " + exc.Message);
            }
        }
        private void FillProfile()
        {
            try
            {
                using (PriemEntities context = new PriemEntities())
                {
                    List <KeyValuePair <string, string> > lst = ((from ent in GetEntry(context)
                                                                  where ent.LicenseProgramId == LicenseProgramId && ent.ObrazProgramId == ObrazProgramId && ent.ProfileId != null
                                                                  select new
                    {
                        Id = ent.ProfileId,
                        Name = ent.ProfileName
                    }).Distinct()).ToList().Select(u => new KeyValuePair <string, string>(u.Id.ToString(), u.Name)).ToList();

                    if (lst.Count() > 0)
                    {
                        ComboServ.FillCombo(cbProfile, lst, false, false);
                        cbProfile.Enabled = true;
                    }
                    else
                    {
                        ComboServ.FillCombo(cbProfile, new List <KeyValuePair <string, string> >(), true, false);
                        cbProfile.Enabled = false;
                    }
                }
            }
            catch (Exception exc)
            {
                WinFormsServ.Error("Ошибка при инициализации формы FillProfile" + exc.Message);
            }
        }
Exemple #17
0
        private void FillComboStudyForm()
        {
            using (PriemEntities context = new PriemEntities())
            {
                var src = (from x in context.qEntry
                           where x.StudyLevelGroupId == MainClass.studyLevelGroupId && x.FacultyId == FacultyId
                           select new
                {
                    x.LicenseProgramId,
                    x.ObrazProgramId,
                    x.ProfileId,
                    x.StudyFormId,
                    x.StudyFormName
                }).Distinct();

                if (LicenseProgramId.HasValue)
                {
                    src = src.Where(x => x.LicenseProgramId == LicenseProgramId);
                }
                if (ObrazProgramId.HasValue)
                {
                    src = src.Where(x => x.ObrazProgramId == ObrazProgramId);
                }
                if (ProfileId.HasValue)
                {
                    src = src.Where(x => x.ProfileId == ProfileId);
                }

                var bind = src.Distinct().ToList()
                           .Select(x => new KeyValuePair <string, string>(x.StudyFormId.ToString(), x.StudyFormName)).ToList();

                ComboServ.FillCombo(cbStudyForm, bind, false, true);
            }
        }
Exemple #18
0
        protected override void ExtraInit()
        {
            base.ExtraInit();

            _title         = "Данные по договору";
            _tableName     = "ed.PaidData";
            this.MdiParent = null;

            try
            {
                using (PriemEntities context = new PriemEntities())
                {
                    _Id = (from pd in context.PaidData
                           where pd.AbiturientId == _abitId
                           orderby pd.DogovorDate descending
                           select pd.Id).FirstOrDefault().ToString();

                    if (string.IsNullOrEmpty(_Id) || _Id == Guid.Empty.ToString())
                    {
                        _Id = null;
                    }

                    ComboServ.FillCombo(cbDogovorType, HelpClass.GetComboListByTable("ed.DogovorType", "ORDER BY Id"), false, false);
                    UpdateAfterDogovorType();
                    ComboServ.FillCombo(cbProrektor, HelpClass.GetComboListByTable("ed.Prorektor"), false, false);
                    ComboServ.FillCombo(cbPayPeriod, HelpClass.GetComboListByTable("ed.PayPeriod"), false, false);
                }
            }
            catch (Exception exc)
            {
                WinFormsServ.Error("Ошибка при инициализации формы " + exc.Message);
            }
        }
        private void FillStudyBasis()
        {
            try
            {
                using (PriemEntities context = new PriemEntities())
                {
                    List <KeyValuePair <string, string> > lst = ((from ent in GetEntry(context)
                                                                  where ent.LicenseProgramId == LicenseProgramId &&
                                                                  ent.ObrazProgramId == ObrazProgramId &&
                                                                  (ProfileId == null ? ent.ProfileId == null : ent.ProfileId == ProfileId) &&
                                                                  ent.FacultyId == FacultyId &&
                                                                  ent.StudyFormId == StudyFormId
                                                                  select new
                    {
                        Id = ent.StudyBasisId,
                        Name = ent.StudyBasis.Name
                    }).Distinct()).ToList().Select(u => new KeyValuePair <string, string>(u.Id.ToString(), u.Name)).ToList();

                    ComboServ.FillCombo(cbStudyBasis, lst, false, false);
                }
            }
            catch (Exception exc)
            {
                WinFormsServ.Error("Ошибка при инициализации формы FillStudyBasis" + exc.Message);
            }
        }
Exemple #20
0
        private void LoadFaculties()
        {
            using (PriemEntities context = new PriemEntities())
            {
                var facs = (from ent in context.qEntry
                            join sl in context.StudyLevel
                            on ent.StudyLevelId equals sl.Id

                            where sl.LevelGroupId == MainClass.studyLevelGroupId
                            select new
                {
                    ent.StudyBasisId,
                    ent.StudyFormId,
                    Id = ent.FacultyId,
                    Name = ent.FacultyName
                });

                int?iStudyFormId  = GetStudyFormId();
                int?iStudyBasisId = GetStudyBasisId();

                if (iStudyFormId != null)
                {
                    facs = facs.Where(x => x.StudyFormId == iStudyFormId.Value);
                }
                //if (iStudyBasisId != null)
                //    facs = facs.Where(x => x.StudyBasisId == iStudyBasisId.Value);

                var lKVP = facs.OrderBy(x => x.Id).ToList().Select(x => new KeyValuePair <string, string>(x.Id.ToString(), x.Name)).Distinct().ToList();

                ComboServ.FillCombo(cbFaculty, lKVP, false, true);
            }
        }
Exemple #21
0
        private void LoadStudyForms()
        {
            using (PriemEntities context = new PriemEntities())
            {
                var sforms = (from ent in context.qEntry
                              join sl in context.StudyLevel
                              on ent.StudyLevelId equals sl.Id

                              where sl.LevelGroupId == (MainClass.dbType == PriemType.Priem ? 1 : 2)
                              select new
                {
                    ent.StudyBasisId,
                    ent.FacultyId,
                    Id = ent.StudyFormId,
                    Name = ent.StudyFormName
                });

                int?iFacultyId    = GetFacultyId();
                int?iStudyBasisId = GetStudyBasisId();
                if (iFacultyId != null)
                {
                    sforms = sforms.Where(x => x.FacultyId == iFacultyId.Value);
                }
                //if (iStudyBasisId != null)
                //    sforms = sforms.Where(x => x.StudyBasisId == iStudyBasisId.Value);

                var lKVP = sforms.ToList().Select(x => new KeyValuePair <string, string>(x.Id.ToString(), x.Name)).Distinct().OrderBy(x => x.Value).ToList();

                ComboServ.FillCombo(cbStudyForm, lKVP, false, false);
            }
        }
Exemple #22
0
        public void UpdateProtocolList(object sender, EventArgs e)
        {
            try
            {
                _currentProtocolIndex = cbProtocolNum.SelectedIndex;

                using (PriemEntities context = new PriemEntities())
                {
                    int protType  = TypeToInt(_protocolType);
                    var protocols = (from p in context.qProtocol
                                     where !p.IsOld && p.ProtocolTypeId == protType &&
                                     p.FacultyId == FacultyId && p.StudyFormId == StudyFormId && p.StudyBasisId == StudyBasisId
                                     orderby p.Number
                                     select new
                    {
                        p.Id,
                        p.Number
                    }).ToList().Select(x => new KeyValuePair <string, string>(x.Id.ToString(), x.Number)).ToList();

                    ComboServ.FillCombo(cbProtocolNum, protocols, true, false);
                }
            }
            catch (Exception ex)
            {
                WinFormsServ.Error("Ошибка при обновлении списка протоколов: " + ex.Message);
            }
        }
        protected override void ExtraInit()
        {
            base.ExtraInit();

            btnAdd.Visible = btnRemove.Visible = false;

            try
            {
                using (PriemEntities context = new PriemEntities())
                {
                    ComboServ.FillCombo(cbFaculty, HelpClass.GetComboListByTable("ed.qFaculty", "ORDER BY Acronym"), false, false);
                    ComboServ.FillCombo(cbStudyForm, HelpClass.GetComboListByTable("ed.StudyForm", "ORDER BY Id"), false, false);

                    FillLicenseProgram();
                    FillObrazProgram();

                    ComboServ.FillCombo(cbLanguage, HelpClass.GetComboListByTable("ed.Language"), false, true);
                    ComboServ.FillCombo(cbOlympType, HelpClass.GetComboListByTable("ed.OlympType", " ORDER BY Id"), false, true);
                    ComboServ.FillCombo(cbOlympName, HelpClass.GetComboListByTable("ed.OlympName"), false, true);
                    ComboServ.FillCombo(cbOlympSubject, HelpClass.GetComboListByTable("ed.OlympSubject"), false, true);
                    ComboServ.FillCombo(cbOlympValue, HelpClass.GetComboListByTable("ed.OlympValue"), false, true);
                    ComboServ.FillCombo(cbOlympLevel, HelpClass.GetComboListByTable("ed.OlympLevel"), false, true);

                    UpdateDataGrid();
                }
            }
            catch (Exception exc)
            {
                WinFormsServ.Error("Ошибка при инициализации формы " + exc.Message);
            }
        }
        protected override void ExtraInit()
        {
            base.ExtraInit();
            _title     = "Экзамен";
            _tableName = "ed.[ExamInEntry]";

            try
            {
                if (_Id != null)
                {
                    chbToAllStudyBasis.Visible = false;
                }
                chbToAllStudyBasis.Checked = true;

                using (PriemEntities context = new PriemEntities())
                {
                    List <KeyValuePair <string, string> > lst = ((from f in context.Exam
                                                                  join en in context.ExamName
                                                                  on f.ExamNameId equals en.Id
                                                                  select new
                    {
                        Id = f.Id,
                        Name = en.Name,
                        IsAdd = f.IsAdditional
                    }).Distinct()).ToList().Select(u => new KeyValuePair <string, string>(u.Id.ToString(), u.Name + (u.IsAdd ? " (доп)" : ""))).ToList();

                    ComboServ.FillCombo(cbExam, lst, false, false);
                }
            }
            catch (Exception exc)
            {
                WinFormsServ.Error("Ошибка при инициализации формы " + exc.Message);
            }
        }
        private void FillComboRegion()
        {
            string query = @"
                SELECT DISTINCT Region.Id, Region.Name
                FROM ed.Abiturient
                INNER JOIN ed.Person ON Person.Id = Abiturient.PersonId
                INNER JOIN ed.Region ON Region.Id = Person.RegionId
                INNER JOIN ed.Entry ON Entry.Id = Abiturient.EntryId
                INNER JOIN ed.StudyLevel ON StudyLevel.Id = Entry.StudyLevelId
                WHERE StudyLevel.LevelGroupId = @LevelGroupId";

            SortedList <string, object> sl = new SortedList <string, object>();

            sl.Add("@LevelGroupId", MainClass.studyLevelGroupId);

            if (FacultyId.HasValue)
            {
                query += " AND Entry.FacultyId=@FacultyId ";
                sl.Add("@FacultyId", FacultyId);
            }
            if (LicenseProgramId.HasValue)
            {
                query += " AND Entry.LicenseProgramId=@LicenseProgramId ";
                sl.Add("@LicenseProgramId", LicenseProgramId);
            }
            if (ObrazProgramId.HasValue)
            {
                query += " AND Entry.ObrazProgramId=@ObrazProgramId ";
                sl.Add("@ObrazProgramId", ObrazProgramId);
            }
            if (StudyFormId.HasValue)
            {
                query += " AND Entry.StudyFormId=@StudyFormId ";
                sl.Add("@StudyFormId", StudyFormId);
            }
            if (StudyBasisId.HasValue)
            {
                query += " AND Entry.StudyBasisId=@StudyBasisId ";
                sl.Add("@StudyBasisId", StudyBasisId);
            }

            string tail = " ORDER BY Region.Id";

            DataTable tbl = MainClass.Bdc.GetDataSet(query + tail, sl).Tables[0];
            List <KeyValuePair <string, string> > bind =
                (from DataRow rw in tbl.Rows
                 select new
                 KeyValuePair <string, string>(rw.Field <int>("Id").ToString(), rw.Field <string>("Name"))
                ).Distinct().ToList();

            //EgeExams =
            //    (from DataRow rw in tbl.Rows
            //     select new
            //     {
            //         Id = rw.Field<int>("Id"),
            //         Name = rw.Field<string>("Name")
            //     }).ToDictionary(x => x.Id, x => x.Name);

            ComboServ.FillCombo(cbRegion, bind, false, false);
        }
Exemple #26
0
        protected override void ExtraInit()
        {
            base.ExtraInit();
            _title     = "Экзамен";
            _tableName = "ed.[Exam]";

            try
            {
                using (PriemEntities context = new PriemEntities())
                {
                    List <KeyValuePair <string, string> > lst = ((from f in context.ExamName
                                                                  select new
                    {
                        Id = f.Id,
                        Name = f.Name
                    }).Distinct()).ToList().Select(u => new KeyValuePair <string, string>(u.Id.ToString(), u.Name)).ToList();

                    ComboServ.FillCombo(cbExamName, lst, false, false);
                }
            }
            catch (Exception exc)
            {
                WinFormsServ.Error("Ошибка при инициализации формы " + exc.Message);
            }
        }
Exemple #27
0
        //дополнительная инициализация контролов
        protected override void ExtraInit()
        {
            base.ExtraInit();
            this.Width = 840;

            muchExams = false;

            btnRemove.Visible = btnAdd.Visible = false;

            try
            {
                using (PriemEntities context = new PriemEntities())
                {
                    ComboServ.FillCombo(cbStudyLevelGroup, HelpClass.GetComboListByTable("ed.StudyLevelGroup", "ORDER BY Acronym"), false, false);
                    ComboServ.FillCombo(cbFaculty, HelpClass.GetComboListByTable("ed.qFaculty", "ORDER BY Acronym"), false, false);
                    ComboServ.FillCombo(cbStudyBasis, HelpClass.GetComboListByTable("ed.StudyBasis", "ORDER BY Name"), false, true);

                    cbStudyBasis.SelectedIndex = 0;
                    FillStudyForm();
                    FillLicenseProgram();
                    FillObrazProgram();
                    FillProfile();

                    ComboServ.FillCombo(cbCompetition, HelpClass.GetComboListByTable("ed.Competition", "ORDER BY Name"), false, true);
                    FillExams();
                }
            }
            catch (Exception exc)
            {
                WinFormsServ.Error("Ошибка при инициализации формы " + exc.Message);
            }
        }
Exemple #28
0
        private void FillComboEgeExam()
        {
            string query = @"
                SELECT DISTINCT EgeExamName.Id, EgeExamName.Name
                FROM ed.Abiturient
                INNER JOIN ed.ExamInEntry ON ExamInEntry.EntryId = Abiturient.EntryId
                INNER JOIN ed.EgeToExam ON EgeToExam.ExamId = ExamInEntry.ExamId
                INNER JOIN ed.EgeExamName ON EgeExamName.Id = EgeToExam.EgeExamNameId
                INNER JOIN ed.Entry ON Entry.Id = Abiturient.EntryId
                INNER JOIN ed.StudyLevel ON StudyLevel.Id = Entry.StudyLevelId
                WHERE StudyLevel.LevelGroupId = @LevelGroupId";

            SortedList <string, object> sl = new SortedList <string, object>();

            sl.Add("@LevelGroupId", MainClass.studyLevelGroupId);

            if (FacultyId.HasValue)
            {
                query += " AND Entry.FacultyId=@FacultyId ";
                sl.Add("@FacultyId", FacultyId);
            }
            if (LicenseProgramId.HasValue)
            {
                query += " AND Entry.LicenseProgramId=@LicenseProgramId ";
                sl.Add("@LicenseProgramId", LicenseProgramId);
            }
            if (ObrazProgramId.HasValue)
            {
                query += " AND Entry.ObrazProgramId=@ObrazProgramId ";
                sl.Add("@ObrazProgramId", ObrazProgramId);
            }
            if (StudyFormId.HasValue)
            {
                query += " AND Entry.StudyFormId=@StudyFormId ";
                sl.Add("@StudyFormId", StudyFormId);
            }
            if (StudyBasisId.HasValue)
            {
                query += " AND Entry.StudyBasisId=@StudyBasisId ";
                sl.Add("@StudyBasisId", StudyBasisId);
            }

            DataTable tbl = MainClass.Bdc.GetDataSet(query, sl).Tables[0];
            List <KeyValuePair <string, string> > bind =
                (from DataRow rw in tbl.Rows
                 select new
                 KeyValuePair <string, string>(rw.Field <int>("Id").ToString(), rw.Field <string>("Name"))
                ).Distinct().ToList();

            EgeExams =
                (from DataRow rw in tbl.Rows
                 select new
            {
                Id = rw.Field <int>("Id"),
                Name = rw.Field <string>("Name")
            }).ToDictionary(x => x.Id, x => x.Name);

            ComboServ.FillCombo(cbEgeExamName, bind, false, false);
        }
Exemple #29
0
        protected override void ExtraInit()
        {
            base.ExtraInit();
            _tableName = "ed.Person";

            Dgv        = dgvApplications;
            personBarc = 0;

            rbMale.Checked = true;

            gbAtt.Visible      = true;
            gbDipl.Visible     = false;
            chbIsEqual.Visible = false;

            chbHostelAbitYes.Checked = false;
            chbHostelAbitNo.Checked  = false;

            lblHasAssignToHostel.Visible = false;
            lblHasExamPass.Visible       = false;
            btnPrintHostel.Enabled       = false;
            btnPrintExamPass.Enabled     = false;
            btnGetAssignToHostel.Enabled = false;
            btnGetExamPass.Enabled       = false;

            tbNum.Enabled = false;

            btnAddAbit.Enabled = false;

            try
            {
                using (PriemEntities context = new PriemEntities())
                {
                    ComboServ.FillCombo(cbPassportType, HelpClass.GetComboListByTable("ed.PassportType"), false, false);

                    ComboServ.FillCombo(cbCountry, HelpClass.GetComboListByTable("ed.ForeignCountry", "ORDER BY Distance, Name"), false, false);
                    ComboServ.FillCombo(cbNationality, HelpClass.GetComboListByTable("ed.ForeignCountry", "ORDER BY Distance, Name"), false, false);
                    ComboServ.FillCombo(cbRegion, HelpClass.GetComboListByTable("ed.Region", "ORDER BY Distance, Name"), true, false);
                    ComboServ.FillCombo(cbLanguage, HelpClass.GetComboListByTable("ed.Language"), false, false);
                    ComboServ.FillCombo(cbCountryEduc, HelpClass.GetComboListByTable("ed.ForeignCountry", "ORDER BY Distance, Name"), false, false);
                    ComboServ.FillCombo(cbHEStudyForm, HelpClass.GetComboListByTable("ed.StudyForm"), true, false);
                    ComboServ.FillCombo(cbSchoolType, HelpClass.GetComboListByTable("ed.SchoolType"), false, false);


                    cbSchoolCity.DataSource      = context.ExecuteStoreQuery <string>("SELECT DISTINCT ed.Person_EducationInfo.SchoolCity AS Name FROM ed.Person_EducationInfo WHERE ed.Person_EducationInfo.SchoolCity > '' ORDER BY 1");
                    cbAttestatSeries.DataSource  = context.ExecuteStoreQuery <string>("SELECT DISTINCT ed.Person_EducationInfo.AttestatSeries AS Name FROM ed.Person_EducationInfo WHERE ed.Person_EducationInfo.AttestatSeries > '' ORDER BY 1");
                    cbHEQualification.DataSource = context.ExecuteStoreQuery <string>("SELECT DISTINCT ed.Person_EducationInfo.HEQualification AS Name FROM ed.Person_EducationInfo WHERE NOT ed.Person_EducationInfo.HEQualification IS NULL /*AND ed.Person_EducationInfo.HEQualification > ''*/ ORDER BY 1");

                    cbAttestatSeries.SelectedIndex  = -1;
                    cbSchoolCity.SelectedIndex      = -1;
                    cbHEQualification.SelectedIndex = -1;
                }

                btnDocs.Visible = true;
            }
            catch (Exception exc)
            {
                WinFormsServ.Error("Ошибка при инициализации формы " + exc.Message);
            }
        }
Exemple #30
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            try
            {
                WordDoc wd = new WordDoc(string.Format(@"{0}\ListPerson.dot", MainClass.dirTemplates));

                int k = dgvAbiturients.Columns.Count;
                wd.AddNewTable(dgvAbiturients.Rows.Count + 1, k);
                TableDoc td = wd.Tables[0];

                int?   facId = ComboServ.GetComboIdInt(cbFaculty);
                string sFac  = cbFaculty.Text.ToLower();
                if (sFac.CompareTo("все") == 0)
                {
                    sFac = "";
                }
                else
                {
                    sFac = "получивших направления на послеление от ";
                    if (facId == 3)
                    {
                        sFac += "высшей школы менеджмента ";
                    }
                    else
                    {
                        sFac += sFac.Replace("кий", "кого ").Replace("ый", "ого ") + " факультета ";
                    }
                }

                wd.Fields["Faculty"].Text = sFac;
                wd.Fields["Info"].Text    = "для общежитий";


                int i = 0;

                td[0, 0] = "№ п/п";
                for (int j = 0; j < k - 1; j++)
                {
                    td[j + 1, 0] = dgvAbiturients.Columns[j + 1].HeaderText;
                }

                // печать из грида
                foreach (DataGridViewRow dgvr in dgvAbiturients.Rows)
                {
                    td[0, i + 1] = (i + 1).ToString();
                    for (int j = 0; j < k - 1; j++)
                    {
                        td[j + 1, i + 1] = dgvAbiturients.Rows[i].Cells[j + 1].Value.ToString();
                    }

                    i++;
                }
            }
            catch (Exception exc)
            {
                WinFormsServ.Error("Ошибка вывода в Word: \n" + exc.Message);
            }
        }