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(); } } } }
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(); }
private void btnUpdateImport_Click(object sender, EventArgs e) { if (!MainClass.IsPasha()) { return; } if (MessageBox.Show("Обновить IsImported = true?", "Обновление", MessageBoxButtons.YesNo) == DialogResult.Yes) { foreach (DataGridViewRow dgvr in dgvAbiturients.SelectedRows) { string sId = dgvr.Cells["Id"].Value.ToString(); try { string query; query = string.Format("UPDATE [Application] SET IsImported = 1 WHERE Id = '{0}'", sId); _bdcInet.ExecuteQuery(query); } catch (Exception ex) { WinFormsServ.Error("Ошибка обновления данных" + ex.Message); goto Next; } Next :; } UpdateDataGrid(); } }
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(); } } }
private void btnDeleteAb_Click(object sender, EventArgs e) { if (MainClass.IsPasha()) { using (PriemEntities context = new PriemEntities()) { if (MessageBox.Show("Удалить из рейтингового списка?", "Удаление", MessageBoxButtons.YesNo) == DialogResult.Yes) { using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.RequiresNew)) { foreach (DataGridViewRow dgvr in dgvAbits.SelectedRows) { Guid abId = new Guid(dgvr.Cells["Id"].Value.ToString()); try { context.Fixieren_DELETE(abId); context.FirstWave_DeleteByAbId(abId); } catch (Exception ex) { WinFormsServ.Error("Ошибка удаления данных" + ex.Message); } } transaction.Complete(); } UpdateDataGrid(); } } } }
protected override void SetAllFieldsEnabled() { base.SetAllFieldsEnabled(); this.tbNumber.TextChanged += new System.EventHandler(this.tbNumber_TextChanged); tbYear.Enabled = false; tbFBSComment.Enabled = false; tbFBSStatus.Enabled = false; tbName.Enabled = chbNewFIO.Checked; tbSecondName.Enabled = chbNewFIO.Checked; tbSurname.Enabled = chbNewFIO.Checked; if (MainClass.IsPasha() || MainClass.IsOwner()) { btnSetStatusPasha.Enabled = tbCommentFBSPasha.Enabled = true; } else { btnSetStatusPasha.Enabled = false; } //if (!MainClass.IsPasha()) //{ // SetAllFieldsNotEnabled(); // btnSaveChange.Enabled = true; // dgvExams.Enabled = true; // dgvExams.Columns["јпелл¤ци¤"].ReadOnly = true; // dgvExams.Columns["Ѕаллы"].ReadOnly = true; //} }
protected override void ExtraInit() { base.ExtraInit(); _tableName = "ed.EgeCertificate"; this.MdiParent = null; lblIsImported.Visible = false; if (_Id == null) { this.tbNumber.TextChanged += new System.EventHandler(this.tbNumber_TextChanged); InitGridNew(); } if (MainClass.IsPasha() || MainClass.IsOwner()) { btnSetStatusPasha.Visible = btnSetStatusPasha.Enabled = true; tbCommentFBSPasha.Visible = true; } else { btnSetStatusPasha.Visible = btnSetStatusPasha.Enabled = false; tbCommentFBSPasha.Visible = false; } }
//открытие файла private void btnLoad_Click(object sender, EventArgs e) { if (!MainClass.IsPasha()) { return; } ParseAndAction(); }
private void btnOk_Click(object sender, EventArgs e) { if (!MainClass.IsPasha()) { return; } LoadMarks(); }
private void btnLock_Click(object sender, EventArgs e) { if (ExamVedId == null) { return; } if (MainClass.IsOwner() || MainClass.IsCrypto() || MainClass.IsPasha()) { if (MessageBox.Show("Ведомость будет закрыта для редактирования, продолжить? ", "Внимание", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { using (PriemEntities context = new PriemEntities()) { using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.RequiresNew)) { List <int> lstNumbers = new List <int>(); int curNum; foreach (DataGridViewRow dgvr in dgvList.Rows) { Guid persId = new Guid(dgvr.Cells["Id"].Value.ToString()); curNum = GetRandomNumber(ref lstNumbers); context.ExamsVedHistory_UpdateNumber(ExamVedId, persId, curNum); } context.ExamsVed_UpdateLock(true, ExamVedId); btnChange.Enabled = false; btnDelete.Enabled = false; btnLock.Enabled = false; lblLocked.Visible = true; MessageBox.Show("Выполнено"); btnPrintSticker.Enabled = true; tbCountCell.Enabled = true; transaction.Complete(); } } } catch (Exception ex) { WinFormsServ.Error("Ошибка обновления данных: " + ex.Message); } } } else { WinFormsServ.Error("Невозможно закрытие ведомостей, недостаточно прав"); } }
/// <summary> /// Статистика - количество заявлений с одного региона пофакультетно /// </summary> public RegionFacultyAbitCountStatistics() { InitializeComponent(); this.MdiParent = MainClass.mainform; if (!MainClass.IsOwner() || !MainClass.IsPasha()) { MessageBox.Show("В разработке"); this.Close(); return; } FillComboRegion(); }
//путь сохранения private void btnFolder_Click(object sender, EventArgs e) { if (folderBrowser.ShowDialog() == DialogResult.OK) { tbFolder.Text = folderBrowser.SelectedPath; btnStart.Enabled = true; if (MainClass.IsPasha()) { btnMetro.Enabled = true; } } }
protected override void SetAllFieldsNotEnabled() { base.SetAllFieldsNotEnabled(); if (MainClass.IsPasha() || MainClass.IsOwner()) { btnSetStatusPasha.Enabled = tbCommentFBSPasha.Enabled = true; } else { btnSetStatusPasha.Enabled = false; } }
//изменение - только для супер private void btnChange_Click(object sender, EventArgs e) { if (ExamVedId == null || ExamVedRoomId == null) { return; } if (MainClass.IsFacMain() || MainClass.IsPasha()) { ExamsVedRoomCard p = new ExamsVedRoomCard(this, ExamVedId, ExamVedRoomId); p.Show(); } }
protected override void DeleteSelectedRows(string sId) { if (MainClass.IsPasha()) { //foreach (DataGridViewRow dgvr in Dgv.SelectedRows) //{ // string itemId = dgvr.Cells["Id"].Value.ToString(); Guid g = Guid.Empty; Guid.TryParse(sId, out g); DeletePerson(g); //} MainClass.DataRefresh(); } }
//дополнительная инициализация контролов private void InitControls() { InitFocusHandlers(); this.CenterToParent(); //this.MdiParent = MainClass.mainform; bdc = MainClass.Bdc; lblAdd.Text = string.Empty; using (PriemEntities context = new PriemEntities()) { extExamsVed exVed = (from ev in context.extExamsVed where ev.Id == _vedId select ev).FirstOrDefault(); _examId = exVed.ExamId.ToString(); _dateExam = exVed.Date; _facultyId = exVed.FacultyId.ToString(); _studybasisId = exVed.StudyBasisId.ToString(); lblFaculty.Text += exVed.FacultyName; if (exVed.StudyBasisId == null) { lblStudyBasis.Text += "все"; } else { lblStudyBasis.Text += exVed.StudyBasisName; } lblExam.Text += exVed.ExamName; lblDate.Text += exVed.Date.ToShortDateString(); if (exVed.IsAddVed) { lblAdd.Text += "дополнительная (" + exVed.AddCount.ToString() + ")"; } if (MainClass.IsCryptoMain() || MainClass.IsPasha()) { btnLoad.Visible = true; } else { btnLoad.Visible = false; } } }
protected override void ExtraInit() { base.ExtraInit(); btnCard.Visible = btnAdd.Visible = btnRemove.Visible = false; loadClass = new LoadFromInet(); _bdcInet = loadClass.BDCInet; if (MainClass.IsReadOnly()) { btnLoad.Enabled = false; } try { using (PriemEntities context = new PriemEntities()) { ComboServ.FillCombo(cbFaculty, HelpClass.GetComboListByTable("ed.qFaculty", "ORDER BY Name"), false, true); ComboServ.FillCombo(cbStudyBasis, HelpClass.GetComboListByTable("ed.StudyBasis", "ORDER BY Name"), false, true); ComboServ.FillCombo(cbStudyLevel, HelpClass.GetComboListByTable("ed.StudyLevel", "ORDER BY LevelGroupId, Name"), false, false); cbStudyBasis.SelectedIndex = 0; FillNationality(); FillLicenseProgram(); FillObrazProgram(); FillProfile(); UpdateDataGrid(); if (MainClass.IsPasha()) { gbUpdateImport.Visible = true; } else { gbUpdateImport.Visible = false; } chbSelectAll.Checked = false; tbAbitBarcode.Focus(); } } catch (Exception exc) { WinFormsServ.Error("Ошибка при инициализации формы " + exc.Message); } }
public static void SetBackDocForBudgetInEntryView() { if (!MainClass.IsPasha()) { return; } using (PriemEntities context = new PriemEntities()) { if (MessageBox.Show("Проставить 'Забрал документы' для платных заявлений, поступивших на бесплатное?", "Внимание", MessageBoxButtons.YesNo) == DialogResult.Yes) { using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.RequiresNew, TimeSpan.FromHours(1))) { var abits = from ev in context.extEntryView join ab in context.extAbit on ev.AbiturientId equals ab.Id where ab.StudyLevelGroupId == 1 && ab.StudyBasisId == 1 && !ab.BackDoc && ab.HasOriginals select ab; foreach (extAbit abit in abits) { var abBackDocks = from ab in context.extAbit where ab.StudyLevelGroupId == abit.StudyLevelGroupId && ab.IsReduced == abit.IsReduced && ab.IsParallel == abit.IsParallel && ab.IsSecond == abit.IsSecond && ab.FacultyId == abit.FacultyId && ab.LicenseProgramId == abit.LicenseProgramId && ab.ObrazProgramId == abit.ObrazProgramId && (abit.ProfileId == null ? ab.ProfileId == null : ab.ProfileId == abit.ProfileId) && ab.StudyFormId == abit.StudyFormId && ab.StudyBasisId == 2 select ab; if (abBackDocks.Count() > 0) { foreach (extAbit abBack in abBackDocks) { context.Abiturient_UpdateBackDoc(true, DateTime.Now, abBack.Id); } } } transaction.Complete(); } } } }
private void DeletePerson(Guid g) { if (MainClass.IsPasha()) { try { using (PriemEntities context = new PriemEntities()) { context.Person_deleteAllInfo(g); } } catch (Exception ex) { WinFormsServ.Error("Ошибка удаления данных", ex); } } }
private void btnCreateOrder_Click(object sender, EventArgs e) { if (MainClass.IsPasha()) { if (dgvViews.CurrentRow == null || dgvViews.CurrentRow.Index < 0) { return; } if (MessageBox.Show("Отчислить людей из выбранного представления?", "Внимание!", MessageBoxButtons.YesNo) == DialogResult.Yes) { using (PriemEntities context = new PriemEntities()) { Guid?protocolId = new Guid(dgvViews.CurrentRow.Cells["Id"].Value.ToString()); if (MessageBox.Show("Перенести оригиналы на другие доступные конкурсы (если это возможно, переносится на максимальный доступный приоритет)?", "Внимание!", MessageBoxButtons.YesNo) == DialogResult.Yes) { var abitLst = context.ProtocolHistory.Where(x => x.ProtocolId == protocolId).Select(x => x.AbiturientId).ToList(); foreach (Guid abId in abitLst) { try { ApplicationDataProvider.ChangeHasOriginalsDestination(abId, null); } catch (Exception ex) { WinFormsServ.Error(ex); } } } using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.RequiresNew)) { context.EntryView_UpdateDisEntry(protocolId); context.Abiturient_UpdateBackDocByDisEntry(true, DateTime.Now.Date, protocolId); MessageBox.Show("ОТЧИСЛЕНЫ! ГЫ-ГЫ"); transaction.Complete(); } } } } }
//дополнительная инициализация private void InitItems() { this.CenterToParent(); this.MdiParent = MainClass.mainform; _bdc = MainClass.Bdc; if (MainClass.IsPasha()) { ComboServ.FillCombo(cbFaculty, HelpClass.GetComboListByTable("ed.SP_Faculty"), false, true); } else { ComboServ.FillCombo(cbFaculty, HelpClass.GetComboListByTable("ed.SP_Faculty"), false, false); } btnStart.Enabled = false; btnMetro.Enabled = false; }
private void btnDelete_Click(object sender, EventArgs e) { if (ExamVedId == null) { return; } try { using (PriemEntities context = new PriemEntities()) { int cnt = (from ev in context.extExamsVed where ev.Id == ExamVedId && (ev.IsLocked || ev.IsLoad) select ev).Count(); if (cnt > 0) { WinFormsServ.Error("Данная ведомость уже закрыта. Удаление невозможно!"); return; } if (MainClass.IsPasha()) { if (MessageBox.Show("Удалить выбранную ведомость? ", "Внимание", MessageBoxButtons.YesNo) == DialogResult.Yes) { using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.RequiresNew)) { context.ExamsVedHistory_DeleteByVedId(ExamVedId); context.ExamsVed_Delete(ExamVedId); transaction.Complete(); UpdateVedList(); } } } } } catch (Exception de) { WinFormsServ.Error("Ошибка удаления данных " + de.Message); } }
public EntryViewList() : base() { //this.CenterToParent(); //this.MdiParent = MainClass.mainform; //this.sQuery = string.Format("SELECT DISTINCT Person.Id, {0} as Ид_номер, Person.Surname AS Фамилия, Person.Name AS Имя, Person.SecondName AS Отчество, Person.BirthDate AS Дата_рождения " + // "FROM Person INNER JOIN ExamsVedHistory ON ExamsVedHistory.PersonId = Person.Id ", MainClass.GetStringPersonNumber()); //InitializeComponent(); //InitControls(); //btnPrintOrder.Visible = btnPrintOrder.Enabled = btnCancelView.Enabled = btnCancelView.Visible = false; btnCreate.Enabled = false; chbIsForeign.Enabled = false; chbIsForeign.Checked = true; if (MainClass.IsFacMain()) { btnCreate.Enabled = true; btnPrintOrder.Visible = btnPrintOrder.Enabled = true; } if (MainClass.IsPasha()) { btnPrintOrder.Visible = btnPrintOrder.Enabled = btnCancelView.Enabled = btnCancelView.Visible = true; btnCreate.Enabled = true; } if (MainClass.IsPrintOrder()) { btnPrintOrder.Visible = btnPrintOrder.Enabled = true; } //// посомтреть, почему отдельные факультеты //if (_bdc.IsMed() || _bdc.GetFacultyId() == "9" || _bdc.GetFacultyId() == "14" || _bdc.GetFacultyId() == "20") // btnCreate.Enabled = true; //if (_bdc.IsReadOnly()) // btnPrintOrder.Visible = btnPrintOrder.Enabled = true; }
public static void DeleteDogFromFirstWave() { if (!MainClass.IsPasha()) { return; } using (PriemEntities context = new PriemEntities()) { if (MessageBox.Show("Удалить платников, забравших документы или зачисленных на 1 курс, из FirstWave?", "Внимание", MessageBoxButtons.YesNo) == DialogResult.Yes) { using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.RequiresNew, TimeSpan.FromHours(1))) { context.FirstWave_DELETE_DogEntryBack(); transaction.Complete(); } } } }
private void btnUnload_Click(object sender, EventArgs e) { if (ExamVedId == null) { return; } using (PriemEntities context = new PriemEntities()) { bool isLocked = (from ev in context.extExamsVed where ev.Id == ExamVedId select ev.IsLocked).FirstOrDefault(); if (!isLocked) { return; } if (MainClass.IsPasha()) { if (MessageBox.Show("Разлочить ведомость и удалить загруженные оценки?", "Удаление", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.RequiresNew)) { context.Mark_DeleteByExamVedId(ExamVedId); context.ExamsVed_UpdateLoad(false, ExamVedId); transaction.Complete(); } MessageBox.Show("Выполнено"); } catch (Exception ex) { WinFormsServ.Error("Ошибка удаления данных" + ex.Message); } } } } }
protected override void UpdateRec(PriemEntities context, Guid id) { context.Person_Foreign_UpdateWithoutMain(BirthPlace, Sex, CountryId, NationalityId, RegionId, Phone, Mobiles, Email, Code, City, Street, House, Korpus, Flat, CodeReal, CityReal, StreetReal, HouseReal, KorpusReal, FlatReal, HostelAbit, HostelEduc, HasAssignToHostel, HostelFacultyId, HasExamPass, ExamPassFacultyId, IsExcellent, LanguageId, SchoolCity, SchoolTypeId, SchoolName, SchoolNum, SchoolExitYear, SchoolAVG, CountryEducId, RegionEducId, IsEqual, EqualDocumentNumber, HasTRKI, TRKISertificateNumber, DiplomSeries, DiplomNum, HighEducation, HEProfession, HEQualification, HEEntryYear, HEExitYear, HEStudyFormId, HEWork, Stag, WorkPlace, PassportCode, PersonalCode, PersonInfo, ExtraInfo, ScienceWork, StartEnglish, EnglishMark, id); if (MainClass.RightsSov_SovMain_FacMain() || MainClass.IsPasha()) { context.Person_UpdateMain(PersonName, SecondName, Surname, BirthDate, PassportTypeId, PassportSeries, PassportNumber, PassportAuthor, PassportDate, AttestatRegion, AttestatSeries, AttestatNum, Privileges, null, id); } context.PersonVisaInfo_update(id, VisaStart, VisaEnd, EnterInRussiaDate); context.PersonEducationDirection_update(id, EducationDirectionDate, EducationDirectionNumber); }
private void LoadMarks() { if (!MainClass.IsPasha()) { return; } try { wtc = new Watch(2); wtc.Show(); marksCount = 0; if (ExamId == null) { foreach (KeyValuePair <string, string> ex in cbExam.Items) { int exId; if (int.TryParse(ex.Key, out exId)) { SetMarksForExam(exId); } } } else { SetMarksForExam(ExamId); } } catch (Exception ex) { WinFormsServ.Error("Ошибка загрузки оценок " + ex.Message); } finally { wtc.Close(); MessageBox.Show(string.Format("Зачтено {0} оценок", marksCount)); } }
private void btnSave_Click(object sender, EventArgs e) { if (MainClass.IsPasha()) { using (PriemEntities context = new PriemEntities()) { Guid?protId = new Guid(dgvViews.CurrentRow.Cells["Id"].Value.ToString()); if (forUpdate) { context.OrderNumbers_Update(protId, dtOrderDate.Value.Date, tbOrderNum.Text.Trim(), dtOrderDateFor.Value.Date, tbOrderNumFor.Text.Trim(), 1, DateTime.Now.Date, ""); } else { context.OrderNumbers_Insert(protId, dtOrderDate.Value.Date, tbOrderNum.Text.Trim(), dtOrderDateFor.Value.Date, tbOrderNumFor.Text.Trim(), 1, DateTime.Now.Date, ""); } forUpdate = true; SetReadOnly(); } } }
private void btnCancelView_Click(object sender, EventArgs e) { if (!MainClass.IsPasha()) { return; } using (PriemEntities context = new PriemEntities()) { if (dgvViews.CurrentRow == null || dgvViews.CurrentRow.Index < 0) { return; } if (MessageBox.Show("Отменить выделенное представление", "Внимание!", MessageBoxButtons.YesNo) == DialogResult.Yes) { Guid?protocolId = new Guid(dgvViews.CurrentRow.Cells["Id"].Value.ToString()); context.Protocol_UpdateIsOld(true, protocolId); MessageBox.Show("Представление отменено"); UpdateDataGrid(); } } }
private void btnSetStatusPasha_Click(object sender, EventArgs e) { if (MainClass.IsPasha() || MainClass.IsOwner()) { if (_Id == null) { return; } using (PriemEntities context = new PriemEntities()) { var cert = (from ec in context.EgeCertificate where ec.Id == GuidId select ec).FirstOrDefault(); if (cert != null) { if (MessageBox.Show(string.Format("ѕроставить статус 'ѕроверено' дл¤ свидетельства {0}?", cert.Number), "¬нимание", MessageBoxButtons.YesNo) == DialogResult.Yes) { context.EgeCertificate_UpdateFBSStatus(4, tbCommentFBSPasha.Text.Trim(), cert.Id); MessageBox.Show("¬ыполнено"); var c = (from ec in context.EgeCertificate where ec.Id == GuidId select ec).FirstOrDefault(); FBSStatus = (from fs in context.FBSStatus where fs.Id == c.FBSStatusId select fs.Name).FirstOrDefault(); FBSComment = c.FBSComment; } } else { MessageBox.Show("Ќет свидетельств, удовлетвор¤ющих критери¤м"); } } } }