Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Console.WriteLine(this.textBox1.Text);
            Console.WriteLine(this.textBox2.Text);

            LocalStore.currentUser = DatabaseAPI.SelectUser(this.textBox1.Text);
            if (LocalStore.currentUser == null)
            {
                Console.WriteLine("Invalid username.");
                label3.Text        = "Invalid username!";
                this.textBox1.Text = "";
                this.textBox2.Text = "";
            }
            else
            {
                label3.Text = "";
                string hashedPassword = sha256(this.textBox2.Text);
                if (LocalStore.currentUser.Password == hashedPassword)
                {
                    FormStorer.Add("Dashboard", new Dashboard());
                    FormStorer.Get("Login").Visible = false;
                    ((Dashboard)FormStorer.Get("Dashboard")).SetCurrentUser();
                    FormStorer.Get("Dashboard").Visible = true;
                }
                else
                {
                    Console.WriteLine("Invalid password.");
                    label3.Text        = "Invalid password!";
                    this.textBox1.Text = "";
                    this.textBox2.Text = "";
                }
            }
        }
Beispiel #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            LocalStore.LoadUsersFromDB();
            this.Visible = false;
            FormStorer.Add("CreateTicket", new CreateTicket());
            FormStorer.Get("CreateTicket").Visible = true;


//            LocalStore.LoadTicketsFromDB(LocalStore.currentUser.Username);
        }
Beispiel #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            LocalStore.LoadUsersFromDB();

            this.Visible = false;
            FormStorer.Add("UserPanel", new UserPanel());

            ((UserPanel)FormStorer.Get("UserPanel")).LoadUsersInForm();

            FormStorer.Get("UserPanel").Visible = true;
        }
Beispiel #4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            FormStorer.Add("Login", new Login());

            Database.Instance().SetConnection("C:\\Madalin\\TicketManager\\database.mdf");
            Database.Instance().ExecuteQueryFromFile("..\\..\\PopulateUsersTable.sql");
            Database.Instance().ExecuteQueryFromFile("..\\..\\PopulateTicketsTable.sql");

            ArrayList users = DatabaseAPI.SelectUsers();

            foreach (User u in users)
            {
                Console.Write(u);
            }
            DatabaseAPI.SelectTickets();

            Application.Run(FormStorer.Get("Login"));
        }