From cee68bf4ee7efccf9b55ac2eee9b09fe99918ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D0=BE=D0=BB=D0=BE=D0=B2?= Date: Thu, 24 Feb 2022 09:52:11 +0500 Subject: [PATCH] DrillingProgramStateDto Add PermissionToEdit --- AsbCloudApp/Data/DrillingProgramStateDto.cs | 7 ++-- AsbCloudDb/UsefulQueries/export_sp.sql | 15 ++++++++ .../UsefulQueries/export_sp_for_gazprom.sql | 36 ------------------- .../DrillingProgram/DrillingProgramService.cs | 3 +- 4 files changed, 19 insertions(+), 42 deletions(-) create mode 100644 AsbCloudDb/UsefulQueries/export_sp.sql delete mode 100644 AsbCloudDb/UsefulQueries/export_sp_for_gazprom.sql diff --git a/AsbCloudApp/Data/DrillingProgramStateDto.cs b/AsbCloudApp/Data/DrillingProgramStateDto.cs index 17b09a15..0581afea 100644 --- a/AsbCloudApp/Data/DrillingProgramStateDto.cs +++ b/AsbCloudApp/Data/DrillingProgramStateDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; namespace AsbCloudApp.Data { @@ -16,6 +12,7 @@ namespace AsbCloudApp.Data /// public int IdState { get; set; } public FileInfoDto Program { get; set; } + public bool PermissionToEdit { get; set; } public IEnumerable Parts { get; set; } } } diff --git a/AsbCloudDb/UsefulQueries/export_sp.sql b/AsbCloudDb/UsefulQueries/export_sp.sql new file mode 100644 index 00000000..c14d213e --- /dev/null +++ b/AsbCloudDb/UsefulQueries/export_sp.sql @@ -0,0 +1,15 @@ +-- USAGE: +--sudo -u postgres psql -v id_t=103 -v file="'/home/soltex/export/t_103.csv'" < export_sp.sql +copy (select + "date", + well_depth, + t_te.id_event, + t_te.message_template, + arg0 as old_value, + arg1 as new_value +from t_telemetry_message t_tm +left join (select * from t_telemetry_event where id_telemetry = :id_t) t_te + on t_te.id_event = t_tm.id_event +where t_tm.id_telemetry = :id_t and t_tm.id_event != 40 +order by date) +to :file DELIMITER ';' CSV header ENCODING 'WIN1251'; \ No newline at end of file diff --git a/AsbCloudDb/UsefulQueries/export_sp_for_gazprom.sql b/AsbCloudDb/UsefulQueries/export_sp_for_gazprom.sql deleted file mode 100644 index f21c590b..00000000 --- a/AsbCloudDb/UsefulQueries/export_sp_for_gazprom.sql +++ /dev/null @@ -1,36 +0,0 @@ -select t_cluster.caption as cluster, - t_well.caption as well, - t_well.id_telemetry -from t_cluster -join t_well on t_well.id_cluster = t_cluster.id -where t_cluster.caption in ('82', 'ê50 Á', 'ê8', '6 A') and t_well.id_telemetry is not null -order by cluster , well - -select * from t_telemetry_event -where id_telemetry = 94; - -select * from t_telemetry_message t_tm -where id_telemetry = 94; - -select - date, - well_depth, - t_te.id_event, - t_te.message_template, - arg0 as old_value, - arg1 as new_value -from t_telemetry_message t_tm -left join (select * from t_telemetry_event where id_telemetry = 94) t_te - on t_te.id_event = t_tm.id_event -where t_tm.id_telemetry = 94 -order by date; - -select * -from t_telemetry_data_saub -where id_telemetry = 94; - -select * -from t_telemetry_data_saub -where id_telemetry = 94 -window w as (PARTITION BY id_telemetry order by date) - diff --git a/AsbCloudInfrastructure/Services/DrillingProgram/DrillingProgramService.cs b/AsbCloudInfrastructure/Services/DrillingProgram/DrillingProgramService.cs index 8baa6c61..4404e468 100644 --- a/AsbCloudInfrastructure/Services/DrillingProgram/DrillingProgramService.cs +++ b/AsbCloudInfrastructure/Services/DrillingProgram/DrillingProgramService.cs @@ -116,7 +116,8 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram { Parts = parts, Program = files.FirstOrDefault(f => f.IdCategory == idFileCategoryDrillingProgram) - .Adapt() + .Adapt(), + PermissionToEdit = userService.HasPermission(idUser, "DrillingProgram.edit"), }; if (parts.Any())