готово 2

This commit is contained in:
Garifullin-Farid 2024-11-26 21:35:40 +04:00
parent 309afa69c4
commit 2954f41b3f
33 changed files with 228 additions and 455 deletions

View File

@ -1,13 +1,13 @@
namespace ProjectSession.Entities
{
public class DisciplineTeachersDistribution
public class DisciplineTeachers
{
public int Id { get; private set; }
public int DisciplineId { get; private set; }
public int NumberHours { get; private set; }
public static DisciplineTeachersDistribution CreateElement(int id, int disciplineId, int numberHours)
public static DisciplineTeachers CreateElement(int id, int disciplineId, int numberHours)
{
return new DisciplineTeachersDistribution
return new DisciplineTeachers
{
Id = id,
DisciplineId = disciplineId,

View File

@ -1,21 +0,0 @@
namespace ProjectSession.Entities.Enum
{
public class TeacherDispline
{
public int Id { get; private set; }
public int TeacherId { get; private set; }
public int DisciplineId { get; private set; }
public int Mark { get; private set; }
public static TeacherDispline CreateElement(int id, int disciplineId, int teacherId, int mark)
{
return new TeacherDispline
{
Id = id,
TeacherId = teacherId,
DisciplineId = disciplineId,
Mark = mark
};
}
}
}

View File

@ -6,44 +6,15 @@ using System.Threading.Tasks;
namespace ProjectSession.Entities.Enum
{
/// <summary>
/// вид должности преподавателя
/// </summary>
public enum TeacherPost
{
/// <summary>
/// асистент
/// </summary>
Assistant = 0,
/// <summary>
/// преподаватель
/// </summary>
Teacher = 1,
/// <summary>
/// старший преподаватель
/// </summary>
SeniorLecturer = 2,
/// <summary>
/// доцент
/// </summary>
Docent = 3,
/// <summary>
/// профессор
/// </summary>
Professor= 4,
/// <summary>
/// заведующий кафедрой
/// </summary>
HeadDepartment = 5,
/// <summary>
/// декан факультета
/// </summary>
DeanFaculty = 6
}
}

View File

@ -8,19 +8,7 @@ namespace ProjectSession.Entities.Enum
{
public enum TypeAttestation
{
/// <summary>
/// зачет
/// </summary>
Credit = 0,
/// <summary>
/// дифференцированный зачет
/// </summary>
DifferentiatedCredit = 0,
/// <summary>
/// экзамен
/// </summary>
Exam = 1,
DifferentiatedCredit = 1,
Exam = 2,
}
}

View File

@ -7,24 +7,24 @@ namespace ProjectSession.Entities
public int Id { get; private set; }
public string Name { get; private set; } = string.Empty;
public int TeacherId { get; private set; }
public int DisciplineId { get; private set; }
public DateTime DateTime { get; private set; }
public static Exam CreateOpeartion(int id,int teacherId,int disciplineId, DateTime dateTime)
public IEnumerable<ExamGradeBook> ExamGradeBook { get; private set; } = [];
public static Exam CreateOpeartion(int id,int teacherId,int disciplineId, DateTime dateTime, IEnumerable<ExamGradeBook> examGradeBook)
{
return new Exam
{
Id = id,
TeacherId = teacherId,
DisciplineId = disciplineId,
DateTime = dateTime
DateTime = dateTime,
ExamGradeBook = examGradeBook
};
}

View File

@ -1,6 +1,4 @@

using ProjectSession.Entities.Enum;
using ProjectSession.Entities.Enum;
namespace ProjectSession.Entities
{
@ -18,11 +16,15 @@ namespace ProjectSession.Entities
public int GroupID { get; private set; }
public string FullName
{
get { return $"{FirstName} {LastName}"; }
}
public StudentStatus Status { get; private set; }
public IEnumerable<ExamGradeBook> ExamGradeBook { get; private set; } = [];
public static Student CreateEntity(int id,string firstName,string lastName,int groupId, StudentStatus studentStatus, IEnumerable<ExamGradeBook> examGradeBook)
public static Student CreateEntity(int id,string firstName,string lastName,int groupId, StudentStatus studentStatus)
{
return new Student
{
@ -31,7 +33,7 @@ namespace ProjectSession.Entities
LastName = lastName,
GroupID = groupId,
Status = studentStatus,
ExamGradeBook = examGradeBook
};
}
}

View File

@ -1,25 +0,0 @@

namespace ProjectSession.Entities
{
public class StudentGradeBook
{
public int Id { get; private set; }
public int StudentId { get; private set; }
public IEnumerable<ExamGradeBook> ExamGradeBook{ get; private set;} = [];
public static StudentGradeBook CreateOpeartion(int id, int studentId,
IEnumerable<ExamGradeBook> examGradeBook)
{
return new StudentGradeBook
{
Id = id,
StudentId = studentId,
ExamGradeBook = examGradeBook
};
}
}
}

View File

@ -15,12 +15,17 @@ namespace ProjectSession.Entities
public string LastName { get; private set; } = string.Empty;
public string FullName
{
get { return $"{FirstName} {LastName}"; }
}
public TeacherPost TeacherPost { get; private set; }
public IEnumerable<DisciplineTeachersDistribution> DisciplineTeachersDistribution { get; private set; } = [];
public IEnumerable<DisciplineTeachers> DisciplineTeachersDistribution { get; private set; } = [];
public static Teacher CreateEntity(int id,string FirstName,string LastName,TeacherPost teacherPost, IEnumerable<DisciplineTeachersDistribution> disciplineTeachersDistribution)
public static Teacher CreateEntity(int id,string FirstName,string LastName,TeacherPost teacherPost, IEnumerable<DisciplineTeachers> disciplineTeachersDistribution)
{
return new Teacher
{

View File

@ -1,21 +0,0 @@
namespace ProjectSession.Entities
{
public class TeachersDistribution
{
public int Id { get; private set; }
public int TeacherId { get; private set; }
public IEnumerable<DisciplineTeachersDistribution> DisciplineTeachersDistribution { get; private set;} = [];
public static TeachersDistribution CreateOpeartion(int id, int teacherId, IEnumerable<DisciplineTeachersDistribution> disciplineTeachersDistribution)
{
return new TeachersDistribution
{
Id = id,
TeacherId = teacherId,
DisciplineTeachersDistribution = disciplineTeachersDistribution
};
}
}
}

View File

@ -61,14 +61,14 @@
comboBoxType.FormattingEnabled = true;
comboBoxType.Location = new Point(33, 99);
comboBoxType.Name = "comboBoxType";
comboBoxType.Size = new Size(100, 23);
comboBoxType.Size = new Size(109, 23);
comboBoxType.TabIndex = 13;
//
// textBoxName
//
textBoxName.Location = new Point(33, 53);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(100, 23);
textBoxName.Size = new Size(109, 23);
textBoxName.TabIndex = 12;
//
// label2

View File

@ -52,7 +52,7 @@
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(664, 450);
dataGridView.Size = new Size(1008, 448);
dataGridView.TabIndex = 5;
//
// panel1
@ -61,9 +61,9 @@
panel1.Controls.Add(buttonDell);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(664, 0);
panel1.Location = new Point(1008, 0);
panel1.Name = "panel1";
panel1.Size = new Size(136, 450);
panel1.Size = new Size(136, 448);
panel1.TabIndex = 4;
//
// buttonUpd
@ -103,7 +103,7 @@
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
ClientSize = new Size(1144, 448);
Controls.Add(dataGridView);
Controls.Add(panel1);
Name = "FormDisciplines";

View File

@ -30,18 +30,24 @@
{
comboBoxTeacher = new ComboBox();
comboBoxDiscipline = new ComboBox();
dateTimePickerExam = new DateTimePicker();
label1 = new Label();
label2 = new Label();
label3 = new Label();
buttonCancel = new Button();
buttonSave = new Button();
groupBoxStidentMark = new GroupBox();
dataGridViewExams = new DataGridView();
ColumnStudent = new DataGridViewComboBoxColumn();
ColumnMark = new DataGridViewTextBoxColumn();
dateTimePicker = new DateTimePicker();
groupBoxStidentMark.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridViewExams).BeginInit();
SuspendLayout();
//
// comboBoxTeacher
//
comboBoxTeacher.FormattingEnabled = true;
comboBoxTeacher.Location = new Point(125, 83);
comboBoxTeacher.Location = new Point(125, 51);
comboBoxTeacher.Name = "comboBoxTeacher";
comboBoxTeacher.Size = new Size(175, 23);
comboBoxTeacher.TabIndex = 0;
@ -49,24 +55,15 @@
// comboBoxDiscipline
//
comboBoxDiscipline.FormattingEnabled = true;
comboBoxDiscipline.Location = new Point(125, 130);
comboBoxDiscipline.Location = new Point(125, 98);
comboBoxDiscipline.Name = "comboBoxDiscipline";
comboBoxDiscipline.Size = new Size(175, 23);
comboBoxDiscipline.TabIndex = 1;
//
// dateTimePickerExam
//
dateTimePickerExam.CustomFormat = " d.MM.yyyy HH:m";
dateTimePickerExam.Format = DateTimePickerFormat.Custom;
dateTimePickerExam.Location = new Point(125, 181);
dateTimePickerExam.Name = "dateTimePickerExam";
dateTimePickerExam.Size = new Size(175, 23);
dateTimePickerExam.TabIndex = 2;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(24, 86);
label1.Location = new Point(24, 51);
label1.Name = "label1";
label1.Size = new Size(89, 15);
label1.TabIndex = 3;
@ -75,7 +72,7 @@
// label2
//
label2.AutoSize = true;
label2.Location = new Point(24, 133);
label2.Location = new Point(24, 98);
label2.Name = "label2";
label2.Size = new Size(74, 15);
label2.TabIndex = 4;
@ -84,7 +81,7 @@
// label3
//
label3.AutoSize = true;
label3.Location = new Point(24, 187);
label3.Location = new Point(24, 147);
label3.Name = "label3";
label3.Size = new Size(77, 15);
label3.TabIndex = 5;
@ -92,7 +89,7 @@
//
// buttonCancel
//
buttonCancel.Location = new Point(166, 261);
buttonCancel.Location = new Point(200, 527);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(100, 48);
buttonCancel.TabIndex = 11;
@ -102,7 +99,7 @@
//
// buttonSave
//
buttonSave.Location = new Point(42, 261);
buttonSave.Location = new Point(24, 527);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(100, 48);
buttonSave.TabIndex = 10;
@ -110,23 +107,69 @@
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// groupBoxStidentMark
//
groupBoxStidentMark.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
groupBoxStidentMark.Controls.Add(dataGridViewExams);
groupBoxStidentMark.Location = new Point(12, 223);
groupBoxStidentMark.Name = "groupBoxStidentMark";
groupBoxStidentMark.Size = new Size(314, 249);
groupBoxStidentMark.TabIndex = 14;
groupBoxStidentMark.TabStop = false;
groupBoxStidentMark.Text = "оценки ";
//
// dataGridViewExams
//
dataGridViewExams.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
dataGridViewExams.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridViewExams.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewExams.Columns.AddRange(new DataGridViewColumn[] { ColumnStudent, ColumnMark });
dataGridViewExams.Location = new Point(16, 23);
dataGridViewExams.Margin = new Padding(3, 4, 3, 4);
dataGridViewExams.MultiSelect = false;
dataGridViewExams.Name = "dataGridViewExams";
dataGridViewExams.RowHeadersWidth = 51;
dataGridViewExams.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridViewExams.Size = new Size(292, 219);
dataGridViewExams.TabIndex = 0;
//
// ColumnStudent
//
ColumnStudent.HeaderText = "студент";
ColumnStudent.Name = "ColumnStudent";
//
// ColumnMark
//
ColumnMark.HeaderText = "Оценка";
ColumnMark.Name = "ColumnMark";
//
// dateTimePicker
//
dateTimePicker.Location = new Point(120, 147);
dateTimePicker.Name = "dateTimePicker";
dateTimePicker.Size = new Size(180, 23);
dateTimePicker.TabIndex = 15;
//
// FormExam
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(312, 362);
ClientSize = new Size(341, 587);
Controls.Add(dateTimePicker);
Controls.Add(groupBoxStidentMark);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(label3);
Controls.Add(label2);
Controls.Add(label1);
Controls.Add(dateTimePickerExam);
Controls.Add(comboBoxDiscipline);
Controls.Add(comboBoxTeacher);
KeyPreview = true;
Name = "FormExam";
StartPosition = FormStartPosition.CenterScreen;
Text = "экзамен";
groupBoxStidentMark.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridViewExams).EndInit();
ResumeLayout(false);
PerformLayout();
}
@ -135,11 +178,15 @@
private ComboBox comboBoxTeacher;
private ComboBox comboBoxDiscipline;
private DateTimePicker dateTimePickerExam;
private Label label1;
private Label label2;
private Label label3;
private Button buttonCancel;
private Button buttonSave;
private GroupBox groupBoxStidentMark;
private DataGridView dataGridViewExams;
private DataGridViewComboBoxColumn ColumnStudent;
private DataGridViewTextBoxColumn ColumnMark;
private DateTimePicker dateTimePicker;
}
}

View File

@ -1,5 +1,7 @@
using ProjectSession.Entities;
using ProjectSession.Repositories;
using ProjectSession.Repositories.Implementations;
using System.Windows.Forms;
namespace ProjectSession.Forms
{
@ -7,29 +9,37 @@ namespace ProjectSession.Forms
{
private readonly IExamRepository _examRepository;
public FormExam( IExamRepository ExamRepository, ITeacherRepository teacherRepository, IDisciplineRepository disciplineRepository)
public FormExam( IExamRepository ExamRepository, ITeacherRepository teacherRepository, IDisciplineRepository disciplineRepository,IStudentRepository studentRepository)
{
InitializeComponent();
_examRepository = ExamRepository ?? throw new ArgumentNullException(nameof(ExamRepository));
comboBoxDiscipline.DataSource = disciplineRepository.ReadDiscipline();
comboBoxDiscipline.DisplayMember = "Name";
comboBoxDiscipline.ValueMember = "Id";
comboBoxTeacher.DataSource = teacherRepository.ReadTeacher();
comboBoxTeacher.DisplayMember = "FirstName";
comboBoxTeacher.DisplayMember = "LastName";
comboBoxTeacher.DisplayMember = "FullName";
comboBoxTeacher.ValueMember = "Id";
ColumnStudent.DataSource = studentRepository.ReadStudent();
ColumnStudent.DisplayMember = "FullName";
ColumnStudent.ValueMember = "Id";
dateTimePicker.Format = DateTimePickerFormat.Custom;
dateTimePicker.CustomFormat = "yyyy-MM-dd HH:mm:ss";
dateTimePicker.Value = DateTime.Now;
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (comboBoxDiscipline.SelectedIndex < 0 ||comboBoxTeacher.SelectedIndex < 0)
if (comboBoxDiscipline.SelectedIndex < 0 ||comboBoxTeacher.SelectedIndex < 0 || dataGridViewExams.RowCount < 1)
{
throw new Exception("Имеются незаполненные поля");
}
_examRepository.CreateExam(Exam.CreateOpeartion(0,(int)comboBoxTeacher.SelectedValue!,
(int)comboBoxDiscipline.SelectedValue!,dateTimePickerExam.Value));
_examRepository.CreateExam(Exam.CreateOpeartion(0, (int)comboBoxTeacher.SelectedValue!,
(int)comboBoxDiscipline.SelectedValue!, dateTimePicker.Value, CreateListExamGradeBookFromDataGrid()));
Close();
}
catch (Exception ex)
@ -38,5 +48,21 @@ namespace ProjectSession.Forms
}
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
private List<ExamGradeBook> CreateListExamGradeBookFromDataGrid(){
var list = new List<ExamGradeBook>();
foreach (DataGridViewRow row in dataGridViewExams.Rows)
{
if (row.Cells["ColumnExam"].Value == null ||
row.Cells["ColumnExam"].Value == null)
{
continue;
}
list.Add(ExamGradeBook.CreateElement(0,
Convert.ToInt32(row.Cells["ColumnExam"].Value),
Convert.ToInt32(row.Cells["ColumnMark"].Value)));
}
return list;
}
}
}

View File

@ -117,4 +117,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ColumnStudent.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnMark.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -28,40 +28,40 @@
/// </summary>
private void InitializeComponent()
{
dataGridViewData = new DataGridView();
dataGridView = new DataGridView();
panel1 = new Panel();
buttonUpd = new Button();
buttonAdd = new Button();
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
panel1.SuspendLayout();
SuspendLayout();
//
// dataGridViewData
// dataGridView
//
dataGridViewData.AllowUserToAddRows = false;
dataGridViewData.AllowUserToDeleteRows = false;
dataGridViewData.AllowUserToResizeColumns = false;
dataGridViewData.AllowUserToResizeRows = false;
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewData.Dock = DockStyle.Fill;
dataGridViewData.Location = new Point(0, 0);
dataGridViewData.MultiSelect = false;
dataGridViewData.Name = "dataGridViewData";
dataGridViewData.ReadOnly = true;
dataGridViewData.RowHeadersVisible = false;
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridViewData.Size = new Size(664, 450);
dataGridViewData.TabIndex = 7;
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AllowUserToResizeColumns = false;
dataGridView.AllowUserToResizeRows = false;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(1021, 446);
dataGridView.TabIndex = 7;
//
// panel1
//
panel1.Controls.Add(buttonUpd);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(664, 0);
panel1.Location = new Point(1021, 0);
panel1.Name = "panel1";
panel1.Size = new Size(136, 450);
panel1.Size = new Size(136, 446);
panel1.TabIndex = 6;
//
// buttonUpd
@ -73,6 +73,7 @@
buttonUpd.Size = new Size(75, 70);
buttonUpd.TabIndex = 3;
buttonUpd.UseVisualStyleBackColor = true;
buttonUpd.Click += ButtonUpd_Click;
//
// buttonAdd
//
@ -89,21 +90,21 @@
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridViewData);
ClientSize = new Size(1157, 446);
Controls.Add(dataGridView);
Controls.Add(panel1);
Name = "FormExams";
StartPosition = FormStartPosition.CenterScreen;
Text = "экзамены";
Load += FormExam_Load;
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
panel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridViewData;
private DataGridView dataGridView;
private Panel panel1;
private Button buttonAdd;
private Button buttonUpd;

View File

@ -1,6 +1,7 @@
using Unity;
using ProjectSession.Repositories;
namespace ProjectSession.Forms
{
public partial class FormExams : Form
@ -11,11 +12,8 @@ namespace ProjectSession.Forms
public FormExams(IUnityContainer container, IExamRepository examRepository)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
_examRepository = examRepository ??
throw new
ArgumentNullException(nameof(examRepository));
_container = container ?? throw new ArgumentNullException(nameof(container));
_examRepository = examRepository ?? throw new ArgumentNullException(nameof(examRepository));
}
private void FormExam_Load(object sender, EventArgs e)
{
@ -41,8 +39,40 @@ namespace ProjectSession.Forms
MessageBox.Show(ex.Message, "Ошибка при добавлении",MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewData.DataSource =
_examRepository.ReadExam();
private void ButtonUpd_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormStudent>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView.DataSource = _examRepository.ReadExam();
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridView.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
return true;
}
}
}

View File

@ -52,7 +52,7 @@
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(664, 450);
dataGridView.Size = new Size(1009, 436);
dataGridView.TabIndex = 3;
//
// panel1
@ -61,9 +61,9 @@
panel1.Controls.Add(buttonDell);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(664, 0);
panel1.Location = new Point(1009, 0);
panel1.Name = "panel1";
panel1.Size = new Size(136, 450);
panel1.Size = new Size(136, 436);
panel1.TabIndex = 2;
//
// buttonUpd
@ -103,7 +103,7 @@
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
ClientSize = new Size(1145, 436);
Controls.Add(dataGridView);
Controls.Add(panel1);
Name = "FormGroups";

View File

@ -38,12 +38,6 @@
label3 = new Label();
comboBoxStudentGroup = new ComboBox();
label4 = new Label();
groupBoxExam = new GroupBox();
dataGridViewExams = new DataGridView();
ColumnExam = new DataGridViewComboBoxColumn();
ColumnMark = new DataGridViewTextBoxColumn();
groupBoxExam.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridViewExams).BeginInit();
SuspendLayout();
//
// label1
@ -80,7 +74,7 @@
//
// buttonSave
//
buttonSave.Location = new Point(12, 551);
buttonSave.Location = new Point(39, 306);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(100, 48);
buttonSave.TabIndex = 6;
@ -90,7 +84,7 @@
//
// buttonCancel
//
buttonCancel.Location = new Point(226, 551);
buttonCancel.Location = new Point(222, 306);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(100, 48);
buttonCancel.TabIndex = 7;
@ -132,49 +126,12 @@
label4.TabIndex = 12;
label4.Text = "группа";
//
// groupBoxExam
//
groupBoxExam.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
groupBoxExam.Controls.Add(dataGridViewExams);
groupBoxExam.Location = new Point(23, 263);
groupBoxExam.Name = "groupBoxExam";
groupBoxExam.Size = new Size(314, 249);
groupBoxExam.TabIndex = 13;
groupBoxExam.TabStop = false;
groupBoxExam.Text = "экзамены";
//
// dataGridViewExams
//
dataGridViewExams.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
dataGridViewExams.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridViewExams.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewExams.Columns.AddRange(new DataGridViewColumn[] { ColumnExam, ColumnMark });
dataGridViewExams.Location = new Point(16, 23);
dataGridViewExams.Margin = new Padding(3, 4, 3, 4);
dataGridViewExams.MultiSelect = false;
dataGridViewExams.Name = "dataGridViewExams";
dataGridViewExams.RowHeadersWidth = 51;
dataGridViewExams.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridViewExams.Size = new Size(283, 219);
dataGridViewExams.TabIndex = 0;
//
// ColumnExam
//
ColumnExam.HeaderText = "экзамен";
ColumnExam.Name = "ColumnExam";
//
// ColumnMark
//
ColumnMark.HeaderText = "Оценка";
ColumnMark.Name = "ColumnMark";
//
// FormStudent
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
AutoValidate = AutoValidate.EnableAllowFocusChange;
ClientSize = new Size(364, 611);
Controls.Add(groupBoxExam);
ClientSize = new Size(361, 407);
Controls.Add(label4);
Controls.Add(comboBoxStudentGroup);
Controls.Add(label3);
@ -188,8 +145,6 @@
Name = "FormStudent";
StartPosition = FormStartPosition.CenterScreen;
Text = "Студент";
groupBoxExam.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridViewExams).EndInit();
ResumeLayout(false);
PerformLayout();
}
@ -206,9 +161,5 @@
private Label label3;
private ComboBox comboBoxStudentGroup;
private Label label4;
private GroupBox groupBoxExam;
private DataGridView dataGridViewExams;
private DataGridViewComboBoxColumn ColumnExam;
private DataGridViewTextBoxColumn ColumnMark;
}
}

View File

@ -53,9 +53,7 @@ namespace ProjectSession.Forms
comboBoxStudentGroup.DataSource = groupRepository.ReadGroup();
comboBoxStudentGroup.DisplayMember = "Name";
comboBoxStudentGroup.ValueMember = "Id";
ColumnExam.DataSource = examRepository.ReadExam();
ColumnExam.DisplayMember = "Name";
ColumnExam.ValueMember = "Id";
foreach (var elem in Enum.GetValues(typeof(StudentStatus)))
{
@ -68,7 +66,7 @@ namespace ProjectSession.Forms
{
try
{
if (string.IsNullOrWhiteSpace(textBoxStudentFirstName.Text) || string.IsNullOrWhiteSpace(textBoxStudentLastName.Text) || comboBoxStudentGroup.SelectedIndex < 0|| dataGridViewExams.RowCount < 1)
if (string.IsNullOrWhiteSpace(textBoxStudentFirstName.Text) || string.IsNullOrWhiteSpace(textBoxStudentLastName.Text) || comboBoxStudentGroup.SelectedIndex < 0)
{
throw new Exception("Имеются незаполненныеполя");
}
@ -94,25 +92,13 @@ namespace ProjectSession.Forms
private Student CreateStudent(int id)
{
var list = new List<ExamGradeBook>();
foreach (DataGridViewRow row in dataGridViewExams.Rows)
{
if (row.Cells["ColumnExam"].Value == null ||
row.Cells["ColumnExam"].Value == null)
{
continue;
}
list.Add(ExamGradeBook.CreateElement(0,
Convert.ToInt32(row.Cells["ColumnExam"].Value),
Convert.ToInt32(row.Cells["ColumnMark"].Value)));
}
StudentStatus studentStatus = StudentStatus.None;
foreach (var elem in checkedListBoxStudentStatus.CheckedItems)
{
studentStatus |= (StudentStatus)elem;
}
return Student.CreateEntity(id, textBoxStudentFirstName.Text, textBoxStudentLastName.Text, (int)comboBoxStudentGroup.SelectedValue!, studentStatus,list);
return Student.CreateEntity(id, textBoxStudentFirstName.Text, textBoxStudentLastName.Text, (int)comboBoxStudentGroup.SelectedValue!, studentStatus);
}
}

View File

@ -117,16 +117,4 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ColumnExam.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnMark.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnExam.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnMark.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -43,9 +43,9 @@
panel1.Controls.Add(buttonDell);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(681, 0);
panel1.Location = new Point(1034, 0);
panel1.Name = "panel1";
panel1.Size = new Size(136, 459);
panel1.Size = new Size(136, 448);
panel1.TabIndex = 0;
//
// buttonUpd
@ -96,14 +96,14 @@
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(681, 459);
dataGridView.Size = new Size(1034, 448);
dataGridView.TabIndex = 1;
//
// FormStudents
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(817, 459);
ClientSize = new Size(1170, 448);
Controls.Add(dataGridView);
Controls.Add(panel1);
Name = "FormStudents";

View File

@ -80,7 +80,7 @@ namespace ProjectSession.Forms
private Teacher CreateTeacher(int id) {
var list = new List<DisciplineTeachersDistribution>();
var list = new List<DisciplineTeachers>();
foreach (DataGridViewRow row in dataGridViewDisciplines.Rows)
{
if (row.Cells["ColumnDiscipline"].Value == null ||
@ -88,7 +88,7 @@ namespace ProjectSession.Forms
{
continue;
}
list.Add(DisciplineTeachersDistribution.CreateElement(0,
list.Add(DisciplineTeachers.CreateElement(0,
Convert.ToInt32(row.Cells["ColumnDiscipline"].Value),
Convert.ToInt32(row.Cells["ColumnNumberHours"].Value)));
}

View File

@ -52,7 +52,7 @@
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(664, 450);
dataGridView.Size = new Size(1052, 494);
dataGridView.TabIndex = 3;
//
// panel1
@ -61,9 +61,9 @@
panel1.Controls.Add(buttonDell);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(664, 0);
panel1.Location = new Point(1052, 0);
panel1.Name = "panel1";
panel1.Size = new Size(136, 450);
panel1.Size = new Size(136, 494);
panel1.TabIndex = 2;
//
// buttonUpd
@ -103,7 +103,7 @@
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
ClientSize = new Size(1188, 494);
Controls.Add(dataGridView);
Controls.Add(panel1);
Name = "FormTeachers";

View File

@ -4,35 +4,15 @@ namespace ProjectSession.Repositories
{
public interface IDisciplineRepository
{
/// <summary>
/// получение
/// </summary>
/// <returns></returns>
IEnumerable<Discipline> ReadDiscipline();
/// <summary>
/// чтение по id
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Discipline ReadDisciplineById(int id);
/// <summary>
/// создание
/// </summary>
/// <param name="discipline"></param>
void CreateDiscipline(Discipline discipline);
/// <summary>
/// обновление
/// </summary>
/// <param name="discipline"></param>
void UpdateDiscipline(Discipline discipline);
/// <summary>
/// удаление
/// </summary>
/// <param name="id"></param>
void DelitDiscipline(int id);
}
}

View File

@ -1,44 +1,18 @@
using ProjectSession.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectSession.Repositories
{
public interface IGroupRepository
{
/// <summary>
/// получение
/// </summary>
/// <returns></returns>
IEnumerable<Group> ReadGroup();
/// <summary>
/// чтение по id
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Group ReadGroupById(int id);
/// <summary>
/// создание
/// </summary>
/// <param name="discipline"></param>
void CreateGroup(Group group);
/// <summary>
/// обновление
/// </summary>
/// <param name="discipline"></param>
void UpdateGroup(Group group);
/// <summary>
/// удаление
/// </summary>
/// <param name="id"></param>
void DelitGroup(int id);
}
}

View File

@ -1,17 +0,0 @@
using ProjectSession.Entities;
using ProjectSession.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectSession.Repositories
{
public interface IStudentGradeBookRepository
{
IEnumerable<StudentGradeBook> ReadStudentGradeBook(int? studentId = null, int? examId = null);
void CreateStudentGradeBook(StudentGradeBook studentGradeBook);
void DeleteStudentGradeBook(int id);
}
}

View File

@ -5,35 +5,14 @@ namespace ProjectSession.Repositories
{
public interface IStudentRepository
{
/// <summary>
/// получение
/// </summary>
/// <returns></returns>
IEnumerable<Student> ReadStudent();
/// <summary>
/// чтение по id
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Student ReadStudentById(int id);
/// <summary>
/// создание
/// </summary>
/// <param name="student"></param>
void CreateStudent(Student student);
/// <summary>
/// обновление
/// </summary>
/// <param name="student"></param>
void UpdateStudent(Student student);
/// <summary>
/// удаление
/// </summary>
/// <param name="id"></param>
void DelitStudent(int id);
}
}

View File

@ -4,35 +4,14 @@ namespace ProjectSession.Repositories
{
public interface ITeacherRepository
{
/// <summary>
/// получение
/// </summary>
/// <returns></returns>
IEnumerable<Teacher> ReadTeacher();
/// <summary>
/// чтение по id
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Teacher ReadTeacherById(int id);
/// <summary>
/// создание
/// </summary>
/// <param name="student"></param>
void CreateTeacher(Teacher teacher);
/// <summary>
/// обновление
/// </summary>
/// <param name="student"></param>
void UpdateTeacher(Teacher teacher);
/// <summary>
/// удаление
/// </summary>
/// <param name="id"></param>
void DelitTeacher(int id);
}
}

View File

@ -1,11 +0,0 @@
using ProjectSession.Entities;
namespace ProjectSession.Repositories
{
public interface ITeachersDistributionRepository
{
IEnumerable<TeachersDistribution> ReadStudentTeachersDistribution(int? teacherId = null, int? disciplineId = null);
void CreateTeachersDistribution(TeachersDistribution teachersDistribution);
void DeleteTeachersDistribution(int id);
}
}

View File

@ -6,7 +6,7 @@ namespace ProjectSession.Repositories.Implementations
{
public void CreateExam(Exam exam)
{
}
public IEnumerable<Exam> ReadExam(DateTime? dateTime = null, int? examId = null, string? name = null)

View File

@ -1,20 +0,0 @@
using ProjectSession.Entities;
namespace ProjectSession.Repositories.Implementations
{
public class StudentGradeBookRepository : IStudentGradeBookRepository
{
public void CreateStudentGradeBook(StudentGradeBook studentGradeBook)
{
}
public void DeleteStudentGradeBook(int id)
{
}
public IEnumerable<StudentGradeBook> ReadStudentGradeBook( int? studentId = null, int? examId = null)
{
return [];
}
}
}

View File

@ -23,7 +23,7 @@ namespace ProjectSession.Repositories.Implementations
public Student ReadStudentById(int id)
{
return Student.CreateEntity(0, string.Empty,string.Empty,0, StudentStatus.None, []);
return Student.CreateEntity(0, string.Empty,string.Empty,0, StudentStatus.None);
}
public void UpdateStudent(Student student)

View File

@ -1,25 +0,0 @@
using ProjectSession.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectSession.Repositories.Implementations
{
internal class TeachersDistributionRepository : ITeachersDistributionRepository
{
public void CreateTeachersDistribution(TeachersDistribution teachersDistribution)
{
}
public void DeleteTeachersDistribution(int id)
{
}
public IEnumerable<TeachersDistribution> ReadStudentTeachersDistribution(int? teacherId = null, int? disciplineId = null)
{
return [];
}
}
}