Синхронизация оценок

This commit is contained in:
kotcheshir73 2022-12-25 11:17:48 +04:00
parent 97ae32a479
commit 1f864dda44
13 changed files with 503 additions and 88 deletions

View File

@ -30,5 +30,15 @@ namespace ToolsDesktop.Helpers
return MessageBox.Show(string.Join(Environment.NewLine, messages.Select(x=> $"{x.Title}:{x.Message}")), title, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
public static DialogResult MessageException(Exception e, string title)
{
var list = new List<string>();
while(e != null)
{
list.Add(e.Message);
e = e.InnerException;
}
return MessageBox.Show(string.Join(Environment.NewLine, list), title, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}

View File

@ -17,6 +17,8 @@ namespace DepartmentContract.ViewModels
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)]
[ViewModelControlElementDependenceEntity(Title = "Приказы по студенту", Order = 1, ParentPropertyName = "StudentId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlOrderStudentRecordList, DepartmentWindowsDesktop")]
[ViewModelControlElementDependenceEntity(Title = "Оценки студента", Order = 1, ParentPropertyName = "StudentId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentMarkPassedDisciplineList, DepartmentWindowsDesktop")]
public class StudentViewModel : ElementViewModel, IStudentModel
{
[ViewModelControlElementProperty("Пользователь", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlUserList, SecurityWindowsDesktop")]

View File

@ -53,6 +53,8 @@ namespace DepartmentWindowsDesktop.EntityControls
/// </summary>
/// <returns></returns>
private async Task SyncOrders()
{
try
{
var flag = await _businessLogic.SyncOrders();
if (!flag)
@ -64,5 +66,10 @@ namespace DepartmentWindowsDesktop.EntityControls
DialogHelper.MessageInformation("Завершено успешно", "Синхронизация приказов");
}
}
catch (Exception e)
{
DialogHelper.MessageException(e, "Синхронизация приказов");
}
}
}
}

View File

@ -0,0 +1,33 @@

namespace DepartmentWindowsDesktop.EntityControls
{
partial class ControlStudentMarkPassedDisciplineElement
{
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
}
#endregion
}
}

View File

@ -0,0 +1,30 @@
using DepartmentContract.BindingModels;
using DepartmentContract.Logics.IGenericEntityLogic;
using DepartmentContract.ViewModels;
using System;
using ToolsDesktop.Controls;
using ToolsDesktop.Interfaces;
using ToolsDesktop.Models;
namespace DepartmentWindowsDesktop.EntityControls
{
/// <summary>
/// Реализация контрола для оценки
/// </summary>
public partial class ControlStudentMarkPassedDisciplineElement :
GenericControlEntityElement<StudentMarkPassedDisciplineGetBindingModel, StudentMarkPassedDisciplineSetBindingModel, StudentMarkPassedDisciplineListViewModel, StudentMarkPassedDisciplineViewModel, IStudentMarkPassedDisciplineLogic>,
IGenericControlEntityElement
{
public ControlStudentMarkPassedDisciplineElement()
{
InitializeComponent();
Title = "Оценка";
ControlId = new Guid("2a9273d4-fd7a-457f-9879-0b1c521c0c5d");
_genericControlViewEntityElement = this;
}
public IControl GetInstanceGenericControl() => new ControlStudentMarkPassedDisciplineElement() { ControlId = Guid.NewGuid() };
public ControlViewEntityElementConfiguration GetConfigControl() => new();
}
}

View 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>

View File

@ -0,0 +1,38 @@

namespace DepartmentWindowsDesktop.EntityControls
{
partial class ControlStudentMarkPassedDisciplineList
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
}
#endregion
}
}

View File

@ -0,0 +1,36 @@
using DepartmentContract.BindingModels;
using DepartmentContract.Logics.IGenericEntityLogic;
using DepartmentContract.ViewModels;
using System;
using ToolsDesktop.Controls;
using ToolsDesktop.Interfaces;
using ToolsDesktop.Models;
using ToolsModule.ManagmentSecurity;
namespace DepartmentWindowsDesktop.EntityControls
{
/// <summary>
/// Реализация контрола для списка оценок
/// </summary>
public partial class ControlStudentMarkPassedDisciplineList :
GenericControlEntityList<StudentMarkPassedDisciplineGetBindingModel, StudentMarkPassedDisciplineSetBindingModel, StudentMarkPassedDisciplineListViewModel, StudentMarkPassedDisciplineViewModel, IStudentMarkPassedDisciplineLogic>,
IGenericControlEntityList
{
public ControlStudentMarkPassedDisciplineList()
{
InitializeComponent();
Title = "Оценки";
ControlId = new Guid("bee52978-78d7-46d0-ac57-4afba63e2890");
AccessOperation = AccessOperation.ОценкиСтудентов;
ControlViewEntityElement = new ControlStudentMarkPassedDisciplineElement();
_genericControlViewEntityList = this;
}
public IControl GetInstanceGenericControl() => new ControlStudentMarkPassedDisciplineList() { ControlId = Guid.NewGuid() };
public ControlViewEntityListConfiguration GetConfigControl() => new()
{
PaginationOn = false
};
}
}

View 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>

View File

@ -8,6 +8,9 @@ using ToolsDesktop.Models;
namespace DepartmentWindowsDesktop.EntityControls
{
/// <summary>
/// Реализация контрола для истории синхронизации оценок
/// </summary>
public partial class ControlStudentMarkSyncHistoryElement :
GenericControlEntityElement<StudentMarkSyncHistoryGetBindingModel, StudentMarkSyncHistorySetBindingModel, StudentMarkSyncHistoryListViewModel, StudentMarkSyncHistoryViewModel, IStudentMarkSyncHistoryLogic>,
IGenericControlEntityElement

View File

@ -13,6 +13,9 @@ using ToolsModule.ManagmentSecurity;
namespace DepartmentWindowsDesktop.EntityControls
{
/// <summary>
/// Реализация контрола для списка историй синхронизации оценок
/// </summary>
public partial class ControlStudentMarkSyncHistoryList :
GenericControlEntityList<StudentMarkSyncHistoryGetBindingModel, StudentMarkSyncHistorySetBindingModel, StudentMarkSyncHistoryListViewModel, StudentMarkSyncHistoryViewModel, IStudentMarkSyncHistoryLogic>,
IGenericControlEntityList
@ -46,10 +49,12 @@ namespace DepartmentWindowsDesktop.EntityControls
};
/// <summary>
/// Синхронизация приказов
/// Синхронизация оценок
/// </summary>
/// <returns></returns>
private async Task SyncStudentMarks()
{
try
{
var flag = await _businessLogic.SyncMarks();
if (!flag)
@ -61,5 +66,10 @@ namespace DepartmentWindowsDesktop.EntityControls
DialogHelper.MessageInformation("Завершено успешно", "Синхронизация оценок");
}
}
catch (Exception e)
{
DialogHelper.MessageException(e, "Синхронизация оценок");
}
}
}
}

View File

@ -8,6 +8,9 @@ using ToolsDesktop.Models;
namespace DepartmentWindowsDesktop.EntityControls
{
/// <summary>
/// Реализация контрола для записи истории синхронизации оценок
/// </summary>
public partial class ControlStudentMarkSyncHistoryRecordElement :
GenericControlEntityElement<StudentMarkSyncHistoryRecordGetBindingModel, StudentMarkSyncHistoryRecordSetBindingModel, StudentMarkSyncHistoryRecordListViewModel, StudentMarkSyncHistoryRecordViewModel, IStudentMarkSyncHistoryRecordLogic>,
IGenericControlEntityElement

View File

@ -11,6 +11,9 @@ using ToolsModule.ManagmentSecurity;
namespace DepartmentWindowsDesktop.EntityControls
{
/// <summary>
/// Реализация контрола для списка записей истории синхронизации оценок
/// </summary>
public partial class ControlStudentMarkSyncHistoryRecordList :
GenericControlEntityList<StudentMarkSyncHistoryRecordGetBindingModel, StudentMarkSyncHistoryRecordSetBindingModel, StudentMarkSyncHistoryRecordListViewModel, StudentMarkSyncHistoryRecordViewModel, IStudentMarkSyncHistoryRecordLogic>,
IGenericControlEntityList