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