ПИбд-22. Халиуллов Р.М. Лабораторная работа №1 #1
28
ProjectShedule/ProjectShedule/Entities/Classroom.cs
Normal file
28
ProjectShedule/ProjectShedule/Entities/Classroom.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using ProjectShedule.Entities.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
|
||||||
|
namespace ProjectShedule.Entities;
|
||||||
|
|
||||||
|
public class Classroom
|
||||||
|
{
|
||||||
|
public int Id { get;private set; }
|
||||||
|
public int Size { get; private set; }
|
||||||
|
public string Name { get; private set; } = String.Empty;
|
||||||
|
public ClassType ClassType { get; private set; }
|
||||||
|
|
||||||
|
public static Classroom CreateClassroom(int id, int size, string name, ClassType classtype)
|
||||||
|
{
|
||||||
|
return new Classroom
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
Size = size,
|
||||||
|
Name = name,
|
||||||
|
ClassType = classtype
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
21
ProjectShedule/ProjectShedule/Entities/Curriculum.cs
Normal file
21
ProjectShedule/ProjectShedule/Entities/Curriculum.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Entities;
|
||||||
|
|
||||||
|
public class Curriculum
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public string Direction { get; private set; } = string.Empty;
|
||||||
|
public static Curriculum CreateCurriculum(int id, string direction)
|
||||||
|
{
|
||||||
|
return new Curriculum
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
Direction = direction,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
26
ProjectShedule/ProjectShedule/Entities/CurriculumSubject.cs
Normal file
26
ProjectShedule/ProjectShedule/Entities/CurriculumSubject.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using ProjectShedule.Entities.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Entities;
|
||||||
|
|
||||||
|
public class CurriculumSubject
|
||||||
|
{
|
||||||
|
public int CurriculumId { get; private set; }
|
||||||
|
public IEnumerable<SubjectSubject> SubjectSubject { get; private set; } = [];
|
||||||
|
public Course Course { get; private set; }
|
||||||
|
|
||||||
|
public static CurriculumSubject CreateCurriculumSubject(int curriculumId, Course course, IEnumerable<SubjectSubject> subjectSubjects)
|
||||||
|
{
|
||||||
|
return new CurriculumSubject()
|
||||||
|
{
|
||||||
|
CurriculumId = curriculumId,
|
||||||
|
Course = course,
|
||||||
|
SubjectSubject = subjectSubjects
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
14
ProjectShedule/ProjectShedule/Entities/Enums/ClassType.cs
Normal file
14
ProjectShedule/ProjectShedule/Entities/Enums/ClassType.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Entities.Enums;
|
||||||
|
|
||||||
|
public enum ClassType
|
||||||
|
{
|
||||||
|
LectureHall = 1,
|
||||||
|
|
||||||
|
ComputerClass = 2
|
||||||
|
}
|
16
ProjectShedule/ProjectShedule/Entities/Enums/Course.cs
Normal file
16
ProjectShedule/ProjectShedule/Entities/Enums/Course.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Entities.Enums;
|
||||||
|
|
||||||
|
public enum Course
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
First = 1,
|
||||||
|
Second = 2,
|
||||||
|
Third = 3,
|
||||||
|
Fourth = 4,
|
||||||
|
}
|
20
ProjectShedule/ProjectShedule/Entities/Enums/PairNumber.cs
Normal file
20
ProjectShedule/ProjectShedule/Entities/Enums/PairNumber.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Entities.Enums;
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum PairNumber
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
First = 1,
|
||||||
|
Second = 2,
|
||||||
|
Third = 4,
|
||||||
|
Fourth = 8,
|
||||||
|
Fifth = 16,
|
||||||
|
Sixth = 32,
|
||||||
|
Seveth = 64
|
||||||
|
}
|
30
ProjectShedule/ProjectShedule/Entities/Group.cs
Normal file
30
ProjectShedule/ProjectShedule/Entities/Group.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
using ProjectShedule.Entities.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Entities;
|
||||||
|
|
||||||
|
public class Group
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public int StudentsCount { get; private set; }
|
||||||
|
public string GroupNumber { get; private set; } = String.Empty;
|
||||||
|
public Course Course { get; private set; }
|
||||||
|
public int CurriculumId { get; private set; }
|
||||||
|
public static Group CreateGroup(int id, int studentsCount, string groupNumber, Course course, int curriculumId)
|
||||||
|
{
|
||||||
|
return new Group
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
StudentsCount = studentsCount,
|
||||||
|
GroupNumber = groupNumber,
|
||||||
|
Course = course,
|
||||||
|
CurriculumId = curriculumId
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
35
ProjectShedule/ProjectShedule/Entities/Shedule.cs
Normal file
35
ProjectShedule/ProjectShedule/Entities/Shedule.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
using ProjectShedule.Entities.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Entities;
|
||||||
|
|
||||||
|
public class Shedule
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public DateTime Date { get; private set; }
|
||||||
|
public PairNumber PairNumber { get; private set; }
|
||||||
|
public int GroupId { get; private set; }
|
||||||
|
public int TeacherId { get; private set; }
|
||||||
|
public int SubjectId { get; private set; }
|
||||||
|
public int ClassroomId { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
|
public static Shedule CreateOperation(int id, DateTime date, PairNumber pairNumber, int groupId, int teacherId, int subjectId, int classroomId)
|
||||||
|
{
|
||||||
|
return new Shedule
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
Date = date,
|
||||||
|
PairNumber = pairNumber,
|
||||||
|
GroupId = groupId,
|
||||||
|
TeacherId = teacherId,
|
||||||
|
SubjectId = subjectId,
|
||||||
|
ClassroomId = classroomId
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
21
ProjectShedule/ProjectShedule/Entities/Subject.cs
Normal file
21
ProjectShedule/ProjectShedule/Entities/Subject.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Entities;
|
||||||
|
|
||||||
|
public class Subject
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public string Name { get; private set; } = String.Empty;
|
||||||
|
public static Subject CreateSubject(int id, string name)
|
||||||
|
{
|
||||||
|
return new Subject
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
Name = name
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
24
ProjectShedule/ProjectShedule/Entities/SubjectSubject.cs
Normal file
24
ProjectShedule/ProjectShedule/Entities/SubjectSubject.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Entities;
|
||||||
|
|
||||||
|
public class SubjectSubject
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public int SubjectId { get; private set; }
|
||||||
|
public int LessonsCount { get; private set; }
|
||||||
|
|
||||||
|
public static SubjectSubject CreateOperation(int id, int subjectId, int lessonsCount)
|
||||||
|
{
|
||||||
|
return new SubjectSubject
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
SubjectId = subjectId,
|
||||||
|
LessonsCount = lessonsCount
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
23
ProjectShedule/ProjectShedule/Entities/Teacher.cs
Normal file
23
ProjectShedule/ProjectShedule/Entities/Teacher.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Entities;
|
||||||
|
|
||||||
|
public class Teacher
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public string FirstName { get; private set; } = string.Empty;
|
||||||
|
public string LastName { get; private set; } = string.Empty;
|
||||||
|
public static Teacher CreateTeacher(int id, string firstName, string lastName)
|
||||||
|
{
|
||||||
|
return new Teacher
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
FirstName = firstName,
|
||||||
|
LastName = lastName
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
39
ProjectShedule/ProjectShedule/Form1.Designer.cs
generated
39
ProjectShedule/ProjectShedule/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
|||||||
namespace ProjectShedule
|
|
||||||
{
|
|
||||||
partial class Form1
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.components = new System.ComponentModel.Container();
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
|
||||||
this.Text = "Form1";
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
namespace ProjectShedule
|
|
||||||
{
|
|
||||||
public partial class Form1 : Form
|
|
||||||
{
|
|
||||||
public Form1()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
156
ProjectShedule/ProjectShedule/FormSchedulingBureau.Designer.cs
generated
Normal file
156
ProjectShedule/ProjectShedule/FormSchedulingBureau.Designer.cs
generated
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
namespace ProjectShedule
|
||||||
|
{
|
||||||
|
partial class FormSchedulingBureau
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
menuStrip = new MenuStrip();
|
||||||
|
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
classroomToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
teacherToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
subjectsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
curriculumsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
studentGroupsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
операцииToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
createSheduleToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
createCurriculumToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
menuStrip.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// menuStrip
|
||||||
|
//
|
||||||
|
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||||
|
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem });
|
||||||
|
menuStrip.Location = new Point(0, 0);
|
||||||
|
menuStrip.Name = "menuStrip";
|
||||||
|
menuStrip.Size = new Size(800, 28);
|
||||||
|
menuStrip.TabIndex = 0;
|
||||||
|
menuStrip.Text = "menuStrip1";
|
||||||
|
//
|
||||||
|
// справочникиToolStripMenuItem
|
||||||
|
//
|
||||||
|
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { classroomToolStripMenuItem, teacherToolStripMenuItem, subjectsToolStripMenuItem, curriculumsToolStripMenuItem, studentGroupsToolStripMenuItem });
|
||||||
|
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||||
|
справочникиToolStripMenuItem.Size = new Size(117, 24);
|
||||||
|
справочникиToolStripMenuItem.Text = "Справочники";
|
||||||
|
//
|
||||||
|
// classroomToolStripMenuItem
|
||||||
|
//
|
||||||
|
classroomToolStripMenuItem.Name = "classroomToolStripMenuItem";
|
||||||
|
classroomToolStripMenuItem.Size = new Size(224, 26);
|
||||||
|
classroomToolStripMenuItem.Text = "Аудитории";
|
||||||
|
classroomToolStripMenuItem.Click += classroomToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// teacherToolStripMenuItem
|
||||||
|
//
|
||||||
|
teacherToolStripMenuItem.Name = "teacherToolStripMenuItem";
|
||||||
|
teacherToolStripMenuItem.Size = new Size(224, 26);
|
||||||
|
teacherToolStripMenuItem.Text = "Преподаватели";
|
||||||
|
teacherToolStripMenuItem.Click += teacherToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// subjectsToolStripMenuItem
|
||||||
|
//
|
||||||
|
subjectsToolStripMenuItem.Name = "subjectsToolStripMenuItem";
|
||||||
|
subjectsToolStripMenuItem.Size = new Size(224, 26);
|
||||||
|
subjectsToolStripMenuItem.Text = "Дисциплины";
|
||||||
|
subjectsToolStripMenuItem.Click += subjectsToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// curriculumsToolStripMenuItem
|
||||||
|
//
|
||||||
|
curriculumsToolStripMenuItem.Name = "curriculumsToolStripMenuItem";
|
||||||
|
curriculumsToolStripMenuItem.Size = new Size(224, 26);
|
||||||
|
curriculumsToolStripMenuItem.Text = "Учебные планы";
|
||||||
|
curriculumsToolStripMenuItem.Click += curriculumsToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// studentGroupsToolStripMenuItem
|
||||||
|
//
|
||||||
|
studentGroupsToolStripMenuItem.Name = "studentGroupsToolStripMenuItem";
|
||||||
|
studentGroupsToolStripMenuItem.Size = new Size(224, 26);
|
||||||
|
studentGroupsToolStripMenuItem.Text = "Группы студентов";
|
||||||
|
studentGroupsToolStripMenuItem.Click += studentGroupsToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// операцииToolStripMenuItem
|
||||||
|
//
|
||||||
|
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { createSheduleToolStripMenuItem, createCurriculumToolStripMenuItem });
|
||||||
|
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
|
||||||
|
операцииToolStripMenuItem.Size = new Size(95, 24);
|
||||||
|
операцииToolStripMenuItem.Text = "Операции";
|
||||||
|
//
|
||||||
|
// createSheduleToolStripMenuItem
|
||||||
|
//
|
||||||
|
createSheduleToolStripMenuItem.Name = "createSheduleToolStripMenuItem";
|
||||||
|
createSheduleToolStripMenuItem.Size = new Size(296, 26);
|
||||||
|
createSheduleToolStripMenuItem.Text = "Составление расписания";
|
||||||
|
createSheduleToolStripMenuItem.Click += createSheduleToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// createCurriculumToolStripMenuItem
|
||||||
|
//
|
||||||
|
createCurriculumToolStripMenuItem.Name = "createCurriculumToolStripMenuItem";
|
||||||
|
createCurriculumToolStripMenuItem.Size = new Size(296, 26);
|
||||||
|
createCurriculumToolStripMenuItem.Text = "Составление учебного плана";
|
||||||
|
createCurriculumToolStripMenuItem.Click += createCurriculumToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// отчетыToolStripMenuItem
|
||||||
|
//
|
||||||
|
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||||
|
отчетыToolStripMenuItem.Size = new Size(73, 24);
|
||||||
|
отчетыToolStripMenuItem.Text = "Отчеты";
|
||||||
|
//
|
||||||
|
// FormSchedulingBureau
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BackgroundImage = Properties.Resources.back;
|
||||||
|
BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(menuStrip);
|
||||||
|
MainMenuStrip = menuStrip;
|
||||||
|
Name = "FormSchedulingBureau";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "Бюро составления расписаний";
|
||||||
|
menuStrip.ResumeLayout(false);
|
||||||
|
menuStrip.PerformLayout();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private MenuStrip menuStrip;
|
||||||
|
private ToolStripMenuItem справочникиToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem classroomToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem teacherToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem subjectsToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem curriculumsToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem studentGroupsToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem операцииToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem createSheduleToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem отчетыToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem createCurriculumToolStripMenuItem;
|
||||||
|
}
|
||||||
|
}
|
108
ProjectShedule/ProjectShedule/FormSchedulingBureau.cs
Normal file
108
ProjectShedule/ProjectShedule/FormSchedulingBureau.cs
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
using ProjectShedule.Forms;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace ProjectShedule
|
||||||
|
{
|
||||||
|
public partial class FormSchedulingBureau : Form
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
public FormSchedulingBureau(IUnityContainer container)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void classroomToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormClassrooms>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void teacherToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormTeachers>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void subjectsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormSubjects>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void curriculumsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormCurriculums>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void studentGroupsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormGroups>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createSheduleToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormShedules>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createCurriculumToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormCurriculumSubjects>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
123
ProjectShedule/ProjectShedule/FormSchedulingBureau.resx
Normal file
123
ProjectShedule/ProjectShedule/FormSchedulingBureau.resx
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
146
ProjectShedule/ProjectShedule/Forms/FormClassroom.Designer.cs
generated
Normal file
146
ProjectShedule/ProjectShedule/Forms/FormClassroom.Designer.cs
generated
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
partial class FormClassroom
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
label1 = new Label();
|
||||||
|
numericUpDownClassroomSize = new NumericUpDown();
|
||||||
|
label2 = new Label();
|
||||||
|
textBoxClassroomNumber = new TextBox();
|
||||||
|
label3 = new Label();
|
||||||
|
comboBoxTypeClassroom = new ComboBox();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownClassroomSize).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Location = new Point(47, 63);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(103, 20);
|
||||||
|
label1.TabIndex = 0;
|
||||||
|
label1.Text = "Вместимость:";
|
||||||
|
//
|
||||||
|
// numericUpDownClassroomSize
|
||||||
|
//
|
||||||
|
numericUpDownClassroomSize.Location = new Point(219, 56);
|
||||||
|
numericUpDownClassroomSize.Name = "numericUpDownClassroomSize";
|
||||||
|
numericUpDownClassroomSize.Size = new Size(150, 27);
|
||||||
|
numericUpDownClassroomSize.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new Point(47, 109);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(138, 20);
|
||||||
|
label2.TabIndex = 2;
|
||||||
|
label2.Text = "Номер аудитории:";
|
||||||
|
//
|
||||||
|
// textBoxClassroomNumber
|
||||||
|
//
|
||||||
|
textBoxClassroomNumber.Location = new Point(219, 102);
|
||||||
|
textBoxClassroomNumber.Name = "textBoxClassroomNumber";
|
||||||
|
textBoxClassroomNumber.Size = new Size(150, 27);
|
||||||
|
textBoxClassroomNumber.TabIndex = 3;
|
||||||
|
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
label3.AutoSize = true;
|
||||||
|
label3.Location = new Point(47, 149);
|
||||||
|
label3.Name = "label3";
|
||||||
|
label3.Size = new Size(116, 20);
|
||||||
|
label3.TabIndex = 4;
|
||||||
|
label3.Text = "Тип аудитории:";
|
||||||
|
//
|
||||||
|
// comboBoxTypeClassroom
|
||||||
|
//
|
||||||
|
comboBoxTypeClassroom.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxTypeClassroom.FormattingEnabled = true;
|
||||||
|
comboBoxTypeClassroom.Location = new Point(219, 141);
|
||||||
|
comboBoxTypeClassroom.Name = "comboBoxTypeClassroom";
|
||||||
|
comboBoxTypeClassroom.Size = new Size(151, 28);
|
||||||
|
comboBoxTypeClassroom.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(119, 206);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(94, 29);
|
||||||
|
buttonSave.TabIndex = 6;
|
||||||
|
buttonSave.Text = "Создать";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += buttonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(219, 206);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(94, 29);
|
||||||
|
buttonCancel.TabIndex = 7;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += buttonCancel_Click;
|
||||||
|
//
|
||||||
|
// FormClassroom
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BackColor = SystemColors.Menu;
|
||||||
|
BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ClientSize = new Size(428, 276);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(comboBoxTypeClassroom);
|
||||||
|
Controls.Add(label3);
|
||||||
|
Controls.Add(textBoxClassroomNumber);
|
||||||
|
Controls.Add(label2);
|
||||||
|
Controls.Add(numericUpDownClassroomSize);
|
||||||
|
Controls.Add(label1);
|
||||||
|
Name = "FormClassroom";
|
||||||
|
Text = "Аудитория";
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownClassroomSize).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label label1;
|
||||||
|
private NumericUpDown numericUpDownClassroomSize;
|
||||||
|
private Label label2;
|
||||||
|
private TextBox textBoxClassroomNumber;
|
||||||
|
private Label label3;
|
||||||
|
private ComboBox comboBoxTypeClassroom;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonCancel;
|
||||||
|
}
|
||||||
|
}
|
83
ProjectShedule/ProjectShedule/Forms/FormClassroom.cs
Normal file
83
ProjectShedule/ProjectShedule/Forms/FormClassroom.cs
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
using ProjectShedule.Entities;
|
||||||
|
using ProjectShedule.Entities.Enums;
|
||||||
|
using ProjectShedule.Repositories;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
public partial class FormClassroom : Form
|
||||||
|
{
|
||||||
|
private readonly IClassroomRepository _classroomRepository;
|
||||||
|
private int? _classroomId;
|
||||||
|
|
||||||
|
public int Id
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var classroom = _classroomRepository.ReadClassroomById(value);
|
||||||
|
if (classroom == null)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException(nameof(classroom));
|
||||||
|
}
|
||||||
|
numericUpDownClassroomSize.Value = classroom.Size;
|
||||||
|
textBoxClassroomNumber.Text = classroom.Name;
|
||||||
|
comboBoxTypeClassroom.SelectedItem = classroom.ClassType;
|
||||||
|
_classroomId = value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public FormClassroom(IClassroomRepository classroomRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_classroomRepository = classroomRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(classroomRepository));
|
||||||
|
comboBoxTypeClassroom.DataSource = Enum.GetValues(typeof(ClassType));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(textBoxClassroomNumber.Text) || comboBoxTypeClassroom.SelectedIndex < 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
if (_classroomId.HasValue)
|
||||||
|
{
|
||||||
|
_classroomRepository.UpdateClassroom(CreateClassroom(_classroomId.Value));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_classroomRepository.UpdateClassroom(CreateClassroom(0));
|
||||||
|
}
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
private Classroom CreateClassroom(int id) => Classroom.CreateClassroom(
|
||||||
|
id,
|
||||||
|
Convert.ToInt32(numericUpDownClassroomSize.Value),
|
||||||
|
textBoxClassroomNumber.Text,
|
||||||
|
(ClassType)comboBoxTypeClassroom.SelectedItem!);
|
||||||
|
}
|
||||||
|
}
|
@ -1,17 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
The primary goals of this format is to allow a simple XML format
|
||||||
that is mostly human readable. The generation and parsing of the
|
that is mostly human readable. The generation and parsing of the
|
||||||
various data types are done through the TypeConverter classes
|
various data types are done through the TypeConverter classes
|
||||||
associated with the data types.
|
associated with the data types.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
... ado.net/XML headers & schema ...
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
<resheader name="version">2.0</resheader>
|
<resheader name="version">2.0</resheader>
|
||||||
@ -26,36 +26,36 @@
|
|||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
<comment>This is a comment</comment>
|
<comment>This is a comment</comment>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
There are any number of "resheader" rows that contain simple
|
||||||
name/value pairs.
|
name/value pairs.
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
Each data row contains a name, and value. The row also contains a
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
text/value conversion through the TypeConverter architecture.
|
text/value conversion through the TypeConverter architecture.
|
||||||
Classes that don't support this are serialized and stored with the
|
Classes that don't support this are serialized and stored with the
|
||||||
mimetype set.
|
mimetype set.
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
The mimetype is used for serialized objects, and tells the
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
read any of the formats listed below.
|
read any of the formats listed below.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
value : The object must be serialized into a byte array
|
value : The object must be serialized into a byte array
|
||||||
: using a System.ComponentModel.TypeConverter
|
: using a System.ComponentModel.TypeConverter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
-->
|
-->
|
128
ProjectShedule/ProjectShedule/Forms/FormClassrooms.Designer.cs
generated
Normal file
128
ProjectShedule/ProjectShedule/Forms/FormClassrooms.Designer.cs
generated
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
partial class FormClassrooms
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
panel1 = new Panel();
|
||||||
|
buttonDel = new Button();
|
||||||
|
buttonUpd = new Button();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonDel);
|
||||||
|
panel1.Controls.Add(buttonUpd);
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(663, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(178, 353);
|
||||||
|
panel1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// buttonDel
|
||||||
|
//
|
||||||
|
buttonDel.BackgroundImage = Properties.Resources.minus_PNG39;
|
||||||
|
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonDel.Location = new Point(42, 248);
|
||||||
|
buttonDel.Name = "buttonDel";
|
||||||
|
buttonDel.Size = new Size(94, 93);
|
||||||
|
buttonDel.TabIndex = 2;
|
||||||
|
buttonDel.UseVisualStyleBackColor = true;
|
||||||
|
buttonDel.Click += buttonDel_Click;
|
||||||
|
//
|
||||||
|
// buttonUpd
|
||||||
|
//
|
||||||
|
buttonUpd.BackgroundImage = Properties.Resources._3712684;
|
||||||
|
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonUpd.Location = new Point(42, 129);
|
||||||
|
buttonUpd.Name = "buttonUpd";
|
||||||
|
buttonUpd.Size = new Size(94, 93);
|
||||||
|
buttonUpd.TabIndex = 1;
|
||||||
|
buttonUpd.UseVisualStyleBackColor = true;
|
||||||
|
buttonUpd.Click += buttonUpd_Click;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = Properties.Resources.Ambox_plus_svg;
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonAdd.Location = new Point(42, 12);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(94, 93);
|
||||||
|
buttonAdd.TabIndex = 0;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
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.RowHeadersWidth = 51;
|
||||||
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridView.Size = new Size(663, 353);
|
||||||
|
dataGridView.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// FormClassrooms
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(841, 353);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "FormClassrooms";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "Аудитории";
|
||||||
|
Load += FormClassrooms_Load;
|
||||||
|
Click += FormClassrooms_Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private Button buttonDel;
|
||||||
|
private Button buttonUpd;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
}
|
||||||
|
}
|
99
ProjectShedule/ProjectShedule/Forms/FormClassrooms.cs
Normal file
99
ProjectShedule/ProjectShedule/Forms/FormClassrooms.cs
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
using ProjectShedule.Repositories;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
public partial class FormClassrooms : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
private readonly IClassroomRepository _classroomRepository;
|
||||||
|
public FormClassrooms(IUnityContainer container, IClassroomRepository classroomRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ??
|
||||||
|
throw new ArgumentNullException(nameof(container));
|
||||||
|
_classroomRepository = classroomRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(classroomRepository));
|
||||||
|
}
|
||||||
|
private void FormClassrooms_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormClassroom>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonUpd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var form = _container.Resolve<FormClassroom>();
|
||||||
|
form.Id = findId;
|
||||||
|
form.ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonDel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_classroomRepository.DeleteClassroom(findId);
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void LoadList() => dataGridView.DataSource = _classroomRepository.ReadClassroom();
|
||||||
|
|
||||||
|
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||||
|
{
|
||||||
|
id = 0;
|
||||||
|
if (dataGridView.SelectedRows.Count < 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[id].Value);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
ProjectShedule/ProjectShedule/Forms/FormClassrooms.resx
Normal file
120
ProjectShedule/ProjectShedule/Forms/FormClassrooms.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
95
ProjectShedule/ProjectShedule/Forms/FormCurriculum.Designer.cs
generated
Normal file
95
ProjectShedule/ProjectShedule/Forms/FormCurriculum.Designer.cs
generated
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
partial class FormCurriculum
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
buttonCancel = new Button();
|
||||||
|
buttonSave = new Button();
|
||||||
|
label2 = new Label();
|
||||||
|
textBoxCurriculumName = new TextBox();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(239, 104);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(94, 29);
|
||||||
|
buttonCancel.TabIndex = 15;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += buttonCancel_Click;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(117, 104);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(94, 29);
|
||||||
|
buttonSave.TabIndex = 14;
|
||||||
|
buttonSave.Text = "Создать";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += buttonSave_Click;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new Point(34, 54);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(177, 20);
|
||||||
|
label2.TabIndex = 10;
|
||||||
|
label2.Text = "Название направления:";
|
||||||
|
//
|
||||||
|
// textBoxCurriculumName
|
||||||
|
//
|
||||||
|
textBoxCurriculumName.Location = new Point(239, 51);
|
||||||
|
textBoxCurriculumName.Name = "textBoxCurriculumName";
|
||||||
|
textBoxCurriculumName.Size = new Size(150, 27);
|
||||||
|
textBoxCurriculumName.TabIndex = 11;
|
||||||
|
//
|
||||||
|
// FormCurriculum
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(441, 167);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(textBoxCurriculumName);
|
||||||
|
Controls.Add(label2);
|
||||||
|
Name = "FormCurriculum";
|
||||||
|
Text = "Учебный план(дисциплина)";
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Label label2;
|
||||||
|
private TextBox textBoxCurriculumName;
|
||||||
|
}
|
||||||
|
}
|
67
ProjectShedule/ProjectShedule/Forms/FormCurriculum.cs
Normal file
67
ProjectShedule/ProjectShedule/Forms/FormCurriculum.cs
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
using ProjectShedule.Entities;
|
||||||
|
using ProjectShedule.Repositories;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
public partial class FormCurriculum : Form
|
||||||
|
{
|
||||||
|
private readonly ICurriculumRepository _curriculumRepository;
|
||||||
|
private int? _curriculumId;
|
||||||
|
public int Id
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var curriculum = _curriculumRepository.ReadCurriculumById(value);
|
||||||
|
if (curriculum == null)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException(nameof(curriculum));
|
||||||
|
}
|
||||||
|
textBoxCurriculumName.Text = curriculum.Direction;
|
||||||
|
_curriculumId = value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public FormCurriculum(ICurriculumRepository curriculumRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_curriculumRepository = curriculumRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(curriculumRepository));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(textBoxCurriculumName.Text))
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
if (_curriculumId.HasValue)
|
||||||
|
{
|
||||||
|
_curriculumRepository.UpdateCurriculum(CreateCurriculum(_curriculumId.Value));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_curriculumRepository.UpdateCurriculum(CreateCurriculum(0));
|
||||||
|
}
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
private Curriculum CreateCurriculum(int id) => Curriculum.CreateCurriculum(
|
||||||
|
id,
|
||||||
|
textBoxCurriculumName.Text);
|
||||||
|
}
|
||||||
|
}
|
120
ProjectShedule/ProjectShedule/Forms/FormCurriculum.resx
Normal file
120
ProjectShedule/ProjectShedule/Forms/FormCurriculum.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
211
ProjectShedule/ProjectShedule/Forms/FormCurriculumSubject.Designer.cs
generated
Normal file
211
ProjectShedule/ProjectShedule/Forms/FormCurriculumSubject.Designer.cs
generated
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
partial class FormCurriculumSubject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
buttonCancel = new Button();
|
||||||
|
buttonSave = new Button();
|
||||||
|
label4 = new Label();
|
||||||
|
label1 = new Label();
|
||||||
|
comboBoxDirection = new ComboBox();
|
||||||
|
comboBoxCourse = new ComboBox();
|
||||||
|
groupBoxCurriculum = new GroupBox();
|
||||||
|
dataGridViewCur = new DataGridView();
|
||||||
|
Column1 = new DataGridViewComboBoxColumn();
|
||||||
|
Column2 = new DataGridViewTextBoxColumn();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
ColumnSubject = new DataGridViewComboBoxColumn();
|
||||||
|
ColumnLessons = new DataGridViewTextBoxColumn();
|
||||||
|
groupBoxCurriculum.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewCur).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(200, 465);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(94, 29);
|
||||||
|
buttonCancel.TabIndex = 19;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += buttonCancel_Click;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(91, 465);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(94, 29);
|
||||||
|
buttonSave.TabIndex = 18;
|
||||||
|
buttonSave.Text = "Создать";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += buttonSave_Click;
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
label4.AutoSize = true;
|
||||||
|
label4.Location = new Point(115, 96);
|
||||||
|
label4.Name = "label4";
|
||||||
|
label4.Size = new Size(44, 20);
|
||||||
|
label4.TabIndex = 16;
|
||||||
|
label4.Text = "Курс:";
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Location = new Point(52, 44);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(107, 20);
|
||||||
|
label1.TabIndex = 11;
|
||||||
|
label1.Text = "Направление:";
|
||||||
|
//
|
||||||
|
// comboBoxDirection
|
||||||
|
//
|
||||||
|
comboBoxDirection.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxDirection.FormattingEnabled = true;
|
||||||
|
comboBoxDirection.Location = new Point(165, 36);
|
||||||
|
comboBoxDirection.Name = "comboBoxDirection";
|
||||||
|
comboBoxDirection.Size = new Size(150, 28);
|
||||||
|
comboBoxDirection.TabIndex = 10;
|
||||||
|
//
|
||||||
|
// comboBoxCourse
|
||||||
|
//
|
||||||
|
comboBoxCourse.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxCourse.FormattingEnabled = true;
|
||||||
|
comboBoxCourse.Location = new Point(165, 93);
|
||||||
|
comboBoxCourse.Name = "comboBoxCourse";
|
||||||
|
comboBoxCourse.Size = new Size(150, 28);
|
||||||
|
comboBoxCourse.TabIndex = 20;
|
||||||
|
//
|
||||||
|
// groupBoxCurriculum
|
||||||
|
//
|
||||||
|
groupBoxCurriculum.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
groupBoxCurriculum.Controls.Add(dataGridView);
|
||||||
|
groupBoxCurriculum.Controls.Add(dataGridViewCur);
|
||||||
|
groupBoxCurriculum.Location = new Point(12, 144);
|
||||||
|
groupBoxCurriculum.Name = "groupBoxCurriculum";
|
||||||
|
groupBoxCurriculum.Size = new Size(360, 315);
|
||||||
|
groupBoxCurriculum.TabIndex = 21;
|
||||||
|
groupBoxCurriculum.TabStop = false;
|
||||||
|
groupBoxCurriculum.Text = "Учбеный план";
|
||||||
|
//
|
||||||
|
// dataGridViewCur
|
||||||
|
//
|
||||||
|
dataGridViewCur.AllowUserToResizeColumns = false;
|
||||||
|
dataGridViewCur.AllowUserToResizeRows = false;
|
||||||
|
dataGridViewCur.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridViewCur.Columns.AddRange(new DataGridViewColumn[] { Column1, Column2 });
|
||||||
|
dataGridViewCur.Dock = DockStyle.Fill;
|
||||||
|
dataGridViewCur.Location = new Point(3, 23);
|
||||||
|
dataGridViewCur.Name = "dataGridViewCur";
|
||||||
|
dataGridViewCur.RowHeadersWidth = 51;
|
||||||
|
dataGridViewCur.Size = new Size(354, 289);
|
||||||
|
dataGridViewCur.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// Column1
|
||||||
|
//
|
||||||
|
Column1.HeaderText = "Column1";
|
||||||
|
Column1.MinimumWidth = 6;
|
||||||
|
Column1.Name = "Column1";
|
||||||
|
Column1.Width = 125;
|
||||||
|
//
|
||||||
|
// Column2
|
||||||
|
//
|
||||||
|
Column2.HeaderText = "Column2";
|
||||||
|
Column2.MinimumWidth = 6;
|
||||||
|
Column2.Name = "Column2";
|
||||||
|
Column2.Width = 125;
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.AllowUserToResizeColumns = false;
|
||||||
|
dataGridView.AllowUserToResizeRows = false;
|
||||||
|
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnSubject, ColumnLessons });
|
||||||
|
dataGridView.Dock = DockStyle.Fill;
|
||||||
|
dataGridView.Location = new Point(3, 23);
|
||||||
|
dataGridView.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
dataGridView.MultiSelect = false;
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.RowHeadersVisible = false;
|
||||||
|
dataGridView.RowHeadersWidth = 51;
|
||||||
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridView.Size = new Size(354, 289);
|
||||||
|
dataGridView.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// ColumnSubject
|
||||||
|
//
|
||||||
|
ColumnSubject.HeaderText = "Дисциплина";
|
||||||
|
ColumnSubject.MinimumWidth = 6;
|
||||||
|
ColumnSubject.Name = "ColumnSubject";
|
||||||
|
//
|
||||||
|
// ColumnLessons
|
||||||
|
//
|
||||||
|
ColumnLessons.HeaderText = "Кол-во занятий";
|
||||||
|
ColumnLessons.MinimumWidth = 6;
|
||||||
|
ColumnLessons.Name = "ColumnLessons";
|
||||||
|
//
|
||||||
|
// FormCurriculumSubject
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(384, 522);
|
||||||
|
Controls.Add(groupBoxCurriculum);
|
||||||
|
Controls.Add(comboBoxCourse);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(label4);
|
||||||
|
Controls.Add(label1);
|
||||||
|
Controls.Add(comboBoxDirection);
|
||||||
|
Name = "FormCurriculumSubject";
|
||||||
|
Text = "Составление учебного плана";
|
||||||
|
groupBoxCurriculum.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewCur).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Label label4;
|
||||||
|
private Label label1;
|
||||||
|
private ComboBox comboBoxDirection;
|
||||||
|
private ComboBox comboBoxCourse;
|
||||||
|
private GroupBox groupBoxCurriculum;
|
||||||
|
private DataGridView dataGridViewCur;
|
||||||
|
private DataGridViewComboBoxColumn Column1;
|
||||||
|
private DataGridViewTextBoxColumn Column2;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private DataGridViewComboBoxColumn ColumnSubject;
|
||||||
|
private DataGridViewTextBoxColumn ColumnLessons;
|
||||||
|
}
|
||||||
|
}
|
72
ProjectShedule/ProjectShedule/Forms/FormCurriculumSubject.cs
Normal file
72
ProjectShedule/ProjectShedule/Forms/FormCurriculumSubject.cs
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
using ProjectShedule.Entities;
|
||||||
|
using ProjectShedule.Entities.Enums;
|
||||||
|
using ProjectShedule.Repositories;
|
||||||
|
|
||||||
|
|
||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
public partial class FormCurriculumSubject : Form
|
||||||
|
{
|
||||||
|
private readonly ICurriculumSubjectRepository _curriculumSubjectRepository;
|
||||||
|
public FormCurriculumSubject(ICurriculumSubjectRepository curriculumSubjectRepository,
|
||||||
|
ICurriculumRepository curriculumRepository,
|
||||||
|
ISubjectRepository subjectRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_curriculumSubjectRepository = curriculumSubjectRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(curriculumSubjectRepository));
|
||||||
|
|
||||||
|
comboBoxDirection.DataSource = curriculumRepository.ReadCurriculum();
|
||||||
|
comboBoxDirection.DisplayMember = "Direction";
|
||||||
|
comboBoxDirection.ValueMember = "Id";
|
||||||
|
|
||||||
|
comboBoxCourse.DataSource = Enum.GetValues(typeof(Course));
|
||||||
|
|
||||||
|
ColumnSubject.DataSource = subjectRepository.ReadSubject();
|
||||||
|
ColumnSubject.DisplayMember = "Name";
|
||||||
|
ColumnSubject.ValueMember = "Id";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (comboBoxDirection.SelectedIndex < 0 ||
|
||||||
|
comboBoxCourse.SelectedIndex < 0 || dataGridView.RowCount < 1)
|
||||||
|
{
|
||||||
|
throw new Exception("Есть незаполненные поля");
|
||||||
|
}
|
||||||
|
_curriculumSubjectRepository.CreateCurriculumSubject(CurriculumSubject.CreateCurriculumSubject(
|
||||||
|
(int)comboBoxDirection.SelectedValue!,
|
||||||
|
(Course)comboBoxCourse.SelectedItem!, CreateListSubjectSubjectFromDataGrid()));
|
||||||
|
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
private List<SubjectSubject> CreateListSubjectSubjectFromDataGrid()
|
||||||
|
{
|
||||||
|
var list = new List<SubjectSubject>();
|
||||||
|
foreach (DataGridViewRow row in dataGridView.Rows)
|
||||||
|
{
|
||||||
|
if (row.Cells["ColumnSubject"].Value == null ||
|
||||||
|
row.Cells["ColumnLessons"].Value == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
list.Add(SubjectSubject.CreateOperation(
|
||||||
|
0,
|
||||||
|
Convert.ToInt32(row.Cells["ColumnSubject"].Value),
|
||||||
|
Convert.ToInt32(row.Cells["ColumnLessons"].Value)));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
132
ProjectShedule/ProjectShedule/Forms/FormCurriculumSubject.resx
Normal file
132
ProjectShedule/ProjectShedule/Forms/FormCurriculumSubject.resx
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="ColumnSubject.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="ColumnLessons.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
98
ProjectShedule/ProjectShedule/Forms/FormCurriculumSubjects.Designer.cs
generated
Normal file
98
ProjectShedule/ProjectShedule/Forms/FormCurriculumSubjects.Designer.cs
generated
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
partial class FormCurriculumSubjects
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
panel1 = new Panel();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(622, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(178, 352);
|
||||||
|
panel1.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = Properties.Resources.Ambox_plus_svg;
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonAdd.Location = new Point(42, 125);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(94, 93);
|
||||||
|
buttonAdd.TabIndex = 0;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
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.RowHeadersWidth = 51;
|
||||||
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridView.Size = new Size(800, 352);
|
||||||
|
dataGridView.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// FormCurriculumSubjects
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 352);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Name = "FormCurriculumSubjects";
|
||||||
|
Text = "FormCurriculumSubjects";
|
||||||
|
Load += FormCurriculumSubjects_Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
using ProjectShedule.Repositories;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
public partial class FormCurriculumSubjects : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
private readonly ICurriculumSubjectRepository _curriculumSubjectRepository;
|
||||||
|
public FormCurriculumSubjects(IUnityContainer container, ICurriculumSubjectRepository curriculumSubjectRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ??
|
||||||
|
throw new ArgumentNullException(nameof(container));
|
||||||
|
_curriculumSubjectRepository = curriculumSubjectRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(curriculumSubjectRepository));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormCurriculumSubjects_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormCurriculumSubject>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void LoadList() => dataGridView.DataSource = _curriculumSubjectRepository.ReadCurriculumSubject();
|
||||||
|
}
|
||||||
|
}
|
120
ProjectShedule/ProjectShedule/Forms/FormCurriculumSubjects.resx
Normal file
120
ProjectShedule/ProjectShedule/Forms/FormCurriculumSubjects.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
126
ProjectShedule/ProjectShedule/Forms/FormCurriculums.Designer.cs
generated
Normal file
126
ProjectShedule/ProjectShedule/Forms/FormCurriculums.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
partial class FormCurriculums
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
panel1 = new Panel();
|
||||||
|
buttonDel = new Button();
|
||||||
|
buttonUpd = new Button();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonDel);
|
||||||
|
panel1.Controls.Add(buttonUpd);
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(622, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(178, 353);
|
||||||
|
panel1.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// buttonDel
|
||||||
|
//
|
||||||
|
buttonDel.BackgroundImage = Properties.Resources.minus_PNG39;
|
||||||
|
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonDel.Location = new Point(42, 248);
|
||||||
|
buttonDel.Name = "buttonDel";
|
||||||
|
buttonDel.Size = new Size(94, 93);
|
||||||
|
buttonDel.TabIndex = 2;
|
||||||
|
buttonDel.UseVisualStyleBackColor = true;
|
||||||
|
buttonDel.Click += buttonDel_Click;
|
||||||
|
//
|
||||||
|
// buttonUpd
|
||||||
|
//
|
||||||
|
buttonUpd.BackgroundImage = Properties.Resources._3712684;
|
||||||
|
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonUpd.Location = new Point(42, 129);
|
||||||
|
buttonUpd.Name = "buttonUpd";
|
||||||
|
buttonUpd.Size = new Size(94, 93);
|
||||||
|
buttonUpd.TabIndex = 1;
|
||||||
|
buttonUpd.UseVisualStyleBackColor = true;
|
||||||
|
buttonUpd.Click += buttonUpd_Click;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = Properties.Resources.Ambox_plus_svg;
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonAdd.Location = new Point(42, 12);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(94, 93);
|
||||||
|
buttonAdd.TabIndex = 0;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
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.RowHeadersWidth = 51;
|
||||||
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridView.Size = new Size(800, 353);
|
||||||
|
dataGridView.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// FormCurriculums
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 353);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Name = "FormCurriculums";
|
||||||
|
Text = "Учебные планы(дисциплины)";
|
||||||
|
Load += FormCurriculums_Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private Button buttonDel;
|
||||||
|
private Button buttonUpd;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
}
|
||||||
|
}
|
109
ProjectShedule/ProjectShedule/Forms/FormCurriculums.cs
Normal file
109
ProjectShedule/ProjectShedule/Forms/FormCurriculums.cs
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
using ProjectShedule.Repositories;
|
||||||
|
using ProjectShedule.Repositories.Implementations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
public partial class FormCurriculums : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
private readonly ICurriculumRepository _curriculumRepository;
|
||||||
|
public FormCurriculums(IUnityContainer container, ICurriculumRepository curriculumRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ??
|
||||||
|
throw new ArgumentNullException(nameof(container));
|
||||||
|
_curriculumRepository = curriculumRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(curriculumRepository));
|
||||||
|
}
|
||||||
|
private void FormCurriculums_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormCurriculum>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonUpd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var form = _container.Resolve<FormCurriculum>();
|
||||||
|
form.Id = findId;
|
||||||
|
form.ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonDel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_curriculumRepository.DeleteCurriculum(findId);
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void LoadList() => dataGridView.DataSource = _curriculumRepository.ReadCurriculum();
|
||||||
|
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||||
|
{
|
||||||
|
id = 0;
|
||||||
|
if (dataGridView.SelectedRows.Count < 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[id].Value);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
ProjectShedule/ProjectShedule/Forms/FormCurriculums.resx
Normal file
120
ProjectShedule/ProjectShedule/Forms/FormCurriculums.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
167
ProjectShedule/ProjectShedule/Forms/FormGroup.Designer.cs
generated
Normal file
167
ProjectShedule/ProjectShedule/Forms/FormGroup.Designer.cs
generated
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
partial class FormGroup
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
comboBoxCourse = new ComboBox();
|
||||||
|
label1 = new Label();
|
||||||
|
label2 = new Label();
|
||||||
|
numericUpDownStudentsCount = new NumericUpDown();
|
||||||
|
label3 = new Label();
|
||||||
|
textBoxGroupName = new TextBox();
|
||||||
|
label4 = new Label();
|
||||||
|
comboBoxCurriculum = new ComboBox();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownStudentsCount).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// comboBoxCourse
|
||||||
|
//
|
||||||
|
comboBoxCourse.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxCourse.FormattingEnabled = true;
|
||||||
|
comboBoxCourse.Location = new Point(179, 142);
|
||||||
|
comboBoxCourse.Name = "comboBoxCourse";
|
||||||
|
comboBoxCourse.Size = new Size(150, 28);
|
||||||
|
comboBoxCourse.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Location = new Point(40, 42);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(133, 20);
|
||||||
|
label1.TabIndex = 1;
|
||||||
|
label1.Text = "Кол-во студентов:";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new Point(40, 98);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(135, 20);
|
||||||
|
label2.TabIndex = 2;
|
||||||
|
label2.Text = "Название группы:";
|
||||||
|
//
|
||||||
|
// numericUpDownStudentsCount
|
||||||
|
//
|
||||||
|
numericUpDownStudentsCount.Location = new Point(179, 35);
|
||||||
|
numericUpDownStudentsCount.Name = "numericUpDownStudentsCount";
|
||||||
|
numericUpDownStudentsCount.Size = new Size(150, 27);
|
||||||
|
numericUpDownStudentsCount.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
label3.AutoSize = true;
|
||||||
|
label3.Location = new Point(129, 150);
|
||||||
|
label3.Name = "label3";
|
||||||
|
label3.Size = new Size(44, 20);
|
||||||
|
label3.TabIndex = 4;
|
||||||
|
label3.Text = "Курс:";
|
||||||
|
//
|
||||||
|
// textBoxGroupName
|
||||||
|
//
|
||||||
|
textBoxGroupName.Location = new Point(179, 91);
|
||||||
|
textBoxGroupName.Name = "textBoxGroupName";
|
||||||
|
textBoxGroupName.Size = new Size(150, 27);
|
||||||
|
textBoxGroupName.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
label4.AutoSize = true;
|
||||||
|
label4.Location = new Point(60, 202);
|
||||||
|
label4.Name = "label4";
|
||||||
|
label4.Size = new Size(113, 20);
|
||||||
|
label4.TabIndex = 6;
|
||||||
|
label4.Text = "Учебный план:";
|
||||||
|
//
|
||||||
|
// comboBoxCurriculum
|
||||||
|
//
|
||||||
|
comboBoxCurriculum.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxCurriculum.FormattingEnabled = true;
|
||||||
|
comboBoxCurriculum.Location = new Point(179, 194);
|
||||||
|
comboBoxCurriculum.Name = "comboBoxCurriculum";
|
||||||
|
comboBoxCurriculum.Size = new Size(150, 28);
|
||||||
|
comboBoxCurriculum.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(97, 250);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(94, 29);
|
||||||
|
buttonSave.TabIndex = 8;
|
||||||
|
buttonSave.Text = "Создать";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += buttonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(206, 250);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(94, 29);
|
||||||
|
buttonCancel.TabIndex = 9;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += buttonCancel_Click;
|
||||||
|
//
|
||||||
|
// FormGroup
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(397, 313);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(comboBoxCurriculum);
|
||||||
|
Controls.Add(label4);
|
||||||
|
Controls.Add(textBoxGroupName);
|
||||||
|
Controls.Add(label3);
|
||||||
|
Controls.Add(numericUpDownStudentsCount);
|
||||||
|
Controls.Add(label2);
|
||||||
|
Controls.Add(label1);
|
||||||
|
Controls.Add(comboBoxCourse);
|
||||||
|
Name = "FormGroup";
|
||||||
|
Text = "Группа студентов";
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownStudentsCount).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private ComboBox comboBoxCourse;
|
||||||
|
private Label label1;
|
||||||
|
private Label label2;
|
||||||
|
private NumericUpDown numericUpDownStudentsCount;
|
||||||
|
private Label label3;
|
||||||
|
private TextBox textBoxGroupName;
|
||||||
|
private Label label4;
|
||||||
|
private ComboBox comboBoxCurriculum;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonCancel;
|
||||||
|
}
|
||||||
|
}
|
90
ProjectShedule/ProjectShedule/Forms/FormGroup.cs
Normal file
90
ProjectShedule/ProjectShedule/Forms/FormGroup.cs
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
using ProjectShedule.Entities;
|
||||||
|
using ProjectShedule.Entities.Enums;
|
||||||
|
using ProjectShedule.Repositories;
|
||||||
|
using ProjectShedule.Repositories.Implementations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
public partial class FormGroup : Form
|
||||||
|
{
|
||||||
|
private readonly IGroupRepository _groupRepository;
|
||||||
|
private int? _groupId;
|
||||||
|
public int Id
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var group = _groupRepository.ReadGroupById(value);
|
||||||
|
if (group == null)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException(nameof(group));
|
||||||
|
}
|
||||||
|
numericUpDownStudentsCount.Value = group.StudentsCount;
|
||||||
|
textBoxGroupName.Text = group.GroupNumber;
|
||||||
|
comboBoxCourse.SelectedItem = group.Course;
|
||||||
|
comboBoxCurriculum.SelectedValue = group.CurriculumId;
|
||||||
|
_groupId = value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public FormGroup(IGroupRepository groupRepository, ICurriculumRepository curriculumRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_groupRepository = groupRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(groupRepository));
|
||||||
|
comboBoxCourse.DataSource = Enum.GetValues(typeof(Course));
|
||||||
|
|
||||||
|
comboBoxCurriculum.DataSource = curriculumRepository.ReadCurriculum();
|
||||||
|
comboBoxCurriculum.DisplayMember = "Direction";
|
||||||
|
comboBoxCurriculum.ValueMember = "Id";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(textBoxGroupName.Text) || comboBoxCourse.SelectedIndex < 1 ||
|
||||||
|
comboBoxCurriculum.SelectedIndex < 1)
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
if (_groupId.HasValue)
|
||||||
|
{
|
||||||
|
_groupRepository.UpdateGroup(CreateGroup(_groupId.Value));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_groupRepository.CreateGroup(CreateGroup(0));
|
||||||
|
}
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
private Group CreateGroup(int id) => Group.CreateGroup(
|
||||||
|
id,
|
||||||
|
Convert.ToInt32(numericUpDownStudentsCount.Value),
|
||||||
|
textBoxGroupName.Text,
|
||||||
|
(Course)comboBoxCourse.SelectedItem!,
|
||||||
|
(int)comboBoxCourse.SelectedValue!);
|
||||||
|
}
|
||||||
|
}
|
120
ProjectShedule/ProjectShedule/Forms/FormGroup.resx
Normal file
120
ProjectShedule/ProjectShedule/Forms/FormGroup.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
126
ProjectShedule/ProjectShedule/Forms/FormGroups.Designer.cs
generated
Normal file
126
ProjectShedule/ProjectShedule/Forms/FormGroups.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
partial class FormGroups
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
panel1 = new Panel();
|
||||||
|
buttonDel = new Button();
|
||||||
|
buttonUpd = new Button();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonDel);
|
||||||
|
panel1.Controls.Add(buttonUpd);
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(622, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(178, 354);
|
||||||
|
panel1.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// buttonDel
|
||||||
|
//
|
||||||
|
buttonDel.BackgroundImage = Properties.Resources.minus_PNG39;
|
||||||
|
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonDel.Location = new Point(42, 248);
|
||||||
|
buttonDel.Name = "buttonDel";
|
||||||
|
buttonDel.Size = new Size(94, 93);
|
||||||
|
buttonDel.TabIndex = 2;
|
||||||
|
buttonDel.UseVisualStyleBackColor = true;
|
||||||
|
buttonDel.Click += buttonDel_Click;
|
||||||
|
//
|
||||||
|
// buttonUpd
|
||||||
|
//
|
||||||
|
buttonUpd.BackgroundImage = Properties.Resources._3712684;
|
||||||
|
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonUpd.Location = new Point(42, 129);
|
||||||
|
buttonUpd.Name = "buttonUpd";
|
||||||
|
buttonUpd.Size = new Size(94, 93);
|
||||||
|
buttonUpd.TabIndex = 1;
|
||||||
|
buttonUpd.UseVisualStyleBackColor = true;
|
||||||
|
buttonUpd.Click += buttonUpd_Click;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = Properties.Resources.Ambox_plus_svg;
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonAdd.Location = new Point(42, 12);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(94, 93);
|
||||||
|
buttonAdd.TabIndex = 0;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
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.RowHeadersWidth = 51;
|
||||||
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridView.Size = new Size(800, 354);
|
||||||
|
dataGridView.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// FormGroups
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 354);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Name = "FormGroups";
|
||||||
|
Text = "Группы студентов";
|
||||||
|
Load += FormGroups_Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private Button buttonDel;
|
||||||
|
private Button buttonUpd;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
}
|
||||||
|
}
|
111
ProjectShedule/ProjectShedule/Forms/FormGroups.cs
Normal file
111
ProjectShedule/ProjectShedule/Forms/FormGroups.cs
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
using ProjectShedule.Repositories;
|
||||||
|
using ProjectShedule.Repositories.Implementations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
public partial class FormGroups : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
private readonly IGroupRepository _groupRepository;
|
||||||
|
public FormGroups(IUnityContainer container, IGroupRepository groupRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ??
|
||||||
|
throw new ArgumentNullException(nameof(container));
|
||||||
|
_groupRepository = groupRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(groupRepository));
|
||||||
|
}
|
||||||
|
private void FormGroups_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormGroup>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonUpd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var form = _container.Resolve<FormGroup>();
|
||||||
|
form.Id = findId;
|
||||||
|
form.ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonDel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_groupRepository.DeleteGroup(findId);
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void LoadList() => dataGridView.DataSource = _groupRepository.ReadGroup();
|
||||||
|
|
||||||
|
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||||
|
{
|
||||||
|
id = 0;
|
||||||
|
if (dataGridView.SelectedRows.Count < 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[id].Value);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
120
ProjectShedule/ProjectShedule/Forms/FormGroups.resx
Normal file
120
ProjectShedule/ProjectShedule/Forms/FormGroups.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
210
ProjectShedule/ProjectShedule/Forms/FormShedule.Designer.cs
generated
Normal file
210
ProjectShedule/ProjectShedule/Forms/FormShedule.Designer.cs
generated
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
partial class FormShedule
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
dateTimePicker = new DateTimePicker();
|
||||||
|
labelData = new Label();
|
||||||
|
comboBoxClassroom = new ComboBox();
|
||||||
|
comboBoxTeacher = new ComboBox();
|
||||||
|
comboBoxGroup = new ComboBox();
|
||||||
|
comboBoxSubject = new ComboBox();
|
||||||
|
checkedListBox = new CheckedListBox();
|
||||||
|
label1 = new Label();
|
||||||
|
label2 = new Label();
|
||||||
|
label3 = new Label();
|
||||||
|
label4 = new Label();
|
||||||
|
label5 = new Label();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
buttonSave = new Button();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// dateTimePicker
|
||||||
|
//
|
||||||
|
dateTimePicker.Location = new Point(163, 37);
|
||||||
|
dateTimePicker.Name = "dateTimePicker";
|
||||||
|
dateTimePicker.Size = new Size(159, 27);
|
||||||
|
dateTimePicker.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// labelData
|
||||||
|
//
|
||||||
|
labelData.AutoSize = true;
|
||||||
|
labelData.Location = new Point(103, 44);
|
||||||
|
labelData.Name = "labelData";
|
||||||
|
labelData.Size = new Size(44, 20);
|
||||||
|
labelData.TabIndex = 1;
|
||||||
|
labelData.Text = "Дата:";
|
||||||
|
//
|
||||||
|
// comboBoxClassroom
|
||||||
|
//
|
||||||
|
comboBoxClassroom.FormattingEnabled = true;
|
||||||
|
comboBoxClassroom.Location = new Point(163, 252);
|
||||||
|
comboBoxClassroom.Name = "comboBoxClassroom";
|
||||||
|
comboBoxClassroom.Size = new Size(159, 28);
|
||||||
|
comboBoxClassroom.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// comboBoxTeacher
|
||||||
|
//
|
||||||
|
comboBoxTeacher.FormattingEnabled = true;
|
||||||
|
comboBoxTeacher.Location = new Point(163, 147);
|
||||||
|
comboBoxTeacher.Name = "comboBoxTeacher";
|
||||||
|
comboBoxTeacher.Size = new Size(159, 28);
|
||||||
|
comboBoxTeacher.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// comboBoxGroup
|
||||||
|
//
|
||||||
|
comboBoxGroup.FormattingEnabled = true;
|
||||||
|
comboBoxGroup.Location = new Point(163, 91);
|
||||||
|
comboBoxGroup.Name = "comboBoxGroup";
|
||||||
|
comboBoxGroup.Size = new Size(159, 28);
|
||||||
|
comboBoxGroup.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// comboBoxSubject
|
||||||
|
//
|
||||||
|
comboBoxSubject.FormattingEnabled = true;
|
||||||
|
comboBoxSubject.Location = new Point(163, 200);
|
||||||
|
comboBoxSubject.Name = "comboBoxSubject";
|
||||||
|
comboBoxSubject.Size = new Size(159, 28);
|
||||||
|
comboBoxSubject.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// checkedListBox
|
||||||
|
//
|
||||||
|
checkedListBox.FormattingEnabled = true;
|
||||||
|
checkedListBox.Location = new Point(455, 37);
|
||||||
|
checkedListBox.Name = "checkedListBox";
|
||||||
|
checkedListBox.Size = new Size(150, 246);
|
||||||
|
checkedListBox.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Location = new Point(27, 155);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(120, 20);
|
||||||
|
label1.TabIndex = 8;
|
||||||
|
label1.Text = "Преподаватель:";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new Point(86, 99);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(61, 20);
|
||||||
|
label2.TabIndex = 9;
|
||||||
|
label2.Text = "Группа:";
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
label3.AutoSize = true;
|
||||||
|
label3.Location = new Point(74, 208);
|
||||||
|
label3.Name = "label3";
|
||||||
|
label3.Size = new Size(73, 20);
|
||||||
|
label3.TabIndex = 10;
|
||||||
|
label3.Text = "Предмет:";
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
label4.AutoSize = true;
|
||||||
|
label4.Location = new Point(63, 260);
|
||||||
|
label4.Name = "label4";
|
||||||
|
label4.Size = new Size(84, 20);
|
||||||
|
label4.TabIndex = 11;
|
||||||
|
label4.Text = "Аудитория";
|
||||||
|
//
|
||||||
|
// label5
|
||||||
|
//
|
||||||
|
label5.AutoSize = true;
|
||||||
|
label5.Location = new Point(370, 44);
|
||||||
|
label5.Name = "label5";
|
||||||
|
label5.Size = new Size(69, 20);
|
||||||
|
label5.TabIndex = 12;
|
||||||
|
label5.Text = "Пара(ы):";
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(323, 315);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(94, 29);
|
||||||
|
buttonCancel.TabIndex = 14;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += buttonCancel_Click;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(223, 315);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(94, 29);
|
||||||
|
buttonSave.TabIndex = 13;
|
||||||
|
buttonSave.Text = "Создать";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += buttonSave_Click;
|
||||||
|
//
|
||||||
|
// FormShedule
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(642, 368);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(label5);
|
||||||
|
Controls.Add(label4);
|
||||||
|
Controls.Add(label3);
|
||||||
|
Controls.Add(label2);
|
||||||
|
Controls.Add(label1);
|
||||||
|
Controls.Add(checkedListBox);
|
||||||
|
Controls.Add(comboBoxSubject);
|
||||||
|
Controls.Add(comboBoxGroup);
|
||||||
|
Controls.Add(comboBoxTeacher);
|
||||||
|
Controls.Add(comboBoxClassroom);
|
||||||
|
Controls.Add(labelData);
|
||||||
|
Controls.Add(dateTimePicker);
|
||||||
|
Name = "FormShedule";
|
||||||
|
Text = "Составление расписания";
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DateTimePicker dateTimePicker;
|
||||||
|
private Label labelData;
|
||||||
|
private ComboBox comboBoxClassroom;
|
||||||
|
private ComboBox comboBoxTeacher;
|
||||||
|
private ComboBox comboBoxGroup;
|
||||||
|
private ComboBox comboBoxSubject;
|
||||||
|
private CheckedListBox checkedListBox;
|
||||||
|
private Label label1;
|
||||||
|
private Label label2;
|
||||||
|
private Label label3;
|
||||||
|
private Label label4;
|
||||||
|
private Label label5;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Button buttonSave;
|
||||||
|
}
|
||||||
|
}
|
72
ProjectShedule/ProjectShedule/Forms/FormShedule.cs
Normal file
72
ProjectShedule/ProjectShedule/Forms/FormShedule.cs
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
using ProjectShedule.Entities;
|
||||||
|
using ProjectShedule.Entities.Enums;
|
||||||
|
using ProjectShedule.Repositories;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
public partial class FormShedule : Form
|
||||||
|
{
|
||||||
|
private readonly ISheduleRepository _sheduleRepository;
|
||||||
|
public FormShedule(ISheduleRepository sheduleRepository, IGroupRepository groupRepository, ITeacherRepository teacherRepository,
|
||||||
|
ISubjectRepository subjectRepository, IClassroomRepository classroomRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_sheduleRepository = sheduleRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(sheduleRepository));
|
||||||
|
foreach (PairNumber pairNumber in Enum.GetValues(typeof(PairNumber)))
|
||||||
|
{
|
||||||
|
if (pairNumber == PairNumber.None) continue;
|
||||||
|
checkedListBox.Items.Add(pairNumber);
|
||||||
|
}
|
||||||
|
comboBoxGroup.DataSource = groupRepository.ReadGroup();
|
||||||
|
comboBoxGroup.DisplayMember = "GroupNumber";
|
||||||
|
comboBoxGroup.ValueMember = "Id";
|
||||||
|
|
||||||
|
comboBoxTeacher.DataSource = teacherRepository.ReadTeacher();
|
||||||
|
comboBoxTeacher.DisplayMember = "LastName";
|
||||||
|
comboBoxTeacher.ValueMember = "Id";
|
||||||
|
|
||||||
|
comboBoxSubject.DataSource = subjectRepository.ReadSubject();
|
||||||
|
comboBoxSubject.DisplayMember = "Name";
|
||||||
|
comboBoxSubject.ValueMember = "Id";
|
||||||
|
|
||||||
|
comboBoxClassroom.DataSource = classroomRepository.ReadClassroom();
|
||||||
|
comboBoxClassroom.DisplayMember = "Name";
|
||||||
|
comboBoxClassroom.ValueMember = "Id";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (comboBoxGroup.SelectedIndex < 0 || comboBoxTeacher.SelectedIndex < 0 || comboBoxSubject.SelectedIndex < 0 ||
|
||||||
|
comboBoxClassroom.SelectedIndex < 0 || checkedListBox.CheckedItems.Count == 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
PairNumber pairNumber = PairNumber.None;
|
||||||
|
foreach (var elem in checkedListBox.CheckedItems)
|
||||||
|
{
|
||||||
|
pairNumber |= (PairNumber)elem;
|
||||||
|
}
|
||||||
|
_sheduleRepository.CreateShedule(Shedule.CreateOperation(0,
|
||||||
|
dateTimePicker.Value,
|
||||||
|
pairNumber,
|
||||||
|
(int)comboBoxGroup.SelectedValue!,
|
||||||
|
(int)comboBoxTeacher.SelectedValue!,
|
||||||
|
(int)comboBoxSubject.SelectedValue!,
|
||||||
|
(int)comboBoxClassroom.SelectedValue!));
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
}
|
||||||
|
}
|
120
ProjectShedule/ProjectShedule/Forms/FormShedule.resx
Normal file
120
ProjectShedule/ProjectShedule/Forms/FormShedule.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
98
ProjectShedule/ProjectShedule/Forms/FormShedules.Designer.cs
generated
Normal file
98
ProjectShedule/ProjectShedule/Forms/FormShedules.Designer.cs
generated
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
partial class FormShedules
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
panel1 = new Panel();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
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.RowHeadersWidth = 51;
|
||||||
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridView.Size = new Size(622, 315);
|
||||||
|
dataGridView.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = Properties.Resources.Ambox_plus_svg;
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonAdd.Location = new Point(48, 112);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(94, 93);
|
||||||
|
buttonAdd.TabIndex = 0;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(622, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(178, 315);
|
||||||
|
panel1.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// FormShedules
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 315);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "FormShedules";
|
||||||
|
Text = "Расписании";
|
||||||
|
Load += FormShedules_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private Panel panel1;
|
||||||
|
}
|
||||||
|
}
|
49
ProjectShedule/ProjectShedule/Forms/FormShedules.cs
Normal file
49
ProjectShedule/ProjectShedule/Forms/FormShedules.cs
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
|
||||||
|
using ProjectShedule.Repositories;
|
||||||
|
using ProjectShedule.Repositories.Implementations;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
|
||||||
|
public partial class FormShedules : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
private readonly ISheduleRepository _sheduleRepository;
|
||||||
|
|
||||||
|
public FormShedules(IUnityContainer container, ISheduleRepository sheduleRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ??
|
||||||
|
throw new ArgumentNullException(nameof(container));
|
||||||
|
_sheduleRepository = sheduleRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(sheduleRepository));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormShedule>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormShedules_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void LoadList() => dataGridView.DataSource = _sheduleRepository.ReadShedule();
|
||||||
|
}
|
||||||
|
}
|
120
ProjectShedule/ProjectShedule/Forms/FormShedules.resx
Normal file
120
ProjectShedule/ProjectShedule/Forms/FormShedules.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
95
ProjectShedule/ProjectShedule/Forms/FormSubject.Designer.cs
generated
Normal file
95
ProjectShedule/ProjectShedule/Forms/FormSubject.Designer.cs
generated
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
partial class FormSubject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
buttonCancel = new Button();
|
||||||
|
buttonSave = new Button();
|
||||||
|
textBoxSubjectName = new TextBox();
|
||||||
|
label2 = new Label();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(251, 136);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(94, 29);
|
||||||
|
buttonCancel.TabIndex = 15;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += buttonCancel_Click;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(96, 136);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(94, 29);
|
||||||
|
buttonSave.TabIndex = 14;
|
||||||
|
buttonSave.Text = "Создать";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += buttonSave_Click;
|
||||||
|
//
|
||||||
|
// textBoxSubjectName
|
||||||
|
//
|
||||||
|
textBoxSubjectName.Location = new Point(216, 63);
|
||||||
|
textBoxSubjectName.Name = "textBoxSubjectName";
|
||||||
|
textBoxSubjectName.Size = new Size(150, 27);
|
||||||
|
textBoxSubjectName.TabIndex = 11;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new Point(57, 66);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(151, 20);
|
||||||
|
label2.TabIndex = 10;
|
||||||
|
label2.Text = "Название предмета:";
|
||||||
|
//
|
||||||
|
// FormSubject
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(445, 210);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(textBoxSubjectName);
|
||||||
|
Controls.Add(label2);
|
||||||
|
Name = "FormSubject";
|
||||||
|
Text = "Дициплина";
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Button buttonSave;
|
||||||
|
private TextBox textBoxSubjectName;
|
||||||
|
private Label label2;
|
||||||
|
}
|
||||||
|
}
|
77
ProjectShedule/ProjectShedule/Forms/FormSubject.cs
Normal file
77
ProjectShedule/ProjectShedule/Forms/FormSubject.cs
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
using ProjectShedule.Entities.Enums;
|
||||||
|
using ProjectShedule.Entities;
|
||||||
|
using ProjectShedule.Repositories;
|
||||||
|
using ProjectShedule.Repositories.Implementations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Forms;
|
||||||
|
|
||||||
|
public partial class FormSubject : Form
|
||||||
|
{
|
||||||
|
private readonly ISubjectRepository _subjectRepository;
|
||||||
|
private int? _subjectId;
|
||||||
|
public int Id
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var subject = _subjectRepository.ReadSubjectById(value);
|
||||||
|
if (subject == null)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException(nameof(subject));
|
||||||
|
}
|
||||||
|
textBoxSubjectName.Text = subject.Name;
|
||||||
|
_subjectId = value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public FormSubject(ISubjectRepository subjectRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_subjectRepository = subjectRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(subjectRepository));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(textBoxSubjectName.Text))
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
if (_subjectId.HasValue)
|
||||||
|
{
|
||||||
|
_subjectRepository.UpdateSubject(CreateSubject(_subjectId.Value));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_subjectRepository.UpdateSubject(CreateSubject(0));
|
||||||
|
}
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
private Subject CreateSubject(int id) => Subject.CreateSubject(
|
||||||
|
id,
|
||||||
|
textBoxSubjectName.Text);
|
||||||
|
}
|
120
ProjectShedule/ProjectShedule/Forms/FormSubject.resx
Normal file
120
ProjectShedule/ProjectShedule/Forms/FormSubject.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
127
ProjectShedule/ProjectShedule/Forms/FormSubjects.Designer.cs
generated
Normal file
127
ProjectShedule/ProjectShedule/Forms/FormSubjects.Designer.cs
generated
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
partial class FormSubjects
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
panel1 = new Panel();
|
||||||
|
buttonDel = new Button();
|
||||||
|
buttonUpd = new Button();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonDel);
|
||||||
|
panel1.Controls.Add(buttonUpd);
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(622, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(178, 354);
|
||||||
|
panel1.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// buttonDel
|
||||||
|
//
|
||||||
|
buttonDel.BackgroundImage = Properties.Resources.minus_PNG39;
|
||||||
|
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonDel.Location = new Point(42, 248);
|
||||||
|
buttonDel.Name = "buttonDel";
|
||||||
|
buttonDel.Size = new Size(94, 93);
|
||||||
|
buttonDel.TabIndex = 2;
|
||||||
|
buttonDel.UseVisualStyleBackColor = true;
|
||||||
|
buttonDel.Click += buttonDel_Click;
|
||||||
|
//
|
||||||
|
// buttonUpd
|
||||||
|
//
|
||||||
|
buttonUpd.BackgroundImage = Properties.Resources._3712684;
|
||||||
|
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonUpd.Location = new Point(42, 129);
|
||||||
|
buttonUpd.Name = "buttonUpd";
|
||||||
|
buttonUpd.Size = new Size(94, 93);
|
||||||
|
buttonUpd.TabIndex = 1;
|
||||||
|
buttonUpd.UseVisualStyleBackColor = true;
|
||||||
|
buttonUpd.Click += buttonUpd_Click;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = Properties.Resources.Ambox_plus_svg;
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonAdd.Location = new Point(42, 12);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(94, 93);
|
||||||
|
buttonAdd.TabIndex = 0;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
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.RowHeadersWidth = 51;
|
||||||
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridView.Size = new Size(800, 354);
|
||||||
|
dataGridView.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// FormSubjects
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 354);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Name = "FormSubjects";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "Дисциплины";
|
||||||
|
Load += FormSubjects_Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private Button buttonDel;
|
||||||
|
private Button buttonUpd;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
}
|
||||||
|
}
|
109
ProjectShedule/ProjectShedule/Forms/FormSubjects.cs
Normal file
109
ProjectShedule/ProjectShedule/Forms/FormSubjects.cs
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
using ProjectShedule.Repositories;
|
||||||
|
using ProjectShedule.Repositories.Implementations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
public partial class FormSubjects : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
private readonly ISubjectRepository _subjectRepository;
|
||||||
|
public FormSubjects(IUnityContainer container, ISubjectRepository subjectRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ??
|
||||||
|
throw new ArgumentNullException(nameof(container));
|
||||||
|
_subjectRepository = subjectRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(subjectRepository));
|
||||||
|
}
|
||||||
|
private void FormSubjects_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormSubject>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonUpd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var form = _container.Resolve<FormSubject>();
|
||||||
|
form.Id = findId;
|
||||||
|
form.ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonDel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_subjectRepository.DeleteSubject(findId);
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void LoadList() => dataGridView.DataSource = _subjectRepository.ReadSubject();
|
||||||
|
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||||
|
{
|
||||||
|
id = 0;
|
||||||
|
if (dataGridView.SelectedRows.Count < 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[id].Value);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
120
ProjectShedule/ProjectShedule/Forms/FormSubjects.resx
Normal file
120
ProjectShedule/ProjectShedule/Forms/FormSubjects.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
120
ProjectShedule/ProjectShedule/Forms/FormTeacher.Designer.cs
generated
Normal file
120
ProjectShedule/ProjectShedule/Forms/FormTeacher.Designer.cs
generated
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
partial class FormTeacher
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
buttonCancel = new Button();
|
||||||
|
buttonSave = new Button();
|
||||||
|
label3 = new Label();
|
||||||
|
textBoxFirstName = new TextBox();
|
||||||
|
label2 = new Label();
|
||||||
|
textBoxLastName = new TextBox();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(223, 146);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(94, 29);
|
||||||
|
buttonCancel.TabIndex = 15;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += buttonCancel_Click;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(94, 146);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(94, 29);
|
||||||
|
buttonSave.TabIndex = 14;
|
||||||
|
buttonSave.Text = "Создать";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += buttonSave_Click;
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
label3.AutoSize = true;
|
||||||
|
label3.Location = new Point(50, 98);
|
||||||
|
label3.Name = "label3";
|
||||||
|
label3.Size = new Size(76, 20);
|
||||||
|
label3.TabIndex = 12;
|
||||||
|
label3.Text = "Фамилия:";
|
||||||
|
//
|
||||||
|
// textBoxFirstName
|
||||||
|
//
|
||||||
|
textBoxFirstName.Location = new Point(223, 49);
|
||||||
|
textBoxFirstName.Name = "textBoxFirstName";
|
||||||
|
textBoxFirstName.Size = new Size(150, 27);
|
||||||
|
textBoxFirstName.TabIndex = 11;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new Point(50, 56);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(42, 20);
|
||||||
|
label2.TabIndex = 10;
|
||||||
|
label2.Text = "Имя:";
|
||||||
|
//
|
||||||
|
// textBoxLastName
|
||||||
|
//
|
||||||
|
textBoxLastName.Location = new Point(223, 91);
|
||||||
|
textBoxLastName.Name = "textBoxLastName";
|
||||||
|
textBoxLastName.Size = new Size(150, 27);
|
||||||
|
textBoxLastName.TabIndex = 16;
|
||||||
|
//
|
||||||
|
// FormTeacher
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(411, 203);
|
||||||
|
Controls.Add(textBoxLastName);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(label3);
|
||||||
|
Controls.Add(textBoxFirstName);
|
||||||
|
Controls.Add(label2);
|
||||||
|
Name = "FormTeacher";
|
||||||
|
Text = "Преподаватель";
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Button buttonSave;
|
||||||
|
private ComboBox comboBoxTypeClassroom;
|
||||||
|
private Label label3;
|
||||||
|
private TextBox textBoxFirstName;
|
||||||
|
private Label label2;
|
||||||
|
private TextBox textBoxLastName;
|
||||||
|
private NumericUpDown numericUpDownClassroomSize;
|
||||||
|
private Label label1;
|
||||||
|
}
|
||||||
|
}
|
82
ProjectShedule/ProjectShedule/Forms/FormTeacher.cs
Normal file
82
ProjectShedule/ProjectShedule/Forms/FormTeacher.cs
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
using ProjectShedule.Entities;
|
||||||
|
using ProjectShedule.Repositories;
|
||||||
|
using ProjectShedule.Repositories.Implementations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
public partial class FormTeacher : Form
|
||||||
|
{
|
||||||
|
private readonly ITeacherRepository _teacherRepository;
|
||||||
|
private int? _teacherId;
|
||||||
|
public int Id
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var teacher = _teacherRepository.ReadTeacherById(value);
|
||||||
|
if (teacher == null)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException(nameof(teacher));
|
||||||
|
}
|
||||||
|
textBoxFirstName.Text = teacher.FirstName;
|
||||||
|
textBoxLastName.Text = teacher.LastName;
|
||||||
|
_teacherId = value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public FormTeacher(ITeacherRepository teacherRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_teacherRepository = teacherRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(teacherRepository));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(textBoxFirstName.Text) ||
|
||||||
|
string.IsNullOrWhiteSpace(textBoxLastName.Text))
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
if (_teacherId.HasValue)
|
||||||
|
{
|
||||||
|
_teacherRepository.UpdateTeacher(CreateTeacher(_teacherId.Value));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_teacherRepository.UpdateTeacher(CreateTeacher(0));
|
||||||
|
}
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
private Teacher CreateTeacher(int id) => Teacher.CreateTeacher(
|
||||||
|
id,
|
||||||
|
textBoxFirstName.Text,
|
||||||
|
textBoxLastName.Text);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
120
ProjectShedule/ProjectShedule/Forms/FormTeacher.resx
Normal file
120
ProjectShedule/ProjectShedule/Forms/FormTeacher.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
126
ProjectShedule/ProjectShedule/Forms/FormTeachers.Designer.cs
generated
Normal file
126
ProjectShedule/ProjectShedule/Forms/FormTeachers.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
partial class FormTeachers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
panel1 = new Panel();
|
||||||
|
buttonDel = new Button();
|
||||||
|
buttonUpd = new Button();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonDel);
|
||||||
|
panel1.Controls.Add(buttonUpd);
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(622, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(178, 353);
|
||||||
|
panel1.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// buttonDel
|
||||||
|
//
|
||||||
|
buttonDel.BackgroundImage = Properties.Resources.minus_PNG39;
|
||||||
|
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonDel.Location = new Point(42, 248);
|
||||||
|
buttonDel.Name = "buttonDel";
|
||||||
|
buttonDel.Size = new Size(94, 93);
|
||||||
|
buttonDel.TabIndex = 2;
|
||||||
|
buttonDel.UseVisualStyleBackColor = true;
|
||||||
|
buttonDel.Click += buttonDel_Click;
|
||||||
|
//
|
||||||
|
// buttonUpd
|
||||||
|
//
|
||||||
|
buttonUpd.BackgroundImage = Properties.Resources._3712684;
|
||||||
|
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonUpd.Location = new Point(42, 129);
|
||||||
|
buttonUpd.Name = "buttonUpd";
|
||||||
|
buttonUpd.Size = new Size(94, 93);
|
||||||
|
buttonUpd.TabIndex = 1;
|
||||||
|
buttonUpd.UseVisualStyleBackColor = true;
|
||||||
|
buttonUpd.Click += buttonUpd_Click;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = Properties.Resources.Ambox_plus_svg;
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonAdd.Location = new Point(42, 12);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(94, 93);
|
||||||
|
buttonAdd.TabIndex = 0;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
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.RowHeadersWidth = 51;
|
||||||
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridView.Size = new Size(800, 353);
|
||||||
|
dataGridView.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// FormTeachers
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 353);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Name = "FormTeachers";
|
||||||
|
Text = "Преподаватели";
|
||||||
|
Load += FormTeachers_Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private Button buttonDel;
|
||||||
|
private Button buttonUpd;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
}
|
||||||
|
}
|
109
ProjectShedule/ProjectShedule/Forms/FormTeachers.cs
Normal file
109
ProjectShedule/ProjectShedule/Forms/FormTeachers.cs
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
using ProjectShedule.Repositories;
|
||||||
|
using ProjectShedule.Repositories.Implementations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Forms
|
||||||
|
{
|
||||||
|
public partial class FormTeachers : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
private readonly ITeacherRepository _teacherRepository;
|
||||||
|
public FormTeachers(IUnityContainer container, ITeacherRepository teacherRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ??
|
||||||
|
throw new ArgumentNullException(nameof(container));
|
||||||
|
_teacherRepository = teacherRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(teacherRepository));
|
||||||
|
}
|
||||||
|
private void FormTeachers_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormTeacher>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonUpd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var form = _container.Resolve<FormTeacher>();
|
||||||
|
form.Id = findId;
|
||||||
|
form.ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonDel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_teacherRepository.DeleteTeacher(findId);
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void LoadList() => dataGridView.DataSource = _teacherRepository.ReadTeacher();
|
||||||
|
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||||
|
{
|
||||||
|
id = 0;
|
||||||
|
if (dataGridView.SelectedRows.Count < 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[id].Value);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
120
ProjectShedule/ProjectShedule/Forms/FormTeachers.resx
Normal file
120
ProjectShedule/ProjectShedule/Forms/FormTeachers.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -1,3 +1,7 @@
|
|||||||
|
using ProjectShedule.Repositories;
|
||||||
|
using ProjectShedule.Repositories.Implementations;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
namespace ProjectShedule
|
namespace ProjectShedule
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
@ -11,7 +15,21 @@ namespace ProjectShedule
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new Form1());
|
Application.Run(CreateContainer().Resolve<FormSchedulingBureau>());
|
||||||
|
}
|
||||||
|
private static IUnityContainer CreateContainer()
|
||||||
|
{
|
||||||
|
var container = new UnityContainer();
|
||||||
|
|
||||||
|
container.RegisterType<IClassroomRepository, ClassroomRepository>();
|
||||||
|
container.RegisterType<ICurriculumRepository, CurriculumRepository>();
|
||||||
|
container.RegisterType<IGroupRepository, GroupRepository>();
|
||||||
|
container.RegisterType<ISheduleRepository, SheduleRepository>();
|
||||||
|
container.RegisterType<ISubjectRepository, SubjectRepository>();
|
||||||
|
container.RegisterType<ITeacherRepository, TeacherRepository>();
|
||||||
|
container.RegisterType<ICurriculumSubjectRepository, CurriculumSubjectRepository>();
|
||||||
|
|
||||||
|
return container;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,4 +8,23 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Unity" Version="5.11.10" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="Properties\Resources.Designer.cs">
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Update="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
103
ProjectShedule/ProjectShedule/Properties/Resources.Designer.cs
generated
Normal file
103
ProjectShedule/ProjectShedule/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Этот код создан программой.
|
||||||
|
// Исполняемая версия:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||||
|
// повторной генерации кода.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace ProjectShedule.Properties {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||||
|
/// </summary>
|
||||||
|
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
||||||
|
// с помощью такого средства, как ResGen или Visual Studio.
|
||||||
|
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
||||||
|
// с параметром /str или перестройте свой проект VS.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources {
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
|
get {
|
||||||
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjectShedule.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||||
|
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture {
|
||||||
|
get {
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap _3712684 {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("3712684", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap Ambox_plus_svg {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Ambox_plus.svg", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap back {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("back", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap minus_PNG39 {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("minus_PNG39", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
133
ProjectShedule/ProjectShedule/Properties/Resources.resx
Normal file
133
ProjectShedule/ProjectShedule/Properties/Resources.resx
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="back" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\back.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="3712684" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\3712684.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="Ambox_plus.svg" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Ambox_plus.svg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="minus_PNG39" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\minus_PNG39.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
@ -0,0 +1,12 @@
|
|||||||
|
using ProjectShedule.Entities;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Repositories;
|
||||||
|
|
||||||
|
public interface IClassroomRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Classroom> ReadClassroom();
|
||||||
|
Classroom ReadClassroomById(int id);
|
||||||
|
void CreateClassroom(Classroom classroom);
|
||||||
|
void UpdateClassroom(Classroom classroom);
|
||||||
|
void DeleteClassroom(int id);
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using ProjectShedule.Entities;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Repositories;
|
||||||
|
|
||||||
|
public interface ICurriculumRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Curriculum> ReadCurriculum();
|
||||||
|
Curriculum ReadCurriculumById(int id);
|
||||||
|
void CreateCurriculum(Curriculum curriculum);
|
||||||
|
void UpdateCurriculum(Curriculum curriculum);
|
||||||
|
void DeleteCurriculum(int id);
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
using ProjectShedule.Entities;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Repositories;
|
||||||
|
|
||||||
|
public interface ICurriculumSubjectRepository
|
||||||
|
{
|
||||||
|
IEnumerable<CurriculumSubject> ReadCurriculumSubject();
|
||||||
|
void CreateCurriculumSubject(CurriculumSubject curriculumSubject);
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using ProjectShedule.Entities;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Repositories;
|
||||||
|
|
||||||
|
public interface IGroupRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Group> ReadGroup();
|
||||||
|
Group ReadGroupById(int id);
|
||||||
|
void CreateGroup(Group group);
|
||||||
|
void UpdateGroup(Group group);
|
||||||
|
void DeleteGroup(int id);
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
using ProjectShedule.Entities;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Repositories;
|
||||||
|
|
||||||
|
public interface ISheduleRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Shedule> ReadShedule(DateTime? dateTime = null, int? groupId = null);
|
||||||
|
void CreateShedule(Shedule shedule);
|
||||||
|
void UpdateShedule(Shedule shedule);
|
||||||
|
void DeleteShedule(int id);
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using ProjectShedule.Entities;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Repositories;
|
||||||
|
|
||||||
|
public interface ISubjectRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Subject> ReadSubject();
|
||||||
|
Subject ReadSubjectById(int id);
|
||||||
|
void CreateSubject(Subject subject);
|
||||||
|
void UpdateSubject(Subject subject);
|
||||||
|
void DeleteSubject(int id);
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using ProjectShedule.Entities;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Repositories;
|
||||||
|
|
||||||
|
public interface ITeacherRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Teacher> ReadTeacher();
|
||||||
|
Teacher ReadTeacherById(int id);
|
||||||
|
void CreateTeacher(Teacher teacher);
|
||||||
|
void UpdateTeacher(Teacher teacher);
|
||||||
|
void DeleteTeacher(int id);
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
using ProjectShedule.Entities;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class ClassroomRepository : IClassroomRepository
|
||||||
|
{
|
||||||
|
public void CreateClassroom(Classroom classroom)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteClassroom(int id)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Classroom> ReadClassroom()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public Classroom ReadClassroomById(int id)
|
||||||
|
{
|
||||||
|
return Classroom.CreateClassroom(0, 0, string.Empty, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateClassroom(Classroom classroom)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
using ProjectShedule.Entities;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class CurriculumRepository : ICurriculumRepository
|
||||||
|
{
|
||||||
|
public void CreateCurriculum(Curriculum curriculum)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteCurriculum(int id)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Curriculum> ReadCurriculum()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public Curriculum ReadCurriculumById(int id)
|
||||||
|
{
|
||||||
|
return Curriculum.CreateCurriculum(0, string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateCurriculum(Curriculum curriculum)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using ProjectShedule.Entities;
|
||||||
|
using ProjectShedule.Entities.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class CurriculumSubjectRepository : ICurriculumSubjectRepository
|
||||||
|
{
|
||||||
|
public void CreateCurriculumSubject(CurriculumSubject curriculumSubject)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public IEnumerable<CurriculumSubject> ReadCurriculumSubject()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
using ProjectShedule.Entities;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class GroupRepository : IGroupRepository
|
||||||
|
{
|
||||||
|
public void CreateGroup(Group group)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteGroup(int id)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Group> ReadGroup()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public Group ReadGroupById(int id)
|
||||||
|
{
|
||||||
|
return Group.CreateGroup(0, 0, string.Empty, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateGroup(Group group)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
using ProjectShedule.Entities;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Repositories.Implementations;
|
||||||
|
public class SheduleRepository : ISheduleRepository
|
||||||
|
{
|
||||||
|
public void CreateShedule(Shedule shedule)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteShedule(int id)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Shedule> ReadShedule(DateTime? dateTime = null, int? groupId = null)
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateShedule(Shedule shedule)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
|||||||
|
using ProjectShedule.Entities;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class SubjectRepository : ISubjectRepository
|
||||||
|
{
|
||||||
|
public void CreateSubject(Subject subject)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteSubject(int id)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Subject> ReadSubject()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public Subject ReadSubjectById(int id)
|
||||||
|
{
|
||||||
|
return Subject.CreateSubject(0,string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateSubject(Subject subject)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
using ProjectShedule.Entities;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectShedule.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class TeacherRepository : ITeacherRepository
|
||||||
|
{
|
||||||
|
public void CreateTeacher(Teacher teacher)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteTeacher(int id)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Teacher> ReadTeacher()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public Teacher ReadTeacherById(int id)
|
||||||
|
{
|
||||||
|
return Teacher.CreateTeacher(0,string.Empty,string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateTeacher(Teacher teacher)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
BIN
ProjectShedule/ProjectShedule/Resources/3712684.png
Normal file
BIN
ProjectShedule/ProjectShedule/Resources/3712684.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
BIN
ProjectShedule/ProjectShedule/Resources/Ambox_plus.svg.png
Normal file
BIN
ProjectShedule/ProjectShedule/Resources/Ambox_plus.svg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 73 KiB |
BIN
ProjectShedule/ProjectShedule/Resources/back.jpg
Normal file
BIN
ProjectShedule/ProjectShedule/Resources/back.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 93 KiB |
BIN
ProjectShedule/ProjectShedule/Resources/minus_PNG39.png
Normal file
BIN
ProjectShedule/ProjectShedule/Resources/minus_PNG39.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
Loading…
Reference in New Issue
Block a user