Beispiel #1
0
        private void label1_Click(object sender, EventArgs e)
        {
            this.Hide();
            var m = new newMainScreen();

            m.Closed       += (s, args) => this.Close();
            m.StartPosition = FormStartPosition.CenterScreen;
            m.Location      = new Point(this.Location.X, this.Location.Y);
            m.Show();
        }
Beispiel #2
0
        private void BTOut_Click(object sender, EventArgs e)
        {
            var em = new Employee();

            em.ClockOut(Login.EmployeeID);
            this.Hide();
            var m = new newMainScreen();

            m.Closed       += (s, args) => this.Close();
            m.StartPosition = FormStartPosition.CenterScreen;
            m.Location      = new Point(this.Location.X, this.Location.Y);
            m.Show();
        }
Beispiel #3
0
        private void BTLogin_Click(object sender, EventArgs e)
        {
            try
            {
                var em = new Employee();
                SQLiteConnection conc = new SQLiteConnection(@"data source = C:\Users\Kutay\Desktop\RepairShop.db");

                if (em.Login(TBMail.Text.Trim(), TBPass.Text.Trim()) == 1)
                {
                    this.Hide();
                    var m = new newMainScreen();
                    m.Closed       += (s, args) => this.Close();
                    m.StartPosition = FormStartPosition.CenterScreen;
                    m.Location      = new Point(this.Location.X, this.Location.Y);
                    m.Show();
                }
                else if (em.Login(TBMail.Text.Trim(), TBPass.Text.Trim()) == 2)
                {
                    this.Hide();
                    var m = new ManagerScreen();
                    m.Closed       += (s, args) => this.Close();
                    m.StartPosition = FormStartPosition.CenterScreen;
                    m.Location      = new Point(this.Location.X, this.Location.Y);
                    m.Show();
                }
                else
                {
                    lblMsg.ForeColor = Color.DarkRed;
                    lblMsg.Text      = "Email or Password is WRONG!";
                }

                SQLiteCommand cm = new SQLiteCommand("Select ID from Employee where Email = '" + TBMail.Text.Trim() + "' AND Password = '******'", conc);
                conc.Open();
                SQLiteDataReader dr = cm.ExecuteReader();
                while (dr.Read())
                {
                    EmployeeID = dr.GetInt32(0);
                }
                dr.Close();
                conc.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }