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); } }
protected override void FillCard() { if (_Id == null) { return; } try { using (PriemEntities context = new PriemEntities()) { qEntry ent = (from ex in context.qEntry where ex.Id == GuidId select ex).FirstOrDefault(); tbStudyLevel.Text = ent.StudyLevelName; tbFaculty.Text = ent.FacultyName; tbLicenseProgram.Text = ent.LicenseProgramName + " (" + ent.LicenseProgramCode + ")"; tbObrazProgram.Text = ent.ObrazProgramName + " (" + ent.ObrazProgramCrypt + ")"; tbProfile.Text = ent.ProfileName; tbStudyForm.Text = ent.StudyFormName; tbStudyBasis.Text = ent.StudyBasisName; tbStudyPlan.Text = ent.StudyPlanNumber; tbKC.Text = ent.KCP.ToString(); string real = ent.IsSecond ? " для лиц с ВО" : ""; real += ent.IsReduced ? " сокращенная" : ""; real += ent.IsParallel ? " параллельная" : ""; tbSecond.Text = real.Length == 0 ? "нет" : real; tbKCPCel.Text = ent.KCPCel.ToString(); UpdateExams(); } } catch (Exception exc) { WinFormsServ.Error("Ошибка при заполнении формы " + exc.Message); } }