Правка логики удаления при М:М
This commit is contained in:
parent
1bf1efbe5a
commit
4ebe950696
@ -6,5 +6,6 @@ public enum ContractorFuelType
|
|||||||
None = 0,
|
None = 0,
|
||||||
GasolineAI92 = 1,
|
GasolineAI92 = 1,
|
||||||
GasolineAI95 = 2,
|
GasolineAI95 = 2,
|
||||||
Diesel = 4
|
Diesel = 4,
|
||||||
|
MotorOIL = 8,
|
||||||
}
|
}
|
@ -5,5 +5,6 @@ public enum FuelType
|
|||||||
None,
|
None,
|
||||||
GasolineAI92,
|
GasolineAI92,
|
||||||
GasolineAI95,
|
GasolineAI95,
|
||||||
Diesel
|
Diesel,
|
||||||
|
MotorOIL,
|
||||||
}
|
}
|
||||||
|
@ -61,28 +61,28 @@
|
|||||||
// toolStripMenuItemSalepersons
|
// toolStripMenuItemSalepersons
|
||||||
//
|
//
|
||||||
toolStripMenuItemSalepersons.Name = "toolStripMenuItemSalepersons";
|
toolStripMenuItemSalepersons.Name = "toolStripMenuItemSalepersons";
|
||||||
toolStripMenuItemSalepersons.Size = new Size(180, 22);
|
toolStripMenuItemSalepersons.Size = new Size(144, 22);
|
||||||
toolStripMenuItemSalepersons.Text = "Сотрудники";
|
toolStripMenuItemSalepersons.Text = "Сотрудники";
|
||||||
toolStripMenuItemSalepersons.Click += toolStripMenuItemSalepersons_Click;
|
toolStripMenuItemSalepersons.Click += toolStripMenuItemSalepersons_Click;
|
||||||
//
|
//
|
||||||
// toolStripMenuItemShifts
|
// toolStripMenuItemShifts
|
||||||
//
|
//
|
||||||
toolStripMenuItemShifts.Name = "toolStripMenuItemShifts";
|
toolStripMenuItemShifts.Name = "toolStripMenuItemShifts";
|
||||||
toolStripMenuItemShifts.Size = new Size(180, 22);
|
toolStripMenuItemShifts.Size = new Size(144, 22);
|
||||||
toolStripMenuItemShifts.Text = "Смены";
|
toolStripMenuItemShifts.Text = "Смены";
|
||||||
toolStripMenuItemShifts.Click += toolStripMenuItemShifts_Click;
|
toolStripMenuItemShifts.Click += toolStripMenuItemShifts_Click;
|
||||||
//
|
//
|
||||||
// toolStripMenuItemContractors
|
// toolStripMenuItemContractors
|
||||||
//
|
//
|
||||||
toolStripMenuItemContractors.Name = "toolStripMenuItemContractors";
|
toolStripMenuItemContractors.Name = "toolStripMenuItemContractors";
|
||||||
toolStripMenuItemContractors.Size = new Size(180, 22);
|
toolStripMenuItemContractors.Size = new Size(144, 22);
|
||||||
toolStripMenuItemContractors.Text = "Поставщики";
|
toolStripMenuItemContractors.Text = "Поставщики";
|
||||||
toolStripMenuItemContractors.Click += toolStripMenuItemContractors_Click;
|
toolStripMenuItemContractors.Click += toolStripMenuItemContractors_Click;
|
||||||
//
|
//
|
||||||
// toolStripMenuItemFuels
|
// toolStripMenuItemFuels
|
||||||
//
|
//
|
||||||
toolStripMenuItemFuels.Name = "toolStripMenuItemFuels";
|
toolStripMenuItemFuels.Name = "toolStripMenuItemFuels";
|
||||||
toolStripMenuItemFuels.Size = new Size(180, 22);
|
toolStripMenuItemFuels.Size = new Size(144, 22);
|
||||||
toolStripMenuItemFuels.Text = "Топливо";
|
toolStripMenuItemFuels.Text = "Топливо";
|
||||||
toolStripMenuItemFuels.Click += toolStripMenuItemFuels_Click;
|
toolStripMenuItemFuels.Click += toolStripMenuItemFuels_Click;
|
||||||
//
|
//
|
||||||
@ -96,14 +96,14 @@
|
|||||||
// toolStripMenuItemFuelSale
|
// toolStripMenuItemFuelSale
|
||||||
//
|
//
|
||||||
toolStripMenuItemFuelSale.Name = "toolStripMenuItemFuelSale";
|
toolStripMenuItemFuelSale.Name = "toolStripMenuItemFuelSale";
|
||||||
toolStripMenuItemFuelSale.Size = new Size(180, 22);
|
toolStripMenuItemFuelSale.Size = new Size(160, 22);
|
||||||
toolStripMenuItemFuelSale.Text = "Новая проадажа";
|
toolStripMenuItemFuelSale.Text = "Новая продажа";
|
||||||
toolStripMenuItemFuelSale.Click += toolStripMenuItemFuelSale_Click;
|
toolStripMenuItemFuelSale.Click += toolStripMenuItemFuelSale_Click;
|
||||||
//
|
//
|
||||||
// toolStripMenuItemContractorFuel
|
// toolStripMenuItemContractorFuel
|
||||||
//
|
//
|
||||||
toolStripMenuItemContractorFuel.Name = "toolStripMenuItemContractorFuel";
|
toolStripMenuItemContractorFuel.Name = "toolStripMenuItemContractorFuel";
|
||||||
toolStripMenuItemContractorFuel.Size = new Size(180, 22);
|
toolStripMenuItemContractorFuel.Size = new Size(160, 22);
|
||||||
toolStripMenuItemContractorFuel.Text = "Новая поставка";
|
toolStripMenuItemContractorFuel.Text = "Новая поставка";
|
||||||
toolStripMenuItemContractorFuel.Click += toolStripMenuItemContractorFuel_Click;
|
toolStripMenuItemContractorFuel.Click += toolStripMenuItemContractorFuel_Click;
|
||||||
//
|
//
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,7 @@ using Microsoft.Extensions.Logging;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Npgsql;
|
using Npgsql;
|
||||||
using ProjectGasStation.Entities;
|
using ProjectGasStation.Entities;
|
||||||
|
using System.Transactions;
|
||||||
|
|
||||||
namespace ProjectGasStation.Repositories.Implementations;
|
namespace ProjectGasStation.Repositories.Implementations;
|
||||||
|
|
||||||
@ -62,10 +63,19 @@ public class ContractorFuelRepository : IContractorFuelRepository
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
using var transaction = connection.BeginTransaction();
|
||||||
|
var queryDeleteSub = @"
|
||||||
|
DELETE FROM ContractorFuelFuel
|
||||||
|
WHERE ContractorFuelId = @id";
|
||||||
|
connection.Execute(queryDeleteSub, new { id }, transaction);
|
||||||
|
|
||||||
var queryDelete = @"
|
var queryDelete = @"
|
||||||
DELETE FROM ContractorFuel
|
DELETE FROM ContractorFuel
|
||||||
WHERE Id=@id";
|
WHERE Id = @id";
|
||||||
connection.Execute(queryDelete, new { id });
|
connection.Execute(queryDelete, new { id }, transaction);
|
||||||
|
|
||||||
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -81,10 +81,20 @@ public class FuelSaleRepository : IFuelSaleRepository
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
using var transaction = connection.BeginTransaction();
|
||||||
|
|
||||||
|
var queryDeleteSub = @"
|
||||||
|
DELETE FROM FuelFuelSale
|
||||||
|
WHERE FuelSaleId = @id";
|
||||||
|
connection.Execute(queryDeleteSub, new { id }, transaction);
|
||||||
|
|
||||||
var queryDelete = @"
|
var queryDelete = @"
|
||||||
DELETE FROM FuelSale
|
DELETE FROM FuelSale
|
||||||
WHERE Id=@id";
|
WHERE Id = @id";
|
||||||
connection.Execute(queryDelete, new { id });
|
connection.Execute(queryDelete, new { id }, transaction);
|
||||||
|
|
||||||
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user