static void Main() { MessageBox.Show("Open README before start."); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ProductsDataBase.SetPath(".\\products.db"); ProductsDataBase.Initialize(); UsersDataBase.SetPath(".\\users.db"); UsersDataBase.Initialize(); OrdersDataBase.SetPath(".\\orders.db"); OrdersDataBase.Initialize(); while (true) { SignInForm signInForm = new SignInForm(); signInForm.ShowDialog(); if (!signInForm.Result) { return; } if (UserManager.CurrentUser == null) { return; } if (UserManager.CurrentUser.IsAdmin) { Application.Run(new AdminForm()); } else { Application.Run(new UserForm()); } } }
/// <summary> /// Sign Up a new user with input parameters. /// </summary> /// <param name="id"></param> /// <param name="email"></param> /// <param name="password"></param> /// <param name="name"></param> /// <param name="surname"></param> /// <param name="midname"></param> /// <param name="telephone"></param> public static void Register(int id, string email, string password, string name, string surname, string midname, string telephone) { User user = new User(id, email, password, name, surname, midname, telephone); UsersDataBase.Add(user); }
/// <summary> /// Get all users from database. /// </summary> /// <returns></returns> public static List <User> GetAllUsers() { return(UsersDataBase.Read()); }