diff --git a/DepartmentPortal/Common/ToolsDesktop/Helpers/DialogHelper.cs b/DepartmentPortal/Common/ToolsDesktop/Helpers/DialogHelper.cs index 147c1ff..6387cc0 100644 --- a/DepartmentPortal/Common/ToolsDesktop/Helpers/DialogHelper.cs +++ b/DepartmentPortal/Common/ToolsDesktop/Helpers/DialogHelper.cs @@ -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(); + while(e != null) + { + list.Add(e.Message); + e = e.InnerException; + } + return MessageBox.Show(string.Join(Environment.NewLine, list), title, MessageBoxButtons.OK, MessageBoxIcon.Error); + } } } diff --git a/DepartmentPortal/Department/DepartmentContract/ViewModels/StudentViewModels.cs b/DepartmentPortal/Department/DepartmentContract/ViewModels/StudentViewModels.cs index c46ccf7..4fff9a0 100644 --- a/DepartmentPortal/Department/DepartmentContract/ViewModels/StudentViewModels.cs +++ b/DepartmentPortal/Department/DepartmentContract/ViewModels/StudentViewModels.cs @@ -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")] diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderSyncHistory/ControlOrderSyncHistoryList.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderSyncHistory/ControlOrderSyncHistoryList.cs index bbee6dd..c38cd51 100644 --- a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderSyncHistory/ControlOrderSyncHistoryList.cs +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderSyncHistory/ControlOrderSyncHistoryList.cs @@ -17,52 +17,59 @@ namespace DepartmentWindowsDesktop.EntityControls /// Реализация контрола для списка историй синхронизации приказов /// public partial class ControlOrderSyncHistoryList : - GenericControlEntityList, - IGenericControlEntityList - { - public ControlOrderSyncHistoryList() - { - InitializeComponent(); - Title = "Синхронизация Приказов"; - ControlId = new Guid("7b857c17-405e-40fb-961f-7fe74fddf84e"); - AccessOperation = AccessOperation.СинхронизацияПриказов; - ControlViewEntityElement = new ControlOrderSyncHistoryElement(); - _genericControlViewEntityList = this; - } + GenericControlEntityList, + IGenericControlEntityList + { + public ControlOrderSyncHistoryList() + { + InitializeComponent(); + Title = "Синхронизация Приказов"; + ControlId = new Guid("7b857c17-405e-40fb-961f-7fe74fddf84e"); + AccessOperation = AccessOperation.СинхронизацияПриказов; + ControlViewEntityElement = new ControlOrderSyncHistoryElement(); + _genericControlViewEntityList = this; + } - public IControl GetInstanceGenericControl() => new ControlOrderSyncHistoryList() { ControlId = Guid.NewGuid() }; + public IControl GetInstanceGenericControl() => new ControlOrderSyncHistoryList() { ControlId = Guid.NewGuid() }; - public ControlViewEntityListConfiguration GetConfigControl() => new() - { - PaginationOn = false, - HideToolStripButton = new List - { - ToolStripButtonListNames.toolStripButtonAdd, - ToolStripButtonListNames.toolStripButtonUpd, - ToolStripButtonListNames.toolStripButtonDel, - ToolStripButtonListNames.toolStripButtonSearch - }, - ControlOnMoveElem = new() - { - { "ToolStripMenuItemSyncOrders", ("Синхронизировать студентов", async (object sender, EventArgs e) => { await SyncOrders (); }) } - } - }; + public ControlViewEntityListConfiguration GetConfigControl() => new() + { + PaginationOn = false, + HideToolStripButton = new List + { + ToolStripButtonListNames.toolStripButtonAdd, + ToolStripButtonListNames.toolStripButtonUpd, + ToolStripButtonListNames.toolStripButtonDel, + ToolStripButtonListNames.toolStripButtonSearch + }, + ControlOnMoveElem = new() + { + { "ToolStripMenuItemSyncOrders", ("Синхронизировать студентов", async (object sender, EventArgs e) => { await SyncOrders(); }) } + } + }; - /// - /// Синхронизация приказов - /// - /// - private async Task SyncOrders() - { - var flag = await _businessLogic.SyncOrders(); - if (!flag) - { - DialogHelper.MessageException(_businessLogic.Errors, "Ошибки при синхронизации"); - } - else - { - DialogHelper.MessageInformation("Завершено успешно", "Синхронизация приказов"); - } - } - } + /// + /// Синхронизация приказов + /// + /// + private async Task SyncOrders() + { + try + { + var flag = await _businessLogic.SyncOrders(); + if (!flag) + { + DialogHelper.MessageException(_businessLogic.Errors, "Ошибки при синхронизации"); + } + else + { + DialogHelper.MessageInformation("Завершено успешно", "Синхронизация приказов"); + } + } + catch (Exception e) + { + DialogHelper.MessageException(e, "Синхронизация приказов"); + } + } + } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkPassedDiscipline/ControlStudentMarkPassedDisciplineElement.Designer.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkPassedDiscipline/ControlStudentMarkPassedDisciplineElement.Designer.cs new file mode 100644 index 0000000..bc4591c --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkPassedDiscipline/ControlStudentMarkPassedDisciplineElement.Designer.cs @@ -0,0 +1,33 @@ + +namespace DepartmentWindowsDesktop.EntityControls +{ + partial class ControlStudentMarkPassedDisciplineElement + { + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором компонентов + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + } + + #endregion + } +} diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkPassedDiscipline/ControlStudentMarkPassedDisciplineElement.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkPassedDiscipline/ControlStudentMarkPassedDisciplineElement.cs new file mode 100644 index 0000000..a6683ab --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkPassedDiscipline/ControlStudentMarkPassedDisciplineElement.cs @@ -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 +{ + /// + /// Реализация контрола для оценки + /// + public partial class ControlStudentMarkPassedDisciplineElement : + GenericControlEntityElement, + 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(); + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkPassedDiscipline/ControlStudentMarkPassedDisciplineElement.resx b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkPassedDiscipline/ControlStudentMarkPassedDisciplineElement.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkPassedDiscipline/ControlStudentMarkPassedDisciplineElement.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkPassedDiscipline/ControlStudentMarkPassedDisciplineList.Designer.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkPassedDiscipline/ControlStudentMarkPassedDisciplineList.Designer.cs new file mode 100644 index 0000000..0956587 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkPassedDiscipline/ControlStudentMarkPassedDisciplineList.Designer.cs @@ -0,0 +1,38 @@ + +namespace DepartmentWindowsDesktop.EntityControls +{ + partial class ControlStudentMarkPassedDisciplineList + { + /// + /// Обязательная переменная конструктора. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором компонентов + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + } + + #endregion + } +} diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkPassedDiscipline/ControlStudentMarkPassedDisciplineList.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkPassedDiscipline/ControlStudentMarkPassedDisciplineList.cs new file mode 100644 index 0000000..5ee5ecb --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkPassedDiscipline/ControlStudentMarkPassedDisciplineList.cs @@ -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 +{ + /// + /// Реализация контрола для списка оценок + /// + public partial class ControlStudentMarkPassedDisciplineList : + GenericControlEntityList, + 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 + }; + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkPassedDiscipline/ControlStudentMarkPassedDisciplineList.resx b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkPassedDiscipline/ControlStudentMarkPassedDisciplineList.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkPassedDiscipline/ControlStudentMarkPassedDisciplineList.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkSyncHistory/ControlStudentMarkSyncHistoryElement.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkSyncHistory/ControlStudentMarkSyncHistoryElement.cs index 8118ad1..6f9d18d 100644 --- a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkSyncHistory/ControlStudentMarkSyncHistoryElement.cs +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkSyncHistory/ControlStudentMarkSyncHistoryElement.cs @@ -8,6 +8,9 @@ using ToolsDesktop.Models; namespace DepartmentWindowsDesktop.EntityControls { + /// + /// Реализация контрола для истории синхронизации оценок + /// public partial class ControlStudentMarkSyncHistoryElement : GenericControlEntityElement, IGenericControlEntityElement diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkSyncHistory/ControlStudentMarkSyncHistoryList.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkSyncHistory/ControlStudentMarkSyncHistoryList.cs index 7c81e93..63c9656 100644 --- a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkSyncHistory/ControlStudentMarkSyncHistoryList.cs +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkSyncHistory/ControlStudentMarkSyncHistoryList.cs @@ -13,53 +13,63 @@ using ToolsModule.ManagmentSecurity; namespace DepartmentWindowsDesktop.EntityControls { + /// + /// Реализация контрола для списка историй синхронизации оценок + /// public partial class ControlStudentMarkSyncHistoryList : - GenericControlEntityList, - IGenericControlEntityList - { + GenericControlEntityList, + IGenericControlEntityList + { public ControlStudentMarkSyncHistoryList() { InitializeComponent(); - Title = "Синхронизация Оценок"; - ControlId = new Guid("1c5fb304-ceef-418a-a869-cb225b2a3f89"); - AccessOperation = AccessOperation.ОценкиСтудентов; - ControlViewEntityElement = new ControlStudentMarkSyncHistoryElement(); - _genericControlViewEntityList = this; - } + Title = "Синхронизация Оценок"; + ControlId = new Guid("1c5fb304-ceef-418a-a869-cb225b2a3f89"); + AccessOperation = AccessOperation.ОценкиСтудентов; + ControlViewEntityElement = new ControlStudentMarkSyncHistoryElement(); + _genericControlViewEntityList = this; + } - public IControl GetInstanceGenericControl() => new ControlStudentMarkSyncHistoryList() { ControlId = Guid.NewGuid() }; + public IControl GetInstanceGenericControl() => new ControlStudentMarkSyncHistoryList() { ControlId = Guid.NewGuid() }; - public ControlViewEntityListConfiguration GetConfigControl() => new() - { - PaginationOn = false, - HideToolStripButton = new List - { - ToolStripButtonListNames.toolStripButtonAdd, - ToolStripButtonListNames.toolStripButtonUpd, - ToolStripButtonListNames.toolStripButtonDel, - ToolStripButtonListNames.toolStripButtonSearch - }, - ControlOnMoveElem = new() - { - { "ToolStripMenuItemSyncStudentMarks", ("Синхронизировать оценки", async (object sender, EventArgs e) => { await SyncStudentMarks(); }) } - } - }; + public ControlViewEntityListConfiguration GetConfigControl() => new() + { + PaginationOn = false, + HideToolStripButton = new List + { + ToolStripButtonListNames.toolStripButtonAdd, + ToolStripButtonListNames.toolStripButtonUpd, + ToolStripButtonListNames.toolStripButtonDel, + ToolStripButtonListNames.toolStripButtonSearch + }, + ControlOnMoveElem = new() + { + { "ToolStripMenuItemSyncStudentMarks", ("Синхронизировать оценки", async (object sender, EventArgs e) => { await SyncStudentMarks(); }) } + } + }; - /// - /// Синхронизация приказов - /// - /// - private async Task SyncStudentMarks() - { - var flag = await _businessLogic.SyncMarks(); - if (!flag) - { - DialogHelper.MessageException(_businessLogic.Errors, "Ошибки при синхронизации"); - } - else - { - DialogHelper.MessageInformation("Завершено успешно", "Синхронизация оценок"); - } - } - } + /// + /// Синхронизация оценок + /// + /// + private async Task SyncStudentMarks() + { + try + { + var flag = await _businessLogic.SyncMarks(); + if (!flag) + { + DialogHelper.MessageException(_businessLogic.Errors, "Ошибки при синхронизации"); + } + else + { + DialogHelper.MessageInformation("Завершено успешно", "Синхронизация оценок"); + } + } + catch (Exception e) + { + DialogHelper.MessageException(e, "Синхронизация оценок"); + } + } + } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkSyncHistoryRecord/ControlStudentMarkSyncHistoryRecordElement.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkSyncHistoryRecord/ControlStudentMarkSyncHistoryRecordElement.cs index 4039558..6407b4e 100644 --- a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkSyncHistoryRecord/ControlStudentMarkSyncHistoryRecordElement.cs +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkSyncHistoryRecord/ControlStudentMarkSyncHistoryRecordElement.cs @@ -8,6 +8,9 @@ using ToolsDesktop.Models; namespace DepartmentWindowsDesktop.EntityControls { + /// + /// Реализация контрола для записи истории синхронизации оценок + /// public partial class ControlStudentMarkSyncHistoryRecordElement : GenericControlEntityElement, IGenericControlEntityElement diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkSyncHistoryRecord/ControlStudentMarkSyncHistoryRecordList.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkSyncHistoryRecord/ControlStudentMarkSyncHistoryRecordList.cs index e4961cf..ed067d6 100644 --- a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkSyncHistoryRecord/ControlStudentMarkSyncHistoryRecordList.cs +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/StudentMarkSyncHistoryRecord/ControlStudentMarkSyncHistoryRecordList.cs @@ -11,7 +11,10 @@ using ToolsModule.ManagmentSecurity; namespace DepartmentWindowsDesktop.EntityControls { - public partial class ControlStudentMarkSyncHistoryRecordList : + /// + /// Реализация контрола для списка записей истории синхронизации оценок + /// + public partial class ControlStudentMarkSyncHistoryRecordList : GenericControlEntityList, IGenericControlEntityList {