Compare commits
No commits in common. "lab4" and "main" have entirely different histories.
@ -1,13 +0,0 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Rider ignored files
|
||||
/projectSettingsUpdater.xml
|
||||
/modules.xml
|
||||
/.idea.ProjectGSM.iml
|
||||
/contentModel.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise">
|
||||
<file url="file://$PROJECT_DIR$/FormAdvocateApp.cs" charset="windows-1251" />
|
||||
</component>
|
||||
</project>
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -1,71 +0,0 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ProjectGSM.Repositories;
|
||||
|
||||
namespace ProjectGSM.Documents;
|
||||
|
||||
public class ChartReport
|
||||
{
|
||||
private readonly ICaseRepository _caseRepository;
|
||||
private readonly ICaseAdvocateRepository _caseAdvocateRepository;
|
||||
private readonly IAdvocateRepository _advocateRepository;
|
||||
private readonly ILogger<ChartReport> _logger;
|
||||
|
||||
public ChartReport(ICaseRepository caseRepository,
|
||||
IAdvocateRepository advocateRepository,
|
||||
ICaseAdvocateRepository caseAdvocateRepository,
|
||||
ILogger<ChartReport> logger)
|
||||
{
|
||||
_caseRepository = caseRepository ??
|
||||
throw new
|
||||
ArgumentNullException(nameof(caseRepository));
|
||||
_advocateRepository = advocateRepository ??
|
||||
throw new ArgumentNullException(nameof(advocateRepository));
|
||||
_caseAdvocateRepository = caseAdvocateRepository ??
|
||||
throw new ArgumentNullException(nameof(caseAdvocateRepository));
|
||||
_logger = logger ??
|
||||
throw new ArgumentNullException(nameof(logger));
|
||||
}
|
||||
|
||||
public bool CreateChart(string filePath, DateTime dateTime)
|
||||
{
|
||||
try
|
||||
{
|
||||
new PdfBuilder(filePath)
|
||||
.AddHeader("Доля выручки адвоката")
|
||||
.AddPieChart($"Всего до: {dateTime.Date}", GetData(dateTime))
|
||||
.Build();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при формировании документа");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private List<(string, double)> GetData(DateTime dateTime)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _caseAdvocateRepository
|
||||
.ReadCaseAdvocates(dateTo: dateTime.Date.AddDays(1))
|
||||
.Join(_caseRepository.ReadCases(dateTime.Date.AddDays(1)),
|
||||
caseItem => caseItem.CaseId,
|
||||
caseCaseId => caseCaseId.Id,
|
||||
(caseItem, caseCase) => new
|
||||
{
|
||||
caseItem.AdvocateName, caseCase.Payment, caseCase.Verdict, caseCase.Price, caseCase.VictoryPrice
|
||||
})
|
||||
.GroupBy(x => x.AdvocateName)
|
||||
.Select(g => (g.Key,
|
||||
Sum: g.Sum(x =>
|
||||
x.Payment ? (x.Verdict ? (double)(x.Price + x.VictoryPrice) : (double)x.Price) : 0)))
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error occurred while calculating advocate earnings");
|
||||
return new List<(string, double)>();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,113 +0,0 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ProjectGSM.Repositories;
|
||||
|
||||
namespace ProjectGSM.Documents;
|
||||
|
||||
public class DocReport
|
||||
{
|
||||
private readonly IAdvocateRepository _advocateRepository;
|
||||
private readonly IClientRepository _clientRepository;
|
||||
private readonly ICourtRepository _courtRepository;
|
||||
private readonly ILogger<DocReport> _logger;
|
||||
|
||||
public DocReport(IAdvocateRepository advocateRepository, IClientRepository
|
||||
clientRepository,
|
||||
ICourtRepository courtRepository, ILogger<DocReport> logger)
|
||||
{
|
||||
_advocateRepository = advocateRepository ??
|
||||
throw new
|
||||
ArgumentNullException(nameof(advocateRepository));
|
||||
_clientRepository = clientRepository ??
|
||||
throw new ArgumentNullException(nameof(clientRepository));
|
||||
_courtRepository = courtRepository ??
|
||||
throw new ArgumentNullException(nameof(courtRepository));
|
||||
_logger = logger ??
|
||||
throw new ArgumentNullException(nameof(logger));
|
||||
}
|
||||
|
||||
public bool CreateDoc(string filePath, bool includeAdvocates, bool
|
||||
includeClients, bool includeCourts)
|
||||
{
|
||||
try
|
||||
{
|
||||
var builder = new WordBuilder(filePath)
|
||||
.AddHeader("Документ со справочниками");
|
||||
if (includeAdvocates)
|
||||
{
|
||||
builder.AddParagraph("Адвокаты")
|
||||
.AddTable([2400, 1200, 2400, 1200, 1200, 1200, 2400, 2400, 2400, 5000],
|
||||
GetAdvocates());
|
||||
}
|
||||
|
||||
if (includeClients)
|
||||
{
|
||||
builder.AddParagraph("Клиенты")
|
||||
.AddTable([2400, 2400, 2400, 2400, 2400, 2400], GetClients());
|
||||
}
|
||||
|
||||
if (includeCourts)
|
||||
{
|
||||
builder.AddParagraph("Суды")
|
||||
.AddTable([2400, 2400], GetCourts());
|
||||
}
|
||||
|
||||
builder.Build();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при формировании документа");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private List<string[]> GetAdvocates()
|
||||
{
|
||||
return
|
||||
[
|
||||
[
|
||||
"ФИО", "Пол", "Дата рождения", "Опыт", "Кол-во завершенных дел", "Рейтинг", "E-mail", "Номер телефона",
|
||||
"Адрес", "Лицензии"
|
||||
],
|
||||
.. _advocateRepository
|
||||
.ReadAdvocates()
|
||||
.Select(x => new[]
|
||||
{
|
||||
x.Name,
|
||||
x.Sex ? "Мужчина" : "Женщина", x.DateOfBirth.ToShortDateString(), x.Experience.ToString(),
|
||||
x.CompletedTasks.ToString(), x.Rating.ToString(), x.Email, x.PhoneNumber, x.Address,
|
||||
x.LicenseType.ToString()
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
private List<string[]> GetClients()
|
||||
{
|
||||
return
|
||||
[
|
||||
["ФИО", "Пол", "Дата рождения", "E-mail", "Номер телефона", "Адрес"],
|
||||
.. _clientRepository
|
||||
.ReadClients()
|
||||
.Select(x => new[]
|
||||
{
|
||||
x.Name,
|
||||
x.Sex ? "Мужчина" : "Женщина", x.DateOfBirth.ToShortDateString(), x.Email, x.PhoneNumber, x.Address
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
private List<string[]> GetCourts()
|
||||
{
|
||||
return
|
||||
[
|
||||
["Название", "Адрес"],
|
||||
.. _courtRepository
|
||||
.ReadCourts()
|
||||
.Select(x => new[]
|
||||
{
|
||||
x.Name,
|
||||
x.Address
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
@ -1,322 +0,0 @@
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
|
||||
namespace ProjectGSM.Documents;
|
||||
|
||||
internal class ExcelBuilder
|
||||
{
|
||||
private readonly string _filePath;
|
||||
|
||||
private readonly SheetData _sheetData;
|
||||
|
||||
private readonly MergeCells _mergeCells;
|
||||
|
||||
private readonly Columns _columns;
|
||||
|
||||
private uint _rowIndex = 0;
|
||||
|
||||
public ExcelBuilder(string filePath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(filePath))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(filePath));
|
||||
}
|
||||
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
|
||||
_filePath = filePath;
|
||||
_sheetData = new SheetData();
|
||||
_mergeCells = new MergeCells();
|
||||
_columns = new Columns();
|
||||
_rowIndex = 1;
|
||||
}
|
||||
|
||||
public ExcelBuilder AddHeader(string header, int startIndex, int count)
|
||||
{
|
||||
CreateCell(startIndex, _rowIndex, header, StyleIndex.BoldTextWithoutBorder);
|
||||
for (int i = startIndex + 1; i < startIndex + count; ++i)
|
||||
{
|
||||
CreateCell(i, _rowIndex, "", StyleIndex.SimpleTextWithoutBorder);
|
||||
}
|
||||
|
||||
_mergeCells.Append(new MergeCell()
|
||||
{
|
||||
Reference =
|
||||
new StringValue($"{GetExcelColumnName(startIndex)}{_rowIndex}:{GetExcelColumnName(startIndex + count - 1)}{_rowIndex}")
|
||||
});
|
||||
|
||||
_rowIndex++;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ExcelBuilder AddParagraph(string text, int columnIndex)
|
||||
{
|
||||
CreateCell(columnIndex, _rowIndex++, text, StyleIndex.SimpleTextWithoutBorder);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ExcelBuilder AddTable(int[] columnsWidths, List<string[]> data)
|
||||
{
|
||||
if (columnsWidths == null || columnsWidths.Length == 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(columnsWidths));
|
||||
}
|
||||
|
||||
if (data == null || data.Count == 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(data));
|
||||
}
|
||||
|
||||
if (data.Any(x => x.Length != columnsWidths.Length))
|
||||
{
|
||||
throw new InvalidOperationException("columnsWidths.Length != data.Length");
|
||||
}
|
||||
|
||||
uint counter = 1;
|
||||
int coef = 2;
|
||||
_columns.Append(columnsWidths.Select(x => new Column
|
||||
{
|
||||
Min = counter,
|
||||
Max = counter++,
|
||||
Width = x * coef,
|
||||
CustomWidth = true
|
||||
}));
|
||||
|
||||
for (var j = 0; j < data.First().Length; ++j)
|
||||
{
|
||||
CreateCell(j, _rowIndex, data.First()[j], StyleIndex.BoldTextWithBorder);
|
||||
}
|
||||
|
||||
_rowIndex++;
|
||||
for (var i = 1; i < data.Count - 1; ++i)
|
||||
{
|
||||
for (var j = 0; j < data[i].Length; ++j)
|
||||
{
|
||||
CreateCell(j, _rowIndex, data[i][j], StyleIndex.SimpleTextWithBorder);
|
||||
}
|
||||
|
||||
_rowIndex++;
|
||||
}
|
||||
|
||||
for (var j = 0; j < data.Last().Length; ++j)
|
||||
{
|
||||
CreateCell(j, _rowIndex, data.Last()[j], StyleIndex.BoldTextWithBorder);
|
||||
}
|
||||
|
||||
_rowIndex++;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void Build()
|
||||
{
|
||||
using var spreadsheetDocument = SpreadsheetDocument.Create(_filePath, SpreadsheetDocumentType.Workbook);
|
||||
var workbookpart = spreadsheetDocument.AddWorkbookPart();
|
||||
GenerateStyle(workbookpart);
|
||||
workbookpart.Workbook = new Workbook();
|
||||
var worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
|
||||
worksheetPart.Worksheet = new Worksheet();
|
||||
if (_columns.HasChildren)
|
||||
{
|
||||
worksheetPart.Worksheet.Append(_columns);
|
||||
}
|
||||
|
||||
worksheetPart.Worksheet.Append(_sheetData);
|
||||
var sheets = spreadsheetDocument.WorkbookPart!.Workbook.AppendChild(new Sheets());
|
||||
var sheet = new Sheet()
|
||||
{
|
||||
Id = spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
|
||||
SheetId = 1,
|
||||
Name = "Лист 1"
|
||||
};
|
||||
|
||||
sheets.Append(sheet);
|
||||
if (_mergeCells.HasChildren)
|
||||
{
|
||||
worksheetPart.Worksheet.InsertAfter(_mergeCells, worksheetPart.Worksheet.Elements<SheetData>().First());
|
||||
}
|
||||
}
|
||||
|
||||
private static void GenerateStyle(WorkbookPart workbookPart)
|
||||
{
|
||||
var workbookStylesPart = workbookPart.AddNewPart<WorkbookStylesPart>();
|
||||
workbookStylesPart.Stylesheet = new Stylesheet();
|
||||
|
||||
var fonts = new Fonts() { Count = 2, KnownFonts = BooleanValue.FromBoolean(true) };
|
||||
fonts.Append(new DocumentFormat.OpenXml.Spreadsheet.Font
|
||||
{
|
||||
FontSize = new FontSize() { Val = 11 },
|
||||
FontName = new FontName() { Val = "Calibri" },
|
||||
FontFamilyNumbering = new FontFamilyNumbering() { Val = 2 },
|
||||
FontScheme = new FontScheme() { Val = new EnumValue<FontSchemeValues>(FontSchemeValues.Minor) }
|
||||
});
|
||||
|
||||
fonts.Append(new DocumentFormat.OpenXml.Spreadsheet.Font
|
||||
{
|
||||
FontSize = new FontSize() { Val = 11 },
|
||||
FontName = new FontName() { Val = "Calibri" },
|
||||
FontFamilyNumbering = new FontFamilyNumbering() { Val = 2 },
|
||||
FontScheme = new FontScheme() { Val = new EnumValue<FontSchemeValues>(FontSchemeValues.Minor) },
|
||||
Bold = new Bold() { Val = true }
|
||||
});
|
||||
|
||||
workbookStylesPart.Stylesheet.Append(fonts);
|
||||
|
||||
// Default Fill
|
||||
var fills = new Fills() { Count = 1 };
|
||||
fills.Append(new Fill
|
||||
{
|
||||
PatternFill = new PatternFill() { PatternType = new EnumValue<PatternValues>(PatternValues.None) }
|
||||
});
|
||||
workbookStylesPart.Stylesheet.Append(fills);
|
||||
|
||||
// Default Border
|
||||
var borders = new Borders() { Count = 2 };
|
||||
borders.Append(new Border
|
||||
{
|
||||
LeftBorder = new LeftBorder(),
|
||||
RightBorder = new RightBorder(),
|
||||
TopBorder = new TopBorder(),
|
||||
BottomBorder = new BottomBorder(),
|
||||
DiagonalBorder = new DiagonalBorder()
|
||||
});
|
||||
|
||||
borders.Append(new Border
|
||||
{
|
||||
LeftBorder = new LeftBorder() { Style = BorderStyleValues.Thin },
|
||||
RightBorder = new RightBorder() { Style = BorderStyleValues.Thin },
|
||||
TopBorder = new TopBorder() { Style = BorderStyleValues.Thin },
|
||||
BottomBorder = new BottomBorder() { Style = BorderStyleValues.Thin },
|
||||
DiagonalBorder = new DiagonalBorder()
|
||||
});
|
||||
workbookStylesPart.Stylesheet.Append(borders);
|
||||
|
||||
// Default cell format and a date cell format
|
||||
var cellFormats = new CellFormats() { Count = 4 };
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = 0,
|
||||
FormatId = 0,
|
||||
FontId = 0,
|
||||
BorderId = 0,
|
||||
FillId = 0,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Horizontal = HorizontalAlignmentValues.Left,
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
});
|
||||
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = 0,
|
||||
FormatId = 0,
|
||||
FontId = 0,
|
||||
BorderId = 1,
|
||||
FillId = 0,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Horizontal = HorizontalAlignmentValues.Right,
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
});
|
||||
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = 0,
|
||||
FormatId = 0,
|
||||
FontId = 1,
|
||||
BorderId = 0,
|
||||
FillId = 0,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Horizontal = HorizontalAlignmentValues.Center,
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
});
|
||||
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = 0,
|
||||
FormatId = 0,
|
||||
FontId = 1,
|
||||
BorderId = 1,
|
||||
FillId = 0,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Horizontal = HorizontalAlignmentValues.Center,
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
});
|
||||
workbookStylesPart.Stylesheet.Append(cellFormats);
|
||||
}
|
||||
|
||||
private enum StyleIndex
|
||||
{
|
||||
SimpleTextWithoutBorder = 0,
|
||||
SimpleTextWithBorder = 1,
|
||||
BoldTextWithoutBorder = 2,
|
||||
BoldTextWithBorder = 3,
|
||||
}
|
||||
|
||||
private void CreateCell(int columnIndex, uint rowIndex, string text, StyleIndex styleIndex)
|
||||
{
|
||||
var columnName = GetExcelColumnName(columnIndex);
|
||||
var cellReference = columnName + rowIndex;
|
||||
var row = _sheetData.Elements<Row>().FirstOrDefault(r => r.RowIndex! == rowIndex);
|
||||
if (row == null)
|
||||
{
|
||||
row = new Row() { RowIndex = rowIndex };
|
||||
_sheetData.Append(row);
|
||||
}
|
||||
|
||||
var newCell = row.Elements<Cell>()
|
||||
.FirstOrDefault(c => c.CellReference != null && c.CellReference.Value == columnName + rowIndex);
|
||||
if (newCell == null)
|
||||
{
|
||||
Cell? refCell = null;
|
||||
foreach (Cell cell in row.Elements<Cell>())
|
||||
{
|
||||
if (cell.CellReference?.Value != null && cell.CellReference.Value.Length == cellReference.Length)
|
||||
{
|
||||
if (string.Compare(cell.CellReference.Value, cellReference, true) > 0)
|
||||
{
|
||||
refCell = cell;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
newCell = new Cell() { CellReference = cellReference };
|
||||
row.InsertBefore(newCell, refCell);
|
||||
}
|
||||
|
||||
newCell.CellValue = new CellValue(text);
|
||||
newCell.DataType = CellValues.String;
|
||||
newCell.StyleIndex = (uint)styleIndex;
|
||||
}
|
||||
|
||||
private static string GetExcelColumnName(int columnNumber)
|
||||
{
|
||||
columnNumber += 1;
|
||||
int dividend = columnNumber;
|
||||
string columnName = string.Empty;
|
||||
int modulo;
|
||||
|
||||
while (dividend > 0)
|
||||
{
|
||||
modulo = (dividend - 1) % 26;
|
||||
columnName = Convert.ToChar(65 + modulo).ToString() + columnName;
|
||||
dividend = (dividend - modulo) / 26;
|
||||
}
|
||||
|
||||
return columnName;
|
||||
}
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
using MigraDoc.DocumentObjectModel;
|
||||
using MigraDoc.DocumentObjectModel.Shapes.Charts;
|
||||
using MigraDoc.Rendering;
|
||||
|
||||
namespace ProjectGSM.Documents;
|
||||
|
||||
public class PdfBuilder
|
||||
{
|
||||
private readonly string _filePath;
|
||||
private readonly Document _document;
|
||||
|
||||
public PdfBuilder(string filePath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(filePath))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(filePath));
|
||||
}
|
||||
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
|
||||
_filePath = filePath;
|
||||
_document = new Document();
|
||||
DefineStyles();
|
||||
}
|
||||
|
||||
public PdfBuilder AddHeader(string header)
|
||||
{
|
||||
_document.AddSection().AddParagraph(header, "NormalBold");
|
||||
return this;
|
||||
}
|
||||
|
||||
public PdfBuilder AddPieChart(string title, List<(string Caption, double
|
||||
Value)> data)
|
||||
{
|
||||
if (data == null || data.Count == 0)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
var chart = new Chart(ChartType.Pie2D);
|
||||
var series = chart.SeriesCollection.AddSeries();
|
||||
series.Add(data.Select(x => x.Value).ToArray());
|
||||
var xseries = chart.XValues.AddXSeries();
|
||||
xseries.Add(data.Select(x => x.Caption).ToArray());
|
||||
chart.DataLabel.Type = DataLabelType.Percent;
|
||||
chart.DataLabel.Position = DataLabelPosition.OutsideEnd;
|
||||
chart.Width = Unit.FromCentimeter(16);
|
||||
chart.Height = Unit.FromCentimeter(12);
|
||||
chart.TopArea.AddParagraph(title);
|
||||
chart.XAxis.MajorTickMark = TickMarkType.Outside;
|
||||
chart.YAxis.MajorTickMark = TickMarkType.Outside;
|
||||
chart.YAxis.HasMajorGridlines = true;
|
||||
chart.PlotArea.LineFormat.Width = 1;
|
||||
chart.PlotArea.LineFormat.Visible = true;
|
||||
chart.TopArea.AddLegend();
|
||||
_document.LastSection.Add(chart);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void Build()
|
||||
{
|
||||
var renderer = new PdfDocumentRenderer(true)
|
||||
{
|
||||
Document = _document
|
||||
};
|
||||
renderer.RenderDocument();
|
||||
renderer.PdfDocument.Save(_filePath);
|
||||
}
|
||||
|
||||
private void DefineStyles()
|
||||
{
|
||||
var normalStyle = _document.Styles["Normal"];
|
||||
normalStyle.Font.Name = "Arial";
|
||||
normalStyle.Font.Size = 12;
|
||||
|
||||
var normalBoldStyle = _document.Styles.AddStyle("NormalBold", "Normal");
|
||||
normalBoldStyle.Font.Bold = true;
|
||||
}
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ProjectGSM.Entities;
|
||||
using ProjectGSM.Repositories;
|
||||
|
||||
namespace ProjectGSM.Documents;
|
||||
|
||||
internal class TableReport
|
||||
{
|
||||
private readonly ICaseRepository _caseRepository;
|
||||
private readonly IStatusHistoryRepository _statusHistoryRepository;
|
||||
private readonly ILogger<TableReport> _logger;
|
||||
internal static readonly string[] item = ["Статусы", "Дата", "Изменений статуса"];
|
||||
|
||||
public TableReport(
|
||||
ICaseRepository caseRepository,
|
||||
IStatusHistoryRepository statusHistoryRepository,
|
||||
ILogger<TableReport> logger)
|
||||
{
|
||||
_caseRepository = caseRepository ??
|
||||
throw new
|
||||
ArgumentNullException(nameof(caseRepository));
|
||||
_statusHistoryRepository = statusHistoryRepository ??
|
||||
throw new
|
||||
ArgumentNullException(nameof(statusHistoryRepository));
|
||||
_logger = logger ??
|
||||
throw new ArgumentNullException(nameof(logger));
|
||||
}
|
||||
|
||||
public bool CreateTable(string filePath, int caseId, DateTime startDate,
|
||||
DateTime endDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
new ExcelBuilder(filePath)
|
||||
.AddHeader($"Сводка по делу \"{_caseRepository.ReadCaseById(caseId).Description}\"", 0, 4)
|
||||
.AddParagraph($"за период c {startDate:dd.MM.yyyy} по{endDate: dd.MM.yyyy}", 0)
|
||||
.AddTable([10, 10, 15], GetData(caseId, startDate,
|
||||
endDate))
|
||||
.Build();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при формировании документа");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private List<string[]> GetData(int caseId, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
var statusData = _statusHistoryRepository
|
||||
.ReadStatusHistories(startDate, endDate, caseId)
|
||||
.GroupBy(x => (x.Status, x.CreatedAt.Date))
|
||||
.Select(x => new
|
||||
{
|
||||
Status = x.Key.Status,
|
||||
Date = x.Key.Date,
|
||||
Count = x.Count()
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return new List<string[]>() { item }
|
||||
.Union(
|
||||
statusData
|
||||
.Select(x => new string[]
|
||||
{
|
||||
x.Status.ToString(), x.Date.ToString("dd.MM.yyyy"), x.Count.ToString()
|
||||
}))
|
||||
.Union(
|
||||
[
|
||||
[
|
||||
"Всего", "", statusData.Sum(x => x.Count).ToString()
|
||||
]
|
||||
])
|
||||
.ToList();
|
||||
}
|
||||
}
|
@ -1,133 +0,0 @@
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
|
||||
internal class WordBuilder
|
||||
{
|
||||
private readonly string _filePath;
|
||||
private readonly Document _document;
|
||||
private readonly Body _body;
|
||||
|
||||
public WordBuilder(string filePath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(filePath))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(filePath));
|
||||
}
|
||||
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
|
||||
_filePath = filePath;
|
||||
_document = new Document();
|
||||
_body = _document.AppendChild(new Body());
|
||||
}
|
||||
|
||||
public WordBuilder AddHeader(string header)
|
||||
{
|
||||
var paragraph = _body.AppendChild(new Paragraph());
|
||||
var run = paragraph.AppendChild(new Run());
|
||||
run.RunProperties = new RunProperties(new Bold());
|
||||
run.AppendChild(new Text(header));
|
||||
return this;
|
||||
}
|
||||
|
||||
public WordBuilder AddParagraph(string text)
|
||||
{
|
||||
var paragraph = _body.AppendChild(new Paragraph());
|
||||
var run = paragraph.AppendChild(new Run());
|
||||
run.AppendChild(new Text(text));
|
||||
return this;
|
||||
}
|
||||
|
||||
public WordBuilder AddTable(int[] widths, List<string[]> data)
|
||||
{
|
||||
if (widths == null || widths.Length == 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(widths));
|
||||
}
|
||||
|
||||
if (data == null || data.Count == 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(data));
|
||||
}
|
||||
|
||||
if (data.Any(x => x.Length != widths.Length))
|
||||
{
|
||||
throw new InvalidOperationException("widths.Length != data.Length");
|
||||
}
|
||||
|
||||
var table = new Table();
|
||||
table.AppendChild(new TableProperties(
|
||||
new TableBorders(
|
||||
new TopBorder()
|
||||
{
|
||||
Val = new
|
||||
EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new BottomBorder()
|
||||
{
|
||||
Val = new
|
||||
EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new LeftBorder()
|
||||
{
|
||||
Val = new
|
||||
EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new RightBorder()
|
||||
{
|
||||
Val = new
|
||||
EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new InsideHorizontalBorder()
|
||||
{
|
||||
Val = new
|
||||
EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new InsideVerticalBorder()
|
||||
{
|
||||
Val = new
|
||||
EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
}
|
||||
)
|
||||
));
|
||||
// Заголовок
|
||||
var tr = new TableRow();
|
||||
for (var j = 0; j < widths.Length; ++j)
|
||||
{
|
||||
tr.Append(new TableCell(
|
||||
new TableCellProperties(new TableCellWidth()
|
||||
{
|
||||
Width =
|
||||
widths[j].ToString()
|
||||
}),
|
||||
new Paragraph(new Run(new RunProperties(new Bold()), new
|
||||
Text(data.First()[j])))));
|
||||
}
|
||||
|
||||
table.Append(tr);
|
||||
// Данные
|
||||
table.Append(data.Skip(1).Select(x =>
|
||||
new TableRow(x.Select(y => new TableCell(new Paragraph(new
|
||||
Run(new Text(y))))))));
|
||||
_body.Append(table);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void Build()
|
||||
{
|
||||
using var wordDocument = WordprocessingDocument.Create(_filePath,
|
||||
WordprocessingDocumentType.Document);
|
||||
var mainPart = wordDocument.AddMainDocumentPart();
|
||||
mainPart.Document = _document;
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
using ProjectGSM.Entities.Enums;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace ProjectGSM.Entities;
|
||||
|
||||
public class Advocate
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
[DisplayName("Имя")] public string Name { get; private set; } = string.Empty;
|
||||
|
||||
[DisplayName("Пол")] public bool Sex { get; private set; }
|
||||
|
||||
[DisplayName("Дата рождения")] public DateTime DateOfBirth { get; private set; }
|
||||
|
||||
[DisplayName("Опыт")] public int Experience { get; private set; }
|
||||
|
||||
[DisplayName("Выполненные задачи")] public int CompletedTasks { get; private set; }
|
||||
|
||||
[DisplayName("Рейтинг")] public int Rating { get; private set; }
|
||||
|
||||
[DisplayName("Электронная почта")] public string Email { get; private set; } = string.Empty;
|
||||
|
||||
[DisplayName("Номер телефона")] public string PhoneNumber { get; private set; } = string.Empty;
|
||||
|
||||
[DisplayName("Адрес")] public string Address { get; private set; } = string.Empty;
|
||||
|
||||
[DisplayName("Тип лицензии")] public LicenseType LicenseType { get; private set; }
|
||||
|
||||
[DisplayName("Дата создания")] public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
|
||||
|
||||
// Конструктор для создания сущности
|
||||
public static Advocate CreateEntity(
|
||||
int id,
|
||||
string name,
|
||||
bool sex,
|
||||
DateTime dateOfBirth,
|
||||
int experience,
|
||||
int completedTasks,
|
||||
int rating,
|
||||
string email,
|
||||
string phoneNumber,
|
||||
string address, LicenseType license)
|
||||
{
|
||||
return new Advocate
|
||||
{
|
||||
Id = id,
|
||||
Name = name ?? string.Empty,
|
||||
Sex = sex,
|
||||
DateOfBirth = dateOfBirth,
|
||||
Experience = experience,
|
||||
CompletedTasks = completedTasks,
|
||||
Rating = rating,
|
||||
Email = email ?? string.Empty,
|
||||
PhoneNumber = phoneNumber ?? string.Empty,
|
||||
Address = address ?? string.Empty,
|
||||
LicenseType = license,
|
||||
CreatedAt = DateTime.UtcNow
|
||||
};
|
||||
}
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
using System.Text.Json.Serialization;
|
||||
using ProjectGSM.Entities.Enums;
|
||||
|
||||
namespace ProjectGSM.Entities;
|
||||
|
||||
public class Case
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
[DisplayName("Тип обращения")] public TypeAppeal TypeAppeal { get; private set; }
|
||||
|
||||
[DisplayName("Оплата")] public bool Payment { get; private set; } = false;
|
||||
|
||||
[DisplayName("Цена")] public decimal Price { get; private set; }
|
||||
|
||||
[DisplayName("Цена приговора")] public decimal VictoryPrice { get; private set; }
|
||||
|
||||
[DisplayName("Решение")] public bool Verdict { get; private set; } = false;
|
||||
|
||||
[Browsable(false)] public int CourtId { get; private set; }
|
||||
|
||||
[Browsable(false)] public int ClientId { get; private set; }
|
||||
|
||||
[DisplayName("Суд")] public string CourtName { get; private set; } = string.Empty;
|
||||
|
||||
[DisplayName("Клиент")] public string ClientName { get; private set; } = string.Empty;
|
||||
[DisplayName("Описание")] public string Description { get; private set; } = string.Empty;
|
||||
[DisplayName("Дата создания")] public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
|
||||
|
||||
|
||||
[JsonIgnore] [Browsable(false)] public IEnumerable<CaseAdvocate> Advocates { get; private set; } = [];
|
||||
|
||||
[DisplayName("Адвокаты")]
|
||||
public string AdvocatesNames => string.Join(", ", Advocates.Select(x => $"{x.AdvocateName} ({x.Post})"));
|
||||
|
||||
public void SetAdvocates(IEnumerable<CaseAdvocate> advocates)
|
||||
{
|
||||
if (advocates != null && advocates.Any())
|
||||
{
|
||||
Advocates = advocates;
|
||||
}
|
||||
}
|
||||
|
||||
// Конструктор для создания сущности
|
||||
public static Case CreateEntity(
|
||||
int id,
|
||||
TypeAppeal typeAppeal,
|
||||
bool payment,
|
||||
decimal price,
|
||||
decimal victoryPrice,
|
||||
bool verdict,
|
||||
int courtId,
|
||||
int clientId,
|
||||
string description
|
||||
)
|
||||
{
|
||||
return new Case
|
||||
{
|
||||
Id = id,
|
||||
TypeAppeal = typeAppeal,
|
||||
Payment = payment,
|
||||
Price = price,
|
||||
VictoryPrice = victoryPrice,
|
||||
Verdict = verdict,
|
||||
CourtId = courtId,
|
||||
ClientId = clientId,
|
||||
Description = description ?? string.Empty,
|
||||
CreatedAt = DateTime.UtcNow
|
||||
};
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace ProjectGSM.Entities;
|
||||
|
||||
public class CaseAdvocate
|
||||
{
|
||||
public int CaseId { get; private set; }
|
||||
|
||||
public int AdvocateId { get; private set; }
|
||||
|
||||
[DisplayName("Дело")] public string CaseDescription { get; private set; } = string.Empty;
|
||||
|
||||
[DisplayName("Авокат")] public string AdvocateName { get; private set; } = string.Empty;
|
||||
|
||||
[DisplayName("Должность")] public string Post { get; private set; } = string.Empty;
|
||||
|
||||
[DisplayName("Дата создания")] public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
|
||||
|
||||
// Конструктор для создания сущности
|
||||
public static CaseAdvocate CreateEntity(int caseId, int advocateId, string post)
|
||||
{
|
||||
return new CaseAdvocate
|
||||
{
|
||||
CaseId = caseId,
|
||||
AdvocateId = advocateId,
|
||||
Post = post,
|
||||
CreatedAt = DateTime.UtcNow
|
||||
};
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace ProjectGSM.Entities;
|
||||
|
||||
public class Client
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
[DisplayName("Имя")] public string Name { get; private set; } = string.Empty;
|
||||
|
||||
[DisplayName("Пол")] public bool Sex { get; private set; }
|
||||
|
||||
[DisplayName("Дата рождения")] public DateTime DateOfBirth { get; private set; }
|
||||
|
||||
[DisplayName("Электронная почта")] public string Email { get; private set; } = string.Empty;
|
||||
|
||||
[DisplayName("Номер телефона")] public string PhoneNumber { get; private set; } = string.Empty;
|
||||
|
||||
[DisplayName("Адрес")] public string Address { get; private set; } = string.Empty;
|
||||
|
||||
[DisplayName("Дата создания")] public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
|
||||
|
||||
// Конструктор для создания сущности
|
||||
public static Client CreateEntity(
|
||||
int id,
|
||||
string name,
|
||||
bool sex,
|
||||
DateTime dateOfBirth,
|
||||
string email,
|
||||
string phoneNumber,
|
||||
string address)
|
||||
{
|
||||
return new Client
|
||||
{
|
||||
Id = id,
|
||||
Name = name ?? string.Empty,
|
||||
Sex = sex,
|
||||
DateOfBirth = dateOfBirth,
|
||||
Email = email ?? string.Empty,
|
||||
PhoneNumber = phoneNumber ?? string.Empty,
|
||||
Address = address ?? string.Empty,
|
||||
CreatedAt = DateTime.UtcNow
|
||||
};
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace ProjectGSM.Entities;
|
||||
|
||||
public class Court
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
[DisplayName("Название")] public string Name { get; private set; } = string.Empty;
|
||||
|
||||
[DisplayName("Адрес")] public string Address { get; private set; } = string.Empty;
|
||||
|
||||
[DisplayName("Дата создания")] public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
|
||||
|
||||
// Конструктор для создания сущности
|
||||
public static Court CreateEntity(int id, string name, string address, DateTime? createdAt = null)
|
||||
{
|
||||
return new Court
|
||||
{
|
||||
Id = id,
|
||||
Name = name ?? string.Empty,
|
||||
Address = address ?? string.Empty,
|
||||
CreatedAt = createdAt ?? DateTime.UtcNow
|
||||
};
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectGSM.Entities.Enums
|
||||
{
|
||||
[Flags]
|
||||
public enum LicenseType
|
||||
{
|
||||
None = 0,
|
||||
Base = 1 << 0,
|
||||
Pro = 1 << 1,
|
||||
Master = 1 << 2,
|
||||
Guru = 1 << 3
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectGSM.Entities.Enums
|
||||
{
|
||||
public enum Status
|
||||
{
|
||||
Success,
|
||||
Consideration,
|
||||
WorkDocumnets,
|
||||
WorkWithCourt,
|
||||
Bribe
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectGSM.Entities.Enums
|
||||
{
|
||||
public enum TypeAppeal
|
||||
{
|
||||
Bisness, Immovables, Divorce, Inheritance
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
using ProjectGSM.Entities.Enums;
|
||||
|
||||
namespace ProjectGSM.Entities;
|
||||
|
||||
public class StatusHistory
|
||||
{
|
||||
public int CaseId { get; private set; }
|
||||
|
||||
[DisplayName("Дело")] public string CaseDescription { get; private set; } = string.Empty;
|
||||
|
||||
[DisplayName("Статус")] public Status Status { get; private set; }
|
||||
|
||||
[DisplayName("Цена")] public decimal Price { get; private set; }
|
||||
|
||||
[DisplayName("Дата создания")] public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
|
||||
|
||||
// Конструктор для создания сущности
|
||||
public static StatusHistory CreateEntity(int caseId, Status status, decimal price, DateTime? dateTime = null)
|
||||
{
|
||||
return new StatusHistory
|
||||
{
|
||||
CaseId = caseId,
|
||||
Status = status,
|
||||
Price = price,
|
||||
CreatedAt = dateTime ?? DateTime.UtcNow
|
||||
};
|
||||
}
|
||||
}
|
39
ProjectGSM/Form1.Designer.cs
generated
Normal file
39
ProjectGSM/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
||||
namespace ProjectGSM
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
10
ProjectGSM/Form1.cs
Normal file
10
ProjectGSM/Form1.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace ProjectGSM
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
<!--
|
||||
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
|
||||
|
||||
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>
|
||||
@ -26,36 +26,36 @@
|
||||
<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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
166
ProjectGSM/FormAdvocateApp.Designer.cs
generated
166
ProjectGSM/FormAdvocateApp.Designer.cs
generated
@ -1,166 +0,0 @@
|
||||
namespace ProjectGSM
|
||||
{
|
||||
partial class FormAdvocateApp
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
private System.Windows.Forms.MenuStrip menuStrip;
|
||||
private System.Windows.Forms.ToolStripMenuItem directoriesMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem operationsMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem reportsMenuItem; // Новый пункт "Отчеты"
|
||||
private System.Windows.Forms.ToolStripMenuItem clientsMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem advocatesMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem casesMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem statusHistoryRepositoryMenuItem;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
menuStrip = new MenuStrip();
|
||||
directoriesMenuItem = new ToolStripMenuItem();
|
||||
clientsMenuItem = new ToolStripMenuItem();
|
||||
advocatesMenuItem = new ToolStripMenuItem();
|
||||
courtsToolStripMenuItem = new ToolStripMenuItem();
|
||||
operationsMenuItem = new ToolStripMenuItem();
|
||||
casesMenuItem = new ToolStripMenuItem();
|
||||
statusHistoryRepositoryMenuItem = new ToolStripMenuItem();
|
||||
reportsMenuItem = new ToolStripMenuItem();
|
||||
infoToolStripMenuItem = new ToolStripMenuItem();
|
||||
caseToolStripMenuItem = new ToolStripMenuItem();
|
||||
statusesToolStripMenuItem = new ToolStripMenuItem();
|
||||
menuStrip.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// menuStrip
|
||||
//
|
||||
menuStrip.Items.AddRange(new ToolStripItem[] { directoriesMenuItem, operationsMenuItem, reportsMenuItem });
|
||||
menuStrip.Location = new Point(0, 0);
|
||||
menuStrip.Name = "menuStrip";
|
||||
menuStrip.Padding = new Padding(7, 2, 0, 2);
|
||||
menuStrip.Size = new Size(933, 24);
|
||||
menuStrip.TabIndex = 0;
|
||||
menuStrip.Text = "menuStrip";
|
||||
//
|
||||
// directoriesMenuItem
|
||||
//
|
||||
directoriesMenuItem.DropDownItems.AddRange(new ToolStripItem[] { clientsMenuItem, advocatesMenuItem, courtsToolStripMenuItem });
|
||||
directoriesMenuItem.Name = "directoriesMenuItem";
|
||||
directoriesMenuItem.Size = new Size(94, 20);
|
||||
directoriesMenuItem.Text = "Справочники";
|
||||
//
|
||||
// clientsMenuItem
|
||||
//
|
||||
clientsMenuItem.Name = "clientsMenuItem";
|
||||
clientsMenuItem.Size = new Size(127, 22);
|
||||
clientsMenuItem.Text = "Клиенты";
|
||||
clientsMenuItem.Click += clientsMenuItem_Click_1;
|
||||
//
|
||||
// advocatesMenuItem
|
||||
//
|
||||
advocatesMenuItem.Name = "advocatesMenuItem";
|
||||
advocatesMenuItem.Size = new Size(127, 22);
|
||||
advocatesMenuItem.Text = "Адвокаты";
|
||||
advocatesMenuItem.Click += advocatesMenuItem_Click;
|
||||
//
|
||||
// courtsToolStripMenuItem
|
||||
//
|
||||
courtsToolStripMenuItem.Name = "courtsToolStripMenuItem";
|
||||
courtsToolStripMenuItem.Size = new Size(127, 22);
|
||||
courtsToolStripMenuItem.Text = "Суды";
|
||||
courtsToolStripMenuItem.Click += courtsToolStripMenuItem_Click;
|
||||
//
|
||||
// operationsMenuItem
|
||||
//
|
||||
operationsMenuItem.DropDownItems.AddRange(new ToolStripItem[] { casesMenuItem, statusHistoryRepositoryMenuItem });
|
||||
operationsMenuItem.Name = "operationsMenuItem";
|
||||
operationsMenuItem.Size = new Size(75, 20);
|
||||
operationsMenuItem.Text = "Операции";
|
||||
//
|
||||
// casesMenuItem
|
||||
//
|
||||
casesMenuItem.Name = "casesMenuItem";
|
||||
casesMenuItem.Size = new Size(191, 22);
|
||||
casesMenuItem.Text = "Дела";
|
||||
casesMenuItem.Click += casesMenuItem_Click;
|
||||
//
|
||||
// statusHistoryRepositoryMenuItem
|
||||
//
|
||||
statusHistoryRepositoryMenuItem.Name = "statusHistoryRepositoryMenuItem";
|
||||
statusHistoryRepositoryMenuItem.Size = new Size(191, 22);
|
||||
statusHistoryRepositoryMenuItem.Text = "Хронология статусов";
|
||||
statusHistoryRepositoryMenuItem.Click += statusHistoryRepositoryMenuItem_Click;
|
||||
//
|
||||
// reportsMenuItem
|
||||
//
|
||||
reportsMenuItem.DropDownItems.AddRange(new ToolStripItem[] { infoToolStripMenuItem, caseToolStripMenuItem, statusesToolStripMenuItem });
|
||||
reportsMenuItem.Name = "reportsMenuItem";
|
||||
reportsMenuItem.Size = new Size(60, 20);
|
||||
reportsMenuItem.Text = "Отчеты";
|
||||
//
|
||||
// infoToolStripMenuItem
|
||||
//
|
||||
infoToolStripMenuItem.Name = "infoToolStripMenuItem";
|
||||
infoToolStripMenuItem.Size = new Size(207, 22);
|
||||
infoToolStripMenuItem.Text = "Выгрузка справочников";
|
||||
infoToolStripMenuItem.Click += infoToolStripMenuItem_Click;
|
||||
//
|
||||
// caseToolStripMenuItem
|
||||
//
|
||||
caseToolStripMenuItem.Name = "caseToolStripMenuItem";
|
||||
caseToolStripMenuItem.Size = new Size(207, 22);
|
||||
caseToolStripMenuItem.Text = "Отчет по делам";
|
||||
caseToolStripMenuItem.Click += caseToolStripMenuItem_Click;
|
||||
//
|
||||
// statusesToolStripMenuItem
|
||||
//
|
||||
statusesToolStripMenuItem.Name = "statusesToolStripMenuItem";
|
||||
statusesToolStripMenuItem.Size = new Size(207, 22);
|
||||
statusesToolStripMenuItem.Text = "Статусы дел";
|
||||
statusesToolStripMenuItem.Click += statusesToolStripMenuItem_Click;
|
||||
//
|
||||
// FormAdvocateApp
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackgroundImage = Properties.Resources.maxresdefault;
|
||||
BackgroundImageLayout = ImageLayout.Stretch;
|
||||
ClientSize = new Size(933, 519);
|
||||
Controls.Add(menuStrip);
|
||||
MainMenuStrip = menuStrip;
|
||||
Margin = new Padding(4, 3, 4, 3);
|
||||
Name = "FormAdvocateApp";
|
||||
Text = "Шарашкина контора";
|
||||
menuStrip.ResumeLayout(false);
|
||||
menuStrip.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ToolStripMenuItem courtsToolStripMenuItem;
|
||||
private ToolStripMenuItem infoToolStripMenuItem;
|
||||
private ToolStripMenuItem caseToolStripMenuItem;
|
||||
private ToolStripMenuItem statusesToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -1,117 +0,0 @@
|
||||
using ProjectGSM.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectGSM
|
||||
{
|
||||
public partial class FormAdvocateApp : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
public FormAdvocateApp(IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
}
|
||||
private void clientsMenuItem_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormClients>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void advocatesMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormAdvocates>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void casesMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormCases>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void courtsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormCourts>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void statusHistoryRepositoryMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormStatusesHistory>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void infoToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormDirectoryReport>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå îò÷åòà",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void caseToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormCaseReport>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå îò÷åòà",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void statusesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormStatusesCasesReport>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå îò÷åòà",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,123 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
292
ProjectGSM/Forms/FormAdvocate.Designer.cs
generated
292
ProjectGSM/Forms/FormAdvocate.Designer.cs
generated
@ -1,292 +0,0 @@
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
partial class FormAdvocate
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
nameLabel = new Label();
|
||||
nameTextBox = new TextBox();
|
||||
expLabel = new Label();
|
||||
saveButton = new Button();
|
||||
cancelButton = new Button();
|
||||
sex = new Label();
|
||||
sexCheckBox = new CheckBox();
|
||||
DateLabel = new Label();
|
||||
dateTimePicker = new DateTimePicker();
|
||||
PhoneLabel = new Label();
|
||||
phoneText = new TextBox();
|
||||
adressLabel = new Label();
|
||||
adressBox = new TextBox();
|
||||
expNumeric = new NumericUpDown();
|
||||
tasksLabel = new Label();
|
||||
tasksNumeric = new NumericUpDown();
|
||||
ratingLabel = new Label();
|
||||
ratingNumeric = new NumericUpDown();
|
||||
emailLabel = new Label();
|
||||
emailTextBox = new TextBox();
|
||||
licenseLabel = new Label();
|
||||
checkedListBox = new CheckedListBox();
|
||||
((System.ComponentModel.ISupportInitialize)expNumeric).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)tasksNumeric).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)ratingNumeric).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
nameLabel.Location = new Point(14, 9);
|
||||
nameLabel.Name = "nameLabel";
|
||||
nameLabel.Size = new Size(134, 23);
|
||||
nameLabel.TabIndex = 0;
|
||||
nameLabel.Text = "Имя адвоката:";
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
nameTextBox.Location = new Point(148, 5);
|
||||
nameTextBox.Name = "nameTextBox";
|
||||
nameTextBox.Size = new Size(116, 31);
|
||||
nameTextBox.TabIndex = 1;
|
||||
//
|
||||
// expLabel
|
||||
//
|
||||
expLabel.Location = new Point(10, 90);
|
||||
expLabel.Name = "expLabel";
|
||||
expLabel.Size = new Size(100, 23);
|
||||
expLabel.TabIndex = 2;
|
||||
expLabel.Text = "Опыт:";
|
||||
//
|
||||
// saveButton
|
||||
//
|
||||
saveButton.Location = new Point(122, 303);
|
||||
saveButton.Name = "saveButton";
|
||||
saveButton.Size = new Size(114, 35);
|
||||
saveButton.TabIndex = 4;
|
||||
saveButton.Text = "Сохранить";
|
||||
saveButton.Click += saveButton_Click;
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
cancelButton.Location = new Point(255, 309);
|
||||
cancelButton.Name = "cancelButton";
|
||||
cancelButton.Size = new Size(133, 29);
|
||||
cancelButton.TabIndex = 5;
|
||||
cancelButton.Text = "Отмена";
|
||||
cancelButton.Click += cancelButton_Click;
|
||||
//
|
||||
// sex
|
||||
//
|
||||
sex.Location = new Point(10, 38);
|
||||
sex.Name = "sex";
|
||||
sex.Size = new Size(100, 23);
|
||||
sex.TabIndex = 0;
|
||||
sex.Text = "Пол:";
|
||||
//
|
||||
// sexCheckBox
|
||||
//
|
||||
sexCheckBox.AutoSize = true;
|
||||
sexCheckBox.Location = new Point(148, 32);
|
||||
sexCheckBox.Name = "sexCheckBox";
|
||||
sexCheckBox.Size = new Size(112, 29);
|
||||
sexCheckBox.TabIndex = 6;
|
||||
sexCheckBox.Text = "мужчина";
|
||||
sexCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// DateLabel
|
||||
//
|
||||
DateLabel.Location = new Point(10, 61);
|
||||
DateLabel.Name = "DateLabel";
|
||||
DateLabel.Size = new Size(100, 23);
|
||||
DateLabel.TabIndex = 7;
|
||||
DateLabel.Text = "Дата рождения:";
|
||||
//
|
||||
// dateTimePicker
|
||||
//
|
||||
dateTimePicker.Location = new Point(144, 56);
|
||||
dateTimePicker.Name = "dateTimePicker";
|
||||
dateTimePicker.Size = new Size(120, 31);
|
||||
dateTimePicker.TabIndex = 8;
|
||||
//
|
||||
// PhoneLabel
|
||||
//
|
||||
PhoneLabel.Location = new Point(10, 217);
|
||||
PhoneLabel.Name = "PhoneLabel";
|
||||
PhoneLabel.Size = new Size(111, 23);
|
||||
PhoneLabel.TabIndex = 9;
|
||||
PhoneLabel.Text = "Номер телефона:";
|
||||
//
|
||||
// phoneText
|
||||
//
|
||||
phoneText.Location = new Point(144, 212);
|
||||
phoneText.Name = "phoneText";
|
||||
phoneText.Size = new Size(120, 31);
|
||||
phoneText.TabIndex = 10;
|
||||
//
|
||||
// adressLabel
|
||||
//
|
||||
adressLabel.Location = new Point(12, 249);
|
||||
adressLabel.Name = "adressLabel";
|
||||
adressLabel.Size = new Size(111, 23);
|
||||
adressLabel.TabIndex = 11;
|
||||
adressLabel.Text = "Адрес:";
|
||||
//
|
||||
// adressBox
|
||||
//
|
||||
adressBox.Location = new Point(144, 241);
|
||||
adressBox.Name = "adressBox";
|
||||
adressBox.Size = new Size(120, 31);
|
||||
adressBox.TabIndex = 12;
|
||||
//
|
||||
// expNumeric
|
||||
//
|
||||
expNumeric.Location = new Point(144, 85);
|
||||
expNumeric.Name = "expNumeric";
|
||||
expNumeric.Size = new Size(120, 31);
|
||||
expNumeric.TabIndex = 13;
|
||||
//
|
||||
// tasksLabel
|
||||
//
|
||||
tasksLabel.Location = new Point(10, 119);
|
||||
tasksLabel.Name = "tasksLabel";
|
||||
tasksLabel.Size = new Size(100, 23);
|
||||
tasksLabel.TabIndex = 15;
|
||||
tasksLabel.Text = "Решенные дела:";
|
||||
//
|
||||
// tasksNumeric
|
||||
//
|
||||
tasksNumeric.Location = new Point(144, 114);
|
||||
tasksNumeric.Name = "tasksNumeric";
|
||||
tasksNumeric.Size = new Size(120, 31);
|
||||
tasksNumeric.TabIndex = 16;
|
||||
//
|
||||
// ratingLabel
|
||||
//
|
||||
ratingLabel.Location = new Point(10, 154);
|
||||
ratingLabel.Name = "ratingLabel";
|
||||
ratingLabel.Size = new Size(100, 23);
|
||||
ratingLabel.TabIndex = 17;
|
||||
ratingLabel.Text = "Рейтинг:";
|
||||
//
|
||||
// ratingNumeric
|
||||
//
|
||||
ratingNumeric.Location = new Point(144, 147);
|
||||
ratingNumeric.Name = "ratingNumeric";
|
||||
ratingNumeric.Size = new Size(120, 31);
|
||||
ratingNumeric.TabIndex = 18;
|
||||
//
|
||||
// emailLabel
|
||||
//
|
||||
emailLabel.Location = new Point(11, 184);
|
||||
emailLabel.Name = "emailLabel";
|
||||
emailLabel.Size = new Size(111, 23);
|
||||
emailLabel.TabIndex = 19;
|
||||
emailLabel.Text = "Email:";
|
||||
//
|
||||
// emailTextBox
|
||||
//
|
||||
emailTextBox.Location = new Point(144, 179);
|
||||
emailTextBox.Name = "emailTextBox";
|
||||
emailTextBox.Size = new Size(120, 31);
|
||||
emailTextBox.TabIndex = 20;
|
||||
//
|
||||
// licenseLabel
|
||||
//
|
||||
licenseLabel.Location = new Point(298, 9);
|
||||
licenseLabel.Name = "licenseLabel";
|
||||
licenseLabel.Size = new Size(100, 23);
|
||||
licenseLabel.TabIndex = 21;
|
||||
licenseLabel.Text = "Лицензии:";
|
||||
//
|
||||
// checkedListBox
|
||||
//
|
||||
checkedListBox.FormattingEnabled = true;
|
||||
checkedListBox.Location = new Point(298, 56);
|
||||
checkedListBox.Name = "checkedListBox";
|
||||
checkedListBox.Size = new Size(304, 228);
|
||||
checkedListBox.TabIndex = 22;
|
||||
//
|
||||
// FormAdvocate
|
||||
//
|
||||
ClientSize = new Size(637, 593);
|
||||
Controls.Add(checkedListBox);
|
||||
Controls.Add(licenseLabel);
|
||||
Controls.Add(emailTextBox);
|
||||
Controls.Add(emailLabel);
|
||||
Controls.Add(ratingNumeric);
|
||||
Controls.Add(ratingLabel);
|
||||
Controls.Add(tasksNumeric);
|
||||
Controls.Add(tasksLabel);
|
||||
Controls.Add(expNumeric);
|
||||
Controls.Add(adressBox);
|
||||
Controls.Add(adressLabel);
|
||||
Controls.Add(phoneText);
|
||||
Controls.Add(PhoneLabel);
|
||||
Controls.Add(dateTimePicker);
|
||||
Controls.Add(DateLabel);
|
||||
Controls.Add(sexCheckBox);
|
||||
Controls.Add(sex);
|
||||
Controls.Add(nameLabel);
|
||||
Controls.Add(nameTextBox);
|
||||
Controls.Add(expLabel);
|
||||
Controls.Add(saveButton);
|
||||
Controls.Add(cancelButton);
|
||||
Name = "FormAdvocate";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Адвокат";
|
||||
((System.ComponentModel.ISupportInitialize)expNumeric).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)tasksNumeric).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)ratingNumeric).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label nameLabel;
|
||||
private TextBox nameTextBox;
|
||||
|
||||
private Label expLabel;
|
||||
|
||||
private Button saveButton;
|
||||
private Button cancelButton;
|
||||
private Label sex;
|
||||
private Label tasksLabel;
|
||||
private CheckBox sexCheckBox;
|
||||
private Label DateLabel;
|
||||
private DateTimePicker dateTimePicker;
|
||||
private Label PhoneLabel;
|
||||
private TextBox phoneText;
|
||||
private Label adressLabel;
|
||||
private TextBox adressBox;
|
||||
private NumericUpDown expNumeric;
|
||||
private NumericUpDown tasksNumeric;
|
||||
private Label ratingLabel;
|
||||
private NumericUpDown ratingNumeric;
|
||||
private Label emailLabel;
|
||||
private TextBox emailTextBox;
|
||||
private Label licenseLabel;
|
||||
private CheckedListBox checkedListBox;
|
||||
}
|
||||
}
|
@ -1,123 +0,0 @@
|
||||
using Microsoft.VisualBasic.FileIO;
|
||||
using ProjectGSM.Entities;
|
||||
using ProjectGSM.Entities.Enums;
|
||||
using ProjectGSM.Repositories;
|
||||
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
public partial class FormAdvocate : Form
|
||||
{
|
||||
private readonly IAdvocateRepository _advocateRepository;
|
||||
|
||||
private int? _advocateId;
|
||||
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var advocate =
|
||||
_advocateRepository.ReadAdvocateById(value);
|
||||
if (advocate == null)
|
||||
{
|
||||
throw new
|
||||
InvalidDataException(nameof(advocate));
|
||||
}
|
||||
|
||||
_advocateId = value;
|
||||
foreach (LicenseType elem in Enum.GetValues(typeof(LicenseType)))
|
||||
{
|
||||
if ((elem & advocate.LicenseType) != 0)
|
||||
{
|
||||
checkedListBox.SetItemChecked(checkedListBox.Items.IndexOf(
|
||||
elem), true);
|
||||
}
|
||||
}
|
||||
|
||||
nameTextBox.Text = advocate.Name;
|
||||
sexCheckBox.Checked = advocate.Sex;
|
||||
dateTimePicker.Value = new DateTime(advocate.DateOfBirth.Year, advocate.DateOfBirth.Month,
|
||||
advocate.DateOfBirth.Day);
|
||||
expNumeric.Value = advocate.Experience;
|
||||
tasksNumeric.Value = advocate.CompletedTasks;
|
||||
ratingNumeric.Value = advocate.Rating;
|
||||
emailTextBox.Text = advocate.Email;
|
||||
phoneText.Text = advocate.PhoneNumber;
|
||||
adressBox.Text = advocate.Address;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public FormAdvocate(IAdvocateRepository advocateRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_advocateRepository = advocateRepository ??
|
||||
throw new
|
||||
ArgumentNullException(nameof(advocateRepository));
|
||||
|
||||
foreach (var elem in Enum.GetValues(typeof(LicenseType)))
|
||||
{
|
||||
checkedListBox.Items.Add(elem);
|
||||
}
|
||||
}
|
||||
|
||||
private void saveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(nameTextBox.Text) ||
|
||||
string.IsNullOrWhiteSpace(emailTextBox.Text) ||
|
||||
string.IsNullOrWhiteSpace(phoneText.Text) ||
|
||||
string.IsNullOrWhiteSpace(adressBox.Text) || checkedListBox.CheckedItems.Count == 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
if (_advocateId.HasValue)
|
||||
{
|
||||
_advocateRepository.UpdateAdvocate(CreateAdvocate(_advocateId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_advocateRepository.CreateAdvocate(CreateAdvocate(0));
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void cancelButton_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Advocate CreateAdvocate(int id)
|
||||
{
|
||||
int licenseType = 0;
|
||||
foreach (int elem in checkedListBox.CheckedItems)
|
||||
{
|
||||
licenseType |= elem;
|
||||
}
|
||||
return Advocate.CreateEntity(id,
|
||||
nameTextBox.Text,
|
||||
sexCheckBox.Checked,
|
||||
dateTimePicker.Value,
|
||||
Convert.ToInt32(expNumeric.Value),
|
||||
Convert.ToInt32(tasksNumeric.Value),
|
||||
Convert.ToInt32(ratingNumeric.Value),
|
||||
emailTextBox.Text,
|
||||
phoneText.Text,
|
||||
adressBox.Text, (LicenseType)licenseType);
|
||||
}
|
||||
}
|
||||
}
|
130
ProjectGSM/Forms/FormAdvocates.Designer.cs
generated
130
ProjectGSM/Forms/FormAdvocates.Designer.cs
generated
@ -1,130 +0,0 @@
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
partial class FormAdvocates
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
panel1 = new Panel();
|
||||
deleteButton = new Button();
|
||||
editButton = new Button();
|
||||
addButton = new Button();
|
||||
dataGridViewAdvocats = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewAdvocats).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(deleteButton);
|
||||
panel1.Controls.Add(editButton);
|
||||
panel1.Controls.Add(addButton);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(604, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(142, 450);
|
||||
panel1.TabIndex = 0;
|
||||
//
|
||||
// deleteButton
|
||||
//
|
||||
deleteButton.BackgroundImage = Properties.Resources.circle_x_svgrepo_com;
|
||||
deleteButton.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
deleteButton.Location = new Point(33, 240);
|
||||
deleteButton.Name = "deleteButton";
|
||||
deleteButton.Size = new Size(75, 75);
|
||||
deleteButton.TabIndex = 2;
|
||||
deleteButton.Text = " ";
|
||||
deleteButton.UseVisualStyleBackColor = true;
|
||||
deleteButton.Click += deleteButton_Click;
|
||||
//
|
||||
// editButton
|
||||
//
|
||||
editButton.BackgroundImage = Properties.Resources.pencil_svgrepo_com;
|
||||
editButton.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
editButton.Location = new Point(33, 139);
|
||||
editButton.Name = "editButton";
|
||||
editButton.Size = new Size(75, 75);
|
||||
editButton.TabIndex = 1;
|
||||
editButton.Text = " ";
|
||||
editButton.UseVisualStyleBackColor = true;
|
||||
editButton.Click += editButton_Click;
|
||||
//
|
||||
// addButton
|
||||
//
|
||||
addButton.BackgroundImage = Properties.Resources.circle_plus_svgrepo_com;
|
||||
addButton.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
addButton.Location = new Point(33, 38);
|
||||
addButton.Name = "addButton";
|
||||
addButton.Size = new Size(75, 75);
|
||||
addButton.TabIndex = 0;
|
||||
addButton.Text = " ";
|
||||
addButton.UseVisualStyleBackColor = true;
|
||||
addButton.Click += addButton_Click;
|
||||
//
|
||||
// dataGridView1
|
||||
//
|
||||
dataGridViewAdvocats.AllowUserToAddRows = false;
|
||||
dataGridViewAdvocats.AllowUserToDeleteRows = false;
|
||||
dataGridViewAdvocats.AllowUserToResizeColumns = false;
|
||||
dataGridViewAdvocats.AllowUserToResizeRows = false;
|
||||
dataGridViewAdvocats.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewAdvocats.BackgroundColor = SystemColors.Info;
|
||||
dataGridViewAdvocats.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewAdvocats.Dock = DockStyle.Fill;
|
||||
dataGridViewAdvocats.Location = new Point(0, 0);
|
||||
dataGridViewAdvocats.MultiSelect = false;
|
||||
dataGridViewAdvocats.Name = "dataGridViewAdvocats";
|
||||
dataGridViewAdvocats.ReadOnly = true;
|
||||
dataGridViewAdvocats.RowHeadersVisible = false;
|
||||
dataGridViewAdvocats.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewAdvocats.Size = new Size(604, 450);
|
||||
dataGridViewAdvocats.TabIndex = 1;
|
||||
//
|
||||
// FormAdvocates
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(746, 450);
|
||||
Controls.Add(dataGridViewAdvocats);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormAdvocates";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Адвокаты";
|
||||
Load += FormClients_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewAdvocats).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button deleteButton;
|
||||
private Button editButton;
|
||||
private Button addButton;
|
||||
private DataGridView dataGridViewAdvocats;
|
||||
}
|
||||
}
|
@ -1,128 +0,0 @@
|
||||
using ProjectGSM.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 ProjectGSM.Forms
|
||||
{
|
||||
public partial class FormAdvocates : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
private readonly IAdvocateRepository _advocateRepository;
|
||||
public FormAdvocates(IUnityContainer container, IAdvocateRepository advocateRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_advocateRepository = advocateRepository ??
|
||||
throw new
|
||||
ArgumentNullException(nameof(advocateRepository));
|
||||
|
||||
}
|
||||
|
||||
private void deleteButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление",
|
||||
MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_advocateRepository.DeleteAdvocate(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void editButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormAdvocate>();
|
||||
form.Id = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при изменении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormAdvocate>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void FormClients_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void LoadList() {
|
||||
dataGridViewAdvocats.DataSource =
|
||||
_advocateRepository.ReadAdvocates();
|
||||
dataGridViewAdvocats.Columns["Id"].Visible = false;
|
||||
dataGridViewAdvocats.Columns["CreatedAt"].DefaultCellStyle.Format =
|
||||
"dd.MM.yyyy";
|
||||
}
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewAdvocats.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id =
|
||||
Convert.ToInt32(dataGridViewAdvocats.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?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>
|
315
ProjectGSM/Forms/FormCase.Designer.cs
generated
315
ProjectGSM/Forms/FormCase.Designer.cs
generated
@ -1,315 +0,0 @@
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
partial class FormCase
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
typeApealLabel = new Label();
|
||||
paymentLabel = new Label();
|
||||
saveButton = new Button();
|
||||
cancelButton = new Button();
|
||||
priceLabel = new Label();
|
||||
verdictLabel = new Label();
|
||||
typeApellBox = new ComboBox();
|
||||
paymentCheckBox = new CheckBox();
|
||||
priceNumeric = new NumericUpDown();
|
||||
winPriceLabel = new Label();
|
||||
winPriceNumeric = new NumericUpDown();
|
||||
verdictCheckBox = new CheckBox();
|
||||
courtBox = new ComboBox();
|
||||
courtLabel = new Label();
|
||||
clientBox = new ComboBox();
|
||||
clientLabel = new Label();
|
||||
descriptionLabel = new Label();
|
||||
textBox1 = new TextBox();
|
||||
groupBox1 = new GroupBox();
|
||||
dataGridView1 = new DataGridView();
|
||||
ColumnAdvocate = new DataGridViewComboBoxColumn();
|
||||
ColumnPost = new DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)priceNumeric).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)winPriceNumeric).BeginInit();
|
||||
groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// typeApealLabel
|
||||
//
|
||||
typeApealLabel.Location = new Point(10, 10);
|
||||
typeApealLabel.Name = "typeApealLabel";
|
||||
typeApealLabel.Size = new Size(100, 23);
|
||||
typeApealLabel.TabIndex = 0;
|
||||
typeApealLabel.Text = "Тип обращения:";
|
||||
//
|
||||
// paymentLabel
|
||||
//
|
||||
paymentLabel.Location = new Point(10, 50);
|
||||
paymentLabel.Name = "paymentLabel";
|
||||
paymentLabel.Size = new Size(100, 23);
|
||||
paymentLabel.TabIndex = 2;
|
||||
paymentLabel.Text = "Оплачено:";
|
||||
//
|
||||
// saveButton
|
||||
//
|
||||
saveButton.Location = new Point(116, 531);
|
||||
saveButton.Name = "saveButton";
|
||||
saveButton.Size = new Size(128, 39);
|
||||
saveButton.TabIndex = 4;
|
||||
saveButton.Text = "Сохранить";
|
||||
saveButton.Click += saveButton_Click;
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
cancelButton.Location = new Point(283, 531);
|
||||
cancelButton.Name = "cancelButton";
|
||||
cancelButton.Size = new Size(126, 39);
|
||||
cancelButton.TabIndex = 5;
|
||||
cancelButton.Text = "Отмена";
|
||||
cancelButton.Click += cancelButton_Click;
|
||||
//
|
||||
// priceLabel
|
||||
//
|
||||
priceLabel.Location = new Point(10, 89);
|
||||
priceLabel.Name = "priceLabel";
|
||||
priceLabel.Size = new Size(100, 23);
|
||||
priceLabel.TabIndex = 0;
|
||||
priceLabel.Text = "Цена:";
|
||||
//
|
||||
// verdictLabel
|
||||
//
|
||||
verdictLabel.Location = new Point(10, 176);
|
||||
verdictLabel.Name = "verdictLabel";
|
||||
verdictLabel.Size = new Size(111, 23);
|
||||
verdictLabel.TabIndex = 11;
|
||||
verdictLabel.Text = "Вердикт:";
|
||||
//
|
||||
// typeApellBox
|
||||
//
|
||||
typeApellBox.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
typeApellBox.FormattingEnabled = true;
|
||||
typeApellBox.Location = new Point(116, 10);
|
||||
typeApellBox.Name = "typeApellBox";
|
||||
typeApellBox.Size = new Size(121, 33);
|
||||
typeApellBox.TabIndex = 13;
|
||||
//
|
||||
// paymentCheckBox
|
||||
//
|
||||
paymentCheckBox.AutoSize = true;
|
||||
paymentCheckBox.Location = new Point(120, 49);
|
||||
paymentCheckBox.Name = "paymentCheckBox";
|
||||
paymentCheckBox.Size = new Size(109, 29);
|
||||
paymentCheckBox.TabIndex = 14;
|
||||
paymentCheckBox.Text = "успешно";
|
||||
paymentCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// priceNumeric
|
||||
//
|
||||
priceNumeric.DecimalPlaces = 2;
|
||||
priceNumeric.Location = new Point(117, 87);
|
||||
priceNumeric.Name = "priceNumeric";
|
||||
priceNumeric.Size = new Size(120, 31);
|
||||
priceNumeric.TabIndex = 15;
|
||||
//
|
||||
// winPriceLabel
|
||||
//
|
||||
winPriceLabel.Location = new Point(10, 122);
|
||||
winPriceLabel.Name = "winPriceLabel";
|
||||
winPriceLabel.Size = new Size(100, 23);
|
||||
winPriceLabel.TabIndex = 16;
|
||||
winPriceLabel.Text = "Победная цена:";
|
||||
//
|
||||
// winPriceNumeric
|
||||
//
|
||||
winPriceNumeric.DecimalPlaces = 2;
|
||||
winPriceNumeric.Location = new Point(117, 122);
|
||||
winPriceNumeric.Name = "winPriceNumeric";
|
||||
winPriceNumeric.Size = new Size(120, 31);
|
||||
winPriceNumeric.TabIndex = 17;
|
||||
//
|
||||
// verdictCheckBox
|
||||
//
|
||||
verdictCheckBox.AutoSize = true;
|
||||
verdictCheckBox.Location = new Point(116, 176);
|
||||
verdictCheckBox.Name = "verdictCheckBox";
|
||||
verdictCheckBox.Size = new Size(109, 29);
|
||||
verdictCheckBox.TabIndex = 19;
|
||||
verdictCheckBox.Text = "успешно";
|
||||
verdictCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// courtBox
|
||||
//
|
||||
courtBox.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
courtBox.FormattingEnabled = true;
|
||||
courtBox.Location = new Point(116, 212);
|
||||
courtBox.Name = "courtBox";
|
||||
courtBox.Size = new Size(121, 33);
|
||||
courtBox.TabIndex = 21;
|
||||
//
|
||||
// courtLabel
|
||||
//
|
||||
courtLabel.Location = new Point(12, 215);
|
||||
courtLabel.Name = "courtLabel";
|
||||
courtLabel.Size = new Size(100, 23);
|
||||
courtLabel.TabIndex = 20;
|
||||
courtLabel.Text = "Суд:";
|
||||
//
|
||||
// clientBox
|
||||
//
|
||||
clientBox.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
clientBox.FormattingEnabled = true;
|
||||
clientBox.Location = new Point(116, 262);
|
||||
clientBox.Name = "clientBox";
|
||||
clientBox.Size = new Size(121, 33);
|
||||
clientBox.TabIndex = 23;
|
||||
//
|
||||
// clientLabel
|
||||
//
|
||||
clientLabel.Location = new Point(10, 262);
|
||||
clientLabel.Name = "clientLabel";
|
||||
clientLabel.Size = new Size(100, 23);
|
||||
clientLabel.TabIndex = 22;
|
||||
clientLabel.Text = "Клиент:";
|
||||
//
|
||||
// descriptionLabel
|
||||
//
|
||||
descriptionLabel.Location = new Point(10, 296);
|
||||
descriptionLabel.Name = "descriptionLabel";
|
||||
descriptionLabel.Size = new Size(100, 23);
|
||||
descriptionLabel.TabIndex = 24;
|
||||
descriptionLabel.Text = "Описание:";
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
textBox1.Location = new Point(118, 296);
|
||||
textBox1.Multiline = true;
|
||||
textBox1.Name = "textBox1";
|
||||
textBox1.Size = new Size(154, 73);
|
||||
textBox1.TabIndex = 25;
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
groupBox1.Controls.Add(dataGridView1);
|
||||
groupBox1.Location = new Point(327, 30);
|
||||
groupBox1.Name = "groupBox1";
|
||||
groupBox1.Size = new Size(477, 339);
|
||||
groupBox1.TabIndex = 26;
|
||||
groupBox1.TabStop = false;
|
||||
groupBox1.Text = "Прикрепленные адвокаты";
|
||||
//
|
||||
// dataGridView1
|
||||
//
|
||||
dataGridView1.AllowUserToResizeColumns = false;
|
||||
dataGridView1.AllowUserToResizeRows = false;
|
||||
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView1.BackgroundColor = SystemColors.ActiveCaption;
|
||||
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView1.Columns.AddRange(new DataGridViewColumn[] { ColumnAdvocate, ColumnPost });
|
||||
dataGridView1.Dock = DockStyle.Fill;
|
||||
dataGridView1.Location = new Point(3, 27);
|
||||
dataGridView1.Name = "dataGridView1";
|
||||
dataGridView1.RowHeadersWidth = 62;
|
||||
dataGridView1.Size = new Size(471, 309);
|
||||
dataGridView1.TabIndex = 0;
|
||||
//
|
||||
// ColumnAdvocate
|
||||
//
|
||||
ColumnAdvocate.HeaderText = "Адвокаты";
|
||||
ColumnAdvocate.MinimumWidth = 8;
|
||||
ColumnAdvocate.Name = "ColumnAdvocate";
|
||||
//
|
||||
// ColumnPost
|
||||
//
|
||||
ColumnPost.HeaderText = "Должности";
|
||||
ColumnPost.MinimumWidth = 8;
|
||||
ColumnPost.Name = "ColumnPost";
|
||||
//
|
||||
// FormCase
|
||||
//
|
||||
ClientSize = new Size(845, 582);
|
||||
Controls.Add(groupBox1);
|
||||
Controls.Add(textBox1);
|
||||
Controls.Add(descriptionLabel);
|
||||
Controls.Add(clientBox);
|
||||
Controls.Add(clientLabel);
|
||||
Controls.Add(courtBox);
|
||||
Controls.Add(courtLabel);
|
||||
Controls.Add(verdictCheckBox);
|
||||
Controls.Add(winPriceNumeric);
|
||||
Controls.Add(winPriceLabel);
|
||||
Controls.Add(priceNumeric);
|
||||
Controls.Add(paymentCheckBox);
|
||||
Controls.Add(typeApellBox);
|
||||
Controls.Add(verdictLabel);
|
||||
Controls.Add(priceLabel);
|
||||
Controls.Add(typeApealLabel);
|
||||
Controls.Add(paymentLabel);
|
||||
Controls.Add(saveButton);
|
||||
Controls.Add(cancelButton);
|
||||
Name = "FormCase";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Дело";
|
||||
((System.ComponentModel.ISupportInitialize)priceNumeric).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)winPriceNumeric).EndInit();
|
||||
groupBox1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label typeApealLabel;
|
||||
|
||||
private Label paymentLabel;
|
||||
private TextBox emailTextBox;
|
||||
|
||||
private Button saveButton;
|
||||
private Button cancelButton;
|
||||
private Label priceLabel;
|
||||
private Label label2;
|
||||
private CheckBox sexCheckBox;
|
||||
private Label DateLabel;
|
||||
private DateTimePicker dateTimePicker;
|
||||
private TextBox phoneText;
|
||||
private Label verdictLabel;
|
||||
private ComboBox typeApellBox;
|
||||
private CheckBox paymentCheckBox;
|
||||
private NumericUpDown priceNumeric;
|
||||
private Label winPriceLabel;
|
||||
private NumericUpDown winPriceNumeric;
|
||||
private CheckBox verdictCheckBox;
|
||||
private ComboBox courtBox;
|
||||
private Label courtLabel;
|
||||
private ComboBox clientBox;
|
||||
private Label clientLabel;
|
||||
private Label descriptionLabel;
|
||||
private TextBox textBox1;
|
||||
private GroupBox groupBox1;
|
||||
private DataGridView dataGridView1;
|
||||
private DataGridViewComboBoxColumn ColumnAdvocate;
|
||||
private DataGridViewTextBoxColumn ColumnPost;
|
||||
}
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
using ProjectGSM.Entities;
|
||||
using ProjectGSM.Entities.Enums;
|
||||
using ProjectGSM.Repositories;
|
||||
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
|
||||
public partial class FormCase : Form
|
||||
{
|
||||
private readonly ICaseRepository _caseRepository;
|
||||
|
||||
|
||||
public FormCase(ICaseRepository caseRepository,IClientRepository clientRepository, ICourtRepository courtRepository, IAdvocateRepository advocateRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_caseRepository = caseRepository ??
|
||||
throw new
|
||||
ArgumentNullException(nameof(caseRepository));
|
||||
|
||||
typeApellBox.DataSource = Enum.GetValues(typeof(TypeAppeal));
|
||||
|
||||
ColumnAdvocate.DataSource = advocateRepository.ReadAdvocates();
|
||||
ColumnAdvocate.DisplayMember = "Name";
|
||||
ColumnAdvocate.ValueMember = "Id";
|
||||
|
||||
clientBox.DataSource = clientRepository.ReadClients();
|
||||
clientBox.DisplayMember = "Name";
|
||||
clientBox.ValueMember = "Id";
|
||||
|
||||
courtBox.DataSource = courtRepository.ReadCourts();
|
||||
courtBox.DisplayMember = "Name";
|
||||
courtBox.ValueMember = "Id";
|
||||
}
|
||||
|
||||
private void saveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{if(dataGridView1.RowCount < 1 || typeApellBox.SelectedIndex < 0 || clientBox.SelectedIndex < 0 || courtBox.SelectedIndex < 0
|
||||
|
||||
)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
Case caseE = CreateCase(0);
|
||||
caseE.SetAdvocates(CreateListCaseAdvocateFromDataGrid());
|
||||
_caseRepository.CreateCase(caseE);
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void cancelButton_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
|
||||
private List<CaseAdvocate> CreateListCaseAdvocateFromDataGrid()
|
||||
{
|
||||
var list = new List<CaseAdvocate>();
|
||||
foreach (DataGridViewRow row in dataGridView1.Rows)
|
||||
{
|
||||
if (row.Cells["ColumnAdvocate"].Value == null ||
|
||||
row.Cells["ColumnPost"].Value == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
list.Add(CaseAdvocate.CreateEntity(0,
|
||||
Convert.ToInt32(row.Cells["ColumnAdvocate"].Value),
|
||||
row.Cells["ColumnPost"].Value.ToString()??string.Empty));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
private Case CreateCase(int id) => Case.CreateEntity(id,
|
||||
(TypeAppeal)typeApellBox.SelectedItem!,
|
||||
paymentCheckBox.Checked,
|
||||
priceNumeric.Value,
|
||||
winPriceNumeric.Value,
|
||||
verdictCheckBox.Checked,
|
||||
((Court)courtBox.SelectedItem).Id,
|
||||
((Client)clientBox.SelectedItem).Id,
|
||||
textBox1.Text);
|
||||
}
|
||||
}
|
@ -1,126 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="ColumnAdvocate.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnPost.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
163
ProjectGSM/Forms/FormCaseReport.Designer.cs
generated
163
ProjectGSM/Forms/FormCaseReport.Designer.cs
generated
@ -1,163 +0,0 @@
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
partial class FormCaseReport
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
textBoxFilePath = new TextBox();
|
||||
fileLabel = new Label();
|
||||
labelCase = new Label();
|
||||
comboBoxCase = new ComboBox();
|
||||
labelData1 = new Label();
|
||||
labelDate2 = new Label();
|
||||
dateTimePickerBegin = new DateTimePicker();
|
||||
dateTimePickerEnd = new DateTimePicker();
|
||||
ButtonSelectFilePath = new Button();
|
||||
buttonMakeReport = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// textBoxFilePath
|
||||
//
|
||||
textBoxFilePath.Enabled = false;
|
||||
textBoxFilePath.Location = new Point(124, 30);
|
||||
textBoxFilePath.Name = "textBoxFilePath";
|
||||
textBoxFilePath.Size = new Size(163, 23);
|
||||
textBoxFilePath.TabIndex = 0;
|
||||
//
|
||||
// fileLabel
|
||||
//
|
||||
fileLabel.AutoSize = true;
|
||||
fileLabel.Location = new Point(28, 33);
|
||||
fileLabel.Name = "fileLabel";
|
||||
fileLabel.Size = new Size(90, 15);
|
||||
fileLabel.TabIndex = 1;
|
||||
fileLabel.Text = "Путь до файла:";
|
||||
//
|
||||
// labelCase
|
||||
//
|
||||
labelCase.AutoSize = true;
|
||||
labelCase.Location = new Point(28, 77);
|
||||
labelCase.Name = "labelCase";
|
||||
labelCase.Size = new Size(38, 15);
|
||||
labelCase.TabIndex = 2;
|
||||
labelCase.Text = "Дело:";
|
||||
//
|
||||
// comboBoxCase
|
||||
//
|
||||
comboBoxCase.FormattingEnabled = true;
|
||||
comboBoxCase.Location = new Point(124, 69);
|
||||
comboBoxCase.Name = "comboBoxCase";
|
||||
comboBoxCase.Size = new Size(200, 23);
|
||||
comboBoxCase.TabIndex = 3;
|
||||
//
|
||||
// labelData1
|
||||
//
|
||||
labelData1.AutoSize = true;
|
||||
labelData1.Location = new Point(28, 128);
|
||||
labelData1.Name = "labelData1";
|
||||
labelData1.Size = new Size(77, 15);
|
||||
labelData1.TabIndex = 4;
|
||||
labelData1.Text = "Дата начала:";
|
||||
//
|
||||
// labelDate2
|
||||
//
|
||||
labelDate2.AutoSize = true;
|
||||
labelDate2.Location = new Point(28, 177);
|
||||
labelDate2.Name = "labelDate2";
|
||||
labelDate2.Size = new Size(71, 15);
|
||||
labelDate2.TabIndex = 5;
|
||||
labelDate2.Text = "Дата конца:";
|
||||
//
|
||||
// dateTimePickerBegin
|
||||
//
|
||||
dateTimePickerBegin.Location = new Point(124, 122);
|
||||
dateTimePickerBegin.Name = "dateTimePickerBegin";
|
||||
dateTimePickerBegin.Size = new Size(200, 23);
|
||||
dateTimePickerBegin.TabIndex = 6;
|
||||
//
|
||||
// dateTimePickerEnd
|
||||
//
|
||||
dateTimePickerEnd.Location = new Point(124, 171);
|
||||
dateTimePickerEnd.Name = "dateTimePickerEnd";
|
||||
dateTimePickerEnd.Size = new Size(200, 23);
|
||||
dateTimePickerEnd.TabIndex = 7;
|
||||
//
|
||||
// ButtonSelectFilePath
|
||||
//
|
||||
ButtonSelectFilePath.Location = new Point(293, 30);
|
||||
ButtonSelectFilePath.Name = "ButtonSelectFilePath";
|
||||
ButtonSelectFilePath.Size = new Size(31, 23);
|
||||
ButtonSelectFilePath.TabIndex = 8;
|
||||
ButtonSelectFilePath.Text = "...";
|
||||
ButtonSelectFilePath.UseVisualStyleBackColor = true;
|
||||
ButtonSelectFilePath.Click += ButtonSelectFilePath_Click;
|
||||
//
|
||||
// buttonMakeReport
|
||||
//
|
||||
buttonMakeReport.Location = new Point(110, 221);
|
||||
buttonMakeReport.Name = "buttonMakeReport";
|
||||
buttonMakeReport.Size = new Size(166, 23);
|
||||
buttonMakeReport.TabIndex = 9;
|
||||
buttonMakeReport.Text = "Сформировать";
|
||||
buttonMakeReport.UseVisualStyleBackColor = true;
|
||||
buttonMakeReport.Click += ButtonMakeReport_Click;
|
||||
//
|
||||
// FormCaseReport
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(368, 257);
|
||||
Controls.Add(buttonMakeReport);
|
||||
Controls.Add(ButtonSelectFilePath);
|
||||
Controls.Add(dateTimePickerEnd);
|
||||
Controls.Add(dateTimePickerBegin);
|
||||
Controls.Add(labelDate2);
|
||||
Controls.Add(labelData1);
|
||||
Controls.Add(comboBoxCase);
|
||||
Controls.Add(labelCase);
|
||||
Controls.Add(fileLabel);
|
||||
Controls.Add(textBoxFilePath);
|
||||
Name = "FormCaseReport";
|
||||
Text = "Отчет по статусам дела";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private TextBox textBoxFilePath;
|
||||
private Label fileLabel;
|
||||
private Label labelCase;
|
||||
private ComboBox comboBoxCase;
|
||||
private Label labelData1;
|
||||
private Label labelDate2;
|
||||
private DateTimePicker dateTimePickerBegin;
|
||||
private DateTimePicker dateTimePickerEnd;
|
||||
private Button ButtonSelectFilePath;
|
||||
private Button buttonMakeReport;
|
||||
}
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
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 ProjectGSM.Documents;
|
||||
using ProjectGSM.Repositories;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
public partial class FormCaseReport : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
public FormCaseReport(IUnityContainer container, ICaseRepository
|
||||
feedRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
comboBoxCase.DataSource = feedRepository.ReadCases();
|
||||
comboBoxCase.DisplayMember = "Description";
|
||||
comboBoxCase.ValueMember = "Id";
|
||||
}
|
||||
|
||||
private void ButtonSelectFilePath_Click(object sender, EventArgs e)
|
||||
{
|
||||
var sfd = new SaveFileDialog()
|
||||
{
|
||||
Filter = "Excel Files | *.xlsx"
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
textBoxFilePath.Text = sfd.FileName;
|
||||
}
|
||||
|
||||
private void ButtonMakeReport_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxFilePath.Text))
|
||||
{
|
||||
throw new Exception("Отсутствует имя файла для отчета");
|
||||
}
|
||||
|
||||
if (comboBoxCase.SelectedIndex < 0)
|
||||
{
|
||||
throw new Exception("Не выбран корм");
|
||||
}
|
||||
|
||||
if (dateTimePickerEnd.Value <=
|
||||
dateTimePickerBegin.Value)
|
||||
{
|
||||
throw new Exception("Дата начала должна быть раньше даты окончания");
|
||||
}
|
||||
|
||||
if
|
||||
(_container.Resolve<TableReport>().CreateTable(textBoxFilePath.Text,
|
||||
(int)comboBoxCase.SelectedValue!,
|
||||
dateTimePickerBegin.Value, dateTimePickerEnd.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?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>
|
115
ProjectGSM/Forms/FormCases.Designer.cs
generated
115
ProjectGSM/Forms/FormCases.Designer.cs
generated
@ -1,115 +0,0 @@
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
partial class FormCases
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
panel1 = new Panel();
|
||||
deleteButton = new Button();
|
||||
addButton = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(deleteButton);
|
||||
panel1.Controls.Add(addButton);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(604, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(142, 450);
|
||||
panel1.TabIndex = 0;
|
||||
//
|
||||
// deleteButton
|
||||
//
|
||||
deleteButton.BackgroundImage = Properties.Resources.circle_x_svgrepo_com;
|
||||
deleteButton.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
deleteButton.Location = new Point(33, 137);
|
||||
deleteButton.Margin = new Padding(2, 2, 2, 2);
|
||||
deleteButton.Name = "deleteButton";
|
||||
deleteButton.Size = new Size(75, 72);
|
||||
deleteButton.TabIndex = 0;
|
||||
deleteButton.Click += deleteButton_Click;
|
||||
//
|
||||
// addButton
|
||||
//
|
||||
addButton.BackgroundImage = Properties.Resources.circle_plus_svgrepo_com;
|
||||
addButton.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
addButton.Location = new Point(33, 38);
|
||||
addButton.Name = "addButton";
|
||||
addButton.Size = new Size(75, 75);
|
||||
addButton.TabIndex = 0;
|
||||
addButton.Text = " ";
|
||||
addButton.UseVisualStyleBackColor = true;
|
||||
addButton.Click += addButton_Click;
|
||||
//
|
||||
// dataGridView1
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.AllowUserToResizeColumns = false;
|
||||
dataGridView.AllowUserToResizeRows = false;
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.BackgroundColor = SystemColors.Info;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Dock = DockStyle.Fill;
|
||||
dataGridView.Location = new Point(0, 0);
|
||||
dataGridView.MultiSelect = false;
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.RowHeadersWidth = 62;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(604, 450);
|
||||
dataGridView.TabIndex = 1;
|
||||
//
|
||||
// FormCases
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(746, 450);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormCases";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Дела";
|
||||
Load += FormClients_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button deleteButton;
|
||||
private Button addButton;
|
||||
private DataGridView dataGridView;
|
||||
}
|
||||
}
|
@ -1,108 +0,0 @@
|
||||
using ProjectGSM.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 ProjectGSM.Forms
|
||||
{
|
||||
public partial class FormCases : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
private readonly ICaseRepository _caseRepository;
|
||||
public FormCases(IUnityContainer container, ICaseRepository caseRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_caseRepository = caseRepository ??
|
||||
throw new
|
||||
ArgumentNullException(nameof(caseRepository));
|
||||
|
||||
}
|
||||
|
||||
private void deleteButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление",
|
||||
MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_caseRepository.DeleteCase(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormCase>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void FormClients_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void LoadList()
|
||||
{
|
||||
dataGridView.DataSource =
|
||||
_caseRepository.ReadCases();
|
||||
dataGridView.Columns["Id"].Visible = false;
|
||||
dataGridView.Columns["CreatedAt"].DefaultCellStyle.Format =
|
||||
"dd.MM.yyyy";
|
||||
}
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridView.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id =
|
||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?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>
|
202
ProjectGSM/Forms/FormClient.Designer.cs
generated
202
ProjectGSM/Forms/FormClient.Designer.cs
generated
@ -1,202 +0,0 @@
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
partial class FormClient
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
nameLabel = new Label();
|
||||
nameTextBox = new TextBox();
|
||||
emailLabel = new Label();
|
||||
emailTextBox = new TextBox();
|
||||
saveButton = new Button();
|
||||
cancelButton = new Button();
|
||||
sex = new Label();
|
||||
sexCheckBox = new CheckBox();
|
||||
DateLabel = new Label();
|
||||
dateTimePicker = new DateTimePicker();
|
||||
PhoneLabel = new Label();
|
||||
phoneText = new TextBox();
|
||||
adressLabel = new Label();
|
||||
adressBox = new TextBox();
|
||||
SuspendLayout();
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
nameLabel.Location = new Point(10, 10);
|
||||
nameLabel.Name = "nameLabel";
|
||||
nameLabel.Size = new Size(100, 23);
|
||||
nameLabel.TabIndex = 0;
|
||||
nameLabel.Text = "Имя клиента:";
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
nameTextBox.Location = new Point(120, 10);
|
||||
nameTextBox.Name = "nameTextBox";
|
||||
nameTextBox.Size = new Size(108, 23);
|
||||
nameTextBox.TabIndex = 1;
|
||||
//
|
||||
// emailLabel
|
||||
//
|
||||
emailLabel.Location = new Point(10, 50);
|
||||
emailLabel.Name = "emailLabel";
|
||||
emailLabel.Size = new Size(100, 23);
|
||||
emailLabel.TabIndex = 2;
|
||||
emailLabel.Text = "Email:";
|
||||
//
|
||||
// emailTextBox
|
||||
//
|
||||
emailTextBox.Location = new Point(120, 50);
|
||||
emailTextBox.Name = "emailTextBox";
|
||||
emailTextBox.Size = new Size(108, 23);
|
||||
emailTextBox.TabIndex = 3;
|
||||
//
|
||||
// saveButton
|
||||
//
|
||||
saveButton.Location = new Point(117, 226);
|
||||
saveButton.Name = "saveButton";
|
||||
saveButton.Size = new Size(75, 23);
|
||||
saveButton.TabIndex = 4;
|
||||
saveButton.Text = "Сохранить";
|
||||
saveButton.Click += saveButton_Click;
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
cancelButton.Location = new Point(197, 226);
|
||||
cancelButton.Name = "cancelButton";
|
||||
cancelButton.Size = new Size(75, 23);
|
||||
cancelButton.TabIndex = 5;
|
||||
cancelButton.Text = "Отмена";
|
||||
cancelButton.Click += cancelButton_Click;
|
||||
//
|
||||
// sex
|
||||
//
|
||||
sex.Location = new Point(10, 89);
|
||||
sex.Name = "sex";
|
||||
sex.Size = new Size(100, 23);
|
||||
sex.TabIndex = 0;
|
||||
sex.Text = "Пол:";
|
||||
//
|
||||
// sexCheckBox
|
||||
//
|
||||
sexCheckBox.AutoSize = true;
|
||||
sexCheckBox.Location = new Point(120, 88);
|
||||
sexCheckBox.Name = "sexCheckBox";
|
||||
sexCheckBox.Size = new Size(77, 19);
|
||||
sexCheckBox.TabIndex = 6;
|
||||
sexCheckBox.Text = "мужчина";
|
||||
sexCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// DateLabel
|
||||
//
|
||||
DateLabel.Location = new Point(10, 121);
|
||||
DateLabel.Name = "DateLabel";
|
||||
DateLabel.Size = new Size(100, 23);
|
||||
DateLabel.TabIndex = 7;
|
||||
DateLabel.Text = "Дата рождения:";
|
||||
//
|
||||
// dateTimePicker
|
||||
//
|
||||
dateTimePicker.Location = new Point(116, 115);
|
||||
dateTimePicker.Name = "dateTimePicker";
|
||||
dateTimePicker.Size = new Size(112, 23);
|
||||
dateTimePicker.TabIndex = 8;
|
||||
//
|
||||
// PhoneLabel
|
||||
//
|
||||
PhoneLabel.Location = new Point(10, 157);
|
||||
PhoneLabel.Name = "PhoneLabel";
|
||||
PhoneLabel.Size = new Size(111, 23);
|
||||
PhoneLabel.TabIndex = 9;
|
||||
PhoneLabel.Text = "Номер телефона:";
|
||||
//
|
||||
// phoneText
|
||||
//
|
||||
phoneText.Location = new Point(120, 155);
|
||||
phoneText.Name = "phoneText";
|
||||
phoneText.Size = new Size(108, 23);
|
||||
phoneText.TabIndex = 10;
|
||||
//
|
||||
// adressLabel
|
||||
//
|
||||
adressLabel.Location = new Point(10, 191);
|
||||
adressLabel.Name = "adressLabel";
|
||||
adressLabel.Size = new Size(111, 23);
|
||||
adressLabel.TabIndex = 11;
|
||||
adressLabel.Text = "Адрес:";
|
||||
//
|
||||
// adressBox
|
||||
//
|
||||
adressBox.Location = new Point(120, 191);
|
||||
adressBox.Name = "adressBox";
|
||||
adressBox.Size = new Size(108, 23);
|
||||
adressBox.TabIndex = 12;
|
||||
//
|
||||
// FormClient
|
||||
//
|
||||
ClientSize = new Size(284, 261);
|
||||
Controls.Add(adressBox);
|
||||
Controls.Add(adressLabel);
|
||||
Controls.Add(phoneText);
|
||||
Controls.Add(PhoneLabel);
|
||||
Controls.Add(dateTimePicker);
|
||||
Controls.Add(DateLabel);
|
||||
Controls.Add(sexCheckBox);
|
||||
Controls.Add(sex);
|
||||
Controls.Add(nameLabel);
|
||||
Controls.Add(nameTextBox);
|
||||
Controls.Add(emailLabel);
|
||||
Controls.Add(emailTextBox);
|
||||
Controls.Add(saveButton);
|
||||
Controls.Add(cancelButton);
|
||||
Name = "FormClient";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Клиент";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label nameLabel;
|
||||
private TextBox nameTextBox;
|
||||
|
||||
private Label emailLabel;
|
||||
private TextBox emailTextBox;
|
||||
|
||||
private Button saveButton;
|
||||
private Button cancelButton;
|
||||
private Label sex;
|
||||
private Label label2;
|
||||
private CheckBox sexCheckBox;
|
||||
private Label DateLabel;
|
||||
private DateTimePicker dateTimePicker;
|
||||
private Label PhoneLabel;
|
||||
private TextBox phoneText;
|
||||
private Label adressLabel;
|
||||
private TextBox adressBox;
|
||||
}
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
using ProjectGSM.Entities;
|
||||
using ProjectGSM.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
|
||||
public partial class FormClient : Form
|
||||
{
|
||||
private readonly IClientRepository _clientRepository;
|
||||
|
||||
private int? _clientId;
|
||||
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
var client =
|
||||
_clientRepository.ReadClientById(value);
|
||||
if (client == null)
|
||||
{
|
||||
throw new
|
||||
InvalidDataException(nameof(client));
|
||||
}
|
||||
|
||||
_clientId = value;
|
||||
nameTextBox.Text = client.Name;
|
||||
emailTextBox.Text = client.Email;
|
||||
sexCheckBox.Checked = client.Sex;
|
||||
dateTimePicker.Value = client.DateOfBirth;
|
||||
phoneText.Text = client.PhoneNumber;
|
||||
adressBox.Text = client.Address;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, $"Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public FormClient(IClientRepository clientRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_clientRepository = clientRepository ??
|
||||
throw new
|
||||
ArgumentNullException(nameof(clientRepository));
|
||||
}
|
||||
|
||||
private void saveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(nameTextBox.Text) || string.IsNullOrWhiteSpace(emailTextBox.Text) || string.IsNullOrWhiteSpace(phoneText.Text) || string.IsNullOrWhiteSpace(adressBox.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
if (_clientId.HasValue)
|
||||
{
|
||||
_clientRepository.UpdateClient(CreateClient(_clientId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_clientRepository.CreateClient(CreateClient(0));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, $"Ошибка при сохранении {_clientId}",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void cancelButton_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Client CreateClient(int id) => Client.CreateEntity(id,
|
||||
nameTextBox.Text,
|
||||
sexCheckBox.Checked,
|
||||
dateTimePicker.Value,
|
||||
emailTextBox.Text,
|
||||
phoneText.Text,
|
||||
adressBox.Text);
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?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>
|
130
ProjectGSM/Forms/FormClients.Designer.cs
generated
130
ProjectGSM/Forms/FormClients.Designer.cs
generated
@ -1,130 +0,0 @@
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
partial class FormClients
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
panel1 = new Panel();
|
||||
deleteButton = new Button();
|
||||
editButton = new Button();
|
||||
addButton = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(deleteButton);
|
||||
panel1.Controls.Add(editButton);
|
||||
panel1.Controls.Add(addButton);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(604, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(142, 450);
|
||||
panel1.TabIndex = 0;
|
||||
//
|
||||
// deleteButton
|
||||
//
|
||||
deleteButton.BackgroundImage = Properties.Resources.circle_x_svgrepo_com;
|
||||
deleteButton.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
deleteButton.Location = new Point(33, 240);
|
||||
deleteButton.Name = "deleteButton";
|
||||
deleteButton.Size = new Size(75, 75);
|
||||
deleteButton.TabIndex = 2;
|
||||
deleteButton.Text = " ";
|
||||
deleteButton.UseVisualStyleBackColor = true;
|
||||
deleteButton.Click += deleteButton_Click;
|
||||
//
|
||||
// editButton
|
||||
//
|
||||
editButton.BackgroundImage = Properties.Resources.pencil_svgrepo_com;
|
||||
editButton.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
editButton.Location = new Point(33, 139);
|
||||
editButton.Name = "editButton";
|
||||
editButton.Size = new Size(75, 75);
|
||||
editButton.TabIndex = 1;
|
||||
editButton.Text = " ";
|
||||
editButton.UseVisualStyleBackColor = true;
|
||||
editButton.Click += editButton_Click;
|
||||
//
|
||||
// addButton
|
||||
//
|
||||
addButton.BackgroundImage = Properties.Resources.circle_plus_svgrepo_com;
|
||||
addButton.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
addButton.Location = new Point(33, 38);
|
||||
addButton.Name = "addButton";
|
||||
addButton.Size = new Size(75, 75);
|
||||
addButton.TabIndex = 0;
|
||||
addButton.Text = " ";
|
||||
addButton.UseVisualStyleBackColor = true;
|
||||
addButton.Click += addButton_Click;
|
||||
//
|
||||
// dataGridView1
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.AllowUserToResizeColumns = false;
|
||||
dataGridView.AllowUserToResizeRows = false;
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.BackgroundColor = SystemColors.Info;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Dock = DockStyle.Fill;
|
||||
dataGridView.Location = new Point(0, 0);
|
||||
dataGridView.MultiSelect = false;
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(604, 450);
|
||||
dataGridView.TabIndex = 1;
|
||||
//
|
||||
// FormClients
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(746, 450);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormClients";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Клиенты";
|
||||
Load += FormClients_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button deleteButton;
|
||||
private Button editButton;
|
||||
private Button addButton;
|
||||
private DataGridView dataGridView;
|
||||
}
|
||||
}
|
@ -1,128 +0,0 @@
|
||||
using ProjectGSM.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 ProjectGSM.Forms
|
||||
{
|
||||
public partial class FormClients : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
private readonly IClientRepository _clientRepository;
|
||||
public FormClients(IUnityContainer container, IClientRepository clientRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_clientRepository = clientRepository ??
|
||||
throw new
|
||||
ArgumentNullException(nameof(clientRepository));
|
||||
|
||||
}
|
||||
|
||||
private void deleteButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление",
|
||||
MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_clientRepository.DeleteClient(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void editButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormClient>();
|
||||
form.Id = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при изменении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormClient>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void FormClients_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void LoadList() {
|
||||
dataGridView.DataSource =
|
||||
_clientRepository.ReadClients();
|
||||
dataGridView.Columns["Id"].Visible = false;
|
||||
dataGridView.Columns["CreatedAt"].DefaultCellStyle.Format =
|
||||
"dd.MM.yyyy";
|
||||
}
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridView.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id =
|
||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?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>
|
113
ProjectGSM/Forms/FormCourt.Designer.cs
generated
113
ProjectGSM/Forms/FormCourt.Designer.cs
generated
@ -1,113 +0,0 @@
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
partial class FormCourt
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
nameLabel = new Label();
|
||||
nameTextBox = new TextBox();
|
||||
saveButton = new Button();
|
||||
cancelButton = new Button();
|
||||
adressLabel = new Label();
|
||||
adressBox = new TextBox();
|
||||
SuspendLayout();
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
nameLabel.Location = new Point(10, 10);
|
||||
nameLabel.Name = "nameLabel";
|
||||
nameLabel.Size = new Size(100, 23);
|
||||
nameLabel.TabIndex = 0;
|
||||
nameLabel.Text = "Название:";
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
nameTextBox.Location = new Point(116, 10);
|
||||
nameTextBox.Name = "nameTextBox";
|
||||
nameTextBox.Size = new Size(120, 23);
|
||||
nameTextBox.TabIndex = 1;
|
||||
//
|
||||
// saveButton
|
||||
//
|
||||
saveButton.Location = new Point(116, 101);
|
||||
saveButton.Name = "saveButton";
|
||||
saveButton.Size = new Size(75, 23);
|
||||
saveButton.TabIndex = 4;
|
||||
saveButton.Text = "Сохранить";
|
||||
saveButton.Click += saveButton_Click;
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
cancelButton.Location = new Point(197, 101);
|
||||
cancelButton.Name = "cancelButton";
|
||||
cancelButton.Size = new Size(75, 23);
|
||||
cancelButton.TabIndex = 5;
|
||||
cancelButton.Text = "Отмена";
|
||||
cancelButton.Click += cancelButton_Click;
|
||||
//
|
||||
// adressLabel
|
||||
//
|
||||
adressLabel.Location = new Point(10, 50);
|
||||
adressLabel.Name = "adressLabel";
|
||||
adressLabel.Size = new Size(111, 23);
|
||||
adressLabel.TabIndex = 11;
|
||||
adressLabel.Text = "Адрес:";
|
||||
//
|
||||
// adressBox
|
||||
//
|
||||
adressBox.Location = new Point(116, 47);
|
||||
adressBox.Name = "adressBox";
|
||||
adressBox.Size = new Size(120, 23);
|
||||
adressBox.TabIndex = 12;
|
||||
//
|
||||
// FormCourt
|
||||
//
|
||||
ClientSize = new Size(284, 134);
|
||||
Controls.Add(adressBox);
|
||||
Controls.Add(adressLabel);
|
||||
Controls.Add(nameLabel);
|
||||
Controls.Add(nameTextBox);
|
||||
Controls.Add(saveButton);
|
||||
Controls.Add(cancelButton);
|
||||
Name = "FormCourt";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Суд";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label nameLabel;
|
||||
private TextBox nameTextBox;
|
||||
|
||||
private Button saveButton;
|
||||
private Button cancelButton;
|
||||
private Label adressLabel;
|
||||
private TextBox adressBox;
|
||||
}
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
using ProjectGSM.Entities;
|
||||
using ProjectGSM.Repositories;
|
||||
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
|
||||
public partial class FormCourt : Form
|
||||
{
|
||||
private readonly ICourtRepository _courtRepository;
|
||||
|
||||
private int? _courtId;
|
||||
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var court =
|
||||
_courtRepository.ReadCourtById(value);
|
||||
if (court == null)
|
||||
{
|
||||
throw new
|
||||
InvalidDataException(nameof(court));
|
||||
}
|
||||
|
||||
_courtId = value;
|
||||
nameTextBox.Text = court.Name;
|
||||
adressBox.Text = court.Address;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public FormCourt(ICourtRepository courtRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_courtRepository = courtRepository ??
|
||||
throw new
|
||||
ArgumentNullException(nameof(courtRepository));
|
||||
}
|
||||
|
||||
private void saveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(nameTextBox.Text) || string.IsNullOrWhiteSpace(adressBox.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
if (_courtId.HasValue)
|
||||
{
|
||||
_courtRepository.UpdateCourt(CreateCourt(_courtId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_courtRepository.CreateCourt(CreateCourt(0));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void cancelButton_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Court CreateCourt(int id) => Court.CreateEntity(id,
|
||||
nameTextBox.Text,
|
||||
adressBox.Text);
|
||||
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?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>
|
130
ProjectGSM/Forms/FormCourts.Designer.cs
generated
130
ProjectGSM/Forms/FormCourts.Designer.cs
generated
@ -1,130 +0,0 @@
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
partial class FormCourts
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
panel1 = new Panel();
|
||||
deleteButton = new Button();
|
||||
editButton = new Button();
|
||||
addButton = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(deleteButton);
|
||||
panel1.Controls.Add(editButton);
|
||||
panel1.Controls.Add(addButton);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(604, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(142, 450);
|
||||
panel1.TabIndex = 0;
|
||||
//
|
||||
// deleteButton
|
||||
//
|
||||
deleteButton.BackgroundImage = Properties.Resources.circle_x_svgrepo_com;
|
||||
deleteButton.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
deleteButton.Location = new Point(33, 240);
|
||||
deleteButton.Name = "deleteButton";
|
||||
deleteButton.Size = new Size(75, 75);
|
||||
deleteButton.TabIndex = 2;
|
||||
deleteButton.Text = " ";
|
||||
deleteButton.UseVisualStyleBackColor = true;
|
||||
deleteButton.Click += deleteButton_Click;
|
||||
//
|
||||
// editButton
|
||||
//
|
||||
editButton.BackgroundImage = Properties.Resources.pencil_svgrepo_com;
|
||||
editButton.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
editButton.Location = new Point(33, 139);
|
||||
editButton.Name = "editButton";
|
||||
editButton.Size = new Size(75, 75);
|
||||
editButton.TabIndex = 1;
|
||||
editButton.Text = " ";
|
||||
editButton.UseVisualStyleBackColor = true;
|
||||
editButton.Click += editButton_Click;
|
||||
//
|
||||
// addButton
|
||||
//
|
||||
addButton.BackgroundImage = Properties.Resources.circle_plus_svgrepo_com;
|
||||
addButton.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
addButton.Location = new Point(33, 38);
|
||||
addButton.Name = "addButton";
|
||||
addButton.Size = new Size(75, 75);
|
||||
addButton.TabIndex = 0;
|
||||
addButton.Text = " ";
|
||||
addButton.UseVisualStyleBackColor = true;
|
||||
addButton.Click += addButton_Click;
|
||||
//
|
||||
// dataGridView1
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.AllowUserToResizeColumns = false;
|
||||
dataGridView.AllowUserToResizeRows = false;
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.BackgroundColor = SystemColors.Info;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Dock = DockStyle.Fill;
|
||||
dataGridView.Location = new Point(0, 0);
|
||||
dataGridView.MultiSelect = false;
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(604, 450);
|
||||
dataGridView.TabIndex = 1;
|
||||
//
|
||||
// FormCourts
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(746, 450);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormCourts";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Суды";
|
||||
Load += FormClients_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button deleteButton;
|
||||
private Button editButton;
|
||||
private Button addButton;
|
||||
private DataGridView dataGridView;
|
||||
}
|
||||
}
|
@ -1,129 +0,0 @@
|
||||
using ProjectGSM.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 ProjectGSM.Forms
|
||||
{
|
||||
public partial class FormCourts : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
private readonly ICourtRepository _courtRepository;
|
||||
public FormCourts(IUnityContainer container, ICourtRepository courtRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_courtRepository = courtRepository ??
|
||||
throw new
|
||||
ArgumentNullException(nameof(courtRepository));
|
||||
|
||||
}
|
||||
|
||||
private void deleteButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление",
|
||||
MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_courtRepository.DeleteCourt(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void editButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormCourt>();
|
||||
form.Id = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при изменении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormCourt>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void FormClients_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void LoadList()
|
||||
{
|
||||
dataGridView.DataSource =
|
||||
_courtRepository.ReadCourts();
|
||||
dataGridView.Columns["Id"].Visible = false;
|
||||
dataGridView.Columns["CreatedAt"].DefaultCellStyle.Format =
|
||||
"dd.MM.yyyy";
|
||||
}
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridView.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id =
|
||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?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>
|
99
ProjectGSM/Forms/FormDirectoryReport.Designer.cs
generated
99
ProjectGSM/Forms/FormDirectoryReport.Designer.cs
generated
@ -1,99 +0,0 @@
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
partial class FormDirectoryReport
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
checkBoxAdvocates = new CheckBox();
|
||||
checkBoxClients = new CheckBox();
|
||||
checkBoxCourts = new CheckBox();
|
||||
buttonBuild = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// checkBoxAdvocates
|
||||
//
|
||||
checkBoxAdvocates.AutoSize = true;
|
||||
checkBoxAdvocates.Location = new Point(58, 53);
|
||||
checkBoxAdvocates.Name = "checkBoxAdvocates";
|
||||
checkBoxAdvocates.Size = new Size(79, 19);
|
||||
checkBoxAdvocates.TabIndex = 0;
|
||||
checkBoxAdvocates.Text = "Адвокаты";
|
||||
checkBoxAdvocates.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxClients
|
||||
//
|
||||
checkBoxClients.AutoSize = true;
|
||||
checkBoxClients.Location = new Point(58, 78);
|
||||
checkBoxClients.Name = "checkBoxClients";
|
||||
checkBoxClients.Size = new Size(74, 19);
|
||||
checkBoxClients.TabIndex = 1;
|
||||
checkBoxClients.Text = "Клиенты";
|
||||
checkBoxClients.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxCourts
|
||||
//
|
||||
checkBoxCourts.AutoSize = true;
|
||||
checkBoxCourts.Location = new Point(58, 103);
|
||||
checkBoxCourts.Name = "checkBoxCourts";
|
||||
checkBoxCourts.Size = new Size(55, 19);
|
||||
checkBoxCourts.TabIndex = 2;
|
||||
checkBoxCourts.Text = "Суды";
|
||||
checkBoxCourts.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonBuild
|
||||
//
|
||||
buttonBuild.Location = new Point(204, 74);
|
||||
buttonBuild.Name = "buttonBuild";
|
||||
buttonBuild.Size = new Size(151, 23);
|
||||
buttonBuild.TabIndex = 3;
|
||||
buttonBuild.Text = "Сформировать";
|
||||
buttonBuild.UseVisualStyleBackColor = true;
|
||||
buttonBuild.Click += ButtonBuild_Click;
|
||||
//
|
||||
// FormDirectoryReport
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(367, 173);
|
||||
Controls.Add(buttonBuild);
|
||||
Controls.Add(checkBoxCourts);
|
||||
Controls.Add(checkBoxClients);
|
||||
Controls.Add(checkBoxAdvocates);
|
||||
Name = "FormDirectoryReport";
|
||||
Text = "Выгрузка справочников";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private CheckBox checkBoxAdvocates;
|
||||
private CheckBox checkBoxClients;
|
||||
private CheckBox checkBoxCourts;
|
||||
private Button buttonBuild;
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
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 ProjectGSM.Documents;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
public partial class FormDirectoryReport : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
public FormDirectoryReport(IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
}
|
||||
|
||||
private void ButtonBuild_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!checkBoxAdvocates.Checked &&
|
||||
!checkBoxClients.Checked && !checkBoxCourts.Checked)
|
||||
{
|
||||
throw new Exception("Не выбран ни один справочник для выгрузки");
|
||||
}
|
||||
var sfd = new SaveFileDialog()
|
||||
{
|
||||
Filter = "Docx Files | *.docx"
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
{
|
||||
throw new Exception("Не выбран файла для отчета");
|
||||
}
|
||||
if
|
||||
(_container.Resolve<DocReport>().CreateDoc(sfd.FileName, checkBoxAdvocates.Checked,
|
||||
checkBoxClients.Checked,
|
||||
checkBoxCourts.Checked))
|
||||
{
|
||||
MessageBox.Show("Документ сформирован",
|
||||
"Формирование документа",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Возникли ошибки при формировании документа. Подробности в логах",
|
||||
"Формирование документа",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при создании отчета", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?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>
|
161
ProjectGSM/Forms/FormStatusHistory.Designer.cs
generated
161
ProjectGSM/Forms/FormStatusHistory.Designer.cs
generated
@ -1,161 +0,0 @@
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
partial class FormStatusHistory
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
statusLabel = new Label();
|
||||
saveButton = new Button();
|
||||
cancelButton = new Button();
|
||||
dateLabel = new Label();
|
||||
dateTimePicker1 = new DateTimePicker();
|
||||
caseLabel = new Label();
|
||||
statusBox = new ComboBox();
|
||||
caseBox = new ComboBox();
|
||||
priceLabel = new Label();
|
||||
priceNumeric = new NumericUpDown();
|
||||
((System.ComponentModel.ISupportInitialize)priceNumeric).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// statusLabel
|
||||
//
|
||||
statusLabel.Location = new Point(10, 47);
|
||||
statusLabel.Name = "statusLabel";
|
||||
statusLabel.Size = new Size(100, 23);
|
||||
statusLabel.TabIndex = 0;
|
||||
statusLabel.Text = "Статус:";
|
||||
//
|
||||
// saveButton
|
||||
//
|
||||
saveButton.Location = new Point(116, 173);
|
||||
saveButton.Name = "saveButton";
|
||||
saveButton.Size = new Size(75, 38);
|
||||
saveButton.TabIndex = 4;
|
||||
saveButton.Text = "Сохранить";
|
||||
saveButton.Click += saveButton_Click;
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
cancelButton.Location = new Point(197, 173);
|
||||
cancelButton.Name = "cancelButton";
|
||||
cancelButton.Size = new Size(75, 38);
|
||||
cancelButton.TabIndex = 5;
|
||||
cancelButton.Text = "Отмена";
|
||||
cancelButton.Click += cancelButton_Click;
|
||||
//
|
||||
// dateLabel
|
||||
//
|
||||
dateLabel.Location = new Point(10, 137);
|
||||
dateLabel.Name = "dateLabel";
|
||||
dateLabel.Size = new Size(111, 23);
|
||||
dateLabel.TabIndex = 13;
|
||||
dateLabel.Text = "Дата:";
|
||||
//
|
||||
// dateTimePicker1
|
||||
//
|
||||
dateTimePicker1.Location = new Point(125, 137);
|
||||
dateTimePicker1.Name = "dateTimePicker1";
|
||||
dateTimePicker1.Size = new Size(120, 31);
|
||||
dateTimePicker1.TabIndex = 14;
|
||||
//
|
||||
// caseLabel
|
||||
//
|
||||
caseLabel.Location = new Point(10, 7);
|
||||
caseLabel.Name = "caseLabel";
|
||||
caseLabel.Size = new Size(100, 23);
|
||||
caseLabel.TabIndex = 15;
|
||||
caseLabel.Text = "Дело:";
|
||||
//
|
||||
// statusBox
|
||||
//
|
||||
statusBox.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
statusBox.FormattingEnabled = true;
|
||||
statusBox.Location = new Point(125, 47);
|
||||
statusBox.Name = "statusBox";
|
||||
statusBox.Size = new Size(178, 33);
|
||||
statusBox.TabIndex = 16;
|
||||
//
|
||||
// caseBox
|
||||
//
|
||||
caseBox.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
caseBox.FormattingEnabled = true;
|
||||
caseBox.Location = new Point(125, 7);
|
||||
caseBox.Name = "caseBox";
|
||||
caseBox.Size = new Size(121, 33);
|
||||
caseBox.TabIndex = 17;
|
||||
//
|
||||
// priceLabel
|
||||
//
|
||||
priceLabel.Location = new Point(10, 98);
|
||||
priceLabel.Name = "priceLabel";
|
||||
priceLabel.Size = new Size(100, 23);
|
||||
priceLabel.TabIndex = 18;
|
||||
priceLabel.Text = "Цена:";
|
||||
//
|
||||
// priceNumeric
|
||||
//
|
||||
priceNumeric.DecimalPlaces = 2;
|
||||
priceNumeric.Location = new Point(123, 99);
|
||||
priceNumeric.Name = "priceNumeric";
|
||||
priceNumeric.Size = new Size(180, 31);
|
||||
priceNumeric.TabIndex = 19;
|
||||
//
|
||||
// FormStatusHistory
|
||||
//
|
||||
ClientSize = new Size(374, 324);
|
||||
Controls.Add(priceNumeric);
|
||||
Controls.Add(priceLabel);
|
||||
Controls.Add(caseBox);
|
||||
Controls.Add(statusBox);
|
||||
Controls.Add(caseLabel);
|
||||
Controls.Add(dateTimePicker1);
|
||||
Controls.Add(dateLabel);
|
||||
Controls.Add(statusLabel);
|
||||
Controls.Add(saveButton);
|
||||
Controls.Add(cancelButton);
|
||||
Name = "FormStatusHistory";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Хронология статусов";
|
||||
((System.ComponentModel.ISupportInitialize)priceNumeric).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label statusLabel;
|
||||
|
||||
private Button saveButton;
|
||||
private Button cancelButton;
|
||||
private Label dateLabel;
|
||||
private DateTimePicker dateTimePicker1;
|
||||
private Label caseLabel;
|
||||
private ComboBox statusBox;
|
||||
private ComboBox caseBox;
|
||||
private Label priceLabel;
|
||||
private NumericUpDown priceNumeric;
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
using ProjectGSM.Entities;
|
||||
using ProjectGSM.Entities.Enums;
|
||||
using ProjectGSM.Repositories;
|
||||
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
|
||||
public partial class FormStatusHistory : Form
|
||||
{
|
||||
private readonly IStatusHistoryRepository _statusHistoryRepository;
|
||||
|
||||
|
||||
public FormStatusHistory(IStatusHistoryRepository statusHistoryRepository, ICaseRepository caseRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_statusHistoryRepository = statusHistoryRepository ??
|
||||
throw new
|
||||
ArgumentNullException(nameof(statusHistoryRepository));
|
||||
|
||||
try
|
||||
{
|
||||
caseBox.DataSource = caseRepository.ReadCases();
|
||||
caseBox.DisplayMember = "Description";
|
||||
caseBox.SelectedIndex = 0;
|
||||
}
|
||||
catch (Exception ex) { }
|
||||
|
||||
statusBox.DataSource = Enum.GetValues(typeof(Status));
|
||||
}
|
||||
|
||||
private void saveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (caseBox.SelectedIndex < 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
_statusHistoryRepository.CreateStatusHistory(StatusHistory.CreateEntity((((Case)caseBox.SelectedItem!)!).Id, (Status)statusBox.SelectedIndex!, priceNumeric.Value, dateTimePicker1.Value));
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void cancelButton_Click(object sender, EventArgs e) => Close();
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?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>
|
107
ProjectGSM/Forms/FormStatusesCasesReport.Designer.cs
generated
107
ProjectGSM/Forms/FormStatusesCasesReport.Designer.cs
generated
@ -1,107 +0,0 @@
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
partial class FormStatusesCasesReport
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
ButtonSelectFileName = new Button();
|
||||
labelFileName = new Label();
|
||||
labelDate = new Label();
|
||||
dateTimePicker = new DateTimePicker();
|
||||
ButtonCreate = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// ButtonSelectFileName
|
||||
//
|
||||
ButtonSelectFileName.Location = new Point(12, 12);
|
||||
ButtonSelectFileName.Name = "ButtonSelectFileName";
|
||||
ButtonSelectFileName.Size = new Size(106, 23);
|
||||
ButtonSelectFileName.TabIndex = 0;
|
||||
ButtonSelectFileName.Text = "Выбрать";
|
||||
ButtonSelectFileName.UseVisualStyleBackColor = true;
|
||||
ButtonSelectFileName.Click += ButtonSelectFileName_Click;
|
||||
//
|
||||
// labelFileName
|
||||
//
|
||||
labelFileName.AutoSize = true;
|
||||
labelFileName.Location = new Point(202, 16);
|
||||
labelFileName.Name = "labelFileName";
|
||||
labelFileName.Size = new Size(36, 15);
|
||||
labelFileName.TabIndex = 1;
|
||||
labelFileName.Text = "Файл";
|
||||
//
|
||||
// labelDate
|
||||
//
|
||||
labelDate.AutoSize = true;
|
||||
labelDate.Location = new Point(12, 58);
|
||||
labelDate.Name = "labelDate";
|
||||
labelDate.Size = new Size(35, 15);
|
||||
labelDate.TabIndex = 2;
|
||||
labelDate.Text = "Дата:";
|
||||
//
|
||||
// dateTimePicker
|
||||
//
|
||||
dateTimePicker.Location = new Point(74, 55);
|
||||
dateTimePicker.Name = "dateTimePicker";
|
||||
dateTimePicker.Size = new Size(279, 23);
|
||||
dateTimePicker.TabIndex = 3;
|
||||
//
|
||||
// ButtonCreate
|
||||
//
|
||||
ButtonCreate.Location = new Point(97, 97);
|
||||
ButtonCreate.Name = "ButtonCreate";
|
||||
ButtonCreate.Size = new Size(154, 23);
|
||||
ButtonCreate.TabIndex = 4;
|
||||
ButtonCreate.Text = "Сформировать";
|
||||
ButtonCreate.UseVisualStyleBackColor = true;
|
||||
ButtonCreate.Click += ButtonCreate_Click;
|
||||
//
|
||||
// FormStatusesCasesReport
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(365, 143);
|
||||
Controls.Add(ButtonCreate);
|
||||
Controls.Add(dateTimePicker);
|
||||
Controls.Add(labelDate);
|
||||
Controls.Add(labelFileName);
|
||||
Controls.Add(ButtonSelectFileName);
|
||||
Name = "FormStatusesCasesReport";
|
||||
Text = "Доля выручки адвоката";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button ButtonSelectFileName;
|
||||
private Label labelFileName;
|
||||
private Label labelDate;
|
||||
private DateTimePicker dateTimePicker;
|
||||
private Button ButtonCreate;
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
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 ProjectGSM.Documents;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
public partial class FormStatusesCasesReport : Form
|
||||
{
|
||||
private string _fileName = string.Empty;
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
public FormStatusesCasesReport(IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
}
|
||||
|
||||
|
||||
private void ButtonSelectFileName_Click(object sender, EventArgs e)
|
||||
{
|
||||
var sfd = new SaveFileDialog()
|
||||
{
|
||||
Filter = "Pdf Files | *.pdf"
|
||||
};
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_fileName = sfd.FileName;
|
||||
labelFileName.Text = Path.GetFileName(_fileName);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_fileName))
|
||||
{
|
||||
throw new Exception("Отсутствует имя файла для отчета");
|
||||
}
|
||||
|
||||
if
|
||||
(_container.Resolve<ChartReport>().CreateChart(_fileName, dateTimePicker.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?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>
|
100
ProjectGSM/Forms/FormStatusesHistory.Designer.cs
generated
100
ProjectGSM/Forms/FormStatusesHistory.Designer.cs
generated
@ -1,100 +0,0 @@
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
partial class FormStatusesHistory
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
panel1 = new Panel();
|
||||
addButton = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(addButton);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(604, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(142, 450);
|
||||
panel1.TabIndex = 0;
|
||||
//
|
||||
// addButton
|
||||
//
|
||||
addButton.BackgroundImage = Properties.Resources.circle_plus_svgrepo_com;
|
||||
addButton.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
addButton.Location = new Point(33, 38);
|
||||
addButton.Name = "addButton";
|
||||
addButton.Size = new Size(75, 75);
|
||||
addButton.TabIndex = 0;
|
||||
addButton.Text = " ";
|
||||
addButton.UseVisualStyleBackColor = true;
|
||||
addButton.Click += addButton_Click;
|
||||
//
|
||||
// dataGridView1
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.AllowUserToResizeColumns = false;
|
||||
dataGridView.AllowUserToResizeRows = false;
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.BackgroundColor = SystemColors.Info;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Dock = DockStyle.Fill;
|
||||
dataGridView.Location = new Point(0, 0);
|
||||
dataGridView.MultiSelect = false;
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(604, 450);
|
||||
dataGridView.TabIndex = 1;
|
||||
//
|
||||
// FormStatusesHistory
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(746, 450);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormStatusesHistory";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Суды";
|
||||
Load += FormClients_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button addButton;
|
||||
private DataGridView dataGridView;
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
using ProjectGSM.Repositories;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectGSM.Forms
|
||||
{
|
||||
public partial class FormStatusesHistory : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
private readonly IStatusHistoryRepository _statusHistoryRepository;
|
||||
|
||||
public FormStatusesHistory(IUnityContainer container, IStatusHistoryRepository statusHistoryRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_statusHistoryRepository = statusHistoryRepository ??
|
||||
throw new
|
||||
ArgumentNullException(nameof(statusHistoryRepository));
|
||||
}
|
||||
|
||||
private void addButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormStatusHistory>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void FormClients_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList()
|
||||
{
|
||||
dataGridView.DataSource =
|
||||
_statusHistoryRepository.ReadStatusHistories();
|
||||
dataGridView.Columns["CaseId"].Visible = false;
|
||||
dataGridView.Columns["CreatedAt"].DefaultCellStyle.Format =
|
||||
"dd.MM.yyyy";
|
||||
}
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridView.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
id =
|
||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -1,12 +1,3 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ProjectGSM.Repositories;
|
||||
using ProjectGSM.Repositories.Implementations;
|
||||
using Serilog;
|
||||
using Unity;
|
||||
using Unity.Lifetime;
|
||||
using Unity.Microsoft.Logging;
|
||||
|
||||
namespace ProjectGSM
|
||||
{
|
||||
internal static class Program
|
||||
@ -20,36 +11,7 @@ namespace ProjectGSM
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run((CreateContainer().Resolve<FormAdvocateApp>()));
|
||||
}
|
||||
|
||||
private static IUnityContainer CreateContainer()
|
||||
{
|
||||
var container = new UnityContainer();
|
||||
container.AddExtension(new
|
||||
LoggingExtension(CreateLoggerFactory()));
|
||||
|
||||
container.RegisterType<IConnectionString,
|
||||
PSQLConnectionString>(new SingletonLifetimeManager());
|
||||
container.RegisterType<ICaseAdvocateRepository, CaseAdvocatesRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IAdvocateRepository, AdvocateRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<ICaseRepository, CaseRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IClientRepository, ClientRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<ICourtRepository, CourtRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IStatusHistoryRepository, StatusHistoryRepository>(new TransientLifetimeManager());
|
||||
return container;
|
||||
}
|
||||
|
||||
private static LoggerFactory CreateLoggerFactory()
|
||||
{
|
||||
var loggerFactory = new LoggerFactory();
|
||||
loggerFactory.AddSerilog(new LoggerConfiguration()
|
||||
.ReadFrom.Configuration(new ConfigurationBuilder()
|
||||
.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile("appsettings.json")
|
||||
.Build())
|
||||
.CreateLogger());
|
||||
return loggerFactory;
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
@ -8,59 +8,4 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Forms\FormCase.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Forms\FormCases.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Forms\FormStatusesHistory.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Forms\FormStatusHistory.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Forms\FormCourts.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Forms\FormCourt.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Forms\FormAdvocate.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Forms\FormClient.cs" />
|
||||
<Compile Update="Forms\FormAdvocates.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<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>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Dapper" Version="2.1.35" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
|
||||
<PackageReference Include="MigraDocXML" Version="3.0.0" />
|
||||
<PackageReference Include="Npgsql" Version="9.0.0" />
|
||||
<PackageReference Include="Open-XML-SDK" Version="2.9.1" />
|
||||
<PackageReference Include="Serilog" Version="4.2.0-dev-02328" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.1-dev-10410" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.4" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.9.0" />
|
||||
<PackageReference Include="Unity" Version="5.11.10" />
|
||||
<PackageReference Include="Unity.Microsoft.Logging" Version="5.11.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,25 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.11.35208.52
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProjectGSM", "ProjectGSM.csproj", "{7B07CD6F-951C-4BAB-9EE5-BA47030F0A9C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{7B07CD6F-951C-4BAB-9EE5-BA47030F0A9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7B07CD6F-951C-4BAB-9EE5-BA47030F0A9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7B07CD6F-951C-4BAB-9EE5-BA47030F0A9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7B07CD6F-951C-4BAB-9EE5-BA47030F0A9C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {7F60A3F6-8280-4D35-8CD7-39ECA1D7A494}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
103
ProjectGSM/Properties/Resources.Designer.cs
generated
103
ProjectGSM/Properties/Resources.Designer.cs
generated
@ -1,103 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ProjectGSM.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("ProjectGSM.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap circle_plus_svgrepo_com {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("circle-plus-svgrepo-com", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap circle_x_svgrepo_com {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("circle-x-svgrepo-com", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap maxresdefault {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("maxresdefault", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap pencil_svgrepo_com {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("pencil-svgrepo-com", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,133 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="pencil-svgrepo-com" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\pencil-svgrepo-com.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="maxresdefault" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\maxresdefault.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="circle-plus-svgrepo-com" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\circle-plus-svgrepo-com.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="circle-x-svgrepo-com" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\circle-x-svgrepo-com.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
@ -1,34 +0,0 @@
|
||||
using System.Text;
|
||||
|
||||
namespace ProjectGSM.Query;
|
||||
|
||||
internal class QueryBuilder
|
||||
{
|
||||
private readonly StringBuilder _builder;
|
||||
|
||||
public QueryBuilder()
|
||||
{
|
||||
_builder = new();
|
||||
}
|
||||
|
||||
public QueryBuilder AddCondition(string condition)
|
||||
{
|
||||
if (_builder.Length > 0)
|
||||
{
|
||||
_builder.Append(" AND ");
|
||||
}
|
||||
|
||||
_builder.Append(condition);
|
||||
return this;
|
||||
}
|
||||
|
||||
public string Build()
|
||||
{
|
||||
if (_builder.Length == 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return $"WHERE {_builder}";
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
using ProjectGSM.Entities;
|
||||
|
||||
namespace ProjectGSM.Repositories;
|
||||
|
||||
public interface IAdvocateRepository
|
||||
{
|
||||
IEnumerable<Advocate> ReadAdvocates();
|
||||
Advocate ReadAdvocateById(int id);
|
||||
void CreateAdvocate(Advocate advocate);
|
||||
void UpdateAdvocate(Advocate advocate);
|
||||
void DeleteAdvocate(int id);
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
using ProjectGSM.Entities;
|
||||
|
||||
namespace ProjectGSM.Repositories;
|
||||
|
||||
public interface ICaseAdvocateRepository
|
||||
{
|
||||
IEnumerable<CaseAdvocate> ReadCaseAdvocates(DateTime? dateForm = null, DateTime? dateTo = null,
|
||||
int? caseId = null, int? advocateId = null);
|
||||
void CreateCaseAdvocates(CaseAdvocate caseAdvocate);
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
using ProjectGSM.Entities;
|
||||
|
||||
namespace ProjectGSM.Repositories;
|
||||
|
||||
public interface ICaseRepository
|
||||
{
|
||||
IEnumerable<Case> ReadCases(DateTime? dateTo = null);
|
||||
Case ReadCaseById(int id);
|
||||
void CreateCase(Case caseEntity);
|
||||
void DeleteCase(int id);
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
using ProjectGSM.Entities;
|
||||
|
||||
namespace ProjectGSM.Repositories;
|
||||
|
||||
public interface IClientRepository
|
||||
{
|
||||
IEnumerable<Client> ReadClients();
|
||||
Client ReadClientById(int id);
|
||||
void CreateClient(Client client);
|
||||
void UpdateClient(Client client);
|
||||
void DeleteClient(int id);
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace ProjectGSM.Repositories
|
||||
{
|
||||
public interface IConnectionString
|
||||
{
|
||||
string ConnectionString { get; }
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
using ProjectGSM.Entities;
|
||||
|
||||
namespace ProjectGSM.Repositories;
|
||||
|
||||
public interface ICourtRepository
|
||||
{
|
||||
IEnumerable<Court> ReadCourts();
|
||||
Court ReadCourtById(int id);
|
||||
void CreateCourt(Court court);
|
||||
void UpdateCourt(Court court);
|
||||
void DeleteCourt(int id);
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
using ProjectGSM.Entities;
|
||||
|
||||
namespace ProjectGSM.Repositories;
|
||||
|
||||
public interface IStatusHistoryRepository
|
||||
{
|
||||
IEnumerable<StatusHistory> ReadStatusHistories(DateTime? dateForm = null, DateTime? dateTo = null,
|
||||
int? caseId = null);
|
||||
void CreateStatusHistory(StatusHistory statusHistory);
|
||||
void DeleteStatusHistory(int statusId, int caseId);
|
||||
}
|
@ -1,133 +0,0 @@
|
||||
using System.Data.SqlClient;
|
||||
using System.Text.Json;
|
||||
using Dapper;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Npgsql;
|
||||
using ProjectGSM.Entities;
|
||||
|
||||
namespace ProjectGSM.Repositories.Implementations;
|
||||
|
||||
public class AdvocateRepository : IAdvocateRepository
|
||||
{
|
||||
private readonly IConnectionString _connectionString;
|
||||
private readonly ILogger<AdvocateRepository> _logger;
|
||||
|
||||
public AdvocateRepository(IConnectionString connectionString,
|
||||
ILogger<AdvocateRepository> logger)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IEnumerable<Advocate> ReadAdvocates()
|
||||
{
|
||||
_logger.LogInformation("Получение всех объектов");
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = "SELECT * FROM advocates";
|
||||
var advocates = connection.Query<Advocate>(querySelect);
|
||||
_logger.LogDebug("Полученные объекты: {json}",
|
||||
JsonSerializer.Serialize(advocates));
|
||||
return advocates;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Advocate ReadAdvocateById(int id)
|
||||
{
|
||||
_logger.LogInformation("Получение объекта по идентификатору");
|
||||
_logger.LogDebug("Объект: {id}", id);
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = @"SELECT * FROM advocates WHERE Id=@id";
|
||||
var advocate = connection.QueryFirst<Advocate>(querySelect, new { id });
|
||||
_logger.LogDebug("Найденный объект: {json}",
|
||||
JsonSerializer.Serialize(advocate));
|
||||
return advocate;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при поиске объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateAdvocate(Advocate advocate)
|
||||
{
|
||||
_logger.LogInformation("Добавление объекта");
|
||||
_logger.LogDebug("Объект: {json}",
|
||||
JsonSerializer.Serialize(advocate));
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryInsert = @"
|
||||
INSERT INTO advocates (name, sex, dateofbirth, experience, completed_tasks, rating, email, phonenumber, address, licensetype, createdat)
|
||||
VALUES (@Name, @Sex, @DateOfBirth, @Experience, @CompletedTasks, @Rating, @Email, @PhoneNumber, @Address, @LicenseType, @CreatedAt)";
|
||||
connection.Execute(queryInsert, advocate);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateAdvocate(Advocate advocate)
|
||||
{
|
||||
_logger.LogInformation("Обновление объекта");
|
||||
_logger.LogDebug("Объект: {json}",
|
||||
JsonSerializer.Serialize(advocate));
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryUpdate = @"UPDATE advocates
|
||||
SET id = @Id,
|
||||
name = @Name,
|
||||
sex = @Sex,
|
||||
dateofbirth = @DateOfBirth,
|
||||
experience = @Experience,
|
||||
completed_tasks = @CompletedTasks,
|
||||
rating = @Rating,
|
||||
email = @Email,
|
||||
phonenumber = @PhoneNumber,
|
||||
address = @Address,
|
||||
licensetype = @LicenseType,
|
||||
createdat = @CreatedAt
|
||||
WHERE id = @Id;";
|
||||
connection.Execute(queryUpdate, advocate);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при обновлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteAdvocate(int id)
|
||||
{
|
||||
_logger.LogInformation("Удаление объекта");
|
||||
_logger.LogDebug("Объект: {id}", id);
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryDelete = @"DELETE FROM advocates WHERE id = @Id;";
|
||||
connection.Execute(queryDelete, new { Id = id });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при удалении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
using System.Data.SqlClient;
|
||||
using System.Text.Json;
|
||||
using Dapper;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Npgsql;
|
||||
using ProjectGSM.Entities;
|
||||
using ProjectGSM.Query;
|
||||
|
||||
namespace ProjectGSM.Repositories.Implementations;
|
||||
|
||||
public class CaseAdvocatesRepository : ICaseAdvocateRepository
|
||||
{
|
||||
private readonly IConnectionString _connectionString;
|
||||
private readonly ILogger<CaseAdvocatesRepository> _logger;
|
||||
|
||||
public CaseAdvocatesRepository(IConnectionString connectionString,
|
||||
ILogger<CaseAdvocatesRepository> logger)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IEnumerable<CaseAdvocate> ReadCaseAdvocates(DateTime? dateForm = null, DateTime? dateTo = null,
|
||||
int? caseId = null, int? statusId = null)
|
||||
{
|
||||
_logger.LogInformation("Получение всех объектов");
|
||||
try
|
||||
{
|
||||
var builder = new QueryBuilder();
|
||||
if (dateTo.HasValue)
|
||||
{
|
||||
builder.AddCondition("ca.CreatedAt <= @dateTo");
|
||||
}
|
||||
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect =
|
||||
"SELECT ca.*, a.name as AdvocateName, cs.description as CaseDescription " +
|
||||
"FROM case_advocates as ca LEFT JOIN cases as cs ON cs.id = ca.caseid " +
|
||||
$"LEFT JOIN advocates as a ON a.id = ca.advocateid {builder.Build()}";
|
||||
var caseAdvocates =
|
||||
connection.Query<CaseAdvocate>(querySelect, param: new { dateTo });
|
||||
_logger.LogDebug("Полученные объекты: {json}",
|
||||
JsonSerializer.Serialize(caseAdvocates));
|
||||
return caseAdvocates;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateCaseAdvocates(CaseAdvocate caseAdvocate)
|
||||
{
|
||||
_logger.LogInformation("Добавление объекта");
|
||||
_logger.LogDebug("Объект: {json}",
|
||||
JsonSerializer.Serialize(caseAdvocate));
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryInsert = @"
|
||||
INSERT INTO case_advocates (caseid, advocateid, post, createdat)
|
||||
VALUES (@CaseId, @AdvocateId, @Post, @CreatedAt)";
|
||||
connection.Execute(queryInsert, caseAdvocate);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,151 +0,0 @@
|
||||
using System.Data.SqlClient;
|
||||
using Dapper;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using ProjectGSM.Entities;
|
||||
using ProjectGSM.Query;
|
||||
using JsonSerializer = System.Text.Json.JsonSerializer;
|
||||
|
||||
namespace ProjectGSM.Repositories.Implementations;
|
||||
|
||||
public class CaseRepository : ICaseRepository
|
||||
{
|
||||
private readonly IConnectionString _connectionString;
|
||||
private readonly ILogger<CaseRepository> _logger;
|
||||
|
||||
public CaseRepository(IConnectionString connectionString,
|
||||
ILogger<CaseRepository> logger)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IEnumerable<Case> ReadCases(DateTime? dateTo = null)
|
||||
{
|
||||
_logger.LogInformation("Получение всех объектов");
|
||||
try
|
||||
{
|
||||
var builder = new QueryBuilder();
|
||||
if (dateTo.HasValue)
|
||||
{
|
||||
builder.AddCondition("cases.CreatedAt <= @dateTo");
|
||||
}
|
||||
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
|
||||
var querySelect =
|
||||
"SELECT cases.*, courts.name as CourtName, clients.name as ClientName, ca.caseid as CaseId, a.name as AdvocateName " +
|
||||
"FROM cases " +
|
||||
"LEFT JOIN courts on courts.Id = cases.courtid " +
|
||||
"LEFT JOIN clients on clients.Id = cases.clientid " +
|
||||
"INNER JOIN case_advocates ca ON ca.caseid = cases.Id LEFT JOIN advocates a on a.Id = ca.advocateid " +
|
||||
$"{builder.Build()}";
|
||||
// $"{builder.Build()}";
|
||||
var casesDict = new Dictionary<int, List<CaseAdvocate>>();
|
||||
;
|
||||
var cases = connection.Query<Case, CaseAdvocate, Case>(querySelect,
|
||||
(caseEntity, caseAdvocate) =>
|
||||
{
|
||||
if (!casesDict.TryGetValue(caseEntity.Id, out var ca))
|
||||
{
|
||||
ca = new List<CaseAdvocate>();
|
||||
casesDict.Add(caseEntity.Id, ca);
|
||||
}
|
||||
|
||||
ca.Add(caseAdvocate);
|
||||
return caseEntity;
|
||||
}, splitOn: "CaseId", param: new { dateTo, });
|
||||
|
||||
_logger.LogDebug("Полученные объекты: {json}",
|
||||
JsonConvert.SerializeObject(cases));
|
||||
return casesDict.Select(x =>
|
||||
{
|
||||
var caseEntity = cases.First(y => y.Id == x.Key);
|
||||
caseEntity.SetAdvocates(x.Value);
|
||||
return caseEntity;
|
||||
}).ToArray();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Case ReadCaseById(int id)
|
||||
{
|
||||
_logger.LogInformation("Получение объекта по идентификатору");
|
||||
_logger.LogDebug("Объект: {id}", id);
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = @"SELECT * FROM cases WHERE Id=@id";
|
||||
var caseE = connection.QueryFirst<Case>(querySelect, new { id });
|
||||
_logger.LogDebug("Найденный объект: {json}",
|
||||
JsonSerializer.Serialize(caseE));
|
||||
return caseE;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при поиске объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateCase(Case caseEntity)
|
||||
{
|
||||
_logger.LogInformation("Добавление объекта");
|
||||
_logger.LogDebug("Объект: {json}",
|
||||
JsonSerializer.Serialize(caseEntity));
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
connection.Open();
|
||||
using var transaction = connection.BeginTransaction();
|
||||
var queryInsert =
|
||||
@"INSERT INTO Cases (typeappeal, Payment, Price, victoryprice, Verdict, courtid, clientid, Description, createdat)
|
||||
VALUES (@TypeAppeal, @Payment, @Price, @VictoryPrice, @Verdict, @CourtId, @ClientId, @Description, @CreatedAt);
|
||||
SELECT MAX(Id) FROM cases;";
|
||||
var caseId =
|
||||
connection.QueryFirst<int>(queryInsert, caseEntity, transaction);
|
||||
var querySubInsert = @"
|
||||
INSERT INTO case_advocates (caseid, advocateid, post, createdat)
|
||||
VALUES (@CaseId, @AdvocateId, @Post, @CreatedAt)";
|
||||
foreach (var elem in caseEntity.Advocates)
|
||||
{
|
||||
connection.Execute(querySubInsert, new
|
||||
{
|
||||
caseId, elem.AdvocateId, elem.Post, elem.CreatedAt
|
||||
}, transaction);
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteCase(int id)
|
||||
{
|
||||
_logger.LogInformation("Удаление объекта");
|
||||
_logger.LogDebug("Объект: {id}", id);
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryDelete = @"DELETE FROM cases WHERE id = @Id;";
|
||||
connection.Execute(queryDelete, new { Id = id });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при удалении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,126 +0,0 @@
|
||||
using System.Data.SqlClient;
|
||||
using System.Text.Json;
|
||||
using Dapper;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Npgsql;
|
||||
using ProjectGSM.Entities;
|
||||
|
||||
namespace ProjectGSM.Repositories.Implementations;
|
||||
|
||||
public class ClientRepository : IClientRepository
|
||||
{
|
||||
private readonly IConnectionString _connectionString;
|
||||
private readonly ILogger<ClientRepository> _logger;
|
||||
|
||||
public ClientRepository(IConnectionString connectionString,
|
||||
ILogger<ClientRepository> logger)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IEnumerable<Client> ReadClients()
|
||||
{
|
||||
_logger.LogInformation("Получение всех объектов");
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = "SELECT * FROM clients";
|
||||
var clients = connection.Query<Client>(querySelect);
|
||||
_logger.LogDebug("Полученные объекты: {json}",
|
||||
JsonSerializer.Serialize(clients));
|
||||
return clients;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Client ReadClientById(int id)
|
||||
{
|
||||
_logger.LogInformation("Получение объекта по идентификатору");
|
||||
_logger.LogDebug("Объект: {id}", id);
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = @"SELECT * FROM clients WHERE Id=@id";
|
||||
var client = connection.QueryFirst<Client>(querySelect, new { id });
|
||||
_logger.LogDebug("Найденный объект: {json}",
|
||||
JsonSerializer.Serialize(client));
|
||||
return client;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при поиске объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateClient(Client client)
|
||||
{
|
||||
_logger.LogInformation("Добавление объекта");
|
||||
_logger.LogDebug("Объект: {json}",
|
||||
JsonSerializer.Serialize(client));
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryInsert = @"INSERT INTO clients (name, sex, dateOfBirth, email, phonenumber, address, createdAt)
|
||||
VALUES (@Name, @Sex, @DateOfBirth, @Email, @PhoneNumber, @Address, @CreatedAt);";
|
||||
connection.Execute(queryInsert, client);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateClient(Client client)
|
||||
{
|
||||
_logger.LogInformation("Обновление объекта");
|
||||
_logger.LogDebug("Объект: {json}",
|
||||
JsonSerializer.Serialize(client));
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryUpdate = @"UPDATE clients
|
||||
SET name = @Name,
|
||||
sex = @Sex,
|
||||
dateofbirth = @DateOfBirth,
|
||||
email = @Email,
|
||||
phonenumber = @PhoneNumber,
|
||||
address = @Address
|
||||
WHERE id = @Id;";
|
||||
connection.Execute(queryUpdate, client);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при обновлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteClient(int id)
|
||||
{
|
||||
_logger.LogInformation("Удаление объекта");
|
||||
_logger.LogDebug("Объект: {id}", id);
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryDelete = @"DELETE FROM clients WHERE id = @Id;";
|
||||
connection.Execute(queryDelete, new { Id = id });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при удалении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,122 +0,0 @@
|
||||
using System.Data.SqlClient;
|
||||
using System.Text.Json;
|
||||
using Dapper;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Npgsql;
|
||||
using ProjectGSM.Entities;
|
||||
|
||||
namespace ProjectGSM.Repositories.Implementations;
|
||||
|
||||
public class CourtRepository : ICourtRepository
|
||||
{
|
||||
private readonly IConnectionString _connectionString;
|
||||
private readonly ILogger<CourtRepository> _logger;
|
||||
|
||||
public CourtRepository(IConnectionString connectionString,
|
||||
ILogger<CourtRepository> logger)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IEnumerable<Court> ReadCourts()
|
||||
{
|
||||
_logger.LogInformation("Получение всех объектов");
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = "SELECT * FROM courts";
|
||||
var courts = connection.Query<Court>(querySelect);
|
||||
_logger.LogDebug("Полученные объекты: {json}",
|
||||
JsonSerializer.Serialize(courts));
|
||||
return courts;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Court ReadCourtById(int id)
|
||||
{
|
||||
_logger.LogInformation("Получение объекта по идентификатору");
|
||||
_logger.LogDebug("Объект: {id}", id);
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = @"SELECT * FROM courts WHERE Id = @Id";
|
||||
var court = connection.QueryFirst<Court>(querySelect, new { id });
|
||||
_logger.LogDebug("Полученный объект: {json}",
|
||||
JsonSerializer.Serialize(court));
|
||||
return court;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при чтении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateCourt(Court court)
|
||||
{
|
||||
_logger.LogInformation("Добавление объекта");
|
||||
_logger.LogDebug("Объект: {json}",
|
||||
JsonSerializer.Serialize(court));
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryInsert = @"INSERT INTO courts (name, address, createdat)
|
||||
VALUES (@Name, @Address, @CreatedAt);";
|
||||
connection.Execute(queryInsert, court);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateCourt(Court court)
|
||||
{
|
||||
_logger.LogInformation("Обновление объекта");
|
||||
_logger.LogDebug("Объект: {json}",
|
||||
JsonSerializer.Serialize(court));
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryUpdate = @"UPDATE courts
|
||||
SET name = @Name,
|
||||
address = @Address
|
||||
WHERE id = @Id;";
|
||||
connection.Execute(queryUpdate, court);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при обновлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteCourt(int id)
|
||||
{
|
||||
_logger.LogInformation("Удаление объекта");
|
||||
_logger.LogDebug("Объект: {id}", id);
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryDelete = @"DELETE FROM courts WHERE id = @Id;";
|
||||
connection.Execute(queryDelete, new { Id = id });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при удалении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
namespace ProjectGSM.Repositories.Implementations;
|
||||
|
||||
public class PSQLConnectionString : IConnectionString
|
||||
{
|
||||
private readonly string _connectionString =
|
||||
"User Id=postgres; Password=postgres; Host=localhost; Port=5432; Database=egovdb;";
|
||||
|
||||
public string ConnectionString => _connectionString;
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
using System.Data.SqlClient;
|
||||
using System.Text.Json;
|
||||
using Dapper;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Npgsql;
|
||||
using ProjectGSM.Entities;
|
||||
using ProjectGSM.Query;
|
||||
|
||||
namespace ProjectGSM.Repositories.Implementations;
|
||||
|
||||
public class StatusHistoryRepository : IStatusHistoryRepository
|
||||
{
|
||||
private readonly IConnectionString _connectionString;
|
||||
private readonly ILogger<StatusHistoryRepository> _logger;
|
||||
|
||||
public StatusHistoryRepository(IConnectionString connectionString,
|
||||
ILogger<StatusHistoryRepository> logger)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IEnumerable<StatusHistory> ReadStatusHistories(DateTime? dateForm = null, DateTime? dateTo = null,
|
||||
int? caseId = null)
|
||||
{
|
||||
_logger.LogInformation("Получение всех объектов");
|
||||
try
|
||||
{
|
||||
var builder = new QueryBuilder();
|
||||
if (dateForm.HasValue)
|
||||
{
|
||||
builder.AddCondition("sh.CreatedAt >= @dateForm");
|
||||
}
|
||||
if (dateTo.HasValue)
|
||||
{
|
||||
builder.AddCondition("sh.CreatedAt <= @dateTo");
|
||||
}
|
||||
if (caseId.HasValue)
|
||||
{
|
||||
builder.AddCondition("sh.caseid = @caseId");
|
||||
}
|
||||
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect =
|
||||
@$"SELECT sh.*, c.description as CaseDescription FROM status_histories as sh LEFT JOIN cases as c ON c.id = sh.caseid {builder.Build()}";
|
||||
var statusHistories =
|
||||
connection.Query<StatusHistory>(querySelect, new { dateForm, dateTo, caseId });
|
||||
_logger.LogDebug("Полученные объекты: {json}",
|
||||
JsonSerializer.Serialize(statusHistories));
|
||||
return statusHistories;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateStatusHistory(StatusHistory statusHistory)
|
||||
{
|
||||
_logger.LogInformation("Добавление объекта");
|
||||
_logger.LogDebug("Объект: {json}",
|
||||
JsonSerializer.Serialize(statusHistory));
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryInsert = @"
|
||||
INSERT INTO status_histories (caseid, status, price, createdat)
|
||||
VALUES (@CaseId, @Status, @Price, @CreatedAt)";
|
||||
connection.Execute(queryInsert, statusHistory);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteStatusHistory(int statusId, int caseId)
|
||||
{
|
||||
_logger.LogInformation("Удаление объекта");
|
||||
_logger.LogDebug("Идентификаторы: {statusId}, {caseId}", statusId, caseId);
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryDelete = @"DELETE FROM status_histories WHERE status = @Status AND caseid = @CaseId";
|
||||
connection.Execute(queryDelete, new { StatusId = statusId, CaseId = caseId });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при удалении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 4.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 186 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.7 KiB |
@ -1,15 +0,0 @@
|
||||
{
|
||||
"Serilog": {
|
||||
"Using": [ "Serilog.Sinks.File" ],
|
||||
"MinimumLevel": "Debug",
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "File",
|
||||
"Args": {
|
||||
"path": "Logs/advocates_log.txt",
|
||||
"rollingInterval": "Day"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user