Много шагов
This commit is contained in:
parent
2ccb3f1956
commit
718ef76f20
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
using Accounting_Time_It_Company.Entities.Enums;
|
||||||
|
|
||||||
|
namespace Accounting_Time_It_Company.Entities;
|
||||||
|
|
||||||
|
public class TempWorkTime
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public int ProductId { get; private set; }
|
||||||
|
public int DirectorId { get; private set; }
|
||||||
|
public string Description { get; private set; } = string.Empty;
|
||||||
|
public int AllowanceForJob { get; private set; }
|
||||||
|
public DateTime Date { get; private set; }
|
||||||
|
public int EmployeeId { get; private set; }
|
||||||
|
public int Hours { get; private set; }
|
||||||
|
public TypePost NamePost { get; private set; }
|
||||||
|
}
|
@ -7,7 +7,7 @@ public class TypeJob
|
|||||||
|
|
||||||
public int ProductId { get; private set; }
|
public int ProductId { get; private set; }
|
||||||
|
|
||||||
public int Director { get; private set; }
|
public int DirectorId { get; private set; }
|
||||||
|
|
||||||
public string Description { get; private set; } = string.Empty;
|
public string Description { get; private set; } = string.Empty;
|
||||||
|
|
||||||
@ -19,14 +19,14 @@ public class TypeJob
|
|||||||
|
|
||||||
public IEnumerable<WorkTime> WorkTimesManager { get; private set; } = [];
|
public IEnumerable<WorkTime> WorkTimesManager { get; private set; } = [];
|
||||||
|
|
||||||
public static TypeJob CreateOperation(int id, int productId, int director, string discription, int allowanceForJob,
|
public static TypeJob CreateOperation(int id, int productId, int directorId, string discription, int allowanceForJob,
|
||||||
IEnumerable<WorkTime> workTimesDevelop, IEnumerable<WorkTime> workTimesManager)
|
IEnumerable<WorkTime> workTimesDevelop, IEnumerable<WorkTime> workTimesManager)
|
||||||
{
|
{
|
||||||
return new TypeJob
|
return new TypeJob
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
ProductId = productId,
|
ProductId = productId,
|
||||||
Director = director,
|
DirectorId = directorId,
|
||||||
Description = discription,
|
Description = discription,
|
||||||
AllowanceForJob = allowanceForJob,
|
AllowanceForJob = allowanceForJob,
|
||||||
Date = DateTime.Now,
|
Date = DateTime.Now,
|
||||||
@ -34,4 +34,20 @@ public class TypeJob
|
|||||||
WorkTimesManager = workTimesManager
|
WorkTimesManager = workTimesManager
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TypeJob CreateOperation(TempWorkTime tempWorkTime,
|
||||||
|
IEnumerable<WorkTime> workTimesDevelop, IEnumerable<WorkTime> workTimesManager)
|
||||||
|
{
|
||||||
|
return new TypeJob
|
||||||
|
{
|
||||||
|
Id = tempWorkTime.Id,
|
||||||
|
ProductId = tempWorkTime.ProductId,
|
||||||
|
DirectorId = tempWorkTime.DirectorId,
|
||||||
|
Description = tempWorkTime.Description,
|
||||||
|
AllowanceForJob = tempWorkTime.AllowanceForJob,
|
||||||
|
Date = tempWorkTime.Date,
|
||||||
|
WorkTimesDevelop = workTimesDevelop,
|
||||||
|
WorkTimesManager = workTimesManager
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,17 +5,20 @@ public class Vacation
|
|||||||
{
|
{
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
|
||||||
|
public int DirectorId { get; private set; }
|
||||||
|
|
||||||
public int EmployeeId { get; private set; }
|
public int EmployeeId { get; private set; }
|
||||||
|
|
||||||
public DateTime StartDate { get; private set; }
|
public DateTime StartDate { get; private set; }
|
||||||
|
|
||||||
public DateTime EndDate { get; private set; }
|
public DateTime EndDate { get; private set; }
|
||||||
|
|
||||||
public static Vacation CreateOpeartion(int id, int EmployeeId, DateTime startDate, DateTime endDate)
|
public static Vacation CreateOpeartion(int id, int directorId, int EmployeeId, DateTime startDate, DateTime endDate)
|
||||||
{
|
{
|
||||||
return new Vacation
|
return new Vacation
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
|
DirectorId = directorId,
|
||||||
EmployeeId = EmployeeId,
|
EmployeeId = EmployeeId,
|
||||||
StartDate = startDate,
|
StartDate = startDate,
|
||||||
EndDate = endDate
|
EndDate = endDate
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
typeJobsРаботуToolStripMenuItem = new ToolStripMenuItem();
|
typeJobsРаботуToolStripMenuItem = new ToolStripMenuItem();
|
||||||
reportsToolStripMenuItem = new ToolStripMenuItem();
|
reportsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
DirectoryReportToolStripMenuItem = new ToolStripMenuItem();
|
DirectoryReportToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
WorkAndCheelEmpToolStripMenuItem = new ToolStripMenuItem();
|
||||||
menuStrip1.SuspendLayout();
|
menuStrip1.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
@ -110,7 +111,7 @@
|
|||||||
//
|
//
|
||||||
// reportsToolStripMenuItem
|
// reportsToolStripMenuItem
|
||||||
//
|
//
|
||||||
reportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { DirectoryReportToolStripMenuItem });
|
reportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { DirectoryReportToolStripMenuItem, WorkAndCheelEmpToolStripMenuItem });
|
||||||
reportsToolStripMenuItem.Name = "reportsToolStripMenuItem";
|
reportsToolStripMenuItem.Name = "reportsToolStripMenuItem";
|
||||||
reportsToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.W;
|
reportsToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.W;
|
||||||
reportsToolStripMenuItem.Size = new Size(73, 24);
|
reportsToolStripMenuItem.Size = new Size(73, 24);
|
||||||
@ -119,10 +120,19 @@
|
|||||||
// DirectoryReportToolStripMenuItem
|
// DirectoryReportToolStripMenuItem
|
||||||
//
|
//
|
||||||
DirectoryReportToolStripMenuItem.Name = "DirectoryReportToolStripMenuItem";
|
DirectoryReportToolStripMenuItem.Name = "DirectoryReportToolStripMenuItem";
|
||||||
DirectoryReportToolStripMenuItem.Size = new Size(294, 26);
|
DirectoryReportToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.W;
|
||||||
|
DirectoryReportToolStripMenuItem.Size = new Size(350, 26);
|
||||||
DirectoryReportToolStripMenuItem.Text = "Документ со справочниками";
|
DirectoryReportToolStripMenuItem.Text = "Документ со справочниками";
|
||||||
DirectoryReportToolStripMenuItem.Click += DirectoryReportToolStripMenuItem_Click;
|
DirectoryReportToolStripMenuItem.Click += DirectoryReportToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
|
// WorkAndCheelEmpToolStripMenuItem
|
||||||
|
//
|
||||||
|
WorkAndCheelEmpToolStripMenuItem.Name = "WorkAndCheelEmpToolStripMenuItem";
|
||||||
|
WorkAndCheelEmpToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.E;
|
||||||
|
WorkAndCheelEmpToolStripMenuItem.Size = new Size(350, 26);
|
||||||
|
WorkAndCheelEmpToolStripMenuItem.Text = "Работа и отдых сотрудников";
|
||||||
|
WorkAndCheelEmpToolStripMenuItem.Click += WorkAndCheelEmpToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
// FormCompany
|
// FormCompany
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
@ -154,5 +164,6 @@
|
|||||||
private ToolStripMenuItem reportsToolStripMenuItem;
|
private ToolStripMenuItem reportsToolStripMenuItem;
|
||||||
private ToolStripMenuItem EmployeesToolStripMenuItem;
|
private ToolStripMenuItem EmployeesToolStripMenuItem;
|
||||||
private ToolStripMenuItem DirectoryReportToolStripMenuItem;
|
private ToolStripMenuItem DirectoryReportToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem WorkAndCheelEmpToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Accounting_Time_It_Company.Forms;
|
using Accounting_Time_It_Company.Forms;
|
||||||
|
using Accounting_Time_It_Company.Reports;
|
||||||
using Unity;
|
using Unity;
|
||||||
|
|
||||||
namespace Accounting_Time_It_Company
|
namespace Accounting_Time_It_Company
|
||||||
@ -103,5 +104,18 @@ namespace Accounting_Time_It_Company
|
|||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void WorkAndCheelEmpToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormEmployeeReport>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
162
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormEmployeeReport.Designer.cs
generated
Normal file
162
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormEmployeeReport.Designer.cs
generated
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
namespace Accounting_Time_It_Company.Forms
|
||||||
|
{
|
||||||
|
partial class FormEmployeeReport
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
buttonPath = new Button();
|
||||||
|
buttonBuild = new Button();
|
||||||
|
comboBoxEmployee = new ComboBox();
|
||||||
|
dateTimePickerEndDate = new DateTimePicker();
|
||||||
|
dateTimePickerStartDate = new DateTimePicker();
|
||||||
|
textBoxPath = new TextBox();
|
||||||
|
labelEmployee = new Label();
|
||||||
|
labelStartDate = new Label();
|
||||||
|
labelEndDate = new Label();
|
||||||
|
labelPath = new Label();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// buttonPath
|
||||||
|
//
|
||||||
|
buttonPath.Location = new Point(275, 39);
|
||||||
|
buttonPath.Name = "buttonPath";
|
||||||
|
buttonPath.Size = new Size(29, 29);
|
||||||
|
buttonPath.TabIndex = 0;
|
||||||
|
buttonPath.Text = "...";
|
||||||
|
buttonPath.UseVisualStyleBackColor = true;
|
||||||
|
buttonPath.Click += ButtonPath_Click;
|
||||||
|
//
|
||||||
|
// buttonBuild
|
||||||
|
//
|
||||||
|
buttonBuild.Location = new Point(112, 193);
|
||||||
|
buttonBuild.Name = "buttonBuild";
|
||||||
|
buttonBuild.Size = new Size(125, 29);
|
||||||
|
buttonBuild.TabIndex = 1;
|
||||||
|
buttonBuild.Text = "Сформировать";
|
||||||
|
buttonBuild.UseVisualStyleBackColor = true;
|
||||||
|
buttonBuild.Click += ButtonBuild_Click;
|
||||||
|
//
|
||||||
|
// comboBoxEmployee
|
||||||
|
//
|
||||||
|
comboBoxEmployee.FormattingEnabled = true;
|
||||||
|
comboBoxEmployee.Location = new Point(144, 74);
|
||||||
|
comboBoxEmployee.Name = "comboBoxEmployee";
|
||||||
|
comboBoxEmployee.Size = new Size(160, 28);
|
||||||
|
comboBoxEmployee.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// dateTimePickerEndDate
|
||||||
|
//
|
||||||
|
dateTimePickerEndDate.Location = new Point(144, 150);
|
||||||
|
dateTimePickerEndDate.Name = "dateTimePickerEndDate";
|
||||||
|
dateTimePickerEndDate.Size = new Size(160, 27);
|
||||||
|
dateTimePickerEndDate.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// dateTimePickerStartDate
|
||||||
|
//
|
||||||
|
dateTimePickerStartDate.Location = new Point(144, 112);
|
||||||
|
dateTimePickerStartDate.Name = "dateTimePickerStartDate";
|
||||||
|
dateTimePickerStartDate.Size = new Size(160, 27);
|
||||||
|
dateTimePickerStartDate.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// textBoxPath
|
||||||
|
//
|
||||||
|
textBoxPath.Location = new Point(144, 41);
|
||||||
|
textBoxPath.Name = "textBoxPath";
|
||||||
|
textBoxPath.Size = new Size(125, 27);
|
||||||
|
textBoxPath.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// labelEmployee
|
||||||
|
//
|
||||||
|
labelEmployee.AutoSize = true;
|
||||||
|
labelEmployee.Location = new Point(12, 79);
|
||||||
|
labelEmployee.Name = "labelEmployee";
|
||||||
|
labelEmployee.Size = new Size(74, 20);
|
||||||
|
labelEmployee.TabIndex = 6;
|
||||||
|
labelEmployee.Text = "Работник";
|
||||||
|
//
|
||||||
|
// labelStartDate
|
||||||
|
//
|
||||||
|
labelStartDate.AutoSize = true;
|
||||||
|
labelStartDate.Location = new Point(12, 114);
|
||||||
|
labelStartDate.Name = "labelStartDate";
|
||||||
|
labelStartDate.Size = new Size(28, 20);
|
||||||
|
labelStartDate.TabIndex = 7;
|
||||||
|
labelStartDate.Text = "С -";
|
||||||
|
//
|
||||||
|
// labelEndDate
|
||||||
|
//
|
||||||
|
labelEndDate.AutoSize = true;
|
||||||
|
labelEndDate.Location = new Point(12, 152);
|
||||||
|
labelEndDate.Name = "labelEndDate";
|
||||||
|
labelEndDate.Size = new Size(43, 20);
|
||||||
|
labelEndDate.TabIndex = 8;
|
||||||
|
labelEndDate.Text = "По - ";
|
||||||
|
//
|
||||||
|
// labelPath
|
||||||
|
//
|
||||||
|
labelPath.AutoSize = true;
|
||||||
|
labelPath.Location = new Point(12, 41);
|
||||||
|
labelPath.Name = "labelPath";
|
||||||
|
labelPath.Size = new Size(109, 20);
|
||||||
|
labelPath.TabIndex = 9;
|
||||||
|
labelPath.Text = "Путь до файла";
|
||||||
|
//
|
||||||
|
// FormEmployeeReport
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(380, 248);
|
||||||
|
Controls.Add(labelPath);
|
||||||
|
Controls.Add(labelEndDate);
|
||||||
|
Controls.Add(labelStartDate);
|
||||||
|
Controls.Add(labelEmployee);
|
||||||
|
Controls.Add(textBoxPath);
|
||||||
|
Controls.Add(dateTimePickerStartDate);
|
||||||
|
Controls.Add(dateTimePickerEndDate);
|
||||||
|
Controls.Add(comboBoxEmployee);
|
||||||
|
Controls.Add(buttonBuild);
|
||||||
|
Controls.Add(buttonPath);
|
||||||
|
Name = "FormEmployeeReport";
|
||||||
|
Text = "FormEmployeeReport";
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Button buttonPath;
|
||||||
|
private Button buttonBuild;
|
||||||
|
private ComboBox comboBoxEmployee;
|
||||||
|
private DateTimePicker dateTimePickerEndDate;
|
||||||
|
private DateTimePicker dateTimePickerStartDate;
|
||||||
|
private TextBox textBoxPath;
|
||||||
|
private Label labelEmployee;
|
||||||
|
private Label labelStartDate;
|
||||||
|
private Label labelEndDate;
|
||||||
|
private Label labelPath;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,82 @@
|
|||||||
|
using Accounting_Time_It_Company.Entities.Enums;
|
||||||
|
using Accounting_Time_It_Company.Reports;
|
||||||
|
using Accounting_Time_It_Company.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;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace Accounting_Time_It_Company.Forms
|
||||||
|
{
|
||||||
|
public partial class FormEmployeeReport : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
|
||||||
|
public FormEmployeeReport(IUnityContainer container, IEmployeeRepositories employeeRepositories)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container;
|
||||||
|
|
||||||
|
comboBoxEmployee.DataSource = employeeRepositories.ReadEmployees().Where(x => x.PostId != (int)TypePost.Director).ToList();
|
||||||
|
comboBoxEmployee.DisplayMember = "Name";
|
||||||
|
comboBoxEmployee.ValueMember = "Id";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonBuild_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(textBoxPath.Text))
|
||||||
|
{
|
||||||
|
throw new Exception("Отсутствует имя файла для отчета");
|
||||||
|
}
|
||||||
|
if (comboBoxEmployee.SelectedIndex < 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Не выбран работник");
|
||||||
|
}
|
||||||
|
if (dateTimePickerEndDate.Value <= dateTimePickerStartDate.Value)
|
||||||
|
{
|
||||||
|
throw new Exception("Дата начала должна быть раньше даты окончания");
|
||||||
|
}
|
||||||
|
if
|
||||||
|
(_container.Resolve<TableReport>().CreateTable(textBoxPath.Text,
|
||||||
|
(int)comboBoxEmployee.SelectedValue!,
|
||||||
|
dateTimePickerStartDate.Value, dateTimePickerEndDate.Value))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Документ сформирован", "Формирование документа",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Возникли ошибки при формировании документа.Подробности в логах", "Формирование документа",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при создании очета",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonPath_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var sfd = new SaveFileDialog()
|
||||||
|
{
|
||||||
|
Filter = "Excel Files | *.xlsx"
|
||||||
|
};
|
||||||
|
if (sfd.ShowDialog() != DialogResult.OK)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
textBoxPath.Text = sfd.FileName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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>
|
@ -67,7 +67,7 @@ namespace Accounting_Time_It_Company.Forms
|
|||||||
}
|
}
|
||||||
list.Add(WorkTime.CreateElement(0, Convert.ToInt32(row.Cells[0].Value), Convert.ToInt32(row.Cells[1].Value)));
|
list.Add(WorkTime.CreateElement(0, Convert.ToInt32(row.Cells[0].Value), Convert.ToInt32(row.Cells[1].Value)));
|
||||||
}
|
}
|
||||||
return list;
|
return list.GroupBy(x => x.EmployeeId, x => x.Hours, (id, hours) => WorkTime.CreateElement(0, id, hours.Sum())).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,12 +36,14 @@
|
|||||||
dateTimePickerEndDate = new DateTimePicker();
|
dateTimePickerEndDate = new DateTimePicker();
|
||||||
buttonCansle = new Button();
|
buttonCansle = new Button();
|
||||||
buttonSave = new Button();
|
buttonSave = new Button();
|
||||||
|
comboBoxDirector = new ComboBox();
|
||||||
|
labelDirector = new Label();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// labelEmployee
|
// labelEmployee
|
||||||
//
|
//
|
||||||
labelEmployee.AutoSize = true;
|
labelEmployee.AutoSize = true;
|
||||||
labelEmployee.Location = new Point(12, 9);
|
labelEmployee.Location = new Point(12, 43);
|
||||||
labelEmployee.Name = "labelEmployee";
|
labelEmployee.Name = "labelEmployee";
|
||||||
labelEmployee.Size = new Size(77, 20);
|
labelEmployee.Size = new Size(77, 20);
|
||||||
labelEmployee.TabIndex = 0;
|
labelEmployee.TabIndex = 0;
|
||||||
@ -51,14 +53,14 @@
|
|||||||
//
|
//
|
||||||
comboBoxEmployee.DropDownStyle = ComboBoxStyle.DropDownList;
|
comboBoxEmployee.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
comboBoxEmployee.FormattingEnabled = true;
|
comboBoxEmployee.FormattingEnabled = true;
|
||||||
comboBoxEmployee.Location = new Point(112, 6);
|
comboBoxEmployee.Location = new Point(179, 40);
|
||||||
comboBoxEmployee.Name = "comboBoxEmployee";
|
comboBoxEmployee.Name = "comboBoxEmployee";
|
||||||
comboBoxEmployee.Size = new Size(203, 28);
|
comboBoxEmployee.Size = new Size(203, 28);
|
||||||
comboBoxEmployee.TabIndex = 1;
|
comboBoxEmployee.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// dateTimePickerStartDate
|
// dateTimePickerStartDate
|
||||||
//
|
//
|
||||||
dateTimePickerStartDate.Location = new Point(112, 40);
|
dateTimePickerStartDate.Location = new Point(179, 74);
|
||||||
dateTimePickerStartDate.Name = "dateTimePickerStartDate";
|
dateTimePickerStartDate.Name = "dateTimePickerStartDate";
|
||||||
dateTimePickerStartDate.Size = new Size(203, 27);
|
dateTimePickerStartDate.Size = new Size(203, 27);
|
||||||
dateTimePickerStartDate.TabIndex = 2;
|
dateTimePickerStartDate.TabIndex = 2;
|
||||||
@ -66,7 +68,7 @@
|
|||||||
// labelStartDate
|
// labelStartDate
|
||||||
//
|
//
|
||||||
labelStartDate.AutoSize = true;
|
labelStartDate.AutoSize = true;
|
||||||
labelStartDate.Location = new Point(12, 45);
|
labelStartDate.Location = new Point(12, 79);
|
||||||
labelStartDate.Name = "labelStartDate";
|
labelStartDate.Name = "labelStartDate";
|
||||||
labelStartDate.Size = new Size(64, 20);
|
labelStartDate.Size = new Size(64, 20);
|
||||||
labelStartDate.TabIndex = 3;
|
labelStartDate.TabIndex = 3;
|
||||||
@ -75,7 +77,7 @@
|
|||||||
// labelEndDate
|
// labelEndDate
|
||||||
//
|
//
|
||||||
labelEndDate.AutoSize = true;
|
labelEndDate.AutoSize = true;
|
||||||
labelEndDate.Location = new Point(12, 79);
|
labelEndDate.Location = new Point(12, 113);
|
||||||
labelEndDate.Name = "labelEndDate";
|
labelEndDate.Name = "labelEndDate";
|
||||||
labelEndDate.Size = new Size(56, 20);
|
labelEndDate.Size = new Size(56, 20);
|
||||||
labelEndDate.TabIndex = 4;
|
labelEndDate.TabIndex = 4;
|
||||||
@ -83,14 +85,14 @@
|
|||||||
//
|
//
|
||||||
// dateTimePickerEndDate
|
// dateTimePickerEndDate
|
||||||
//
|
//
|
||||||
dateTimePickerEndDate.Location = new Point(112, 74);
|
dateTimePickerEndDate.Location = new Point(179, 108);
|
||||||
dateTimePickerEndDate.Name = "dateTimePickerEndDate";
|
dateTimePickerEndDate.Name = "dateTimePickerEndDate";
|
||||||
dateTimePickerEndDate.Size = new Size(203, 27);
|
dateTimePickerEndDate.Size = new Size(203, 27);
|
||||||
dateTimePickerEndDate.TabIndex = 5;
|
dateTimePickerEndDate.TabIndex = 5;
|
||||||
//
|
//
|
||||||
// buttonCansle
|
// buttonCansle
|
||||||
//
|
//
|
||||||
buttonCansle.Location = new Point(221, 123);
|
buttonCansle.Location = new Point(288, 157);
|
||||||
buttonCansle.Name = "buttonCansle";
|
buttonCansle.Name = "buttonCansle";
|
||||||
buttonCansle.Size = new Size(94, 29);
|
buttonCansle.Size = new Size(94, 29);
|
||||||
buttonCansle.TabIndex = 24;
|
buttonCansle.TabIndex = 24;
|
||||||
@ -100,7 +102,7 @@
|
|||||||
//
|
//
|
||||||
// buttonSave
|
// buttonSave
|
||||||
//
|
//
|
||||||
buttonSave.Location = new Point(112, 123);
|
buttonSave.Location = new Point(179, 157);
|
||||||
buttonSave.Name = "buttonSave";
|
buttonSave.Name = "buttonSave";
|
||||||
buttonSave.Size = new Size(94, 29);
|
buttonSave.Size = new Size(94, 29);
|
||||||
buttonSave.TabIndex = 23;
|
buttonSave.TabIndex = 23;
|
||||||
@ -108,11 +110,31 @@
|
|||||||
buttonSave.UseVisualStyleBackColor = true;
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
buttonSave.Click += ButtonSave_Click;
|
buttonSave.Click += ButtonSave_Click;
|
||||||
//
|
//
|
||||||
|
// comboBoxDirector
|
||||||
|
//
|
||||||
|
comboBoxDirector.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxDirector.FormattingEnabled = true;
|
||||||
|
comboBoxDirector.Location = new Point(179, 6);
|
||||||
|
comboBoxDirector.Name = "comboBoxDirector";
|
||||||
|
comboBoxDirector.Size = new Size(203, 28);
|
||||||
|
comboBoxDirector.TabIndex = 26;
|
||||||
|
//
|
||||||
|
// labelDirector
|
||||||
|
//
|
||||||
|
labelDirector.AutoSize = true;
|
||||||
|
labelDirector.Location = new Point(12, 9);
|
||||||
|
labelDirector.Name = "labelDirector";
|
||||||
|
labelDirector.Size = new Size(118, 20);
|
||||||
|
labelDirector.TabIndex = 25;
|
||||||
|
labelDirector.Text = "Ответственный:";
|
||||||
|
//
|
||||||
// FormVacation
|
// FormVacation
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(321, 157);
|
ClientSize = new Size(383, 192);
|
||||||
|
Controls.Add(comboBoxDirector);
|
||||||
|
Controls.Add(labelDirector);
|
||||||
Controls.Add(buttonCansle);
|
Controls.Add(buttonCansle);
|
||||||
Controls.Add(buttonSave);
|
Controls.Add(buttonSave);
|
||||||
Controls.Add(dateTimePickerEndDate);
|
Controls.Add(dateTimePickerEndDate);
|
||||||
@ -138,5 +160,7 @@
|
|||||||
private DateTimePicker dateTimePickerEndDate;
|
private DateTimePicker dateTimePickerEndDate;
|
||||||
private Button buttonCansle;
|
private Button buttonCansle;
|
||||||
private Button buttonSave;
|
private Button buttonSave;
|
||||||
|
private ComboBox comboBoxDirector;
|
||||||
|
private Label labelDirector;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,5 @@
|
|||||||
using Accounting_Time_It_Company.Entities;
|
using Accounting_Time_It_Company.Entities;
|
||||||
|
using Accounting_Time_It_Company.Entities.Enums;
|
||||||
using Accounting_Time_It_Company.Repositories;
|
using Accounting_Time_It_Company.Repositories;
|
||||||
|
|
||||||
namespace Accounting_Time_It_Company.Forms
|
namespace Accounting_Time_It_Company.Forms
|
||||||
@ -12,7 +13,11 @@ namespace Accounting_Time_It_Company.Forms
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_vacationRepositories = vacationRepositories ?? throw new ArgumentNullException(nameof(vacationRepositories));
|
_vacationRepositories = vacationRepositories ?? throw new ArgumentNullException(nameof(vacationRepositories));
|
||||||
|
|
||||||
comboBoxEmployee.DataSource = employeeRepositories.ReadEmployees();
|
comboBoxDirector.DataSource = employeeRepositories.ReadEmployees().Where(x => x.PostId == (int)TypePost.Director).ToList();
|
||||||
|
comboBoxDirector.DisplayMember = "Name";
|
||||||
|
comboBoxDirector.ValueMember = "Id";
|
||||||
|
|
||||||
|
comboBoxEmployee.DataSource = employeeRepositories.ReadEmployees().Where(x => x.PostId != (int)TypePost.Director).ToList();
|
||||||
comboBoxEmployee.DisplayMember = "Name";
|
comboBoxEmployee.DisplayMember = "Name";
|
||||||
comboBoxEmployee.ValueMember = "Id";
|
comboBoxEmployee.ValueMember = "Id";
|
||||||
}
|
}
|
||||||
@ -26,7 +31,7 @@ namespace Accounting_Time_It_Company.Forms
|
|||||||
throw new Exception("Имеются незаполненные поля");
|
throw new Exception("Имеются незаполненные поля");
|
||||||
}
|
}
|
||||||
|
|
||||||
_vacationRepositories.CreateVacation(Vacation.CreateOpeartion(0, (int)comboBoxEmployee.SelectedValue!,
|
_vacationRepositories.CreateVacation(Vacation.CreateOpeartion(0, (int)comboBoxDirector.SelectedValue!, (int)comboBoxEmployee.SelectedValue!,
|
||||||
dateTimePickerStartDate.Value, dateTimePickerEndDate.Value));
|
dateTimePickerStartDate.Value, dateTimePickerEndDate.Value));
|
||||||
|
|
||||||
Close();
|
Close();
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
using Accounting_Time_It_Company.Entities;
|
using Accounting_Time_It_Company.Entities;
|
||||||
using Accounting_Time_It_Company.Repositories;
|
using Accounting_Time_It_Company.Repositories;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Diagnostics.Metrics;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Accounting_Time_It_Company.Reports;
|
namespace Accounting_Time_It_Company.Reports;
|
||||||
|
|
||||||
@ -11,7 +13,7 @@ internal class TableReport
|
|||||||
private readonly IVacationRepositories _vacationRepositories;
|
private readonly IVacationRepositories _vacationRepositories;
|
||||||
private readonly ILogger<TableReport> _logger;
|
private readonly ILogger<TableReport> _logger;
|
||||||
|
|
||||||
internal static readonly string[] item = ["Сотрудник", "Дата", "Количество пришло", "Количество ушло"];
|
internal static readonly string[] item = ["Ответственный", "Дата", "Отработано часов", "Дней отпуска"];
|
||||||
|
|
||||||
public TableReport(ITypeJobRepositories typeJobRepositories,
|
public TableReport(ITypeJobRepositories typeJobRepositories,
|
||||||
IVacationRepositories vacationRepositories, ILogger<TableReport> logger)
|
IVacationRepositories vacationRepositories, ILogger<TableReport> logger)
|
||||||
@ -25,14 +27,14 @@ internal class TableReport
|
|||||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CreateTable(string filePath, int feedId, DateTime startDate, DateTime endDate)
|
public bool CreateTable(string filePath, int employeeId, DateTime startDate, DateTime endDate)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
new ExcelBuilder(filePath)
|
new ExcelBuilder(filePath)
|
||||||
.AddHeader("Сводка по работе сотрудников", 0, 4)
|
.AddHeader("Сводка по работе сотрудников", 0, 6)
|
||||||
.AddParagraph("за период", 0)
|
.AddParagraph("за период", 0)
|
||||||
.AddTable([10, 10, 15, 15], GetData(feedId, startDate, endDate)).Build();
|
.AddTable([10, 10, 15, 15], GetData(employeeId, startDate, endDate)).Build();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -44,18 +46,17 @@ internal class TableReport
|
|||||||
|
|
||||||
private List<string[]> GetData(int employeeId, DateTime startDate, DateTime endDate)
|
private List<string[]> GetData(int employeeId, DateTime startDate, DateTime endDate)
|
||||||
{
|
{
|
||||||
|
// бяда
|
||||||
var data = _typeJobRepositories
|
var data = _typeJobRepositories
|
||||||
.ReadTypeJobs()
|
.ReadTypeJobs()
|
||||||
.Where(x => x.Date >= startDate && x.Date <= endDate
|
.Where(x => x.Date >= startDate && x.Date <= endDate
|
||||||
&& (x.WorkTimesDevelop.Any(y => y.EmployeeId == employeeId)
|
&& (x.WorkTimesDevelop.Any(y => y.EmployeeId == employeeId)
|
||||||
|| x.WorkTimesManager.Any(y => y.EmployeeId == employeeId)))
|
|| x.WorkTimesManager.Any(y => y.EmployeeId == employeeId)))
|
||||||
.Select(x => new {
|
.Select(x => new {
|
||||||
x.ProductId,
|
x.DirectorId,
|
||||||
x.Date,
|
x.Date,
|
||||||
CountInManager = x.WorkTimesManager.FirstOrDefault(y => y.EmployeeId == employeeId)?.Hours,
|
CountIn = x.WorkTimesManager.Concat(x.WorkTimesDevelop).FirstOrDefault(y => y.EmployeeId == employeeId)?.Hours,
|
||||||
CountOutManager = (int?)null,
|
CountOut = (int?)null,
|
||||||
CountInDevelop = x.WorkTimesDevelop.FirstOrDefault(y => y.EmployeeId == employeeId)?.Hours,
|
|
||||||
CountOutDevelop = (int?)null
|
|
||||||
})
|
})
|
||||||
.Union(_vacationRepositories
|
.Union(_vacationRepositories
|
||||||
.ReadVacations()
|
.ReadVacations()
|
||||||
@ -63,21 +64,19 @@ internal class TableReport
|
|||||||
&& x.StartDate <= endDate
|
&& x.StartDate <= endDate
|
||||||
&& x.EmployeeId == employeeId)
|
&& x.EmployeeId == employeeId)
|
||||||
.Select(x => new {
|
.Select(x => new {
|
||||||
x.EmployeeId,
|
x.DirectorId,
|
||||||
Date = x.StartDate,
|
Date = x.StartDate,
|
||||||
CountIn = (int?)null,
|
CountIn = (int?)null,
|
||||||
CountOut = (int?)x.Ration
|
CountOut = (int?)(x.EndDate - x.StartDate).TotalDays,
|
||||||
}))
|
}))
|
||||||
.OrderBy(x => x.Date);
|
.OrderBy(x => x.Date);
|
||||||
|
|
||||||
return
|
return new List<string[]>() { item }
|
||||||
new List<string[]>() { item }
|
|
||||||
.Union(data.Select(x => new string[] {
|
.Union(data.Select(x => new string[] {
|
||||||
x.EmployeeId.ToString(), x.Date.ToString(), x.CountIn?.ToString() ??
|
x.DirectorId.ToString(), x.Date.ToString(),
|
||||||
string.Empty, x.CountOut?.ToString() ?? string.Empty}))
|
x.CountIn?.ToString() ?? string.Empty, x.CountOut?.ToString() ?? string.Empty}))
|
||||||
.Union(
|
.Union(
|
||||||
[["Всего", "", data.Sum(x => x.CountIn ?? 0).ToString(),
|
[["Всего", "", data.Sum(x => x.CountIn ?? 0).ToString(), data.Sum(x => x.CountOut ?? 0).ToString()]])
|
||||||
data.Sum(x => x.CountOut ?? 0).ToString()]])
|
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ public interface IVacationRepositories
|
|||||||
{
|
{
|
||||||
IEnumerable<Vacation> ReadVacations(DateTime? startDateFrom = null, DateTime? startDateTo = null,
|
IEnumerable<Vacation> ReadVacations(DateTime? startDateFrom = null, DateTime? startDateTo = null,
|
||||||
DateTime? endDateFrom = null, DateTime? endtDateTo = null,
|
DateTime? endDateFrom = null, DateTime? endtDateTo = null,
|
||||||
int? employeeId = null);
|
int? employeeId = null, int? directorId = null);
|
||||||
|
|
||||||
void CreateVacation(Vacation vacation);
|
void CreateVacation(Vacation vacation);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Accounting_Time_It_Company.Entities;
|
using Accounting_Time_It_Company.Entities;
|
||||||
|
using Accounting_Time_It_Company.Entities.Enums;
|
||||||
using Dapper;
|
using Dapper;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@ -30,7 +31,7 @@ public class TypeJobRepositories : ITypeJobRepositories
|
|||||||
using var transaction = connection.BeginTransaction();
|
using var transaction = connection.BeginTransaction();
|
||||||
var queryInsert = @"
|
var queryInsert = @"
|
||||||
INSERT INTO TypeJob
|
INSERT INTO TypeJob
|
||||||
VALUES (DEFAULT, @ProductId, @Director, @Description, @AllowanceForJob, @Date);
|
VALUES (DEFAULT, @ProductId, @DirectorId, @Description, @AllowanceForJob, @Date);
|
||||||
SELECT MAX(Id) FROM TypeJob";
|
SELECT MAX(Id) FROM TypeJob";
|
||||||
var typeJobId = connection.QueryFirst<int>(queryInsert, typeJob, transaction);
|
var typeJobId = connection.QueryFirst<int>(queryInsert, typeJob, transaction);
|
||||||
var querySubInsert = @"
|
var querySubInsert = @"
|
||||||
@ -92,11 +93,17 @@ public class TypeJobRepositories : ITypeJobRepositories
|
|||||||
{
|
{
|
||||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
connection.Open();
|
connection.Open();
|
||||||
var querySelect = @"SELECT * FROM TypeJob";
|
var querySelect = @"SELECT tj.*, wt.EmployeeId, wt.Hours, p.namepost
|
||||||
var typeJobs = connection.Query<TypeJob>(querySelect);
|
FROM TypeJob tj
|
||||||
_logger.LogDebug("Полученные объекты: {json}",
|
INNER JOIN WorkTime wt ON wt.typejobid = tj.id
|
||||||
JsonConvert.SerializeObject(typeJobs));
|
INNER JOIN Employee e ON e.id = wt.employeeid
|
||||||
return typeJobs;
|
INNER JOIN Post p ON p.id = e.PostId;";
|
||||||
|
var typeJobs = connection.Query<TempWorkTime>(querySelect);
|
||||||
|
_logger.LogDebug("Полученные объекты: {json}", JsonConvert.SerializeObject(typeJobs));
|
||||||
|
return typeJobs.GroupBy(x => x.Id, y => y,
|
||||||
|
(key, value) => TypeJob.CreateOperation(value.First(),
|
||||||
|
value.Where(z => z.NamePost == TypePost.Developer).Select(h => WorkTime.CreateElement(0, h.EmployeeId, h.Hours)).ToList(),
|
||||||
|
value.Where(z => z.NamePost == TypePost.Manager).Select(h => WorkTime.CreateElement(0, h.EmployeeId, h.Hours)).ToList())).ToList();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,7 @@ public class VacationRepositories : IVacationRepositories
|
|||||||
connection.Open();
|
connection.Open();
|
||||||
var queryInsert = @"
|
var queryInsert = @"
|
||||||
INSERT INTO Vacation
|
INSERT INTO Vacation
|
||||||
VALUES (DEFAULT, @EmployeeId, @StartDate, @EndDate)";
|
VALUES (DEFAULT, @DirectorId, @EmployeeId, @StartDate, @EndDate)";
|
||||||
connection.Execute(queryInsert, vacation);
|
connection.Execute(queryInsert, vacation);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -40,7 +40,8 @@ public class VacationRepositories : IVacationRepositories
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Vacation> ReadVacations(DateTime? startDateFrom = null, DateTime? startDateTo = null,
|
public IEnumerable<Vacation> ReadVacations(DateTime? startDateFrom = null, DateTime? startDateTo = null,
|
||||||
DateTime? endDateFrom = null, DateTime? endtDateTo = null, int? employeeId = null)
|
DateTime? endDateFrom = null, DateTime? endtDateTo = null,
|
||||||
|
int? employeeId = null, int? directorId = null)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Получение всех объектов");
|
_logger.LogInformation("Получение всех объектов");
|
||||||
try
|
try
|
||||||
|
Loading…
x
Reference in New Issue
Block a user