DepartmentProject/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentGroup/FormSaveToFile.cs

51 lines
1.6 KiB
C#
Raw Normal View History

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;
}
}
}