コード例 #1
0
ファイル: Program.cs プロジェクト: Alp4ka/Orderinho
        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());
                }
            }
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
 /// <summary>
 /// Get all users from database.
 /// </summary>
 /// <returns></returns>
 public static List <User> GetAllUsers()
 {
     return(UsersDataBase.Read());
 }