Diplom_B/Program.cs

43 lines
808 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Diplom_B.DB;
namespace Diplom_B
{
static class Program
{
/// <summary>
/// Главная точка входа для приложения.
/// </summary>
[STAThread]
static void Main()
{
Init();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormLogin());
}
static void Init()
{
using (var DB = new MainDB())
{
var usr = (from u in DB.Users
where u.Name == "admin"
select u).ToArray();
if(usr.Length < 1)
{
DB.Users.Add(new DB.User()
{
Name = "admin",
Pass = "admin"
});
}
DB.SaveChanges();
}
}
}
}