[성현모] master모드 추가
This commit is contained in:
11
Projects/NetStandard/CIAMaster/CIAMaster.csproj
Normal file
11
Projects/NetStandard/CIAMaster/CIAMaster.csproj
Normal file
@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
97
Projects/NetStandard/CIAMaster/CIAMasterService.cs
Normal file
97
Projects/NetStandard/CIAMaster/CIAMasterService.cs
Normal file
@ -0,0 +1,97 @@
|
||||
using CIAMaster.Models;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace CIAMaster
|
||||
{
|
||||
public class CIAMasterService
|
||||
{
|
||||
public static MasterTable MasterTable { get; set; } = new MasterTable();
|
||||
public static MasterReportTable MasterReportTable { get; set; } = new MasterReportTable();
|
||||
|
||||
public static string CIAMasterTableaPath { get; set; } = @"./";
|
||||
public static string CIAMasterReportTableaPath { get; set; } = @"./";
|
||||
|
||||
public CIAMasterService()
|
||||
{
|
||||
}
|
||||
|
||||
public static bool LoadCIAMasterTable()
|
||||
{
|
||||
try
|
||||
{
|
||||
string path = $"{CIAMasterTableaPath}/CIAMasterTable.json";
|
||||
|
||||
if (File.Exists(path) == true)
|
||||
{
|
||||
var ciaMasterTableJson = File.ReadAllText(path);
|
||||
MasterTable = JsonConvert.DeserializeObject<MasterTable>(ciaMasterTableJson);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine($"LoadCIAMasterTable Error::{e.Message}");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool SaveCIAMasterTable()
|
||||
{
|
||||
try
|
||||
{
|
||||
string ciaMasterTableJson = JsonConvert.SerializeObject(MasterTable, Formatting.Indented);
|
||||
File.WriteAllText($"{CIAMasterTableaPath}/CIAMasterTable.json", ciaMasterTableJson);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Console.WriteLine($"SaveCIAMasterTable Error::{e.Message}");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static bool LoadCIAMasterReportTable()
|
||||
{
|
||||
try
|
||||
{
|
||||
string path = $"{CIAMasterReportTableaPath}/CIAMasterReportTable.json";
|
||||
if(File.Exists(path) == true)
|
||||
{
|
||||
var ciaMasterReportTableJson = File.ReadAllText(path);
|
||||
MasterReportTable = JsonConvert.DeserializeObject<MasterReportTable>(ciaMasterReportTableJson);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine($"LoadCIAMasterReportTable Error::{e.Message}");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool SaveCIAMasterReportTable()
|
||||
{
|
||||
try
|
||||
{
|
||||
string ciaMsterReportTableJson = JsonConvert.SerializeObject(MasterReportTable, Formatting.Indented);
|
||||
File.WriteAllText($"{CIAMasterReportTableaPath}/CIAMasterReportTable.json", ciaMsterReportTableJson);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Console.WriteLine($"SaveCIAMasterReportTable Error::{e.Message}");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Projects/NetStandard/CIAMaster/Models/MasterReport.cs
Normal file
18
Projects/NetStandard/CIAMaster/Models/MasterReport.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CIAMaster.Models
|
||||
{
|
||||
public class MasterReportTable
|
||||
{
|
||||
public List<MasterReport> MasterReport { get; set; } = new List<MasterReport>();
|
||||
}
|
||||
|
||||
public class MasterReport
|
||||
{
|
||||
public string ProductID { get; set; }
|
||||
public DateTime Time { get; set; }
|
||||
public string Result { get; set; }
|
||||
}
|
||||
}
|
||||
26
Projects/NetStandard/CIAMaster/Models/MasterTable.cs
Normal file
26
Projects/NetStandard/CIAMaster/Models/MasterTable.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CIAMaster.Models
|
||||
{
|
||||
public class MasterTable
|
||||
{
|
||||
public List<MasterTime> MasterTime { get; set; } = new List<MasterTime>();
|
||||
public List<MasterProduct> MasterProduct { get; set; } = new List<MasterProduct>();
|
||||
}
|
||||
|
||||
public class MasterTime
|
||||
{
|
||||
public DateTime Time { get; set; }
|
||||
public bool Avtive { get; set; }
|
||||
}
|
||||
|
||||
public class MasterProduct
|
||||
{
|
||||
public int Order { get; set; }
|
||||
public string ProductID { get; set; }
|
||||
public string Result { get; set; }
|
||||
public bool Active { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user