You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tinyPos/TinyPOS/TinyPosDBGen/Program.cs

88 lines
3.1 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using TinyPosEntity;
using TinyPosEntity.Entity;
using TinyPosEntity.Service;
namespace TinyPosDBGen
{
class Program
{
static void Main(string[] args)
{
3 years ago
string source = "localhost";
string catalog = "TestDB";
string userId = "app_client";
3 years ago
string userPassword = "";
Console.WriteLine("데이터베이스를 초기화합니다.");
Console.WriteLine("(※※※ 경고: 기존 데이터베이스 데이터는 모두 삭제됩니다. ※※※)");
Console.WriteLine();
3 years ago
InputValue("서버 이름", ref source);
InputValue("데이터베이스 이름", ref catalog);
InputValue("인증 사용자 계정", ref userId);
InputValue("인증 사용자 비밀번호", ref userPassword);
string connString = string.Format("data source={0};initial catalog={1};user id={2};password={3};", source, catalog, userId, userPassword);
Console.WriteLine();
Console.WriteLine("데이터베이스를 초기화 합니다.");
Console.WriteLine("");
Console.WriteLine("처리중...");
3 years ago
EntityController.ConnectionString = connString;
EntityController.Instance.InitializeDatabase();
3 years ago
Console.WriteLine("초기화가 완료되었습니다.");
Console.WriteLine("----------------------------------");
List<ProductType> productTypeList = ProductTypeService.Instance.FindAll();
if (productTypeList != null && productTypeList.Count > 0)
{
Console.WriteLine("등록된 제품타입");
Console.WriteLine();
Console.WriteLine("id\t|\tname");
foreach (ProductType pt in productTypeList)
{
Console.WriteLine(string.Format("{0}\t|\t{1}", pt.ProductTypeId, pt.Name));
}
}
Console.WriteLine("----------------------------------");
3 years ago
Console.WriteLine("종료를 위해 아무키나 누르세요.");
Console.ReadKey();
3 years ago
//Student student = new Student()
//{
// StudentName = "테스트용",
// Height = 180
//};
////EntityController.GetInstance().AddStudent(student);
//List<Student> students = EntityController.GetInstance().FindStudent("테스트용");
//if (students.Count > 0)
//{
// foreach (Student item in students)
// {
// EntityController.GetInstance().RemoveStudent(student);
// }
//}
}
static void InputValue(string message, ref string target)
{
Console.Write(message + ": ");
string input = Console.ReadLine();
if (string.IsNullOrEmpty(input))
return;
target = input;
}
}
}