예제 #1
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);
            }
        }
예제 #2
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);
            }
        }
예제 #3
0
        private void btnCreateAdd_Click(object sender, EventArgs e)
        {
            if (MainClass.IsFacMain() || MainClass.IsOwner() || MainClass.IsPasha())
            {
                using (PriemEntities context = new PriemEntities())
                {
                    int?stBas = null;
                    if (cbExamVed.SelectedItem.ToString().Contains("г/б"))
                    {
                        stBas = 1;
                    }
                    else if (cbExamVed.SelectedItem.ToString().Contains("дог"))
                    {
                        stBas = 2;
                    }

                    extExamsVed ved = (from ev in context.extExamsVed
                                       where ev.Id == ExamVedId
                                       select ev).FirstOrDefault();

                    DateTime passDate = ved.Date;
                    int      examId   = ved.ExamId;

                    SelectExamCrypto frm = new SelectExamCrypto(this, StudyLevelGroupId, FacultyId, stBas, passDate, examId);
                    frm.Show();
                }
            }
        }
예제 #4
0
        public void FillPaidData()
        {
            try
            {
                using (PriemEntities context = new PriemEntities())
                {
                    PayDataEntry payData = (from ab in context.qAbiturient
                                            join pde in context.PayDataEntry
                                            on ab.EntryId equals pde.EntryId
                                            where ab.Id == _abitId
                                            select pde).FirstOrDefault();

                    if (payData == null)
                    {
                        return;
                    }

                    Qualification = payData.Qualification;
                    Srok          = payData.EducPeriod;
                    DateStart     = payData.DateStart;
                    DateFinish    = payData.DateFinish;
                    ProrektorId   = payData.ProrektorId;
                }
            }
            catch (DataException de)
            {
                WinFormsServ.Error("Ошибка при заполнении формы " + de.Message);
            }
        }
예제 #5
0
 protected override void UpdateRec(PriemEntities context, Guid id)
 {
     context.PaidData_Update(DogovorNum, DogovorDate, DogovorTypeId, ProrektorId, Qualification, Srok,
                             DateStart, DateFinish, SumFirstYear, PayPeriodId, SumFirstPeriod, AbitFIORod, AbitParent, null,
                             Customer, CustomerAddress, CustomerPassport, CustomerPassportAuthor, CustomerLico, CustomerReason,
                             CustomerINN, CustomerRS, "", "", id);
 }
예제 #6
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!isAdditional)
            {
                using (PriemEntities context = new PriemEntities())
                {
                    int cnt = (from ev in context.extExamsVed
                               where ev.ExamId == ExamId && ev.Date == dtDateExam.Value.Date &&
                               ev.FacultyId == facultyId &&
                               (studyBasisId == null ? ev.StudyBasisId == null : ev.StudyBasisId == studyBasisId) &&
                               !ev.IsAddVed
                               select ev).Count();

                    if (cnt > 0)
                    {
                        WinFormsServ.Error(string.Format("{0}едомость на этот экзамен на эту дату {1} уже существует! ", isAdditional ? "Дополнительная в" : "В", studyBasisId == null ? "" : "на эту основу обучения"));
                        return;
                    }
                }
            }

            ExamsVedCard frm = new ExamsVedCard(owner, studyLevelGroupId, facultyId, ExamId, dtDateExam.Value, studyBasisId, isAdditional);

            frm.Show();
            this.Close();
        }
예제 #7
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);
            }
        }
예제 #8
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);
            }
        }
예제 #9
0
 public static void SetIsOpen(string tableName, string itemId)
 {
     using (PriemEntities context = new PriemEntities())
     {
         context.Set_IsOpen(tableName, itemId, true, userName);
     }
 }
예제 #10
0
        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);
            }
        }
예제 #11
0
        protected override string Save()
        {
            try
            {
                using (PriemEntities context = new PriemEntities())
                {
                    if (_Id == null)
                    {
                        ObjectParameter exId;

                        try
                        {
                            exId = new ObjectParameter("id", typeof(Int32));
                            context.Exam_Insert(ExamNameId, IsAdditional, exId);
                        }
                        catch (Exception exc)
                        {
                            throw new Exception("Ошибка при сохранении данных: " + exc.Message);
                        }

                        return(exId.Value.ToString());
                    }
                    else
                    {
                        context.Exam_Update(ExamNameId, IsAdditional, IntId);
                        return(_Id);
                    }
                }
            }
            catch (Exception exc)
            {
                throw new Exception("Ошибка при сохранении данных: " + exc.Message);
            }
        }
예제 #12
0
        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);
            }
        }
예제 #13
0
        private bool SaveMarks()
        {
            try
            {
                using (PriemEntities context = new PriemEntities())
                {
                    using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.RequiresNew))
                    {
                        string mark = null;

                        for (int i = 0; i < dgvMarks.Rows.Count; i++)
                        {
                            int  persNum = int.Parse(dgvMarks["Номер", i].Value.ToString());
                            Guid persId  = new Guid(dgvMarks["PersonId", i].Value.ToString());

                            if (dgvMarks["Баллы", i].Value != null)
                            {
                                mark = dgvMarks["Баллы", i].Value.ToString().Trim();
                            }

                            int?updatedMark;
                            int mrk;

                            if (string.IsNullOrEmpty(mark))
                            {
                                updatedMark = null;
                            }
                            else if (int.TryParse(mark, out mrk) && mrk >= 0 && mrk < 101)
                            {
                                updatedMark = mrk;
                            }
                            else
                            {
                                dgvMarks.CurrentCell = dgvMarks["Баллы", i];
                                WinFormsServ.Error(dgvMarks["Номер", i].Value.ToString() + ": неправильно введены данные");
                                return(false);
                            }

                            if (_isOral)
                            {
                                context.ExamsVedHistory_UpdateMarkOral(_vedId, persId, persNum, updatedMark);
                            }
                            else
                            {
                                context.ExamsVedHistory_UpdateMark(_vedId, persId, persNum, updatedMark);
                            }
                        }

                        transaction.Complete();
                        return(true);
                    }
                }
            }

            catch (Exception exc)
            {
                WinFormsServ.Error("Ошибка сохранения данных: \n" + exc.Message);
                return(false);
            }
        }
예제 #14
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;
                }
            }
        }
예제 #15
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);
            }
        }
예제 #16
0
 public static void DeleteIsOpen(string tableName, string itemId)
 {
     using (PriemEntities context = new PriemEntities())
     {
         context.Set_IsOpen(tableName, itemId, false, null);
     }
 }
예제 #17
0
        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);
            }
        }
예제 #18
0
 public static void DeleteAllOpenByHolder()
 {
     using (PriemEntities context = new PriemEntities())
     {
         context.DeleteAllOpenByHolder(userName);
     }
 }
예제 #19
0
        protected override void GetSource()
        {
            try
            {
                using (PriemEntities context = new PriemEntities())
                {
                    IQueryable <qEntry> query;

                    if (string.IsNullOrEmpty(_orderBy))
                    {
                        query = context.qEntry.OrderBy(c => c.StudyLevelName).ThenBy(c => c.FacultyName).ThenBy(c => c.ObrazProgramName).ThenBy(c => c.ProfileName).ThenBy(c => c.StudyFormId).ThenBy(c => c.StudyBasisId);
                    }
                    else
                    {
                        query = context.qEntry.OrderBy(_orderBy);
                    }

                    GetFilters(ref query);
                    Dgv.DataSource = query;

                    SetVisibleColumnsAndNameColumns();
                }
            }
            catch (Exception exc)
            {
                WinFormsServ.Error(exc.Message);
            }
        }
예제 #20
0
        protected override void FillCard()
        {
            if (_Id == null)
            {
                return;
            }

            try
            {
                using (PriemEntities context = new PriemEntities())
                {
                    ExamName exn = (from pr in context.ExamName
                                    where pr.Id == IntId
                                    select pr).FirstOrDefault();

                    ExamName = exn.Name;
                    NamePad  = exn.NamePad;
                    Acronym  = exn.Acronym;
                }
            }
            catch (Exception ex)
            {
                WinFormsServ.Error("Ошибка при заполнении формы " + ex.Message);
            }
        }
예제 #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);
            }
        }
예제 #22
0
        protected override void FillCard()
        {
            if (_Id == null)
            {
                return;
            }

            try
            {
                using (PriemEntities context = new PriemEntities())
                {
                    OlympBook olymp = (from ec in context.OlympBook
                                       where ec.Id == GuidId
                                       select ec).FirstOrDefault();

                    if (olymp == null)
                    {
                        return;
                    }

                    OlympTypeId    = olymp.OlympTypeId;
                    OlympNameId    = olymp.OlympNameId;
                    OlympSubjectId = olymp.OlympSubjectId;
                    OlympLevelId   = olymp.OlympLevelId;
                }
            }
            catch (DataException de)
            {
                WinFormsServ.Error("Ошибка при заполнении формы " + de.Message);
            }
        }
예제 #23
0
 protected override void InsertRec(PriemEntities context, System.Data.Entity.Core.Objects.ObjectParameter idParam)
 {
     context.PaidData_Insert(DogovorNum, DogovorDate, DogovorTypeId, ProrektorId, Qualification, Srok,
                             DateStart, DateFinish, SumFirstYear, PayPeriodId, SumFirstPeriod, AbitFIORod, AbitParent, null,
                             Customer, CustomerAddress, CustomerPassport, CustomerPassportAuthor, CustomerLico, CustomerReason,
                             CustomerINN, CustomerRS, _abitId, "", "", idParam);
 }
예제 #24
0
        public ExamsVedCard(ExamsVedList owner, Guid?vedId)
        {
            InitializeComponent();

            _Id        = vedId;
            this.owner = owner;
            bdc        = MainClass.Bdc;

            using (PriemEntities context = new PriemEntities())
            {
                extExamsVed ved = (from vd in context.extExamsVed
                                   where vd.Id == _Id
                                   select vd).FirstOrDefault();

                this.facultyId    = ved.FacultyId;
                this.passDate     = ved.Date;
                this.isAdditional = ved.IsAdditional;
                this.examId       = ved.ExamId;
                this.studyBasisId = ved.StudyBasisId;
                this.isAddVed     = false;
                this.addCount     = 0;

                this.studyLevelGroupId = ved.StudyLevelGroupId;
            }

            InitControls();
        }
예제 #25
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);
            }
        }
예제 #26
0
        protected override void FillCard()
        {
            if (_Id == null)
            {
                return;
            }

            try
            {
                using (PriemEntities context = new PriemEntities())
                {
                    ExamInEntry ent = (from ex in context.ExamInEntry
                                       where ex.Id == IntId
                                       select ex).FirstOrDefault();


                    ExamId   = ent.ExamId;
                    IsProfil = ent.IsProfil;
                    EgeMin   = ent.EgeMin;
                }
            }
            catch (Exception exc)
            {
                WinFormsServ.Error("Ошибка при заполнении формы " + exc.Message);
            }
        }
예제 #27
0
        //обновление списка
        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);
            }
        }
예제 #28
0
        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);
            }
        }
예제 #29
0
        private void btnDeleteFromVed_Click(object sender, EventArgs e)
        {
            if (ExamVedId == null)
            {
                return;
            }

            if (MainClass.IsPasha())
            {
                if (MessageBox.Show("Удалить person из ведомости?", "Удаление", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    using (PriemEntities context = new PriemEntities())
                    {
                        foreach (DataGridViewRow dgvr in dgvList.SelectedRows)
                        {
                            Guid persId = new Guid(dgvr.Cells["Id"].Value.ToString());
                            try
                            {
                                context.ExamsVedHistory_DeleteByPersonAndVedId(ExamVedId, persId);
                            }
                            catch (Exception ex)
                            {
                                WinFormsServ.Error("Ошибка удаления данных" + ex.Message);
                                goto Next;
                            }
                            Next :;
                        }
                        UpdateDataGrid();
                    }
                }
            }
        }
예제 #30
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);
            }
        }