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); } }
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; } } }
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); } }
private IEnumerable <Entry> GetEntry(PriemEntities context) { IEnumerable <Entry> entry = MainClass.GetEntry(context); entry = entry.Where(c => c.IsSecond == IsSecond); return(entry); }
//void cbFaculty_SelectedIndexChanged(object sender, EventArgs e) //{ // FillStudyForm(); //} //void cbStudyBasis_SelectedIndexChanged(object sender, EventArgs e) //{ // FillStudyForm(); //} //void cbStudyForm_SelectedIndexChanged(object sender, EventArgs e) //{ // FillLicenseProgram(); //} //void cbLicenseProgram_SelectedIndexChanged(object sender, EventArgs e) //{ // UpdateDataGrid(); //} //public int? FacultyId //{ // get { return ComboServ.GetComboIdInt(cbFaculty); } // set { ComboServ.SetComboId(cbFaculty, value); } //} //public int? LicenseProgramId //{ // get { return ComboServ.GetComboIdInt(cbLicenseProgram); } // set { ComboServ.SetComboId(cbLicenseProgram, value); } //} //public int? StudyBasisId //{ // get { return ComboServ.GetComboIdInt(cbStudyBasis); } // set { ComboServ.SetComboId(cbStudyBasis, value); } //} //public int? StudyFormId //{ // get { return ComboServ.GetComboIdInt(cbStudyForm); } // set { ComboServ.SetComboId(cbStudyForm, value); } //} //public int StudyLevelGroupId //{ // get { return ComboServ.GetComboIdInt(cbStudyLevelGroup).Value; } // set { ComboServ.SetComboId(cbStudyLevelGroup, value); } //} //public bool IsSecond //{ // get { return chbIsSecond.Checked; } // set { chbIsSecond.Checked = value; } //} //public bool IsReduced //{ // get { return chbIsReduced.Checked; } // set { chbIsReduced.Checked = value; } //} //public bool IsParallel //{ // get { return chbIsParallel.Checked; } // set { chbIsParallel.Checked = value; } //} //public bool IsListener //{ // get { return chbIsListener.Checked; } // set { chbIsListener.Checked = value; } //} private void FillFaculty() { using (PriemEntities context = new PriemEntities()) { var ent = MainClass.GetEntry(context).Where(c => c.StudyLevelGroupId == StudyLevelGroupId); List <KeyValuePair <string, string> > lst = ent.Select(x => new { x.FacultyName, x.FacultyId }).Distinct().ToList() .Select(u => new KeyValuePair <string, string>(u.FacultyId.ToString(), u.FacultyName)).OrderBy(x => x.Value).Distinct().ToList(); ComboServ.FillCombo(cbFaculty, lst, false, false); } }
private void FillStudyLevelGroup() { using (PriemEntities context = new PriemEntities()) { var ent = MainClass.GetEntry(context).Select(x => new { x.StudyLevelGroupId, x.StudyLevelGroupName }).ToList(); List <KeyValuePair <string, string> > lst = ent.Select(u => new KeyValuePair <string, string>(u.StudyLevelGroupId.ToString(), u.StudyLevelGroupName)).Distinct().ToList(); ComboServ.FillCombo(cbStudyLevelGroup, lst, false, false); } }
private void FillStudyForm() { using (PriemEntities context = new PriemEntities()) { var ent = MainClass.GetEntry(context).Where(c => c.FacultyId == FacultyId); List <KeyValuePair <string, string> > lst = ent.ToList().Select(u => new KeyValuePair <string, string>(u.StudyFormId.ToString(), u.StudyForm.Name)).Distinct().ToList(); ComboServ.FillCombo(cbStudyForm, lst, false, true); cbStudyForm.SelectedIndex = 0; } }
private void FillStudyForm() { using (PriemEntities context = new PriemEntities()) { var ent = MainClass.GetEntry(context).Where(c => c.FacultyId == FacultyId).Where(c => c.StudyBasisId == StudyBasisId); ent = ent.Where(c => c.IsSecond == IsSecond && c.IsReduced == IsReduced && c.IsParallel == IsParallel); List <KeyValuePair <string, string> > lst = ent.ToList().Select(u => new KeyValuePair <string, string>(u.StudyFormId.ToString(), u.StudyFormName)).Distinct().ToList(); ComboServ.FillCombo(cbStudyForm, lst, false, false); } }
private void FillComboStudyForm() { using (PriemEntities context = new PriemEntities()) { var lst = ((from ent in MainClass.GetEntry(context) where ent.FacultyId == FacultyId select new { ent.StudyFormId, ent.StudyFormName }).Distinct()).ToList().Select(x => new KeyValuePair <string, string>(x.StudyFormId.ToString(), x.StudyFormName)).ToList(); ComboServ.FillCombo(cbStudyForm, lst, false, false); } }
private void FillObrazProgram() { using (PriemEntities context = new PriemEntities()) { List <KeyValuePair <string, string> > lst = ((from ent in MainClass.GetEntry(context) where ent.FacultyId == FacultyId && ent.LicenseProgramId == LicenseProgramId select new { Id = ent.ObrazProgramId, Name = ent.ObrazProgramName, Crypt = ent.ObrazProgramCrypt }).Distinct()).ToList().Select(u => new KeyValuePair <string, string>(u.Id.ToString(), u.Name + ' ' + u.Crypt)).ToList(); ComboServ.FillCombo(cbObrazProgram, lst, false, false); } }
private void FillLicenseProgram() { using (PriemEntities context = new PriemEntities()) { List <KeyValuePair <string, string> > lst = ((from ent in MainClass.GetEntry(context) where ent.FacultyId == FacultyId select new { Id = ent.LicenseProgramId, Name = ent.LicenseProgramName }).Distinct()).ToList().Select(u => new KeyValuePair <string, string>(u.Id.ToString(), u.Name)).ToList(); ComboServ.FillCombo(cbLicenseProgram, lst, false, false); cbLicenseProgram.SelectedIndex = 0; } }
private void FillProfile() { using (PriemEntities context = new PriemEntities()) { if (ObrazProgramId == null) { ComboServ.FillCombo(cbProfile, new List <KeyValuePair <string, string> >(), false, false); cbProfile.Enabled = false; return; } var ent = MainClass.GetEntry(context).Where(c => c.FacultyId == FacultyId).Where(c => c.ProfileId != null); 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); } if (LicenseProgramId != null) { ent = ent.Where(c => c.LicenseProgramId == LicenseProgramId); } if (ObrazProgramId != null) { ent = ent.Where(c => c.ObrazProgramId == ObrazProgramId); } List <KeyValuePair <string, string> > lst = ent.ToList().Select(u => new KeyValuePair <string, string>(u.ProfileId.ToString(), u.ProfileName)).Distinct().ToList(); if (lst.Count() > 0) { ComboServ.FillCombo(cbProfile, lst, false, false); cbProfile.Enabled = true; } else { ComboServ.FillCombo(cbProfile, new List <KeyValuePair <string, string> >(), false, false); cbProfile.Enabled = false; } } }
private void FillLicenseProgram() { using (PriemEntities context = new PriemEntities()) { var ent = MainClass.GetEntry(context).Where(c => c.FacultyId == FacultyId && c.StudyLevel.LevelGroupId == StudyLevelGroupId); 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.SP_LicenseProgram.Name)).Distinct().ToList(); ComboServ.FillCombo(cbLicenseProgram, lst, false, true); cbLicenseProgram.SelectedIndex = 0; } }
private void FillObrazProgram() { using (PriemEntities context = new PriemEntities()) { List <KeyValuePair <string, string> > lst = ((from ent in MainClass.GetEntry(context) where ent.FacultyId == facultyId && (cbStudyBasisId != null ? ent.StudyBasisId == cbStudyBasisId : true == true) && (cbStudyFormId != null ? ent.StudyBasisId == cbStudyFormId : true == true) select new { Id = ent.ObrazProgramId, Name = ent.ObrazProgramName, Crypt = ent.ObrazProgramCrypt }).Distinct()).ToList().Select(u => new KeyValuePair <string, string>(u.Id.ToString(), u.Name + ' ' + u.Crypt)).ToList(); ComboServ.FillCombo(cbObrazProgram, lst, false, true); } }
int GetPlanValueAndCheckLock() { using (PriemEntities context = new PriemEntities()) { int plan = 0, planCel = 0, entered = 0, enteredCel = 0; qEntry entry = (from ent in MainClass.GetEntry(context) where ent.IsReduced == IsReduced && ent.IsParallel == IsParallel && ent.IsSecond == IsSecond && ent.FacultyId == FacultyId && ent.LicenseProgramId == LicenseProgramId && ent.ObrazProgramId == ObrazProgramId && (ProfileId == null ? ent.ProfileId == 0 : ent.ProfileId == ProfileId) && ent.StudyFormId == StudyFormId && ent.StudyBasisId == StudyBasisId select ent).FirstOrDefault(); if (entry == null) { return(0); } plan = entry.KCP ?? 0; planCel = entry.KCPCel ?? 0; Guid?entryId = entry.Id; entered = (from ab in context.qAbitAll join ev in context.extEntryView on ab.Id equals ev.AbiturientId where ab.CompetitionId != 6 && ab.EntryId == entryId select ab).Count(); enteredCel = (from ab in context.qAbitAll join ev in context.extEntryView on ab.Id equals ev.AbiturientId where ab.CompetitionId == 6 && ab.EntryId == entryId select ab).Count(); CheckLockAndPasha(context); return(plan - planCel - entered); } }
private void FillObrazProgram() { using (PriemEntities context = new PriemEntities()) { var ent = MainClass.GetEntry(context).Where(c => c.FacultyId == FacultyId); if (StudyFormId != null) { ent = ent.Where(c => c.StudyFormId == StudyFormId); } if (LicenseProgramId != null) { ent = ent.Where(c => c.LicenseProgramId == LicenseProgramId); } List <KeyValuePair <string, string> > lst = ent.ToList().Select(u => new KeyValuePair <string, string>(u.ObrazProgramId.ToString(), u.SP_ObrazProgram.Name + ' ' + u.StudyLevel.Acronym + "." + u.SP_ObrazProgram.Number + "." + MainClass.PriemYear)).Distinct().ToList(); ComboServ.FillCombo(cbObrazProgram, lst, false, true); } }