diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/GenericBusinessLogic/OrderSyncHistoryBusinessLogic.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/GenericBusinessLogic/OrderSyncHistoryBusinessLogic.cs index 5c33842..35f430e 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/GenericBusinessLogic/OrderSyncHistoryBusinessLogic.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/GenericBusinessLogic/OrderSyncHistoryBusinessLogic.cs @@ -381,10 +381,6 @@ namespace DepartmentBusinessLogic.BusinessLogics.GenericBusinessLogic SaveLog("Не удалось распознать список приказов по студенту"); return; } - if (student.LastName == "Костенко" || student.LastName == "Киселева") - { - int c = 10; - } foreach (var syncOrder in syncOrders.StudentOrders) { if (syncOrder.orderTypeName == "Утверждение тем курсовых работ" || diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/GenericBusinessLogic/StudentGroupBusinessLogic.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/GenericBusinessLogic/StudentGroupBusinessLogic.cs index ebec6b9..4b0209b 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/GenericBusinessLogic/StudentGroupBusinessLogic.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/GenericBusinessLogic/StudentGroupBusinessLogic.cs @@ -2,8 +2,19 @@ using DepartmentContract.Logics.IGenericEntityLogic; using DepartmentContract.Services.IGenericEntityService; using DepartmentContract.ViewModels; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using ToolsModule.ManagmentDependency; using ToolsModule.ManagmentEntity; +using ToolsModule.ManagmentExtension; using ToolsModule.ManagmentSecurity; +using ToolsOffice.Interfaces; +using ToolsOffice.Interfaces.Word; +using ToolsOffice.Interfaces.Word.Models; +using ToolsOffice.Interfaces.Word.Models.Cases; namespace DepartmentBusinessLogic.BusinessLogics.GenericBusinessLogic { @@ -11,7 +22,174 @@ namespace DepartmentBusinessLogic.BusinessLogics.GenericBusinessLogic /// Логика работы с учебными группами /// public class StudentGroupBusinessLogic : GenericBusinessLogic, IStudentGroupLogic - { - public StudentGroupBusinessLogic(IStudentGroupService service) : base(service, "Учебные Группы", AccessOperation.УчебныеГруппы) { } - } + { + public StudentGroupBusinessLogic(IStudentGroupService service) : base(service, "Учебные Группы", AccessOperation.УчебныеГруппы) { } + + public async Task SaveToWord(StudentGroupSaveToWordBindingModel model) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + if (model.FileName.IsEmpty()) + { + throw new ArgumentNullException("Имя файла", nameof(model.FileName)); + } + + var builderWordDocument = DependencyManager.Instance.Resolve(); + if (builderWordDocument == null) + { + throw new ArgumentNullException("Сервис генерации документов", nameof(builderWordDocument)); + } + + var studentLogic = DependencyManager.Instance.Resolve(); + if (studentLogic == null) + { + throw new ArgumentNullException("Сервис студентов", nameof(studentLogic)); + } + var studetns = studentLogic.GetList(new StudentGetBindingModel { StudentGroupId = model.StudentGroupId }); + if (studetns == null) + { + throw new InvalidOperationException(string.Join(Environment.NewLine, studentLogic.Errors.Select(x => x.Message))); + } + + var studentGroup = GetElement(new StudentGroupGetBindingModel { Id = model.StudentGroupId }); + if (studentGroup == null) + { + throw new InvalidOperationException(string.Join(Environment.NewLine, Errors.Select(x => x.Message))); + } + + var table = new ModelWordTable() + { + RowsHeight = new Dictionary(), + BorderType = TypeWordTableBorder.Single, + BorderWidth = 4, + Headers = new List<(int ColumnIndex, int RowIndex, string Header)>(), + ColumnWidths = new Dictionary(), + Data = new List(), + LookFirstRow = true, + LookFirstColumn = true + }; + int columnIndex = 0; + table.Headers.Add((columnIndex, 0, "№")); + table.ColumnWidths.Add(columnIndex, 1); + columnIndex++; + if (model.ShowNumberOfBook) + { + table.Headers.Add((columnIndex, 0, "Номер зачетной книжки")); + table.ColumnWidths.Add(columnIndex, 2.5); + columnIndex++; + } + if (model.UnionFIO) + { + table.Headers.Add((columnIndex, 0, "ФИО")); + table.ColumnWidths.Add(columnIndex, 5); + columnIndex++; + } + else + { + table.Headers.Add((columnIndex, 0, "Фамилия")); + table.ColumnWidths.Add(columnIndex, 5); + columnIndex++; + table.Headers.Add((columnIndex, 0, "Имя")); + table.ColumnWidths.Add(columnIndex, 5); + columnIndex++; + table.Headers.Add((columnIndex, 0, "Отчество")); + table.ColumnWidths.Add(columnIndex, 5); + columnIndex++; + } + if (model.ShowStatus) + { + table.Headers.Add((columnIndex, 0, "Статус")); + table.ColumnWidths.Add(columnIndex, 2.5); + columnIndex++; + } + if (model.ShowInfo) + { + table.Headers.Add((columnIndex, 0, "Информация")); + table.ColumnWidths.Add(columnIndex, 15); + columnIndex++; + } + table.RowsHeight.Add(0, 1.5); + int rowIndex = 0; + foreach(var student in studetns.List) + { + var listOfData = new List() { (rowIndex + 1).ToString() }; + if (model.ShowNumberOfBook) + { + listOfData.Add(student.NumberOfBook); + } + if (model.UnionFIO) + { + if (model.UseInitials) + { + listOfData.Add($"{student.LastName}{(student.FirstName.Length > 0 ? $" {student.FirstName[0]}." : "")}{(student.Patronymic.Length > 0 ? $" {student.Patronymic[0]}." : "")}"); + } + else + { + listOfData.Add($"{student.LastName} {student.FirstName} {student.Patronymic}"); + } + } + else + { + listOfData.Add(student.LastName); + listOfData.Add(student.FirstName); + listOfData.Add(student.Patronymic); + } + if (model.ShowStatus) + { + listOfData.Add(student.StudentStateTitle); + } + if (model.ShowInfo) + { + listOfData.Add(student.Description); + } + table.Data.Add(listOfData.ToArray()); + table.RowsHeight.Add(rowIndex + 1, 1); + rowIndex++; + } + + var pageSize = new PageSizes("А4"); + var docModel = new ModelWordDocumentWithHeaderAndTable + { + Document = new ModelWordDocument + { + WordPageOrientation = TypeWordPageOrientation.Landscape, + PageSizeHeight = pageSize.PageSizeWidth, + PageSizeWidth = pageSize.PageSizeHeight, + PageMarginBottom = pageSize.PageMarginBottom, + PageMarginTop = pageSize.PageMarginTop, + PageMarginLeft = pageSize.PageMarginLeft, + PageMarginRight = pageSize.PageMarginRight, + PageMarginGutter = pageSize.PageMarginGutter, + PageHeader = pageSize.PageHeader, + PageFooter = pageSize.PageFooter + }, + Header = new ModelWordParagraph + { + FontName = FontNames.TimesNewRoman, + FontSize = 16, + IsBold = true, + JustificationType = TypeWordJustification.Center, + Text = studentGroup.ToString(), + SpacingBetweenLinesAfter = 10 + }, + Table = table + }; + + var stream = builderWordDocument.CreateDocumentWithTable(docModel); + if (stream == null) + { + throw new InvalidOperationException("Не удалось получить поток с документом"); + } + stream.Position = 0; + using (var saveStream = new FileStream(model.FileName, FileMode.OpenOrCreate)) + { + await stream.CopyToAsync(saveStream); + } + stream.Close(); + + return true; + } + } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/DepartmentBusinessLogic.csproj b/DepartmentPortal/Department/DepartmentBusinessLogic/DepartmentBusinessLogic.csproj index 9a9af50..d0baae5 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/DepartmentBusinessLogic.csproj +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/DepartmentBusinessLogic.csproj @@ -2,9 +2,11 @@ net5.0 + true + diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/DepartmentLogicDependencyRegistration.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/DepartmentLogicDependencyRegistration.cs index 7ea2ca6..9bd6845 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/DepartmentLogicDependencyRegistration.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/DepartmentLogicDependencyRegistration.cs @@ -1,6 +1,8 @@ using DepartmentBusinessLogic.BusinessLogics.GenericBusinessLogic; using DepartmentContract.Logics.IGenericEntityLogic; using ToolsModule.ManagmentDependency; +using ToolsOffice.Implements.WordOpenXML; +using ToolsOffice.Interfaces.Word; namespace DepartmentBusinessLogic { @@ -42,6 +44,10 @@ namespace DepartmentBusinessLogic DependencyManager.Instance.RegisterType(); DependencyManager.Instance.RegisterType(); + + + + DependencyManager.Instance.RegisterType(); } } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentContract/BindingModels/StudentGroupSaveToWordBindingModel.cs b/DepartmentPortal/Department/DepartmentContract/BindingModels/StudentGroupSaveToWordBindingModel.cs new file mode 100644 index 0000000..8b48f0b --- /dev/null +++ b/DepartmentPortal/Department/DepartmentContract/BindingModels/StudentGroupSaveToWordBindingModel.cs @@ -0,0 +1,21 @@ +using System; + +namespace DepartmentContract.BindingModels +{ + public class StudentGroupSaveToWordBindingModel + { + public string FileName { get; set; } + + public Guid StudentGroupId { get; set; } + + public bool ShowNumberOfBook { get; set; } = false; + + public bool UnionFIO { get; set; } = false; + + public bool UseInitials { get; set; } = false; + + public bool ShowStatus { get; set; } = false; + + public bool ShowInfo { get; set; } = false; + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentContract/Logics/IGenericEntityLogic/IStudentGroupLogic.cs b/DepartmentPortal/Department/DepartmentContract/Logics/IGenericEntityLogic/IStudentGroupLogic.cs index bee9b51..91c1926 100644 --- a/DepartmentPortal/Department/DepartmentContract/Logics/IGenericEntityLogic/IStudentGroupLogic.cs +++ b/DepartmentPortal/Department/DepartmentContract/Logics/IGenericEntityLogic/IStudentGroupLogic.cs @@ -1,5 +1,6 @@ using DepartmentContract.BindingModels; using DepartmentContract.ViewModels; +using System.Threading.Tasks; using ToolsModule.ManagmentEntity; namespace DepartmentContract.Logics.IGenericEntityLogic @@ -7,5 +8,8 @@ namespace DepartmentContract.Logics.IGenericEntityLogic /// /// Логика работы с учебными группами /// - public interface IStudentGroupLogic : IGenericEntityLogic { } + public interface IStudentGroupLogic : IGenericEntityLogic + { + Task SaveToWord(StudentGroupSaveToWordBindingModel model); + } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentGroup/ControlStudentGroupList.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentGroup/ControlStudentGroupList.cs index e18f10d..fbadd47 100644 --- a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentGroup/ControlStudentGroupList.cs +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentGroup/ControlStudentGroupList.cs @@ -1,10 +1,14 @@ using DepartmentContract.BindingModels; using DepartmentContract.Logics.IGenericEntityLogic; using DepartmentContract.ViewModels; +using DepartmentWindowsDesktop.EntityControls.StudentGroup; using System; using System.Collections.Generic; +using System.Threading.Tasks; +using System.Windows.Forms; using ToolsDesktop.Controls; using ToolsDesktop.Enums; +using ToolsDesktop.Helpers; using ToolsDesktop.Interfaces; using ToolsDesktop.Models; using ToolsModule.ManagmentSecurity; @@ -15,28 +19,67 @@ namespace DepartmentWindowsDesktop.EntityControls /// Реализация контрола для списка учебных групп /// public partial class ControlStudentGroupList : - GenericControlEntityList, - IGenericControlEntityList - { - public ControlStudentGroupList() - { - InitializeComponent(); - Title = "Учебные группы"; - ControlId = new Guid("453666ff-511e-4751-887f-0fec5c1e95c8"); - AccessOperation = AccessOperation.УчебныеГруппы; - ControlViewEntityElement = new ControlStudentGroupElement(); - _genericControlViewEntityList = this; - } + GenericControlEntityList, + IGenericControlEntityList + { + public ControlStudentGroupList() + { + InitializeComponent(); + Title = "Учебные группы"; + ControlId = new Guid("453666ff-511e-4751-887f-0fec5c1e95c8"); + AccessOperation = AccessOperation.УчебныеГруппы; + ControlViewEntityElement = new ControlStudentGroupElement(); + _genericControlViewEntityList = this; + } - public IControl GetInstanceGenericControl() => new ControlStudentGroupList() { ControlId = Guid.NewGuid() }; + public IControl GetInstanceGenericControl() => new ControlStudentGroupList() { ControlId = Guid.NewGuid() }; - public ControlViewEntityListConfiguration GetConfigControl() => new() - { - PaginationOn = false, - HideToolStripButton = new List - { - ToolStripButtonListNames.toolStripButtonSearch - } - }; - } + public ControlViewEntityListConfiguration GetConfigControl() => new() + { + PaginationOn = false, + HideToolStripButton = new List + { + ToolStripButtonListNames.toolStripButtonSearch + }, + ControlOnMoveElem = new() + { + { "ToolStripMenuItemSaveStudentGroup", ("Сохранить список студентов", async (object sender, EventArgs e) => { await SaveToFile(); }) } + } + }; + + /// + /// Сохранение в файл + /// + /// + private async Task SaveToFile() + { + var guids = GetSelectedIds(); + if (guids == null || guids.Count != 1) + { + DialogHelper.MessageException("Должна быть выбрана одна группа", "Ошибки при создании документа"); + return; + } + var form = new FormSaveToFile(); + if (form.ShowDialog() != DialogResult.OK) + { + return; + } + var model = form.Model; + if (model == null) + { + DialogHelper.MessageException("Данные для сохранения не получены", "Ошибки при создании документа"); + return; + } + model.StudentGroupId = guids[0]; + var flag = await _businessLogic.SaveToWord(model); + if (!flag) + { + DialogHelper.MessageException(_businessLogic.Errors, "Ошибки при создании документа"); + } + else + { + DialogHelper.MessageInformation("Завершено успешно", "Сохранение списка группы"); + } + } + } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentGroup/FormSaveToFile.Designer.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentGroup/FormSaveToFile.Designer.cs new file mode 100644 index 0000000..758892c --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentGroup/FormSaveToFile.Designer.cs @@ -0,0 +1,165 @@ + +namespace DepartmentWindowsDesktop.EntityControls.StudentGroup +{ + partial class FormSaveToFile + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.labelFileName = new System.Windows.Forms.Label(); + this.textBoxFileName = new System.Windows.Forms.TextBox(); + this.buttonSelect = new System.Windows.Forms.Button(); + this.checkBoxShowNumberOfBook = new System.Windows.Forms.CheckBox(); + this.checkBoxUnionFIO = new System.Windows.Forms.CheckBox(); + this.checkBoxUseInitials = new System.Windows.Forms.CheckBox(); + this.checkBoxShowStatus = new System.Windows.Forms.CheckBox(); + this.checkBoxShowInfo = new System.Windows.Forms.CheckBox(); + this.buttonSave = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // labelFileName + // + this.labelFileName.AutoSize = true; + this.labelFileName.Location = new System.Drawing.Point(22, 24); + this.labelFileName.Name = "labelFileName"; + this.labelFileName.Size = new System.Drawing.Size(90, 15); + this.labelFileName.TabIndex = 0; + this.labelFileName.Text = "Путь до файла:"; + // + // textBoxFileName + // + this.textBoxFileName.Location = new System.Drawing.Point(118, 21); + this.textBoxFileName.Name = "textBoxFileName"; + this.textBoxFileName.Size = new System.Drawing.Size(300, 23); + this.textBoxFileName.TabIndex = 1; + // + // buttonSelect + // + this.buttonSelect.Location = new System.Drawing.Point(338, 50); + this.buttonSelect.Name = "buttonSelect"; + this.buttonSelect.Size = new System.Drawing.Size(80, 23); + this.buttonSelect.TabIndex = 2; + this.buttonSelect.Text = "Выбрать"; + this.buttonSelect.UseVisualStyleBackColor = true; + this.buttonSelect.Click += new System.EventHandler(this.ButtonSelect_Click); + // + // checkBoxShowNumberOfBook + // + this.checkBoxShowNumberOfBook.AutoSize = true; + this.checkBoxShowNumberOfBook.Location = new System.Drawing.Point(29, 73); + this.checkBoxShowNumberOfBook.Name = "checkBoxShowNumberOfBook"; + this.checkBoxShowNumberOfBook.Size = new System.Drawing.Size(216, 19); + this.checkBoxShowNumberOfBook.TabIndex = 3; + this.checkBoxShowNumberOfBook.Text = "Выводить номер зачетной книжки"; + this.checkBoxShowNumberOfBook.UseVisualStyleBackColor = true; + // + // checkBoxUnionFIO + // + this.checkBoxUnionFIO.AutoSize = true; + this.checkBoxUnionFIO.Location = new System.Drawing.Point(29, 112); + this.checkBoxUnionFIO.Name = "checkBoxUnionFIO"; + this.checkBoxUnionFIO.Size = new System.Drawing.Size(204, 19); + this.checkBoxUnionFIO.TabIndex = 4; + this.checkBoxUnionFIO.Text = "Выводить ФИО в одной колонке"; + this.checkBoxUnionFIO.UseVisualStyleBackColor = true; + this.checkBoxUnionFIO.CheckedChanged += new System.EventHandler(this.CheckBoxUnionFIO_CheckedChanged); + // + // checkBoxUseInitials + // + this.checkBoxUseInitials.AutoSize = true; + this.checkBoxUseInitials.Enabled = false; + this.checkBoxUseInitials.Location = new System.Drawing.Point(73, 148); + this.checkBoxUseInitials.Name = "checkBoxUseInitials"; + this.checkBoxUseInitials.Size = new System.Drawing.Size(184, 19); + this.checkBoxUseInitials.TabIndex = 5; + this.checkBoxUseInitials.Text = "Выводить ФИО с иницалами"; + this.checkBoxUseInitials.UseVisualStyleBackColor = true; + // + // checkBoxShowStatus + // + this.checkBoxShowStatus.AutoSize = true; + this.checkBoxShowStatus.Location = new System.Drawing.Point(29, 184); + this.checkBoxShowStatus.Name = "checkBoxShowStatus"; + this.checkBoxShowStatus.Size = new System.Drawing.Size(116, 19); + this.checkBoxShowStatus.TabIndex = 6; + this.checkBoxShowStatus.Text = "Выводить статус"; + this.checkBoxShowStatus.UseVisualStyleBackColor = true; + // + // checkBoxShowInfo + // + this.checkBoxShowInfo.AutoSize = true; + this.checkBoxShowInfo.Location = new System.Drawing.Point(29, 224); + this.checkBoxShowInfo.Name = "checkBoxShowInfo"; + this.checkBoxShowInfo.Size = new System.Drawing.Size(135, 19); + this.checkBoxShowInfo.TabIndex = 7; + this.checkBoxShowInfo.Text = "Выводить описание"; + this.checkBoxShowInfo.UseVisualStyleBackColor = true; + // + // buttonSave + // + this.buttonSave.Location = new System.Drawing.Point(286, 196); + this.buttonSave.Name = "buttonSave"; + this.buttonSave.Size = new System.Drawing.Size(101, 33); + this.buttonSave.TabIndex = 8; + this.buttonSave.Text = "Сохранить"; + this.buttonSave.UseVisualStyleBackColor = true; + this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click); + // + // FormSaveToFile + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(438, 269); + this.Controls.Add(this.buttonSave); + this.Controls.Add(this.checkBoxShowInfo); + this.Controls.Add(this.checkBoxShowStatus); + this.Controls.Add(this.checkBoxUseInitials); + this.Controls.Add(this.checkBoxUnionFIO); + this.Controls.Add(this.checkBoxShowNumberOfBook); + this.Controls.Add(this.buttonSelect); + this.Controls.Add(this.textBoxFileName); + this.Controls.Add(this.labelFileName); + this.Name = "FormSaveToFile"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Сохранение в файл"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label labelFileName; + private System.Windows.Forms.TextBox textBoxFileName; + private System.Windows.Forms.Button buttonSelect; + private System.Windows.Forms.CheckBox checkBoxShowNumberOfBook; + private System.Windows.Forms.CheckBox checkBoxUnionFIO; + private System.Windows.Forms.CheckBox checkBoxUseInitials; + private System.Windows.Forms.CheckBox checkBoxShowStatus; + private System.Windows.Forms.CheckBox checkBoxShowInfo; + private System.Windows.Forms.Button buttonSave; + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentGroup/FormSaveToFile.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentGroup/FormSaveToFile.cs new file mode 100644 index 0000000..f510961 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentGroup/FormSaveToFile.cs @@ -0,0 +1,50 @@ +using DepartmentContract.BindingModels; +using System; +using System.Windows.Forms; +using ToolsModule.ManagmentExtension; + +namespace DepartmentWindowsDesktop.EntityControls.StudentGroup +{ + public partial class FormSaveToFile : Form + { + public StudentGroupSaveToWordBindingModel Model { get; private set; } + + public FormSaveToFile() + { + InitializeComponent(); + } + + private void ButtonSelect_Click(object sender, EventArgs e) + { + var dialog = new SaveFileDialog { Filter = "doc file | *.docx" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + textBoxFileName.Text = dialog.FileName; + } + } + + private void CheckBoxUnionFIO_CheckedChanged(object sender, EventArgs e) + { + checkBoxUseInitials.Enabled = checkBoxUnionFIO.Checked; + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + if (textBoxFileName.Text.IsEmpty()) + { + DialogResult = DialogResult.Cancel; + return; + } + Model = new StudentGroupSaveToWordBindingModel + { + FileName = textBoxFileName.Text, + ShowInfo = checkBoxShowInfo.Checked, + ShowNumberOfBook = checkBoxShowNumberOfBook.Checked, + ShowStatus = checkBoxShowStatus.Checked, + UnionFIO = checkBoxUnionFIO.Checked, + UseInitials = checkBoxUnionFIO.Checked && checkBoxUseInitials.Checked + }; + DialogResult = DialogResult.OK; + } + } +} diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentGroup/FormSaveToFile.resx b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentGroup/FormSaveToFile.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentGroup/FormSaveToFile.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file