Compare commits

...

8 Commits

Author SHA1 Message Date
funa4i
ae601f212e Контейнер 2024-10-29 13:55:57 +04:00
funa4i
9f553b7761 контейнер 2024-10-29 13:51:51 +04:00
funa4i
40ddc1509f Переделанная схема, репозитории операции 2024-10-29 13:50:35 +04:00
funa4i
c75709899e Форма для факультета 2024-10-28 21:38:22 +04:00
funa4i
d78c16662f правки 2024-10-28 20:25:02 +04:00
funa4i
c3a50e6988 ReposImp 2024-10-28 20:20:36 +04:00
funa4i
898a3c0c7b Repos 2024-10-28 20:08:02 +04:00
funa4i
7d448c781e Entities 2024-10-28 19:18:57 +04:00
27 changed files with 9625 additions and 52 deletions

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StudentProgressRecord.Entity.Enums
{
[Flags]
public enum Operations
{
None = 0,
Transfer = 1 << 0,
Enroll = 1 << 1,
Expel = 1 << 2,
}
}

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StudentProgressRecord.Entity
{
public class Marks
{
public long Id { get; set; }
public long StatementId { get; set; }
public long StudentId { get; set; }
public int Mark { get; set; }
public static Marks CreateElement(long id, long statementId, long studentId)
{
return new Marks
{
Id = id,
StatementId = statementId,
StudentId = studentId
};
}
}
}

View File

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StudentProgressRecord.Entity
{
public class Statement
{
public long Id { get; set; }
public long SubjectId { get; set; }
public long TeacherId { get; set; }
public DateTime Date { get; set; }
public IEnumerable<Marks> Marks { get; private set; } = [];
public static Statement CreateOperation(long id, long subjectId, long teacherId,
DateTime timeStamp, IEnumerable<Marks> marks)
{
return new Statement
{
Id = id,
SubjectId = subjectId,
TeacherId = teacherId,
Date = timeStamp,
Marks = marks
};
}
}
}

View File

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StudentProgressRecord.Entity
{
public class Student
{
public long Id { get; set; }
public string Fio { get; set; }
public bool FamilyPos { get; set; }
public bool Domitory { get; set; }
public static Student CreateEntity(long id, string fio, bool familyPos,
bool domitory)
{
return new Student
{
Id = id,
Fio = fio,
FamilyPos = familyPos,
Domitory = domitory
};
}
}
}

View File

@ -0,0 +1,32 @@
using StudentProgressRecord.Entity.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StudentProgressRecord.Entity
{
public class StudentTransition
{
public long Id { get; set; }
public long StudentId { get; set; }
public Operations Operation { get; set; }
public DateTime timeStamp { get; set; }
public static StudentTransition CreateOperation(long id, long studentId, Operations operation, DateTime time)
{
return new StudentTransition
{
Id = id,
StudentId = studentId,
Operation = operation,
timeStamp = time
};
}
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StudentProgressRecord.Entity
{
public class Subject
{
public long Id { get; set; }
public string Name { get; set; }
public static Subject CreateEntity(long id, string name)
{
return new Subject
{
Id = id,
Name = name
};
}
}
}

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StudentProgressRecord.Entity
{
public class Teacher
{
public long Id { get; set; }
public string Fio { get; set; }
public long DepartmentID { get; set; }
public static Teacher CreateEntity(long id, string Fio, long departmentId)
{
return new Teacher
{
Id = id,
Fio = Fio,
DepartmentID = departmentId
};
}
}
}

View File

@ -1,39 +0,0 @@
namespace StudentProgressRecord
{
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
}
}

View File

@ -1,10 +0,0 @@
namespace StudentProgressRecord
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,12 @@
using StudentProgressRecord.Entity;
namespace StudentProgressRecord.Repositories
{
public interface IStatementRepository
{
IEnumerable<Statement> ReadStatements(long? subjectId = null, long? teacherId = null, DateTime? dateFrom = null, DateTime? dateTo=null);
void CreateStatement(Statement statement);
void DeleteStatement(long id);
}
}

View File

@ -0,0 +1,18 @@
using StudentProgressRecord.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StudentProgressRecord.Repositories
{
public interface IStudentRepository
{
IEnumerable<Student> ReadStudents(bool? familyPos=null, bool? domitory=null);
Student ReadStudentById(long id);
void CreateStudent(Student student);
void UpdateStudent(Student student);
void DeleteStudent(long id);
}
}

View File

@ -0,0 +1,18 @@
using StudentProgressRecord.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StudentProgressRecord.IRepositories
{
public interface IStudentTransitionRepository
{
IEnumerable<StudentTransition> ReadStudentTransitions(long? groupId = null, bool? familyPos = null, bool? domitory = null);
StudentTransition ReadStudentTransitionById(long id);
void CreateStudentTransition(StudentTransition studentTransition);
void DeleteStudentTransition(long id);
}
}

View File

@ -0,0 +1,18 @@
using StudentProgressRecord.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StudentProgressRecord.Repositories
{
public interface ISubjectRepository
{
IEnumerable<Subject> ReadSubjects();
Subject ReadSubjectById(long id);
void CreateSubject(Subject subject);
void UpdateSubject(Subject subject);
void DeleteSubject(long id);
}
}

View File

@ -0,0 +1,19 @@
using StudentProgressRecord.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StudentProgressRecord.Repositories
{
public interface ITeacherRepository
{
IEnumerable<Teacher> ReadTeachers(long? departmentID = null);
Teacher ReadTeacherById(long id);
void CreateTeacher(Teacher teacher);
void UpdateTeacher(Teacher teacher);
void DeleteTeacher(long id);
}
}

View File

@ -1,3 +1,10 @@
using StudentProgressRecord.IRepositories;
using StudentProgressRecord.Repositories;
using StudentProgressRecord.RepositoryImp;
using Unity;
using Unity.Lifetime;
namespace StudentProgressRecord
{
internal static class Program
@ -8,10 +15,32 @@ namespace StudentProgressRecord
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
Application.Run(new University());
}
private static IUnityContainer CreateContainer()
{
var container = new UnityContainer();
container.RegisterType<IStatementRepository, StatementRepository>
(new TransientLifetimeManager());
container.RegisterType<IStudentRepository, StudentRepository>
(new TransientLifetimeManager());
container.RegisterType<ISubjectRepository, SubjectRepository>
(new TransientLifetimeManager());
container.RegisterType<ITeacherRepository, TeacherRepository>
(new TransientLifetimeManager());
container.RegisterType<IStudentTransitionRepository, StudentTransitionRepository>
(new TransientLifetimeManager());
return container;
}
}
}

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace StudentProgressRecord.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("StudentProgressRecord.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;
}
}
}
}

View File

@ -0,0 +1,29 @@
using StudentProgressRecord.Entity;
using StudentProgressRecord.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StudentProgressRecord.RepositoryImp
{
public class StatementRepository : IStatementRepository
{
public void CreateStatement(Statement statement)
{
}
public void DeleteStatement(long id)
{
}
public IEnumerable<Statement> ReadStatements(long? subjectId = null, long? teacherId = null,
DateTime? dateFrom = null, DateTime? dateTo = null)
{
return [];
}
}
}

View File

@ -0,0 +1,38 @@
using StudentProgressRecord.Entity;
using StudentProgressRecord.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StudentProgressRecord.RepositoryImp
{
public class StudentRepository : IStudentRepository
{
public void CreateStudent(Student student)
{
}
public void DeleteStudent(long id)
{
}
public Student ReadStudentById(long id)
{
return Student.CreateEntity(0, string.Empty, false , false);
}
public IEnumerable<Student> ReadStudents(bool? familyPos = null, bool? domitory = null)
{
return [];
}
public void UpdateStudent(Student student)
{
}
}
}

View File

@ -0,0 +1,28 @@
using StudentProgressRecord.Entity;
using StudentProgressRecord.IRepositories;
using StudentProgressRecord.Entity.Enums;
namespace StudentProgressRecord.RepositoryImp
{
public class StudentTransitionRepository : IStudentTransitionRepository
{
public void CreateStudentTransition(StudentTransition studentTransition)
{
throw new NotImplementedException();
}
public void DeleteStudentTransition(long id)
{
throw new NotImplementedException();
}
public StudentTransition ReadStudentTransitionById(long id)
{
return StudentTransition.CreateOperation(0, 0, Operations.None, DateTime.Now);
}
public IEnumerable<StudentTransition> ReadStudentTransitions(long? groupId = null, bool? familyPos = null, bool? domitory = null)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,38 @@
using StudentProgressRecord.Entity;
using StudentProgressRecord.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StudentProgressRecord.RepositoryImp
{
public class SubjectRepository : ISubjectRepository
{
public void CreateSubject(Subject subject)
{
}
public void DeleteSubject(long id)
{
}
public Subject ReadSubjectById(long id)
{
return Subject.CreateEntity(0, string.Empty);
}
public IEnumerable<Subject> ReadSubjects()
{
return [];
}
public void UpdateSubject(Subject subject)
{
}
}
}

View File

@ -0,0 +1,38 @@
using StudentProgressRecord.Entity;
using StudentProgressRecord.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StudentProgressRecord.RepositoryImp
{
public class TeacherRepository : ITeacherRepository
{
public void CreateTeacher(Teacher teacher)
{
}
public void DeleteTeacher(long id)
{
}
public Teacher ReadTeacherById(long id)
{
return Teacher.CreateEntity(0, string.Empty, 0);
}
public IEnumerable<Teacher> ReadTeachers(long? departmentID = null)
{
return [];
}
public void UpdateTeacher(Teacher teacher)
{
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 KiB

View File

@ -8,4 +8,25 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Unity" Version="5.11.10" />
<PackageReference Include="Unity.Abstractions" Version="5.11.7" />
<PackageReference Include="Unity.Container" Version="5.11.11" />
</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>

View File

@ -0,0 +1,147 @@
namespace StudentProgressRecord
{
partial class University
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(University));
menuStrip1 = new MenuStrip();
HandbookToolStripMenuItem = new ToolStripMenuItem();
FacultyToolStripMenuItem = new ToolStripMenuItem();
OperationToolStripMenuItem = new ToolStripMenuItem();
ReportToolStripMenuItem = new ToolStripMenuItem();
DepartmentToolStripMenuItem = new ToolStripMenuItem();
GroupToolStripMenuItem = new ToolStripMenuItem();
StudentToolStripMenuItem = new ToolStripMenuItem();
TeacherToolStripMenuItem = new ToolStripMenuItem();
SubjectToolStripMenuItem = new ToolStripMenuItem();
StatementToolStripMenuItem = new ToolStripMenuItem();
menuStrip1.SuspendLayout();
SuspendLayout();
//
// menuStrip1
//
menuStrip1.ImageScalingSize = new Size(20, 20);
menuStrip1.Items.AddRange(new ToolStripItem[] { HandbookToolStripMenuItem, OperationToolStripMenuItem, ReportToolStripMenuItem });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Size = new Size(1200, 28);
menuStrip1.TabIndex = 1;
menuStrip1.Text = "menuStrip1";
//
// HandbookToolStripMenuItem
//
HandbookToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { FacultyToolStripMenuItem, DepartmentToolStripMenuItem, GroupToolStripMenuItem, StudentToolStripMenuItem, TeacherToolStripMenuItem, SubjectToolStripMenuItem, StatementToolStripMenuItem });
HandbookToolStripMenuItem.Name = "HandbookToolStripMenuItem";
HandbookToolStripMenuItem.Size = new Size(117, 24);
HandbookToolStripMenuItem.Text = "Справочники";
//
// FacultyToolStripMenuItem
//
FacultyToolStripMenuItem.Name = "FacultyToolStripMenuItem";
FacultyToolStripMenuItem.Size = new Size(201, 26);
FacultyToolStripMenuItem.Text = "Факультеты";
//
// OperationToolStripMenuItem
//
OperationToolStripMenuItem.Name = "OperationToolStripMenuItem";
OperationToolStripMenuItem.Size = new Size(95, 24);
OperationToolStripMenuItem.Text = "Операции";
//
// ReportToolStripMenuItem
//
ReportToolStripMenuItem.Name = "ReportToolStripMenuItem";
ReportToolStripMenuItem.Size = new Size(73, 24);
ReportToolStripMenuItem.Text = "Отчеты";
//
// DepartmentToolStripMenuItem
//
DepartmentToolStripMenuItem.Name = "DepartmentToolStripMenuItem";
DepartmentToolStripMenuItem.Size = new Size(201, 26);
DepartmentToolStripMenuItem.Text = "Кафедры";
//
// GroupToolStripMenuItem
//
GroupToolStripMenuItem.Name = "GroupToolStripMenuItem";
GroupToolStripMenuItem.Size = new Size(201, 26);
GroupToolStripMenuItem.Text = "Группы";
//
// StudentToolStripMenuItem
//
StudentToolStripMenuItem.Name = "StudentToolStripMenuItem";
StudentToolStripMenuItem.Size = new Size(201, 26);
StudentToolStripMenuItem.Text = "Студенты";
//
// TeacherToolStripMenuItem
//
TeacherToolStripMenuItem.Name = "TeacherToolStripMenuItem";
TeacherToolStripMenuItem.Size = new Size(201, 26);
TeacherToolStripMenuItem.Text = "Преподаватели";
//
// SubjectToolStripMenuItem
//
SubjectToolStripMenuItem.Name = "SubjectToolStripMenuItem";
SubjectToolStripMenuItem.Size = new Size(201, 26);
SubjectToolStripMenuItem.Text = "Предметы";
//
// StatementToolStripMenuItem
//
StatementToolStripMenuItem.Name = "StatementToolStripMenuItem";
StatementToolStripMenuItem.Size = new Size(201, 26);
StatementToolStripMenuItem.Text = "Ведомость";
//
// University
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
BackgroundImage = (Image)resources.GetObject("$this.BackgroundImage");
BackgroundImageLayout = ImageLayout.Stretch;
ClientSize = new Size(1200, 599);
Controls.Add(menuStrip1);
MainMenuStrip = menuStrip1;
Name = "University";
Text = "University";
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private MenuStrip menuStrip1;
private ToolStripMenuItem HandbookToolStripMenuItem;
private ToolStripMenuItem FacultyToolStripMenuItem;
private ToolStripMenuItem OperationToolStripMenuItem;
private ToolStripMenuItem ReportToolStripMenuItem;
private ToolStripMenuItem DepartmentToolStripMenuItem;
private ToolStripMenuItem GroupToolStripMenuItem;
private ToolStripMenuItem StudentToolStripMenuItem;
private ToolStripMenuItem TeacherToolStripMenuItem;
private ToolStripMenuItem SubjectToolStripMenuItem;
private ToolStripMenuItem StatementToolStripMenuItem;
}
}

View File

@ -0,0 +1,20 @@
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 StudentProgressRecord
{
public partial class University : Form
{
public University()
{
InitializeComponent();
}
}
}

File diff suppressed because it is too large Load Diff