2021-09-29 10:12:54 +05:00
|
|
|
|
using System;
|
2021-09-17 15:41:55 +05:00
|
|
|
|
using System.IO;
|
2021-09-15 17:48:34 +05:00
|
|
|
|
using System.Collections.Generic;
|
2021-09-15 10:43:46 +05:00
|
|
|
|
using System.Linq;
|
2021-09-17 15:41:55 +05:00
|
|
|
|
using ClosedXML.Excel;
|
2021-09-20 12:10:15 +05:00
|
|
|
|
using ClosedXML.Excel.Drawings;
|
2021-09-29 10:12:54 +05:00
|
|
|
|
using AsbCloudApp.Data;
|
|
|
|
|
using AsbCloudDb.Model;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using AsbCloudInfrastructure.Services.Cache;
|
|
|
|
|
using AsbCloudInfrastructure.Services;
|
2021-10-03 20:08:17 +05:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Threading;
|
2021-04-02 17:28:07 +05:00
|
|
|
|
|
|
|
|
|
namespace ConsoleApp1
|
|
|
|
|
{
|
2021-09-15 10:43:46 +05:00
|
|
|
|
//var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
|
|
|
|
|
// .UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True")
|
|
|
|
|
// .Options;
|
|
|
|
|
//var context = new AsbCloudDbContext(options);
|
|
|
|
|
|
2021-04-02 17:28:07 +05:00
|
|
|
|
class Program
|
2021-10-03 20:08:17 +05:00
|
|
|
|
{
|
2021-07-28 09:47:13 +05:00
|
|
|
|
static void Main(/*string[] args*/)
|
2021-04-02 17:28:07 +05:00
|
|
|
|
{
|
2021-09-29 10:12:54 +05:00
|
|
|
|
var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
|
|
|
|
|
.UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True")
|
|
|
|
|
.Options;
|
2021-10-01 15:44:56 +05:00
|
|
|
|
using var db = new AsbCloudDbContext(options);
|
2021-09-29 10:12:54 +05:00
|
|
|
|
|
2021-10-01 15:44:56 +05:00
|
|
|
|
var cacheDb = new CacheDb();
|
2021-10-05 09:24:25 +05:00
|
|
|
|
var wellService = new WellService(db, new TelemetryTracker(), cacheDb);
|
|
|
|
|
|
|
|
|
|
var wellOptsStat = new WellOperationsStatService(db, cacheDb, wellService);
|
2021-04-23 10:21:25 +05:00
|
|
|
|
|
2021-10-05 09:24:25 +05:00
|
|
|
|
var tvd = wellOptsStat.GetTvdAsync(1, default).Result;
|
2021-10-06 16:30:46 +05:00
|
|
|
|
Print(tvd);
|
2021-10-05 09:24:25 +05:00
|
|
|
|
Console.WriteLine("_");
|
2021-04-02 17:28:07 +05:00
|
|
|
|
}
|
2021-10-06 16:30:46 +05:00
|
|
|
|
|
|
|
|
|
private static void Print(IEnumerable<PlanFactPredictBase<WellOperationDto>> tvd)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("|\tplan\t|\tfact\t|\tprog\t|");
|
|
|
|
|
Console.WriteLine("|:-------------:|:-------------:|:-------------:|");
|
|
|
|
|
foreach (var item in tvd)
|
|
|
|
|
Print(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void Print(PlanFactPredictBase<WellOperationDto> item)
|
|
|
|
|
{
|
|
|
|
|
static string GetText(WellOperationDto item)
|
|
|
|
|
=> (item is null)
|
|
|
|
|
? " --------- "
|
|
|
|
|
: $"{item.IdCategory} d:{item.WellDepth} ";
|
|
|
|
|
|
|
|
|
|
Console.WriteLine($"|\t{GetText(item.Plan)}\t|\t{GetText(item.Fact)}\t|\t{GetText(item.Predict)}\t|");
|
|
|
|
|
|
|
|
|
|
}
|
2021-04-02 17:28:07 +05:00
|
|
|
|
}
|
|
|
|
|
}
|