есть все кроме ред и удаления, хз пока как это делать

This commit is contained in:
Екатерина Рогашова 2023-10-28 03:39:40 +04:00
parent c4eb5906f6
commit 43b0a2885f
14 changed files with 241 additions and 157 deletions

View File

@ -97,6 +97,7 @@ namespace COPWinForms
{
return;
}
listBox.Items.Clear();
foreach (var item in objects)
{
string str = layoutString;

View File

@ -13,7 +13,7 @@ namespace UniversityContracts.BindingModels
public string FIO { get; set; } = string.Empty;
public string Сharacteristic { get; set; } = string.Empty;
public string Course { get; set; } = string.Empty;
public int Scholarship { get; set; }
public int? Scholarship { get; set; }
}
}

View File

@ -18,6 +18,6 @@ namespace UniversityContracts.ViewModels
[DisplayName("Курс")]
public string Course { get; set; } = string.Empty;
[DisplayName("Стипендия")]
public int Scholarship { get; set; }
public int? Scholarship { get; set; }
}
}

View File

@ -1,4 +1,5 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
@ -11,7 +12,7 @@ using UniversityDataBaseImplements;
namespace UniversityDataBaseImplements.Migrations
{
[DbContext(typeof(UniversityDatabase))]
[Migration("20231027093630_InitialCreate")]
[Migration("20231027200653_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
@ -57,7 +58,7 @@ namespace UniversityDataBaseImplements.Migrations
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Scholarship")
b.Property<int?>("Scholarship")
.HasColumnType("int");
b.Property<string>("Сharacteristic")

View File

@ -31,7 +31,7 @@ namespace UniversityDataBaseImplements.Migrations
.Annotation("SqlServer:Identity", "1, 1"),
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
Сharacteristic = table.Column<string>(type: "nvarchar(max)", nullable: false),
Scholarship = table.Column<int>(type: "int", nullable: false),
Scholarship = table.Column<int>(type: "int", nullable: true),
Course = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>

View File

@ -1,4 +1,5 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
@ -54,7 +55,7 @@ namespace UniversityDataBaseImplements.Migrations
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Scholarship")
b.Property<int?>("Scholarship")
.HasColumnType("int");
b.Property<string>("Сharacteristic")

View File

@ -16,8 +16,7 @@ namespace UniversityDataBaseImplements.Models
public string FIO { get; private set; } = string.Empty;
[Required]
public string Сharacteristic { get; private set; } = string.Empty;
[Required]
public int Scholarship { get; private set; }
public int? Scholarship { get; private set; }
[Required]
public string Course { get; private set; } = string.Empty;

View File

@ -11,6 +11,6 @@ namespace UniversityDataModels.Models
string FIO { get; }
string Сharacteristic { get; }
string Course { get; }
int Scholarship { get; }
int? Scholarship { get; }
}
}

View File

@ -58,27 +58,27 @@ namespace UniversityForms
}
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
var typeName = (string)dataGridView1.CurrentRow.Cells[1].Value;
if (!string.IsNullOrEmpty(typeName))
{
if (dataGridView1.CurrentRow.Cells[0].Value != null)
if (dataGridView1.CurrentRow.Cells[0].Value != null && int.TryParse(dataGridView1.CurrentRow.Cells[0].Value.ToString(), out int id))
{
courseLogic.Create(new CourseBindingModels()
courseLogic.Update(new CourseBindingModels()
{
Id = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value),
Name = (string)dataGridView1.CurrentRow.Cells[1].EditedFormattedValue
Id = id,
Name = typeName
});
}
else
{
var newCourse = new CourseBindingModels()
var newDirection = new CourseBindingModels()
{
Name = (string)dataGridView1.CurrentRow.Cells[1].EditedFormattedValue
Name = typeName
};
courseLogic.Create(newCourse);
list.Add(newCourse);
courseLogic.Create(newDirection);
list.Add(newDirection);
}
}
else
@ -115,102 +115,6 @@ namespace UniversityForms
}
}
}
//private readonly ICourseLogic _logic;
//private int? _id;
//public FormCourses(ICourseLogic logic)
//{
// InitializeComponent();
// _logic = logic;
// dataGridView1.AllowUserToAddRows = false;
//}
//private void FormCourses_Load(object sender, EventArgs e)
//{
// LoadData();
//}
//private void LoadData()
//{
// try
// {
// var list = _logic.ReadList(null);
// if (list != null)
// {
// dataGridView1.DataSource = list;
// dataGridView1.Columns[0].Visible = false;
// dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
// }
// }
// catch (Exception ex)
// {
// MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
// MessageBoxIcon.Error);
// }
//}
//private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
//{
// try
// {
// var model = new CourseBindingModels
// {
// Id = _id ?? 0,
// Name = (string)dataGridView1.CurrentRow.Cells[1].EditedFormattedValue
// };
// var operationResult = _id.HasValue ? _logic.Update(model) :
// _logic.Create(model);
// if (!operationResult)
// {
// throw new Exception("");
// }
// MessageBox.Show("", "",
// MessageBoxButtons.OK, MessageBoxIcon.Information);
// DialogResult = DialogResult.OK;
// Close();
// }
// catch (Exception ex)
// {
// MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
// MessageBoxIcon.Error);
// }
//}
//private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
//{
// if (e.KeyData == Keys.Insert)
// {
// if (dataGridView1.Rows.Count == 0)
// {
// dataGridView1.Rows.
// dataGridView1.CurrentCell = dataGridView1.Rows[0].Cells[1];
// return;
// }
// if (dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[1].Value != null)
// {
// dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[1];
// return;
// }
// }
// if (e.KeyData == Keys.Delete)
// {
// if (MessageBox.Show("Удалить запись?", "Вопрос",
// MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
// {
// int id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value);
// try
// {
// if (!_logic.Delete(new CourseBindingModels
// {
// Id = id
// }))
// {
// throw new Exception("Ошибка при удалении.Дополнительная информация в логах.");
// }
// LoadData();
// }
// catch (Exception ex)
// {
// MessageBox.Show(ex.Message, "Ошибка",
// MessageBoxButtons.OK, MessageBoxIcon.Error);
// }
// }
// }
//}
}
}

View File

@ -34,13 +34,16 @@
this.добавитьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.редактироваьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.изменитьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.созданиеПростогоЭлементаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.созданиеДокаСНастраиваемойТаблицейToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.созданиеДиаграммыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.label1 = new System.Windows.Forms.Label();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.менюToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.отчетПоСтудентамWordToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.отчетПоСтудентамPdfToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.отчетПоСтудентамExelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.справочникToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.componentWord11 = new COPWinForms.ComponentWord1(this.components);
this.pieChart1 = new COP.PieChart(this.components);
this.tablePdfComponent11 = new WinFormsControlLibrary.TablePdfComponent1(this.components);
this.contextMenuStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
@ -60,16 +63,19 @@
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.добавитьToolStripMenuItem,
this.редактироваьToolStripMenuItem,
this.изменитьToolStripMenuItem});
this.изменитьToolStripMenuItem,
this.созданиеПростогоЭлементаToolStripMenuItem,
this.созданиеДокаСНастраиваемойТаблицейToolStripMenuItem,
this.созданиеДиаграммыToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(227, 76);
this.contextMenuStrip1.Size = new System.Drawing.Size(432, 176);
this.contextMenuStrip1.Text = "Студент";
//
// добавитьToolStripMenuItem
//
this.добавитьToolStripMenuItem.Name = обавитьToolStripMenuItem";
this.добавитьToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
this.добавитьToolStripMenuItem.Size = new System.Drawing.Size(226, 24);
this.добавитьToolStripMenuItem.Size = new System.Drawing.Size(431, 24);
this.добавитьToolStripMenuItem.Text = "Добавить";
this.добавитьToolStripMenuItem.Click += new System.EventHandler(this.добавитьToolStripMenuItem_Click_1);
//
@ -77,15 +83,41 @@
//
this.редактироваьToolStripMenuItem.Name = "редактироваьToolStripMenuItem";
this.редактироваьToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.U)));
this.редактироваьToolStripMenuItem.Size = new System.Drawing.Size(226, 24);
this.редактироваьToolStripMenuItem.Text = "Редактироваь";
this.редактироваьToolStripMenuItem.Size = new System.Drawing.Size(431, 24);
this.редактироваьToolStripMenuItem.Text = "Редактировать";
this.редактироваьToolStripMenuItem.Click += new System.EventHandler(this.редактироваьToolStripMenuItem_Click);
//
// изменитьToolStripMenuItem
//
this.изменитьToolStripMenuItem.Name = "изменитьToolStripMenuItem";
this.изменитьToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D)));
this.изменитьToolStripMenuItem.Size = new System.Drawing.Size(226, 24);
this.изменитьToolStripMenuItem.Size = new System.Drawing.Size(431, 24);
this.изменитьToolStripMenuItem.Text = "Удалить";
this.изменитьToolStripMenuItem.Click += new System.EventHandler(this.изменитьToolStripMenuItem_Click);
//
// созданиеПростогоЭлементаToolStripMenuItem
//
this.созданиеПростогоЭлементаToolStripMenuItem.Name = "созданиеПростогоЭлементаToolStripMenuItem";
this.созданиеПростогоЭлементаToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
this.созданиеПростогоЭлементаToolStripMenuItem.Size = new System.Drawing.Size(431, 24);
this.созданиеПростогоЭлементаToolStripMenuItem.Text = "Создание простого элемента";
this.созданиеПростогоЭлементаToolStripMenuItem.Click += new System.EventHandler(this.созданиеПростогоЭлементаToolStripMenuItem_Click);
//
// созданиеДокаСНастраиваемойТаблицейToolStripMenuItem
//
this.созданиеДокаСНастраиваемойТаблицейToolStripMenuItem.Name = "созданиеДокаСНастраиваемойТаблицейToolStripMenuItem";
this.созданиеДокаСНастраиваемойТаблицейToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.T)));
this.созданиеДокаСНастраиваемойТаблицейToolStripMenuItem.Size = new System.Drawing.Size(431, 24);
this.созданиеДокаСНастраиваемойТаблицейToolStripMenuItem.Text = "Создание док-а с настраиваемой таблицей";
this.созданиеДокаСНастраиваемойТаблицейToolStripMenuItem.Click += new System.EventHandler(this.созданиеДокаСНастраиваемойТаблицейToolStripMenuItem_Click);
//
// созданиеДиаграммыToolStripMenuItem
//
this.созданиеДиаграммыToolStripMenuItem.Name = "созданиеДиаграммыToolStripMenuItem";
this.созданиеДиаграммыToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
this.созданиеДиаграммыToolStripMenuItem.Size = new System.Drawing.Size(431, 24);
this.созданиеДиаграммыToolStripMenuItem.Text = "Создание диаграммы";
this.созданиеДиаграммыToolStripMenuItem.Click += new System.EventHandler(this.созданиеДиаграммыToolStripMenuItem_Click);
//
// label1
//
@ -111,36 +143,15 @@
// менюToolStripMenuItem
//
this.менюToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.отчетПоСтудентамWordToolStripMenuItem,
this.отчетПоСтудентамPdfToolStripMenuItem,
this.отчетПоСтудентамExelToolStripMenuItem,
this.справочникToolStripMenuItem});
this.менюToolStripMenuItem.Name = енюToolStripMenuItem";
this.менюToolStripMenuItem.Size = new System.Drawing.Size(65, 24);
this.менюToolStripMenuItem.Text = "Меню";
//
// отчетПоСтудентамWordToolStripMenuItem
//
this.отчетПоСтудентамWordToolStripMenuItem.Name = "отчетПоСтудентамWordToolStripMenuItem";
this.отчетПоСтудентамWordToolStripMenuItem.Size = new System.Drawing.Size(273, 26);
this.отчетПоСтудентамWordToolStripMenuItem.Text = "Отчет по студентам(Word)";
//
// отчетПоСтудентамPdfToolStripMenuItem
//
this.отчетПоСтудентамPdfToolStripMenuItem.Name = "отчетПоСтудентамPdfToolStripMenuItem";
this.отчетПоСтудентамPdfToolStripMenuItem.Size = new System.Drawing.Size(273, 26);
this.отчетПоСтудентамPdfToolStripMenuItem.Text = "Отчет по студентам(Pdf)";
//
// отчетПоСтудентамExelToolStripMenuItem
//
this.отчетПоСтудентамExelToolStripMenuItem.Name = "отчетПоСтудентамExelToolStripMenuItem";
this.отчетПоСтудентамExelToolStripMenuItem.Size = new System.Drawing.Size(273, 26);
this.отчетПоСтудентамExelToolStripMenuItem.Text = "Отчет по студентам(Exel)";
//
// справочникToolStripMenuItem
//
this.справочникToolStripMenuItem.Name = "справочникToolStripMenuItem";
this.справочникToolStripMenuItem.Size = new System.Drawing.Size(273, 26);
this.справочникToolStripMenuItem.Size = new System.Drawing.Size(177, 26);
this.справочникToolStripMenuItem.Text = "Справочник";
this.справочникToolStripMenuItem.Click += new System.EventHandler(this.справочникToolStripMenuItem_Click);
//
@ -170,13 +181,16 @@
private Label label1;
private MenuStrip menuStrip1;
private ToolStripMenuItem менюToolStripMenuItem;
private ToolStripMenuItem отчетПоСтудентамWordToolStripMenuItem;
private ToolStripMenuItem отчетПоСтудентамPdfToolStripMenuItem;
private ToolStripMenuItem отчетПоСтудентамExelToolStripMenuItem;
private ToolStripMenuItem справочникToolStripMenuItem;
private ContextMenuStrip contextMenuStrip1;
private ToolStripMenuItem добавитьToolStripMenuItem;
private ToolStripMenuItem редактироваьToolStripMenuItem;
private ToolStripMenuItem изменитьToolStripMenuItem;
private ToolStripMenuItem созданиеПростогоЭлементаToolStripMenuItem;
private ToolStripMenuItem созданиеДокаСНастраиваемойТаблицейToolStripMenuItem;
private ToolStripMenuItem созданиеДиаграммыToolStripMenuItem;
private COPWinForms.ComponentWord1 componentWord11;
private COP.PieChart pieChart1;
private WinFormsControlLibrary.TablePdfComponent1 tablePdfComponent11;
}
}

View File

@ -1,6 +1,14 @@
using COP;
using COP.Info;
using COPWinForms;
using DocumentFormat.OpenXml.Office2016.Drawing.ChartDrawing;
using NPOI.HPSF;
using NPOI.SS.Formula.Functions;
using System.Windows.Forms;
using UniversityContracts.BindingModels;
using UniversityContracts.BusinessLogicsContracts;
using WinFormsControlLibrary;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace UniversityForms
{
@ -13,7 +21,6 @@ namespace UniversityForms
_studentLogic = studentLogic;
_courseLogic = courseLogic;
InitializeComponent();
}
private void FormMain_Load(object sender, EventArgs e)
{
@ -21,16 +28,20 @@ namespace UniversityForms
}
private void LoadData()
{
try
{
List<string> Hierarchy = new List<string>() { "Course", "Scholarship", "Id", "FIO" };
var Hierarchy = new List<string> { "Course", "Scholarship", "Id", "FIO" };
var list = _studentLogic.ReadList(null);
for (int i = 0; i < list.Count; i++)
{
if (list[i].Scholarship == null) { list[i].Scholarship = 0; }
}
foreach (var prop in list[0].GetType().GetProperties())
{
userTreeView1.Hierarchy.Add(prop.Name);
}
userTreeView1.PopulateTree(list);
userTreeView1.PopulateTree(list, Hierarchy);
}
catch (Exception ex)
{
@ -54,6 +65,148 @@ namespace UniversityForms
{
form.ShowDialog();
}
LoadData();
}
private void ðåäàêòèðîâàüToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void ñîçäàíèåÏðîñòîãîÝëåìåíòàToolStripMenuItem_Click(object sender, EventArgs e)
{
List<string> textList = new List<string>();
var list = _studentLogic.ReadList(null);
//ôèëüòðàöèÿ ôàéëîâ äëÿ äèàëîãîâîãî îêíà
using var dialog = new SaveFileDialog
{
Filter = "docx|*.docx"
};
if (dialog.ShowDialog() == DialogResult.OK)
{
try
{
if (list != null)
{
foreach (var item in list)
{
if (item.Scholarship != null)
{
string clients = string.Concat("ÔÈÎ: ", item.FIO, " Êðàòêàÿ õàðàêòåðèñòèêà: ", item.Ñharacteristic);
textList.Add(clients);
}
}
string[] textArray = textList.ToArray();
componentWord11.CreateWordText(new(dialog.FileName, "Äîêóìåíò ïî ñòóäåíòàì ñî ñòèïåíäèåé", textArray));
}
MessageBox.Show("Âûïîëíåíî", "Óñïåõ", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void ñîçäàíèåÄèàãðàììûToolStripMenuItem_Click(object sender, EventArgs e)
{
PieChart chart = new();
COP.Enums.LegendPosition legend = new();
var listStudents = _studentLogic.ReadList(null);
var listCourses = _courseLogic.ReadList(null);
List<(string, int)> data = new List<(string, int)>();
for (int i = 0; i < listCourses.Count; i++)
{
int counter = 0;
for (int j = 0; j < listStudents.Count; j++)
{
if (listStudents[j].Course == listCourses[i].Name && listStudents[j].Scholarship != null) counter++;
}
data.Add((listCourses[i].Name, counter));
}
List<DataItem> chartData = new List<DataItem>();
foreach (var item in data)
{
chartData.Add(new DataItem
{
Name = item.Item1,
Value = item.Item2
});
}
//ôèëüòðàöèÿ ôàéëîâ äëÿ äèàëîãîâîãî îêíà
using var dialog = new SaveFileDialog
{
Filter = "xlsx|*.xlsx"
};
if (dialog.ShowDialog() == DialogResult.OK)
{
try
{
ExcelChartInfo info = new(dialog.FileName, "Ñêîëüêî ñòóäåíòîâ íà êàêîì êóðñå", "Êóðñû", COP.Enums.LegendPosition.Right, chartData);
chart.GenerateDocument(info);
MessageBox.Show("Ñîõàðíåíî óñïåøíî", "Ðåçóëüòàò", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void ñîçäàíèåÄîêàÑÍàñòðàèâàåìîéÒàáëèöåéToolStripMenuItem_Click(object sender, EventArgs e)
{
CustomTablePdfComponent2 generator = new CustomTablePdfComponent2();
var list = _studentLogic.ReadList(null);
for (int i = 0; i < list.Count; i++)
{
if (list[i].Scholarship == null) { list[i].Scholarship = 0; }
}
var columnConfigs = new List<ColumnConfig>
{
new ColumnConfig { Width = 50f, PropertyName = "Id", ShowName = "Id"},
new ColumnConfig { Width = 300f, PropertyName = "FIO", ShowName = "FIO" },
new ColumnConfig { Width = 100f, PropertyName = "Course", ShowName = "Course" },
new ColumnConfig { Width = 100f, PropertyName = "Scholarship", ShowName = "Scholarship" },
};
using var dialog = new SaveFileDialog
{
Filter = "pdf|*.pdf"
};
if (dialog.ShowDialog() == DialogResult.OK)
{
try
{
generator.GenerateDocument(dialog.FileName, "Students", 100f, 50f, list, columnConfigs);
MessageBox.Show("Ñîõàðíåíî óñïåøíî", "Ðåçóëüòàò", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void èçìåíèòüToolStripMenuItem_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Óäàëèòü çàïèñü", "Âîïðîñ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
var selected = userTreeView1.GetSelectedObject<StudentBindingModels>();
int id = Convert.ToInt32((selected as StudentBindingModels).Id);
try
{
_studentLogic.Delete(new StudentBindingModels { Id = id });
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
LoadData();
}
}
}
}

View File

@ -63,4 +63,13 @@
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="componentWord11.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>338, 17</value>
</metadata>
<metadata name="pieChart1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>524, 17</value>
</metadata>
<metadata name="tablePdfComponent11.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>643, 17</value>
</metadata>
</root>

View File

@ -1,4 +1,5 @@
using System;
using MathNet.Numerics;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@ -11,6 +12,7 @@ using UniversityContracts.BindingModels;
using UniversityContracts.BusinessLogicsContracts;
using UniversityContracts.SearchModels;
using UniversityContracts.ViewModels;
using UniversityDataBaseImplements.Models;
namespace UniversityForms
{
@ -43,7 +45,7 @@ namespace UniversityForms
}
if (textBoxCharacter.Text == null)
{
MessageBox.Show("Заполните ", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show("Заполните характеристику", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
int? scholarship = fieldForInt1.TextBoxValue;
@ -56,7 +58,7 @@ namespace UniversityForms
Сharacteristic = textBoxCharacter.Text,
FIO = textBoxFIO.Text,
Course = componentcBox1.Selected.ToString(),
Scholarship = (int)scholarship
Scholarship = scholarship
});
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;
@ -67,7 +69,6 @@ namespace UniversityForms
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void FormStudent_Load(object sender, EventArgs e)
{
List<CourseViewModel> viewS = _courselogic.ReadList(null);

View File

@ -27,6 +27,7 @@ namespace WinFormsTest
students.Add(student2);
students.Add(student3);
students.Add(student4);
students.Clear();
InitializeComponent();
componenttBox1.Pattern = @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$";