Change Diagram-API to sub-module APICycleVDP

This commit is contained in:
Georgy.Khatuncev 2024-09-20 11:04:10 +05:00
parent c3cca06933
commit de7f84ae54
294 changed files with 4 additions and 19836 deletions

3
.gitmodules vendored Normal file

@ -0,0 +1,3 @@
[submodule "APICycleVDP"]
path = APICycleVDP
url = https://git.khatuncev.ru/google/APICycleVDP.git

1
APICycleVDP Submodule

@ -0,0 +1 @@
Subproject commit 7754a77746c8d59074fd1db95ad6bfe3c187012f

Binary file not shown.

@ -1,31 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31105.61
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GenerateVDPCycle", "GenerateVDPCycle\GenerateVDPCycle.csproj", "{018AAFB3-4293-4F38-9E6C-C9A7F16C278D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Diagram-API", "Diagram-API\Diagram-API.csproj", "{7159386F-FF50-43BD-B93F-C0441D58C15E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{018AAFB3-4293-4F38-9E6C-C9A7F16C278D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{018AAFB3-4293-4F38-9E6C-C9A7F16C278D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{018AAFB3-4293-4F38-9E6C-C9A7F16C278D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{018AAFB3-4293-4F38-9E6C-C9A7F16C278D}.Release|Any CPU.Build.0 = Release|Any CPU
{7159386F-FF50-43BD-B93F-C0441D58C15E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7159386F-FF50-43BD-B93F-C0441D58C15E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7159386F-FF50-43BD-B93F-C0441D58C15E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7159386F-FF50-43BD-B93F-C0441D58C15E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0DFB9976-856A-40AB-8E91-1962DAE0EA2D}
EndGlobalSection
EndGlobal

@ -1,46 +0,0 @@
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Diagram_API.Controller
{
[EnableCors("All")]
public class CyclesController : ControllerBase
{
[HttpPost]
public ActionResult<string> CurrCycles()
{
var result = new JObject();
result["currTime"] = DateTime.Now;
var tasks = new List<Task<DB.Cycle>>();
//var v = new DB.WorkDB();
for (var i = 1; i <= 48; i++)
tasks.Add(DB.WorkDB.GetCycle(i));
var arr = new JArray();
for (var i = 0; i < tasks.Count; i++)
{
var tmp = tasks[i].GetAwaiter().GetResult();
if (tmp != null)
{
var t = new JObject();
t["vdp"] = tmp.NumVdp;
t["cycle"] = tmp.NumCycle;
t["factStart"] = tmp.FactStart;
t["factEnd"] = tmp.FactEnd;
t["thinkEnd"] = tmp.ThinkEnd;
arr.Add(t);
}
}
result["data"] = arr;
return Content(result.ToString(), "application/json");
}
}
}

@ -1,74 +0,0 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
namespace Diagram_API.DB
{
public class VdpDB : DbContext
{
public DbSet<DB.Cycle> Cycles { get; set; }
public VdpDB()
{
Database.EnsureCreated();
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseMySql("server=127.0.0.1;user=diplom;password=diplom;database=VDPCycles;");
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
}
}
[Table("Cycles")]
public class Cycle
{
[Column("idCycle"), Required, Key]
public int IdCycle { get; set; }
[Column("numVdp")]
public int NumVdp { get; set; }
[Column("numCycle")]
public int NumCycle { get; set; }
[Column("factStart")]
public DateTime FactStart { get; set; }
[Column("thinkEnd")]
public DateTime ThinkEnd { get; set; }
[Column("factEnd")]
public DateTime FactEnd { get; set; }
}
public static class WorkDB
{
async public static Task<Cycle> GetCycle(int vdp)
{
var result = new Cycle();
await Task.Run(() =>
{
try
{
using (var db = new DB.VdpDB())
{
var tmp = (from u in db.Cycles
where
u.NumVdp == vdp
orderby u.FactStart descending
select u).FirstOrDefault();
result = tmp;
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
});
return result;
}
}
}

@ -1,12 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>Diagram_API</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.2.5" />
</ItemGroup>
</Project>

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
<ActiveDebugProfile>Diagram_API</ActiveDebugProfile>
<NameOfLastUsedPublishProfile>G:\Diagram-API\Diagram-API\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>

@ -1,26 +0,0 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Diagram_API
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>().UseUrls("http://*:65041");
});
}
}

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<DeleteExistingFiles>False</DeleteExistingFiles>
<ExcludeApp_Data>False</ExcludeApp_Data>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Release\netcoreapp3.1\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
</PropertyGroup>
</Project>

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PublishTargetUrl>G:\Diagram-API\Diagram-API\bin\Release\netcoreapp3.1\publish\</_PublishTargetUrl>
<History>True|2021-05-15T17:10:59.1171936Z;True|2021-05-15T22:06:16.7802197+05:00;</History>
</PropertyGroup>
</Project>

@ -1,27 +0,0 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:9312",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Diagram_API": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

@ -1,61 +0,0 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Diagram_API
{
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddCors(options =>
{
options.AddPolicy(
name: "All",
builder => {
builder
.AllowAnyOrigin()
.AllowAnyHeader()
.AllowAnyMethod()
//.AllowCredentials()
.SetIsOriginAllowed((host) => true);
});
});
services.AddControllers();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();
app.UseCors(
options => options
.AllowAnyOrigin()
.AllowAnyHeader()
.AllowAnyMethod()
//.AllowCredentials()
.SetIsOriginAllowed((host) => true)
);
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(name: "CurrCycles", pattern: "/currcycles",
defaults: new { controller = "Cycles", action = "CurrCycles" });
endpoints.MapControllerRoute(name: "ListCurrencies", pattern: "/listcurrencies",
defaults: new { controller = "Rates", action = "GetListCurrencies" });
endpoints.MapControllerRoute(name: "CurrentRates", pattern: "/currentrates",
defaults: new { controller = "Rates", action = "GetCurrentRates" });
endpoints.MapControllerRoute(name: "RatesList", pattern: "/rateslist",
defaults: new { controller = "Rates", action = "GetRatesList" });
});
}
}
}

@ -1,9 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

@ -1,10 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}

@ -1,10 +0,0 @@
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\Admin\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\Admin\\.nuget\\packages",
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages",
"C:\\Program Files (x86)\\Microsoft\\Xamarin\\NuGet"
]
}
}

@ -1,13 +0,0 @@
{
"runtimeOptions": {
"tfm": "netcoreapp3.1",
"framework": {
"name": "Microsoft.AspNetCore.App",
"version": "3.1.0"
},
"configProperties": {
"System.GC.Server": true,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}

@ -1,9 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

@ -1,10 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}

@ -1,10 +0,0 @@
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\Admin\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\Admin\\.nuget\\packages",
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages",
"C:\\Program Files (x86)\\Microsoft\\Xamarin\\NuGet"
]
}
}

@ -1,13 +0,0 @@
{
"runtimeOptions": {
"tfm": "netcoreapp3.1",
"framework": {
"name": "Microsoft.AspNetCore.App",
"version": "3.1.0"
},
"configProperties": {
"System.GC.Server": true,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}

@ -1,9 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

@ -1,10 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}

@ -1,13 +0,0 @@
{
"runtimeOptions": {
"tfm": "netcoreapp3.1",
"framework": {
"name": "Microsoft.AspNetCore.App",
"version": "3.1.0"
},
"configProperties": {
"System.GC.Server": true,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}

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