grouping services and controllers

This commit is contained in:
ngfrolov 2022-04-11 18:00:34 +05:00
parent 80434475db
commit fa9486e44d
190 changed files with 13729 additions and 13771 deletions

View File

@ -7,7 +7,7 @@ namespace AsbCloudApp.Comparators
public class ComparerIId : IComparer<IId>, IEqualityComparer<IId>
{
private static readonly ComparerIId instance = new ComparerIId();
private ComparerIId(){}
private ComparerIId() { }
public static ComparerIId GetInstance() => instance;

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AsbCloudApp.Data
namespace AsbCloudApp.Data
{
public class FileCategoryDto : IId
{

View File

@ -1,6 +1,6 @@
namespace AsbCloudApp.Data
{
public class PermissionDto: IId
public class PermissionDto : IId
{
public int Id { get; set; }
public string Name { get; set; }

View File

@ -1,4 +1,4 @@
namespace AsbCloudApp.Data
namespace AsbCloudApp.Data.SAUB
{
public class SetpointInfoDto
{

View File

@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AsbCloudApp.Data
namespace AsbCloudApp.Data.SAUB
{
public class SetpointsRequestDto : IId
{

View File

@ -8,7 +8,7 @@ namespace AsbCloudApp.Data
public override bool Equals(object obj)
{
if(obj is SimpleTimezoneDto tTimeZone
if (obj is SimpleTimezoneDto tTimeZone
&& tTimeZone.Hours == Hours
&& tTimeZone.TimezoneId == TimezoneId
&& tTimeZone.IsOverride == IsOverride)

View File

@ -1,5 +1,4 @@
using AsbCloudApp.Data.SAUB;
using System.Text.Json.Serialization;
namespace AsbCloudApp.Data
{

View File

@ -1,6 +1,6 @@
namespace AsbCloudApp.Data
{
public class UserDto: IId
public class UserDto : IId
{
public int Id { get; set; }
public string Login { get; set; }

View File

@ -1,6 +1,4 @@
using System.Collections.Generic;
namespace AsbCloudApp.Data
namespace AsbCloudApp.Data
{
public class UserRegistrationDto : UserDto
{

View File

@ -5,7 +5,7 @@ namespace AsbCloudApp.Data.WITS
/// <summary>
/// This is base class for all WITS-0 records
/// </summary>
public abstract class RecordBaseDto: ITelemetryData
public abstract class RecordBaseDto : ITelemetryData
{
public int Id { get; set; }

View File

@ -5,12 +5,12 @@ namespace AsbCloudApp.Exceptions
/// <summary>
/// Argument validation fail Exception
/// </summary>
public class ArgumentInvalidException: Exception
public class ArgumentInvalidException : Exception
{
public string ParamName { get; }
public ArgumentInvalidException(string message, string paramName = default)
:base(message)
: base(message)
{
ParamName = paramName;
}

View File

@ -5,13 +5,13 @@ namespace AsbCloudApp.Exceptions
/// <summary>
/// Access denied exception
/// </summary>
public class ForbidException: Exception
public class ForbidException : Exception
{
public ForbidException()
:base(){}
: base() { }
public ForbidException(string message)
:base(message){}
: base(message) { }
}
}

View File

@ -1,5 +1,4 @@
using AsbCloudApp.Data;
using System;
using System;
using System.Threading;
using System.Threading.Tasks;

View File

@ -1,8 +1,8 @@
using AsbCloudApp.Data;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Data;
namespace AsbCloudApp.Services
{

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
using AsbCloudApp.Data;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Data;
namespace AsbCloudApp.Services
{

View File

@ -1,6 +1,5 @@
using AsbCloudApp.Data;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;

View File

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
namespace AsbCloudApp.Services
{

View File

@ -1,6 +1,5 @@
using System.Threading;
using System.Threading.Tasks;
using System.IO;
namespace AsbCloudApp.Services
{

View File

@ -1,8 +1,5 @@
using AsbCloudApp.Data;
using System;
using AsbCloudApp.Data.SAUB;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

View File

@ -1,5 +1,4 @@
using AsbCloudApp.Data;
using System;
using System.Threading;
using System.Threading.Tasks;

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
public interface IWellService: ICrudService<WellDto>
public interface IWellService : ICrudService<WellDto>
{
ITelemetryService TelemetryService { get; }

View File

@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
public interface IWitsRecordRepository<TDto>
where TDto: ITelemetryData
where TDto : ITelemetryData
{
Task SaveDataAsync(int idTelemetry, IEnumerable<TDto> dtos, CancellationToken token);
Task<IEnumerable<TDto>> GetAsync(int idTelemetry, DateTime begin, DateTime end, CancellationToken token);

View File

@ -1,13 +1,12 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
namespace AsbCloudApp.Services
{
/// <summary>
///
/// </summary>
public class InstantDataRepository: ConcurrentDictionary<int, ConcurrentDictionary<Type, object>>
public class InstantDataRepository : ConcurrentDictionary<int, ConcurrentDictionary<Type, object>>
{
}
}

View File

@ -1,17 +1,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace AsbCloudApp
{
public class Tree<T> : Dictionary<T, Tree<T>>
{
public Tree()
{}
{ }
public Tree(T key, Tree<T> node = null)
{
@ -19,8 +13,8 @@ namespace AsbCloudApp
}
public Tree(Tree<T> other)
:base(other)
{}
: base(other)
{ }
public Tree(IEnumerable<T> keys)
{

View File

@ -51,7 +51,7 @@ namespace AsbCloudDb
}
}
interface IQueryStringFactory{}
interface IQueryStringFactory { }
class QueryStringFactory<T> : IQueryStringFactory
where T : class
@ -104,7 +104,7 @@ namespace AsbCloudDb
var list = items.ToList();
for (var i = 0; i < list.Count; i++)
{
if(i > 0)
if (i > 0)
builder.Append(',');
BuildRow(builder, list[i]);
}
@ -126,7 +126,7 @@ namespace AsbCloudDb
string vStr => $"'{vStr}'",
DateTime vDate => $"'{FormatDateValue(vDate)}'",
DateTimeOffset vDate => $"'{FormatDateValue(vDate.UtcDateTime)}'",
IFormattable vFormattable=> FormatFormattableValue(vFormattable),
IFormattable vFormattable => FormatFormattableValue(vFormattable),
_ => System.Text.Json.JsonSerializer.Serialize(v),
};

View File

@ -1,6 +1,6 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using System;
namespace AsbCloudDb.Migrations
{

View File

@ -1,6 +1,6 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using System;
namespace AsbCloudDb.Migrations
{

View File

@ -1,6 +1,6 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using System;
namespace AsbCloudDb.Migrations
{

View File

@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using System;
using System.Collections.Generic;
namespace AsbCloudDb.Migrations
{

View File

@ -1,6 +1,6 @@
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using System.Collections.Generic;
namespace AsbCloudDb.Migrations
{

View File

@ -1,6 +1,6 @@
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using System.Collections.Generic;
namespace AsbCloudDb.Migrations
{

View File

@ -1,5 +1,5 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
namespace AsbCloudDb.Migrations
{

View File

@ -1,5 +1,5 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
#nullable disable

View File

@ -229,12 +229,14 @@ namespace AsbCloudDb.Model
.HasConstraintName("t_relation_company_well_t_company_id_fk");
});
modelBuilder.Entity<RelationUserRoleUserRole>(entity => {
modelBuilder.Entity<RelationUserRoleUserRole>(entity =>
{
entity.HasKey(x => new { x.Id, x.IdInclude })
.HasName("t_relation_user_role_user_role_pk");
});
modelBuilder.Entity<RelationUserDrillingProgramPart>(entity => {
modelBuilder.Entity<RelationUserDrillingProgramPart>(entity =>
{
entity.HasKey(x => new { x.IdUser, x.IdDrillingProgramPart })
.HasName("t_relation_user_drilling_program_part_pk");
});
@ -258,8 +260,9 @@ namespace AsbCloudDb.Model
entity.HasIndex(d => d.IdWellOperationCategory);
});
modelBuilder.Entity<DrillingProgramPart>(entity => {
entity.HasIndex(x => new { x.IdWell, x.IdFileCategory})
modelBuilder.Entity<DrillingProgramPart>(entity =>
{
entity.HasIndex(x => new { x.IdWell, x.IdFileCategory })
.IsUnique();
});

View File

@ -1,5 +1,5 @@
using System;
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;

View File

@ -1,6 +1,6 @@
using System;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;

View File

@ -1,8 +1,8 @@
using System;
using System.Text.Json.Serialization;
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace AsbCloudDb.Model
{

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace AsbCloudDb.Model
{
public interface IAsbCloudDbContext: IDisposable
public interface IAsbCloudDbContext : IDisposable
{
DbSet<Cluster> Clusters { get; set; }
DbSet<Company> Companies { get; set; }

View File

@ -2,7 +2,7 @@
namespace AsbCloudDb.Model
{
public class RawData: Dictionary<string, object>
public class RawData : Dictionary<string, object>
{
}

View File

@ -1,6 +1,5 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace AsbCloudDb.Model
{

View File

@ -1,6 +1,6 @@
using System;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

View File

@ -1,6 +1,5 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_10")]
public class Record10: RecordBase {
public class Record10 : RecordBase
{
/// <summary>
/// RecordId = 10,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_11")]
public class Record11: RecordBase {
public class Record11 : RecordBase
{
/// <summary>
/// RecordId = 11,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_12")]
public class Record12: RecordBase {
public class Record12 : RecordBase
{
/// <summary>
/// RecordId = 12,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_13")]
public class Record13: RecordBase {
public class Record13 : RecordBase
{
/// <summary>
/// RecordId = 13,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_14")]
public class Record14: RecordBase {
public class Record14 : RecordBase
{
/// <summary>
/// RecordId = 14,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
#nullable enable
@ -10,7 +9,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_15")]
public class Record15: RecordBase {
public class Record15 : RecordBase
{
/// <summary>
/// RecordId = 15,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_16")]
public class Record16: RecordBase {
public class Record16 : RecordBase
{
/// <summary>
/// RecordId = 16,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_17")]
public class Record17: RecordBase {
public class Record17 : RecordBase
{
/// <summary>
/// RecordId = 17,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_18")]
public class Record18: RecordBase {
public class Record18 : RecordBase
{
/// <summary>
/// RecordId = 18,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_19")]
public class Record19: RecordBase {
public class Record19 : RecordBase
{
/// <summary>
/// RecordId = 19,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -8,7 +7,8 @@ namespace AsbCloudDb.Model.WITS
/// Description: Drilling data gathered at regular depth intervals
/// </summary>
[Table("t_telemetry_wits_2")]
public class Record2: RecordBase {
public class Record2 : RecordBase
{
/// <summary>
/// RecordId = 2,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_20")]
public class Record20: RecordBase {
public class Record20 : RecordBase
{
/// <summary>
/// RecordId = 20,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_21")]
public class Record21: RecordBase {
public class Record21 : RecordBase
{
/// <summary>
/// RecordId = 21,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_22")]
public class Record22: RecordBase {
public class Record22 : RecordBase
{
/// <summary>
/// RecordId = 22,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_23")]
public class Record23: RecordBase {
public class Record23 : RecordBase
{
/// <summary>
/// RecordId = 23,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_24")]
public class Record24: RecordBase {
public class Record24 : RecordBase
{
/// <summary>
/// RecordId = 24,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_25")]
public class Record25: RecordBase {
public class Record25 : RecordBase
{
/// <summary>
/// RecordId = 25,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_3")]
public class Record3: RecordBase {
public class Record3 : RecordBase
{
/// <summary>
/// RecordId = 3,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_4")]
public class Record4: RecordBase {
public class Record4 : RecordBase
{
/// <summary>
/// RecordId = 4,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_5")]
public class Record5: RecordBase {
public class Record5 : RecordBase
{
/// <summary>
/// RecordId = 5,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_50")]
public class Record50: RecordBase {
public class Record50 : RecordBase
{
/// <summary>
/// RecordId = 50,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_6")]
public class Record6: RecordBase {
public class Record6 : RecordBase
{
/// <summary>
/// RecordId = 6,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_60")]
public class Record60: RecordBase {
public class Record60 : RecordBase
{
/// <summary>
/// RecordId = 60,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_61")]
public class Record61: RecordBase {
public class Record61 : RecordBase
{
/// <summary>
/// RecordId = 61,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_7")]
public class Record7: RecordBase {
public class Record7 : RecordBase
{
/// <summary>
/// RecordId = 7,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_8")]
public class Record8: RecordBase {
public class Record8 : RecordBase
{
/// <summary>
/// RecordId = 8,

View File

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -9,7 +8,8 @@ namespace AsbCloudDb.Model.WITS
/// Description2:
/// </summary>
[Table("t_telemetry_wits_9")]
public class Record9: RecordBase {
public class Record9 : RecordBase
{
/// <summary>
/// RecordId = 9,

View File

@ -1,5 +1,4 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.WITS
@ -7,7 +6,7 @@ namespace AsbCloudDb.Model.WITS
/// <summary>
/// This is base class for all WITS-0 records
/// </summary>
public abstract class RecordBase: ITelemetryData
public abstract class RecordBase : ITelemetryData
{
[Column("id_telemetry")]
public int IdTelemetry { get; set; }

View File

@ -1,5 +1,4 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
#nullable disable

View File

@ -15,7 +15,7 @@ namespace AsbCloudInfrastructure
DateTimeKind.Unspecified => DateTime.SpecifyKind(date.AddHours(-remoteTimezoneOffsetHours), DateTimeKind.Utc),
_ => date,
};
return new DateTimeOffset( dateUtc);
return new DateTimeOffset(dateUtc);
}
public static DateTime ToRemoteDateTime(this DateTimeOffset date, double remoteTimezoneOffsetHours)

View File

@ -1,20 +1,20 @@
using AsbCloudApp.Data;
using AsbCloudApp.Data.SAUB;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using AsbCloudInfrastructure.Services;
using AsbCloudInfrastructure.Services.Analysis;
using AsbCloudInfrastructure.Services.Cache;
using AsbCloudInfrastructure.Services.DrillingProgram;
using AsbCloudInfrastructure.Services.SAUB;
using AsbCloudInfrastructure.Services.WellOperationService;
using AsbCloudInfrastructure.Validators;
using FluentValidation.AspNetCore;
using Mapster;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using FluentValidation;
using FluentValidation.AspNetCore;
using AsbCloudInfrastructure.Services.DrillingProgram;
using AsbCloudApp.Data.SAUB;
namespace AsbCloudInfrastructure
{

View File

@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using AsbCloudApp.Exceptions;
using AsbCloudApp.Exceptions;
using AsbCloudDb.Model;
using AsbSaubReport.Model;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
namespace AsbCloudInfrastructure
{
@ -97,7 +97,8 @@ namespace AsbCloudInfrastructure
&& d.DateTime >= beginUtc
&& d.DateTime <= endUtc)
.OrderBy(d => d.DateTime)
.Select(d => new DataSaubReport {
.Select(d => new DataSaubReport
{
Date = d.DateTime.DateTime.AddHours(timezoneOffset),
Mode = d.Mode,
WellDepth = d.WellDepth,

View File

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections.Generic;
namespace AsbCloudInfrastructure.Services.Analysis
{

View File

@ -1,13 +1,14 @@
using System;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using AsbCloudInfrastructure.Services.Cache;
using AsbCloudInfrastructure.Services.SAUB;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using System.Diagnostics;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Hosting;
using AsbCloudInfrastructure.Services.Cache;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using Microsoft.Extensions.Configuration;
namespace AsbCloudInfrastructure.Services.Analysis
{
@ -34,7 +35,7 @@ namespace AsbCloudInfrastructure.Services.Analysis
while (!token.IsCancellationRequested)
{
if(DateTime.Now > timeToStartAnalysis)
if (DateTime.Now > timeToStartAnalysis)
{
timeToStartAnalysis = DateTime.Now + period;
try

View File

@ -76,13 +76,14 @@ namespace AsbCloudInfrastructure.Services.Analysis
var drillingPeriodsInfo = await db.TelemetryDataSaub
.Where(t => t.IdTelemetry == telemetryId)
.GroupBy(t => Math.Floor((((t.DateTime.DayOfYear * 24 + t.DateTime.Hour) * 60 + t.DateTime.Minute) * 60 + t.DateTime.Second + timezone.Hours - shiftStartSec) / intervalSeconds))
.Select(g => new {
.Select(g => new
{
WellDepthMin = g.Min(t => t.WellDepth),
WellDepthMax = g.Max(t => t.WellDepth),
DateMin = g.Min(t => t.DateTime),
DateMax = g.Max(t => t.DateTime),
})
.OrderBy(g=>g.DateMin)
.OrderBy(g => g.DateMin)
.ToListAsync(token);
var wellDepthToIntervalData = drillingPeriodsInfo.Select(d => new WellDepthToIntervalDto
@ -343,7 +344,7 @@ namespace AsbCloudInfrastructure.Services.Analysis
DateTime lastAnalysisDate = new DateTime(0, DateTimeKind.Utc);
if(lastAnalysisInDb is not null)
if (lastAnalysisInDb is not null)
lastAnalysisDate = DateTime.UnixEpoch.AddSeconds(lastAnalysisInDb.DurationSec + lastAnalysisInDb.UnixDate);
return lastAnalysisDate;
@ -363,7 +364,8 @@ namespace AsbCloudInfrastructure.Services.Analysis
)
.OrderBy(d => d.DateTime)
.Take(countOfRecordsForInterpolation)
.Select(d => new DataSaubAnalyse {
.Select(d => new DataSaubAnalyse
{
IdTelemetry = d.IdTelemetry,
Date = d.DateTime,
BitDepth = d.BitDepth ?? 0,
@ -507,7 +509,7 @@ namespace AsbCloudInfrastructure.Services.Analysis
OperationStartDepth = null,
OperationEndDepth = null,
IsWellDepthDecreasing = wellDepthLine.IsYDecreases(-0.0001),
IsWellDepthIncreasing = wellDepthLine.IsYIncreases( 0.0001),
IsWellDepthIncreasing = wellDepthLine.IsYIncreases(0.0001),
IsBitPositionDecreasing = bitPositionLine.IsYDecreases(-0.0001),
IsBitPositionIncreasing = bitPositionLine.IsYIncreases(0.0001),
IsBitPositionLt20 = bitPositionLine.IsAverageYLessThanBound(20),

View File

@ -1,18 +1,18 @@
using AsbCloudApp.Data;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using Mapster;
using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Tokens;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Security.Claims;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Mapster;
using System.IdentityModel.Tokens.Jwt;
namespace AsbCloudInfrastructure.Services
{
@ -23,7 +23,7 @@ namespace AsbCloudInfrastructure.Services
public const string issuer = "a";
public const string audience = "a";
public static readonly SymmetricSecurityKey securityKey = new (Encoding.ASCII.GetBytes("супер секретный ключ для шифрования"));
public static readonly SymmetricSecurityKey securityKey = new(Encoding.ASCII.GetBytes("супер секретный ключ для шифрования"));
private const string algorithms = SecurityAlgorithms.HmacSha256;
private static readonly TimeSpan expiresTimespan = TimeSpan.FromDays(365.25);
@ -84,7 +84,7 @@ namespace AsbCloudInfrastructure.Services
var user = db.Users.FirstOrDefault(u => u.Login == userDto.Login);
if(user is not null)
if (user is not null)
return -6;
var salt = GenerateSalt();

View File

@ -1,5 +1,4 @@
using AsbCloudApp.Data;
using AsbCloudApp.Services;
using AsbCloudApp.Services;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;

View File

@ -1,9 +1,8 @@
using Microsoft.EntityFrameworkCore;
using System.Linq;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System;
using AsbCloudApp;
using System.Linq;
namespace AsbCloudInfrastructure.Services.Cache
{

View File

@ -1,11 +1,11 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Collections;
using System.Diagnostics;
namespace AsbCloudInfrastructure.Services.Cache
{
@ -418,7 +418,7 @@ namespace AsbCloudInfrastructure.Services.Cache
public Task<IEnumerable<TEntity>> InsertAsync(IEnumerable<TEntity> newEntities, CancellationToken token = default)
{
if(newEntities is null)
if (newEntities is null)
return null;
var count = newEntities.Count();
if (count == 0)

View File

@ -1,6 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace AsbCloudInfrastructure.Services.Cache
{

View File

@ -131,7 +131,7 @@ namespace AsbCloudInfrastructure.Services
.Where(w => w.RelationCompaniesWells.Any(c => c.IdCompany == idCompany));
}
private IEnumerable<DepositDto> CreateDepositDto(IEnumerable<IGrouping<Deposit,IGrouping<Cluster, Well>>>gDepositEntities)
private IEnumerable<DepositDto> CreateDepositDto(IEnumerable<IGrouping<Deposit, IGrouping<Cluster, Well>>> gDepositEntities)
{
return gDepositEntities.Select(gDeposit => new DepositDto
{
@ -145,7 +145,8 @@ namespace AsbCloudInfrastructure.Services
Caption = gCluster.Key.Caption,
Latitude = gCluster.Key.Latitude,
Longitude = gCluster.Key.Longitude,
Wells = gCluster.Select(well => {
Wells = gCluster.Select(well =>
{
var dto = well.Adapt<WellDto>();
dto.WellType = well.WellType?.Caption;
dto.LastTelemetryDate = wellService.GetLastTelemetryDate(well.Id).DateTime;

View File

@ -1,4 +1,3 @@
using AsbCloudApp;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using AsbCloudInfrastructure.Services.Cache;
@ -21,9 +20,11 @@ namespace AsbCloudInfrastructure.Services
public ISet<string> Includes { get; } = new SortedSet<string>();
protected CacheTable<TModel> Cache {
get {
if(cache is null)
protected CacheTable<TModel> Cache
{
get
{
if (cache is null)
cache = cacheDb.GetCachedTable<TModel>((AsbCloudDbContext)db, Includes);
return cache;
}
@ -40,7 +41,7 @@ namespace AsbCloudInfrastructure.Services
var entity = Convert(newItem);
var insertedEntity = await Cache.InsertAsync(entity, token)
.ConfigureAwait(false);
return insertedEntity?.Id??-1;
return insertedEntity?.Id ?? -1;
}
public virtual async Task<int> InsertRangeAsync(IEnumerable<TDto> dtos, CancellationToken token)
@ -48,7 +49,7 @@ namespace AsbCloudInfrastructure.Services
var entities = dtos.Select(Convert);
var insertedEntities = await Cache.InsertAsync(entities, token)
.ConfigureAwait(false);
return insertedEntities?.Count()??0;
return insertedEntities?.Count() ?? 0;
}
public virtual async Task<IEnumerable<TDto>> GetAllAsync(CancellationToken token)
@ -74,7 +75,7 @@ namespace AsbCloudInfrastructure.Services
{
if (dto.Id != id)
{
var exist = await Cache.ContainsAsync(i=>i.Id == dto.Id, token)
var exist = await Cache.ContainsAsync(i => i.Id == dto.Id, token)
.ConfigureAwait(false);
if (exist)

View File

@ -1,5 +1,4 @@
using AsbCloudApp;
using AsbCloudApp.Data;
using AsbCloudApp.Data;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using Mapster;
@ -93,7 +92,8 @@ namespace AsbCloudInfrastructure.Services
public virtual Task<int> InsertRangeAsync(IEnumerable<TDto> items, CancellationToken token = default)
{
var entities = items.Select(i => {
var entities = items.Select(i =>
{
var entity = Convert(i);
entity.Id = 0;
return entity;

View File

@ -1,13 +1,13 @@
using AsbCloudApp.Data;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using Mapster;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Data;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using Microsoft.EntityFrameworkCore;
using Mapster;
namespace AsbCloudInfrastructure.Services
{
@ -37,7 +37,8 @@ namespace AsbCloudInfrastructure.Services
.ToListAsync(token)
.ConfigureAwait(false);
var dtos = entities.Select(entity => {
var dtos = entities.Select(entity =>
{
var dto = entity.Adapt<DrillFlowChartDto>();
dto.LastUpdate = entity.LastUpdate.ToRemoteDateTime(timezone.Hours);
return dto;

View File

@ -1,12 +1,12 @@
using System.Collections.Generic;
using AsbCloudApp.Data;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using Mapster;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Data;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using Microsoft.EntityFrameworkCore;
using Mapster;
namespace AsbCloudInfrastructure.Services
{
@ -41,16 +41,16 @@ namespace AsbCloudInfrastructure.Services
DepthStart = startDepth,
DepthEnd = endDepth,
IdWellSectionType = 0,
AxialLoadMin = g.Min(t=> t.AxialLoad) ?? double.NaN,
AxialLoadMin = g.Min(t => t.AxialLoad) ?? double.NaN,
AxialLoadAvg = g.Average(t => t.AxialLoad) ?? double.NaN,
AxialLoadMax = g.Max(t => t.AxialLoad) ?? double.NaN,
PressureMin = g.Min(t=> t.Pressure) ?? double.NaN,
PressureMin = g.Min(t => t.Pressure) ?? double.NaN,
PressureAvg = g.Average(t => t.Pressure) ?? double.NaN,
PressureMax = g.Max(t => t.Pressure) ?? double.NaN,
RotorTorqueMin = g.Min(t=> t.RotorTorque) ?? double.NaN,
RotorTorqueMin = g.Min(t => t.RotorTorque) ?? double.NaN,
RotorTorqueAvg = g.Average(t => t.RotorTorque) ?? double.NaN,
RotorTorqueMax = g.Max(t => t.RotorTorque) ?? double.NaN,
RotorSpeedMin = g.Min(t=> t.RotorSpeed) ?? double.NaN,
RotorSpeedMin = g.Min(t => t.RotorSpeed) ?? double.NaN,
RotorSpeedAvg = g.Average(t => t.RotorSpeed) ?? double.NaN,
RotorSpeedMax = g.Max(t => t.RotorSpeed) ?? double.NaN,
FlowMin = g.Min(t => t.Flow) ?? double.NaN,

View File

@ -1,14 +1,8 @@
using AsbCloudApp.Data;
using AsbCloudApp.Exceptions;
using AsbCloudApp.Services;
using ClosedXML.Excel;
using ClosedXML.Excel;
using ClosedXML.Excel.Drawings;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Services.DrillingProgram
{

View File

@ -79,7 +79,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
public async Task<IEnumerable<FileCategoryDto>> GetCategoriesAsync(CancellationToken token = default)
{
var result = await context.FileCategories
.Where(c=>c.Id > idFileCategoryDrillingProgramPartsStart && c.Id < idFileCategoryDrillingProgramPartsEnd)
.Where(c => c.Id > idFileCategoryDrillingProgramPartsStart && c.Id < idFileCategoryDrillingProgramPartsEnd)
.ToListAsync(token);
return result.Select(c => c.Adapt<FileCategoryDto>());
}
@ -127,7 +127,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
if (parts.Any())
{
if(parts.All(p=>p.IdState == idPartStateApproved))
if (parts.All(p => p.IdState == idPartStateApproved))
{
if (state.Program is not null)
{
@ -164,7 +164,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
if (part == null)
throw new ArgumentInvalidException($"DrillingProgramPart id == {idFileCategory} does not exist", nameof(idFileCategory));
if (! part.RelatedUsers.Any(r => r.IdUser == idUser && r.IdUserRole == idUserRolePublisher))
if (!part.RelatedUsers.Any(r => r.IdUser == idUser && r.IdUserRole == idUserRolePublisher))
throw new ForbidException($"User {idUser} is not in the publisher list.");
var result = await fileService.SaveAsync(
@ -233,7 +233,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
var oldRelation = await context.RelationDrillingProgramPartUsers
.FirstOrDefaultAsync(r => r.IdUser == idUser && r.IdDrillingProgramPart == part.Id, token);
if(oldRelation is not null)
if (oldRelation is not null)
context.RelationDrillingProgramPartUsers.Remove(oldRelation);
var newRelation = new RelationUserDrillingProgramPart
@ -244,7 +244,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
};
context.RelationDrillingProgramPartUsers.Add(newRelation);
if(idUserRole == idUserRoleApprover)
if (idUserRole == idUserRoleApprover)
await RemoveDrillingProgramAsync(part.IdWell, token);
return await context.SaveChangesAsync(token);
}
@ -265,7 +265,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
public async Task<int> AddOrReplaceFileMarkAsync(FileMarkDto fileMarkDto, int idUser, CancellationToken token)
{
if(fileMarkDto.IdMarkType != idMarkTypeApprove &&
if (fileMarkDto.IdMarkType != idMarkTypeApprove &&
fileMarkDto.IdMarkType != idMarkTypeReject)
throw new ArgumentInvalidException($"В этом методе допустимы только отметки о принятии или отклонении.", nameof(fileMarkDto));
@ -290,13 +290,13 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
?.Where(m => m.User.Id == idUser)
.Select(m => m.Id);
if(oldMarksIds?.Any() == true)
if (oldMarksIds?.Any() == true)
await fileService.MarkFileMarkAsDeletedAsync(oldMarksIds, token);
var result = await fileService.CreateFileMarkAsync(fileMarkDto, idUser, token)
.ConfigureAwait(false);
if(fileMarkDto.IdMarkType == idMarkTypeReject)
if (fileMarkDto.IdMarkType == idMarkTypeReject)
await RemoveDrillingProgramAsync(fileInfo.IdWell, token);
return result;
@ -358,7 +358,8 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
var marks = fileEntity.FileMarks?.Where(m => !m.IsDeleted);
if (marks?.Any() == true)
{
part.File.FileMarks = marks.Select(m => {
part.File.FileMarks = marks.Select(m =>
{
var mark = m.Adapt<FileMarkDto>();
mark.DateCreated = m.DateCreated.ToRemoteDateTime(timezoneOffset);
return mark;
@ -401,9 +402,11 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
await fileService.MoveAsync(idWell, null, idFileCategoryDrillingProgram, resultFileName, tempResultFilePath, token);
}
Task funcOnErrorProgramMake(string workId, Exception exception, CancellationToken token) {
Task funcOnErrorProgramMake(string workId, Exception exception, CancellationToken token)
{
var message = $"Не удалось сформировать программу бурения по скважине {well?.Caption}";
drillingProgramCreateErrors[workId] = new() {
drillingProgramCreateErrors[workId] = new()
{
Message = message,
Exception = exception.Message,
};

View File

@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net.Mail;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
@ -37,7 +36,7 @@ namespace AsbCloudInfrastructure.Services
public void EnqueueSend(IEnumerable<string> addresses, string subject, string htmlBody)
{
if(!IsConfigured)
if (!IsConfigured)
{
Trace.TraceWarning("smtp is not configured");
return;
@ -107,7 +106,7 @@ namespace AsbCloudInfrastructure.Services
int hash = -1397075115;
var enumerator = strings.GetEnumerator();
while(enumerator.MoveNext())
while (enumerator.MoveNext())
hash ^= enumerator.Current.GetHashCode();
return hash;
}

View File

@ -30,7 +30,7 @@ namespace AsbCloudInfrastructure.Services
.ThenInclude(c => c.CompanyType)
.Include(f => f.FileMarks)
.ThenInclude(m => m.User)
.Include(f=>f.Well);
.Include(f => f.Well);
}
public async Task<string> GetSharedUrlAsync(int idFileInfo, int idUser, IFileShareService fileShareService,
@ -43,7 +43,7 @@ namespace AsbCloudInfrastructure.Services
return sharedUrl;
}
public async Task<string> GetSharedUrlAsync( FileInfoDto fileInfo, int idUser, IFileShareService fileShareService,
public async Task<string> GetSharedUrlAsync(FileInfoDto fileInfo, int idUser, IFileShareService fileShareService,
CancellationToken token)
{
var fileWebUrl = fileInfo.PublishInfo?.WebStorageFileUrl;
@ -224,7 +224,7 @@ namespace AsbCloudInfrastructure.Services
var relativePath = GetUrl(entity.IdWell, entity.IdCategory, entity.Id, ext);
var fullPath = Path.GetFullPath(relativePath);
if (! File.Exists(fullPath))
if (!File.Exists(fullPath))
{
throw new FileNotFoundException("not found", relativePath);
}
@ -247,7 +247,7 @@ namespace AsbCloudInfrastructure.Services
}
public Task<int> DeleteAsync(int idFile, CancellationToken token)
=> DeleteAsync(new int[] { idFile}, token);
=> DeleteAsync(new int[] { idFile }, token);
public async Task<int> DeleteAsync(IEnumerable<int> ids, CancellationToken token)
{
@ -350,7 +350,7 @@ namespace AsbCloudInfrastructure.Services
CancellationToken token)
{
var fileMarkQuery = db.FileMarks
.Where(m => idsMarks.Contains( m.Id ));
.Where(m => idsMarks.Contains(m.Id));
foreach (var fileMark in fileMarkQuery)
fileMark.IsDeleted = true;

View File

@ -1,16 +1,16 @@
using System;
using AsbCloudApp.Services;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Auth.OAuth2.Flows;
using Google.Apis.Services;
using Google.Apis.Drive.v3;
using Google.Apis.Util.Store;
using Google.Apis.Drive.v3.Data;
using System.IO;
using Google.Apis.Services;
using Google.Apis.Util.Store;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Services;
namespace AsbCloudInfrastructure.Services
{
@ -116,7 +116,7 @@ namespace AsbCloudInfrastructure.Services
public async Task CreatePublicPermissionForFileAsync(string idFile,
CancellationToken token = default)
{
var permission = new Permission() { Type = "anyone", Role = "reader"};
var permission = new Permission() { Type = "anyone", Role = "reader" };
var addPermissionRequest = service.Permissions.Create(permission, idFile);
await addPermissionRequest.ExecuteAsync(token)
.ConfigureAwait(false);

View File

@ -5,7 +5,6 @@ using AsbCloudDb.Model;
using AsbCloudInfrastructure.Services.Cache;
using Mapster;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
@ -47,7 +46,8 @@ namespace AsbCloudInfrastructure.Services
.ConfigureAwait(false);
var timezone = wellService.GetTimezone(idWell);
var dto = entity?.Adapt<MeasureDto, Measure>((d, s) => {
var dto = entity?.Adapt<MeasureDto, Measure>((d, s) =>
{
d.CategoryName = s.Category?.Name;
d.Timestamp = s.Timestamp.ToRemoteDateTime(timezone.Hours);
});
@ -59,7 +59,7 @@ namespace AsbCloudInfrastructure.Services
var query = db.Measures.Include(m => m.Category)
.Where(m => m.IdWell == idWell && !m.IsDeleted);
if(idCategory is not null)
if (idCategory is not null)
query = query.Where(m => m.IdCategory == idCategory);
var entities = await query
@ -69,7 +69,8 @@ namespace AsbCloudInfrastructure.Services
.ConfigureAwait(false);
var timezone = wellService.GetTimezone(idWell);
var dtos = entities.Adapt<MeasureDto, Measure>((d, s) => {
var dtos = entities.Adapt<MeasureDto, Measure>((d, s) =>
{
d.CategoryName = s.Category?.Name;
d.Timestamp = s.Timestamp.ToRemoteDateTime(timezone.Hours);
});

View File

@ -111,7 +111,7 @@ namespace AsbCloudInfrastructure.Services
public DatesRangeDto GetDatesRangeOrDefault(int idWell)
{
var idTelemetry = telemetryService.GetIdTelemetryByIdWell(idWell);
if(idTelemetry is null)
if (idTelemetry is null)
return null;
var range = telemetryService.GetDatesRange((int)idTelemetry);
return range;

View File

@ -1,11 +1,9 @@
using AsbCloudApp.Data;
using AsbCloudApp.Services;
using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Services
{
@ -117,10 +115,10 @@ namespace AsbCloudInfrastructure.Services
users[key].ElapsedMs += requestLog.ElapsedMilliseconds;
users[key].LastDate = requestLog.Date;
users[key].Requests++;
if(!string.IsNullOrEmpty(requestLog.ExceptionMessage))
if (!string.IsNullOrEmpty(requestLog.ExceptionMessage))
users[key].Errors++;
if(users.Count > 1000)
if (users.Count > 1000)
{
var count = 900 - users.Count;
var toRemove = users.OrderBy(kv => kv.Value.LastDate).Take(count);

View File

@ -7,7 +7,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Services
namespace AsbCloudInfrastructure.Services.SAUB
{
public class EventService : IEventService
{

View File

@ -11,7 +11,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Services
namespace AsbCloudInfrastructure.Services.SAUB
{
public class MessageService : IMessageService
{
@ -50,7 +50,7 @@ namespace AsbCloudInfrastructure.Services
var query = db.TelemetryMessages.Where(m => m.IdTelemetry == idTelemetry)
.OrderBy(m => m.DateTime).AsNoTracking();
if ((categoryids?.Any() == true) || !string.IsNullOrEmpty(searchString))
if (categoryids?.Any() == true || !string.IsNullOrEmpty(searchString))
{
if (!string.IsNullOrEmpty(searchString))
events = events.Where(e => e.MessageTemplate.Contains(searchString, StringComparison.OrdinalIgnoreCase));
@ -68,7 +68,7 @@ namespace AsbCloudInfrastructure.Services
query = query.OrderByDescending(m => m.DateTime);
var timezone = telemetryService.GetTimezone(idTelemetry??default);
var timezone = telemetryService.GetTimezone(idTelemetry ?? default);
if (begin != default)
{

View File

@ -0,0 +1 @@
Папка содержит services для получаемых от панели оператора САУБ запросов.

View File

@ -1,4 +1,4 @@
using AsbCloudApp.Data;
using AsbCloudApp.Data.SAUB;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using AsbCloudInfrastructure.Services.Cache;
@ -9,12 +9,12 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Services
namespace AsbCloudInfrastructure.Services.SAUB
{
public class SetpointsService : ISetpointsService, IConverter<SetpointsRequestDto, SetpointsRequest>
{
// ## Инфо от АПГ от 26.11.2021, дополнения ШОВ от 26.11.2021
private static readonly Dictionary<string, SetpointInfoDto> SetpointInfos = new ()
private static readonly Dictionary<string, SetpointInfoDto> SetpointInfos = new()
{
{ "bitLoad", new SetpointInfoDto { Name = "bitLoad", DisplayName = "Осевая нагрузка, т" } },
{ "dPressureMaxRotorSP", new SetpointInfoDto { Name = "dPressureMaxRotorSP", DisplayName = "Дифференциальное рабочее давление в роторе, атм" } },

Some files were not shown because too many files have changed in this diff Show More