public Cathedras_Edit(Cathedra cathedra) { InitializeComponent(); this.cathedra = cathedra; controls = new List <Control>() { number, name, phone, decan }; foreach (List <string> value in SQLiteAdapter.GetValue("employees WHERE employees.id NOT IN(SELECT cathedras.id_decan FROM cathedras)", "employees.surname, employees.name, employees.patronymic")) { string decan_name = value[0].Trim() + " " + value[1].Trim() + " " + value[2].Trim(); if (!decan.Items.Contains(decan_name)) { decan.Items.Add(decan_name); } } decan.Items.Add(cathedra.surname.Trim() + " " + cathedra.name.Trim() + " " + cathedra.patronymic.Trim()); number.Text = cathedra.number; name.Text = cathedra.cathedra; phone.Text = cathedra.phone; decan.SelectedItem = cathedra.surname.Trim() + " " + cathedra.name.Trim() + " " + cathedra.patronymic.Trim(); // EventHandler's number.TextChanged += Controls_Listener; name.TextChanged += Controls_Listener; phone.TextChanged += Controls_Listener; decan.SelectionChanged += Controls_Listener; }
public ActionResult CreateCathedra(Cathedra cathedra) { db.Cathedras.Add(cathedra); db.SaveChanges(); return(RedirectToAction("Cathedra")); }
public async Task <IActionResult> Edit(int id, int facultyId, [Bind("Id,CathedraName")] Cathedra cathedra) { cathedra.FacultyId = facultyId; if (id != cathedra.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cathedra); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CathedraExists(cathedra.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index", "Cathedras", new { id = facultyId, name = _context.FacultyCollection.Where(c => c.Id == facultyId).FirstOrDefault().FacultyName })); } ViewData["FacultyId"] = new SelectList(_context.FacultyCollection, "Id", "FacultyName", cathedra.FacultyId); return(RedirectToAction("Index", "Cathedras", new { id = facultyId, name = _context.FacultyCollection.Where(c => c.Id == facultyId).FirstOrDefault().FacultyName })); }
public ActionResult DeleteCathedra(int id) { Cathedra cath = db.Cathedras.Find(id); if (cath == null) { return(HttpNotFound()); } return(View(cath)); }
public ActionResult EditCathedra(int?id) { Cathedra cathedra = db.Cathedras.Find(id); if (cathedra == null) { return(HttpNotFound()); } ViewBag.Institute = db.Institutes.ToList(); return(View(cathedra)); }
public ActionResult DeleteGrConfirmed(int id) { Cathedra cath = db.Cathedras.Find(id); if (cath == null) { return(HttpNotFound()); } db.Cathedras.Remove(cath); db.SaveChanges(); return(RedirectToAction("Cathedra")); }
public async Task <OperationDetails> Create(CathedraDTO itemDTO) { Cathedra newItem = new Cathedra() { cathedraName = itemDTO.cathedraName, ID_faculty = Database.RFaculties.Get(itemDTO.facultyName).IdFaculty }; Database.RCathedra.Create(newItem); await Database.Save(); return(new OperationDetails(true, "Registration success", "")); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Cathedra = await _context.Cathedras.Where(c => c.Id == id).Include(x => x.Groups).FirstOrDefaultAsync(); if (Cathedra == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> Create(int facultyId, [Bind("Id,FacultyId,CathedraName")] Cathedra cathedra) { cathedra.FacultyId = facultyId; if (ModelState.IsValid) { _context.Add(cathedra); await _context.SaveChangesAsync(); // return RedirectToAction(nameof(Index)); return(RedirectToAction("Index", "Cathedras", new { id = facultyId, name = _context.FacultyCollection.Where(c => c.Id == facultyId).FirstOrDefault().FacultyName })); } // ViewData["FacultyId"] = new SelectList(_context.FacultyCollection, "Id", "FacultyName", cathedra.FacultyId); //return View(cathedra); return(RedirectToAction("Index", "Cathedras", new { id = facultyId, name = _context.FacultyCollection.Where(c => c.Id == facultyId).FirstOrDefault().FacultyName })); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Cathedra = await _context.Cathedras.FirstOrDefaultAsync(m => m.Id == id); if (Cathedra == null) { return(NotFound()); } return(Page()); }
public CathedraDTO FindCathedra(string name) { Cathedra item = Database.RCathedra.Get(name); CathedraDTO itemDTO = null; if (item != null) { itemDTO = new CathedraDTO(); itemDTO.Id_Cathedra = item.IdCathedra; itemDTO.cathedraName = item.cathedraName; itemDTO.facultyName = Database.RCathedra.GetAll().Where(x => x.IdCathedra == item.IdCathedra).SingleOrDefault().cathedraName; } return(itemDTO); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Cathedra = await _context.Cathedras.FindAsync(id); if (Cathedra != null) { _context.Cathedras.Remove(Cathedra); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public ActionResult EditCathedra(Cathedra cathedra, int[] selectedInstitute) { Cathedra newCathedra = db.Cathedras.Find(cathedra.ID); newCathedra.Name = cathedra.Name; newCathedra.Teacher.Clear(); if (selectedInstitute != null) { foreach (var c in db.Teachers.Where(co => selectedInstitute.Contains(co.ID))) { newCathedra.Teacher.Add(c); } } db.Entry(newCathedra).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Cathedra")); }
private void CreateOrder(int course, string code, string direct) { string file = "order.docx"; // создаём документ DocX document = DocX.Create(dir + file); document.SetDefaultFont(new Font("Times New Roman"), fontSize: 12); // Устанавливаем стандартный для документа шрифт и размер шрифта document.MarginLeft = 42.5f; document.MarginTop = 34.1f; document.MarginRight = 34.1f; document.MarginBottom = 34.1f; document.InsertParagraph($"Проект приказа\n\n").Bold().Alignment = Alignment.center; document.InsertParagraph($"\tВ соответствии с календарным графиком учебного процесса допустить " + $"и направить для прохождения {form_pract.SelectedItem.ToString().ToLower()} практики {combobox_type.SelectedItem} " + $"следующих студентов {course} курса, очной формы, направление подготовки {code} «{direct}», " + $"профиль «Прикладная информатика в государственном и муниципальном управлении», факультета " + $"«Информационные системы в управлении» с {first_date.Text}г. по {second_date.Text}.\n"); document.InsertParagraph($"\tСпособ проведения практики: выездная и стационарная."); document.InsertParagraph($"\tСтационарная практика (без оплаты)\n").Bold(); document.InsertParagraph($"\tОбучающихся за счет бюджетных ассигнований федерального бюджета"); IEnumerable <Fill_data> studentsF = fill_data.Where(k => k.payable.Equals("Бюджет")); IEnumerable <Fill_data> studentsB = fill_data.Where(k => k.payable.Equals("Внебюджет")); Xceed.Document.NET.Table table = document.AddTable(studentsF.Count() + 1, 4); Xceed.Document.NET.Table tabpe_pay = document.AddTable(studentsB.Count() + 1, 4); table.Alignment = Alignment.center; table.AutoFit = AutoFit.Contents; tabpe_pay.Alignment = Alignment.center; tabpe_pay.AutoFit = AutoFit.Contents; table.Rows[0].Cells[0].Paragraphs[0].Append("ФИО студента").Alignment = Alignment.center; table.Rows[0].Cells[1].Paragraphs[0].Append("Группа").Alignment = Alignment.center; table.Rows[0].Cells[2].Paragraphs[0].Append("Место прохождения практики").Alignment = Alignment.center; table.Rows[0].Cells[3].Paragraphs[0].Append("Руководитель практики").Alignment = Alignment.center; tabpe_pay.Rows[0].Cells[0].Paragraphs[0].Append("ФИО студента").Alignment = Alignment.center; tabpe_pay.Rows[0].Cells[1].Paragraphs[0].Append("Группа").Alignment = Alignment.center; tabpe_pay.Rows[0].Cells[2].Paragraphs[0].Append("Место прохождения практики").Alignment = Alignment.center; tabpe_pay.Rows[0].Cells[3].Paragraphs[0].Append("Руководитель практики").Alignment = Alignment.center; for (int i = 0; i < studentsF.Count(); i++) { table.Rows[i + 1].Cells[0].Paragraphs[0].Append(studentsF.ElementAt(i).fio); table.Rows[i + 1].Cells[1].Paragraphs[0].Append(combobox_groupe.SelectedItem.ToString()); table.Rows[i + 1].Cells[2].Paragraphs[0].Append(studentsF.ElementAt(i).place); table.Rows[i + 1].Cells[3].Paragraphs[0].Append(combobox_otvetsven.SelectedItem.ToString()); } for (int i = 0; i < studentsB.Count(); i++) { tabpe_pay.Rows[i + 1].Cells[0].Paragraphs[0].Append(studentsB.ElementAt(i).fio); tabpe_pay.Rows[i + 1].Cells[1].Paragraphs[0].Append(combobox_groupe.SelectedItem.ToString()); tabpe_pay.Rows[i + 1].Cells[2].Paragraphs[0].Append(studentsB.ElementAt(i).place); tabpe_pay.Rows[i + 1].Cells[3].Paragraphs[0].Append(combobox_otvetsven.SelectedItem.ToString()); } document.InsertParagraph().InsertTableAfterSelf(table); if (studentsB.Count() > 0) { document.InsertParagraph($"\tОбучающихся на платной основе"); document.InsertParagraph().InsertTableAfterSelf(tabpe_pay); } document.InsertParagraph($"\tОтветственный по {form_pract.SelectedItem.ToString().ToLower()} практики по кафедре в период с {first_date.Text} г. по {second_date.Text} г. - {combobox_otvetsven.Text} ст. преподаватель кафедры ПИЭ."); Classes.Direction directions = Helper.ODirections.Where(k => k.name.Equals(direct)).ElementAt(0); Cathedra cathedra = Helper.OCathedras.Where(k => k.cathedra.Equals(directions.id_cathedra)).ElementAt(0); document.InsertParagraph($@" Проректор по УР ________«____» ________ {first_date.SelectedDate.Value.Year}г. С.В. Мельник Главный бухгалтер ________«____» ________ {first_date.SelectedDate.Value.Year} г. Г.И. Вилисова Начальник ПЭО ________«____» ________ {first_date.SelectedDate.Value.Year}г. Т.В. Грачева Начальник ООП и СТВ ________«____» ________{first_date.SelectedDate.Value.Year}г. Ю.С. Сачук Декан факультета «{directions.id_cathedra}» ________«____» ________ {first_date.SelectedDate.Value.Year}г. {cathedra.name.Remove(1)}.{cathedra.patronymic.Remove(1)}. {cathedra.surname} Ответственный за практику и содействие трудоустройству на факультете ________«____» __________ {first_date.SelectedDate.Value.Year}г. {cathedra.name.Remove(1)}.{cathedra.patronymic.Remove(1)}.{cathedra.surname} "); document.Save(); MessageBox.Show("Документ успешно сформирован!", "Документ", MessageBoxButton.OK, MessageBoxImage.Information); }
private bool CreateContract_Attch2() { try { string file = $"Приложение 2.docx"; SQLiteAdapter.DeleteRowById("attach", $"[id_contract]='{sel_items.id}'"); // Удаляем существующие данные // создаём документ DocX document = DocX.Create(dir + file); document.SetDefaultFont(new Font("Times New Roman"), fontSize: 12); // Устанавливаем стандартный для документа шрифт и размер шрифта document.MarginLeft = 42.5f; document.MarginTop = 34.1f; document.MarginRight = 34.1f; document.MarginBottom = 34.1f; document.PageLayout.Orientation = Xceed.Document.NET.Orientation.Landscape; document.InsertParagraph("Приложение 2").Alignment = Alignment.right; document.InsertParagraph($"к договору № {contract_num.Text} от {date.Text} г.").Alignment = Alignment.right; document.InsertParagraph("Список студентов ФГБОУ ВО «СибАДИ», направляемых на производственные объекты").Alignment = Alignment.center; document.InsertParagraph($"\t\t{contract_org.Text}\t\t\t").UnderlineStyle(UnderlineStyle.singleLine).Alignment = Alignment.center; document.InsertParagraph("наименование предприятия, учреждения, организации").Script(Script.superscript).FontSize(12).Alignment = Alignment.center; document.InsertParagraph("для прохождения").Alignment = Alignment.center; Paragraph paragraph1 = document.InsertParagraph($"\t\t{form_pract.SelectedItem.ToString().Trim()}, {type_pract.Text}\t\t\t").UnderlineStyle(UnderlineStyle.singleLine); paragraph1.Append($"в {date.SelectedDate.Value.Year} г").Alignment = Alignment.center; document.InsertParagraph("вид и тип практики").Script(Script.superscript).FontSize(12).Alignment = Alignment.center; int _all_el = 0; foreach (List <string> tmp in selected_student) { _all_el += tmp.Count; } // создаём таблицу с N строками и 3 столбцами Table table = document.AddTable(_all_el + 2, 9); // располагаем таблицу по центру table.Alignment = Alignment.center; table.AutoFit = AutoFit.Contents; #region Стандартное заполнение table.Rows[0].Cells[0].Paragraphs[0].Append("№ п/п").Alignment = Alignment.center; table.Rows[0].Cells[1].Paragraphs[0].Append("Название факультета, кафедры, заявивших студентов на практику ").Alignment = Alignment.center; table.Rows[0].Cells[2].Paragraphs[0].Append("Направление/специальность").Alignment = Alignment.center; table.Rows[0].Cells[3].Paragraphs[0].Append("Сроки практики").Alignment = Alignment.center; table.Rows[0].Cells[4].Paragraphs[0].Append("Курс").Alignment = Alignment.center; table.Rows[0].Cells[5].Paragraphs[0].Append("Группа").Alignment = Alignment.center; table.Rows[0].Cells[6].Paragraphs[0].Append("Ф.И.О. студента").Alignment = Alignment.center; table.Rows[0].Cells[7].Paragraphs[0].Append("Ф.И.О. руководителя практики от кафедры").Alignment = Alignment.center; table.Rows[0].Cells[8].Paragraphs[0].Append("Контактные телефоны кафедры по вопросам практики ").Alignment = Alignment.center; table.Rows[1].Cells[0].Paragraphs[0].Append("1").Alignment = Alignment.center; table.Rows[1].Cells[1].Paragraphs[0].Append("2").Alignment = Alignment.center; table.Rows[1].Cells[2].Paragraphs[0].Append("3").Alignment = Alignment.center; table.Rows[1].Cells[3].Paragraphs[0].Append("4").Alignment = Alignment.center; table.Rows[1].Cells[4].Paragraphs[0].Append("5").Alignment = Alignment.center; table.Rows[1].Cells[5].Paragraphs[0].Append("6").Alignment = Alignment.center; table.Rows[1].Cells[6].Paragraphs[0].Append("7").Alignment = Alignment.center; table.Rows[1].Cells[7].Paragraphs[0].Append("8").Alignment = Alignment.center; table.Rows[1].Cells[8].Paragraphs[0].Append("9").Alignment = Alignment.center; #endregion int row = 2; for (int i = 0; i < selected_student.Count; i++) { foreach (string tmp_st in selected_student[i]) { table.Rows[row].Cells[0].Paragraphs[0].Append((i + 1).ToString()).Alignment = Alignment.center; Group group = Helper.OGroups.Where(k => k.groupe.Equals(selected_group[i])).ElementAt(0); Classes.Direction direction = Helper.ODirections.Where(k => k.name.Equals(group.direction)).ElementAt(0); Cathedra cathedra = Helper.OCathedras.Where(k => k.cathedra.Equals(direction.id_cathedra)).ElementAt(0); #region Вычисляем курс int enroll = Convert.ToInt32(group.enroll_year); // Год поступления int end = Convert.ToInt32(group.end_year); // Год окончания int course = DateTime.Today.Year - enroll; int month = DateTime.Today.Month - 9; if (month >= 0) { course++; } #endregion table.Rows[row].Cells[1].Paragraphs[0].Append(cathedra.cathedra).Alignment = Alignment.center; // Кафедра table.Rows[row].Cells[2].Paragraphs[0].Append(direction.code + " " + direction.name).Alignment = Alignment.center; // Направление table.Rows[row].Cells[3].Paragraphs[0].Append(" - ").Alignment = Alignment.center; // Сроки практики table.Rows[row].Cells[4].Paragraphs[0].Append(course.ToString()).Alignment = Alignment.center; // Курс table.Rows[row].Cells[5].Paragraphs[0].Append(group.groupe).Alignment = Alignment.center; // Группа table.Rows[row].Cells[6].Paragraphs[0].Append(tmp_st).Alignment = Alignment.center; // Ф.И.О. студента table.Rows[row].Cells[7].Paragraphs[0].Append(cathedra.surname + " " + cathedra.name + " " + cathedra.patronymic).Alignment = Alignment.center; // Ф.И.О. руководителя от кафедры table.Rows[row].Cells[8].Paragraphs[0].Append(cathedra.phone).Alignment = Alignment.center; // Телефон кафедры row++; // Добавляем студента в БД Attach // Разбиваем ФИО студента на состовляющие var fio = tmp_st.Split(); Student st_tmp = Helper.OStudents.Where(k => k.surname.Equals(fio[0]) && k.name.Equals(fio[1]) && k.patronymic.Equals(fio[2])).ElementAt(0); SQLiteAdapter.SetValue("attach", contract_num.Text, st_tmp.id); // и записываем новые } } document.InsertParagraph().InsertTableAfterSelf(table); document.InsertParagraph(); document.InsertParagraph("Согласовано:"); document.InsertParagraph("Заведующий выпускающей кафедрой"); document.InsertParagraph("«___________________________________» ______________ /______________________/"); document.InsertParagraph(" подпись расшифровка подписи").Script(Script.superscript).FontSize(10); document.InsertParagraph("Декан факультета / Директор института"); document.InsertParagraph("«___________________________________» ______________ /______________________/"); document.InsertParagraph(" подпись расшифровка подписи").Script(Script.superscript).FontSize(10); document.InsertParagraph("Начальник отдела организации практики"); document.InsertParagraph("и содействия трудоустройству выпускников ______________ / Ю.С.Сачук /"); document.InsertParagraph(" подпись расшифровка подписи").Script(Script.superscript).FontSize(10); // сохраняем документ document.Save(); } catch (Exception e) { MessageBox.Show($"Error: {e}", "Error", MessageBoxButton.OK); return(false); } return(true); }
public void Seed() { _userService.Add(new Core.Entities.User() { Login = $"AndrewThe", Password = "******", Email = "*****@*****.**", Roles = new List <Role> { Role.Admin }, UserName = "******", GroupId = "29627000-e32d-11e7-b070-a7a2334df747", PhoneNumber = "123-123-123" }); var lecturer = new User() { Id = Guid.NewGuid().ToString(), Login = $"Lecturer", Password = "******", Email = "*****@*****.**", Roles = new List <Role> { Role.Lecturer }, UserName = "******", GroupId = "29627000-e32d-11e7-b070-a7a2334df747", PhoneNumber = "123-123-123" }; _userService.Add(lecturer); var cathedra = new Cathedra { Id = Guid.NewGuid().ToString(), Name = "App Math" }; c.Add(cathedra); var group = new Group() { Id = Guid.NewGuid().ToString(), CathedraId = cathedra.Id, Name = "PMP-51", DisciplineConfiguration = new List <DisciplineConfiguration> { new DisciplineConfiguration { DisciplineType = DisciplineType.Socio, RequiredAmount = 1, Semester = 1 }, new DisciplineConfiguration { DisciplineType = DisciplineType.Socio, RequiredAmount = 1, Semester = 2 }, new DisciplineConfiguration { DisciplineType = DisciplineType.Special, RequiredAmount = 1, Semester = 1 }, new DisciplineConfiguration { DisciplineType = DisciplineType.Special, RequiredAmount = 1, Semester = 2 }, }, Course = 5, }; g.Add(group); for (int i = 0; i < 99; i++) { _userService.Add(new User() { Login = $"student{i}", Password = "******", Email = $"*****@*****.**", Roles = new List <Role> { Role.Student }, UserName = $"student{i}", Course = 5, GroupId = group.Id, PhoneNumber = "123-123-123", }); d.Add(new Discipline { Id = Guid.NewGuid().ToString(), DisciplineType = i % 2 == 0 ? DisciplineType.Socio : DisciplineType.Special, IsAvailable = true, LecturerId = lecturer.Id, Name = $"Discipline{i}_11", Semester = 11, ProviderCathedraId = cathedra.Id }); var di = new Discipline { Id = Guid.NewGuid().ToString(), DisciplineType = i % 2 == 0 ? DisciplineType.Socio : DisciplineType.Special, IsAvailable = true, LecturerId = lecturer.Id, Name = $"Discipline{i}_12", Semester = 12, ProviderCathedraId = cathedra.Id }; d.Add(di); } var disciplines = d.Find(SearchFilter <Discipline> .FilterByEntity(new Discipline { DisciplineType = DisciplineType.Special })); disciplines = new List <Discipline> { disciplines[0], disciplines[1] }; group.DisciplineSubscriptions = disciplines.Select(d => d.Id).ToList(); g.Update(group.Id, group); }