[성현모] Extract 프로젝트 추가
This commit is contained in:
@ -1,7 +1,11 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SystemX.Product.CP.TRA.Extract
|
||||
@ -10,8 +14,76 @@ namespace SystemX.Product.CP.TRA.Extract
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
bool isError = false;
|
||||
|
||||
var config = JsonConvert.DeserializeObject<Config>(File.ReadAllText("Config.json"));
|
||||
DBService dbS = new DBService();
|
||||
dbS.GetLargeData();
|
||||
dbS.CPXV2ConnectionString = $"Server={config.CPXV2Server};Database=CPXV2;User Id={config.User};Password={config.Passwd};";
|
||||
dbS.ConnectionString = $"Server={config.Server};Database={config.DataBase};User Id={config.User};Password={config.Passwd};";
|
||||
|
||||
//db check
|
||||
try
|
||||
{
|
||||
using (SqlConnection conn = new SqlConnection(dbS.CPXV2ConnectionString))
|
||||
{
|
||||
conn.Open();
|
||||
Console.ForegroundColor = ConsoleColor.DarkGreen;
|
||||
Console.WriteLine("Config.json, CPXV2 server connect success.");
|
||||
}
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(dbS.ConnectionString))
|
||||
{
|
||||
conn.Open();
|
||||
Console.ForegroundColor = ConsoleColor.DarkGreen;
|
||||
Console.WriteLine($"Config.json, {config.DataBase} server connect success.");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.DarkRed;
|
||||
Console.WriteLine("Config.json, Invalid Server Set.");
|
||||
isError = true;
|
||||
}
|
||||
Console.WriteLine("");
|
||||
Thread.Sleep(1000);
|
||||
|
||||
//mo check
|
||||
if (string.IsNullOrEmpty(config.MO) == true)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.DarkRed;
|
||||
Console.WriteLine("Config.json, MO Value is Empty");
|
||||
isError = true;
|
||||
}
|
||||
|
||||
//date check
|
||||
try
|
||||
{
|
||||
var start = Convert.ToDateTime(config.StartDate);
|
||||
var end = Convert.ToDateTime(config.EndDate);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.DarkRed;
|
||||
Console.WriteLine("Config.json, StartDate ~ EndDate are Invalid Format. Fix to yyyy-MM-dd");
|
||||
isError = true;
|
||||
}
|
||||
|
||||
if (isError == true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.DarkGreen;
|
||||
Console.WriteLine($"ProductNO:{config.ProductNo}, TestCode:{config.TestCode}");
|
||||
Console.WriteLine($"StartDate:{config.StartDate}, EndDate:{config.EndDate}");
|
||||
Console.WriteLine($"MO:{config.MO}");
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.White;
|
||||
Console.WriteLine("");
|
||||
Thread.Sleep(1000);
|
||||
|
||||
var finsList = dbS.GetTestList(config);
|
||||
dbS.GetLargeData(finsList, config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user