示例#1
0
        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>
 /// Get all products method.
 /// </summary>
 /// <returns></returns>
 public static List <Product> GetAllProducts()
 {
     return(ProductsDataBase.Read());
 }