3 рабочая!!!
This commit is contained in:
parent
468e37445f
commit
80a2db6aaf
@ -17,7 +17,8 @@ namespace UniversityContracts.ViewModels
|
|||||||
public string Сharacteristic { get; set; } = string.Empty;
|
public string Сharacteristic { get; set; } = string.Empty;
|
||||||
[DisplayName("Курс")]
|
[DisplayName("Курс")]
|
||||||
public string Course { get; set; } = string.Empty;
|
public string Course { get; set; } = string.Empty;
|
||||||
[DisplayName("Стипендия")]
|
|
||||||
public int? Scholarship { get; set; }
|
public int? Scholarship { get; set; }
|
||||||
|
[DisplayName("Стипендия")]
|
||||||
|
public string ScholarshipStr { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
24
COP_1/UniversityContracts/ViewModels/StudentViewModel1.cs
Normal file
24
COP_1/UniversityContracts/ViewModels/StudentViewModel1.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UniversityDataModels.Models;
|
||||||
|
|
||||||
|
namespace UniversityContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class StudentViewModel1 : IStudentModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
[DisplayName("ФИО")]
|
||||||
|
public string FIO { get; set; } = string.Empty;
|
||||||
|
[DisplayName("Краткая характеристика")]
|
||||||
|
public string Сharacteristic { get; set; } = string.Empty;
|
||||||
|
[DisplayName("Курс")]
|
||||||
|
public string Course { get; set; } = string.Empty;
|
||||||
|
[DisplayName("Стипендия")]
|
||||||
|
public string ScholarshipStr { get; set; } = string.Empty;
|
||||||
|
public int? Scholarship { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -59,7 +59,8 @@ namespace UniversityDataBaseImplements.Models
|
|||||||
Course = Course,
|
Course = Course,
|
||||||
FIO = FIO,
|
FIO = FIO,
|
||||||
Scholarship = Scholarship,
|
Scholarship = Scholarship,
|
||||||
Сharacteristic = Сharacteristic
|
Сharacteristic = Сharacteristic,
|
||||||
|
ScholarshipStr = Scholarship.ToString()
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ namespace UniversityForms
|
|||||||
_studentLogic = studentLogic;
|
_studentLogic = studentLogic;
|
||||||
_courseLogic = courseLogic;
|
_courseLogic = courseLogic;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
List<string> stringToHierachy = new List<string>() { "Course", "Scholarship", "Id", "FIO" };
|
List<string> stringToHierachy = new List<string>() { "Course", "ScholarshipStr", "Id", "FIO" };
|
||||||
myTreeView1.addToHierarchy(stringToHierachy);
|
myTreeView1.addToHierarchy(stringToHierachy);
|
||||||
myTreeView1.ContextMenuStrip = contextMenuStrip1;
|
myTreeView1.ContextMenuStrip = contextMenuStrip1;
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ namespace UniversityForms
|
|||||||
var list = _studentLogic.ReadList(null);
|
var list = _studentLogic.ReadList(null);
|
||||||
for (int i = 0; i < list.Count; i++)
|
for (int i = 0; i < list.Count; i++)
|
||||||
{
|
{
|
||||||
if (list[i].Scholarship == null) { list[i].Scholarship = 0; }
|
if (list[i].Scholarship == null) { list[i].ScholarshipStr = "Íåò ñòèïåíäèè"; }
|
||||||
}
|
}
|
||||||
myTreeView1.LoadTree(list);
|
myTreeView1.LoadTree(list);
|
||||||
}
|
}
|
||||||
@ -179,14 +179,14 @@ namespace UniversityForms
|
|||||||
var list = _studentLogic.ReadList(null);
|
var list = _studentLogic.ReadList(null);
|
||||||
for (int i = 0; i < list.Count; i++)
|
for (int i = 0; i < list.Count; i++)
|
||||||
{
|
{
|
||||||
if (list[i].Scholarship == null) { list[i].Scholarship = 0; }
|
if (list[i].Scholarship == null) { list[i].ScholarshipStr = "No"; }
|
||||||
}
|
}
|
||||||
var columnConfigs = new List<ColumnConfig>
|
var columnConfigs = new List<ColumnConfig>
|
||||||
{
|
{
|
||||||
new ColumnConfig { Width = 50f, PropertyName = "Id", ShowName = "Id"},
|
new ColumnConfig { Width = 50f, PropertyName = "Id", ShowName = "Id"},
|
||||||
new ColumnConfig { Width = 300f, PropertyName = "FIO", ShowName = "FIO" },
|
new ColumnConfig { Width = 300f, PropertyName = "FIO", ShowName = "FIO" },
|
||||||
new ColumnConfig { Width = 100f, PropertyName = "Course", ShowName = "Course" },
|
new ColumnConfig { Width = 100f, PropertyName = "Course", ShowName = "Course" },
|
||||||
new ColumnConfig { Width = 100f, PropertyName = "Scholarship", ShowName = "Scholarship" },
|
new ColumnConfig { Width = 100f, PropertyName = "ScholarshipStr", ShowName = "Scholarship" },
|
||||||
};
|
};
|
||||||
using var dialog = new SaveFileDialog
|
using var dialog = new SaveFileDialog
|
||||||
{
|
{
|
||||||
@ -209,20 +209,22 @@ namespace UniversityForms
|
|||||||
|
|
||||||
private void èçìåíèòüToolStripMenuItem_Click(object sender, EventArgs e)
|
private void èçìåíèòüToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//if (MessageBox.Show("Óäàëèòü çàïèñü", "Âîïðîñ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
if (MessageBox.Show("Óäàëèòü çàïèñü", "Âîïðîñ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
//{
|
{
|
||||||
// var selected = userTreeView1.GetSelectedObject<StudentBindingModels>();
|
var selectedClient = myTreeView1.GetNode(typeof(StudentViewModel));
|
||||||
// int id = Convert.ToInt32((selected as StudentBindingModels).Id);
|
if (selectedClient != null)
|
||||||
// try
|
{
|
||||||
// {
|
int id = Convert.ToInt32((selectedClient as StudentViewModel).Id);
|
||||||
// _studentLogic.Delete(new StudentBindingModels { Id = id });
|
try
|
||||||
// }
|
{
|
||||||
// catch (Exception ex)
|
_studentLogic.Delete(new StudentBindingModels { Id = id });
|
||||||
// {
|
}
|
||||||
// MessageBox.Show(ex.Message, "Îøèáêà", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
catch (Exception ex)
|
||||||
// }
|
{
|
||||||
// LoadData();
|
MessageBox.Show(ex.Message, "Îøèáêà", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
//}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user