示例#1
0
文件: Login.cs 项目: Zubair94/C
        private void HomeButton_Click(object sender, EventArgs e)
        {
            this.Hide();
            HomeForm home = new HomeForm();

            home.Show();
        }
示例#2
0
 private void LogoutButton_Click(object sender, EventArgs e)
 {
     this.LoginLabel.Visible = false;
     this.Username.Visible = false;
     HomeForm h = new HomeForm();
     this.Hide();
     h.Show();
 }
示例#3
0
 private void HomeButton_Click(object sender, EventArgs e)
 {
     this.Hide();
     HomeForm home = new HomeForm();
     string u = HomeForm.getLabel();
     home.setLabel(u);
     home.Show();
 }
示例#4
0
文件: Login.cs 项目: Zubair94/C
        private void LoginQuery()
        {
            string conn;
            //bool login = false;
            Connector c = new Connector();
            bool      x = c.testConnection();

            if (x)
            {
                conn = c.getConnector();
                MySqlConnection newConnection = new MySqlConnection(conn);
                MySqlCommand    newCommand;
                if (loginFlag == false)
                {
                    newCommand = new MySqlCommand("select * from leavedata.employee where userid='" + this.UsernameBox.Text + "' and password='******';", newConnection);
                }
                else
                {
                    newCommand = new MySqlCommand("select * from leavedata.employer where userid='" + this.UsernameBox.Text + "' and password='******';", newConnection);
                }
                MySqlDataReader newReader;
                newConnection.Open();
                newReader = newCommand.ExecuteReader();
                int count = 0;
                while (newReader.Read())
                {
                    count += 1;
                }
                if (count == 1)
                {
                    if (loginFlag == false)
                    {
                        MessageBox.Show("Logged in as " + this.UsernameBox.Text);
                        HomeForm h = new HomeForm();
                        h.setLabel(this.UsernameBox.Text);
                        this.Hide();
                        h.Show();
                    }
                    else
                    {
                        MessageBox.Show("Logged in as " + this.UsernameBox.Text);
                        AdminForm a = new AdminForm();
                        a.setLabel(this.UsernameBox.Text);
                        this.Hide();
                        a.Show();
                    }
                }
                else if (count > 1)
                {
                    MessageBox.Show("Duplicate Error");
                }
                else
                {
                    MessageBox.Show("Incorrect Username or Password");
                }
                newConnection.Close();
            }
        }
示例#5
0
文件: AdminForm.cs 项目: Zubair94/C
        private void LogoutButton_Click(object sender, EventArgs e)
        {
            this.LoginLabel.Visible = false;
            this.Username.Visible   = false;
            HomeForm h = new HomeForm();

            this.Hide();
            h.Show();
        }
示例#6
0
文件: LeaveForm.cs 项目: Zubair94/C
        private void HomeButton_Click(object sender, EventArgs e)
        {
            this.Hide();
            HomeForm home = new HomeForm();
            string   u    = HomeForm.getLabel();

            home.setLabel(u);
            home.Show();
        }
示例#7
0
文件: Profile.cs 项目: Zubair94/C
        private void StatusButton_Click(object sender, EventArgs e)
        {
            string    conn;
            string    s   = "";
            string    uid = HomeForm.getLabel();
            Connector c   = new Connector();
            bool      x   = c.testConnection();

            if (x)
            {
                conn = c.getConnector();
                MySqlConnection newConnection = new MySqlConnection(conn);
                MySqlCommand    newCommand    = new MySqlCommand("select status from leavedata.leavedata where userid='" + uid + "';", newConnection);
                MySqlDataReader newReader;
                newConnection.Open();
                newReader = newCommand.ExecuteReader();
                while (newReader.Read())
                {
                    s = newReader.GetString(0);
                }
                newConnection.Close();
            }
            if (s == "pending")
            {
                MessageBox.Show("Your current request is pending");
            }
            else if (s == "rejected")
            {
                MessageBox.Show("Your request was rejected");
            }
            else if (s == "accepted")
            {
                MessageBox.Show("Your request was accepted");
            }
            else
            {
                MessageBox.Show("No leave request found");
            }
        }
示例#8
0
        private void checkDataTable()
        {
            string    conn;
            string    uid = HomeForm.getLabel();
            Connector c   = new Connector();
            bool      x   = c.testConnection();

            if (x)
            {
                conn = c.getConnector();
                MySqlConnection  newConnection = new MySqlConnection(conn);
                MySqlCommand     newCommand    = new MySqlCommand("select * from leavedata.leavedata;", newConnection);
                MySqlDataAdapter data          = new MySqlDataAdapter();
                data.SelectCommand = newCommand;
                DataTable dataset = new DataTable();
                data.Fill(dataset);
                BindingSource b = new BindingSource();
                b.DataSource        = dataset;
                DataView.DataSource = b;
                data.Update(dataset);
                newConnection.Close();
            }
        }
示例#9
0
文件: LeaveForm.cs 项目: Zubair94/C
        private void updateLeaveData()
        {
            string conn;

            string    uid = HomeForm.getLabel();
            Connector c   = new Connector();
            bool      x   = c.testConnection();

            if (x)
            {
                string fromdate = DateTimeFrom.Text;
                string todate   = DateTimeTo.Text;
                string reason;
                if (ReasonBox.Text == "Other")
                {
                    reason = OtherBox.Text;
                }
                else
                {
                    reason = ReasonBox.Text;
                }
                conn = c.getConnector();
                MySqlConnection newConnection1 = new MySqlConnection(conn);
                MySqlCommand    newCommand1    = new MySqlCommand("INSERT INTO leavedata(`userid`,`name`,`contact`, `fromdate`, `todate`, `reason`,`status`) VALUES ('" + uid + "','" + this.textBox1.Text + "','" + this.textBox2.Text + "', '" + this.DateTimeFrom.Text + "', '" + this.DateTimeTo.Text + "', '" + reason + "','pending')", newConnection1);
                newConnection1.Open();
                MySqlDataReader newReader1;
                newReader1 = newCommand1.ExecuteReader();
                MessageBox.Show("Submitted LeaveForm");
                newConnection1.Close();
                HomeForm h = new HomeForm();
                string   u = HomeForm.getLabel();
                h.setLabel(u);
                this.Hide();
                h.Show();
            }
        }
示例#10
0
 private void LoginQuery()
 {
     string conn;
     //bool login = false;
     Connector c = new Connector();
     bool x = c.testConnection();
     if(x)
     {
         conn = c.getConnector();
         MySqlConnection newConnection = new MySqlConnection(conn);
         MySqlCommand newCommand;
         if (loginFlag == false)
         {
             newCommand = new MySqlCommand("select * from leavedata.employee where userid='" + this.UsernameBox.Text + "' and password='******';", newConnection);
         }
         else
         {
             newCommand = new MySqlCommand("select * from leavedata.employer where userid='" + this.UsernameBox.Text + "' and password='******';", newConnection);
         }
         MySqlDataReader newReader;
         newConnection.Open();
         newReader = newCommand.ExecuteReader();
         int count = 0;
         while(newReader.Read())
         {
             count += 1;
         }
         if(count == 1)
         {
             if (loginFlag == false)
             {
                 MessageBox.Show("Logged in as " + this.UsernameBox.Text);
                 HomeForm h = new HomeForm();
                 h.setLabel(this.UsernameBox.Text);
                 this.Hide();
                 h.Show();
             }
             else
             {
                 MessageBox.Show("Logged in as " + this.UsernameBox.Text);
                 AdminForm a = new AdminForm();
                 a.setLabel(this.UsernameBox.Text);
                 this.Hide();
                 a.Show();
             }
         }
         else if(count > 1)
         {
             MessageBox.Show("Duplicate Error");
         }
         else
         {
             MessageBox.Show("Incorrect Username or Password");
         }
         newConnection.Close();
     }
 }
示例#11
0
 private void HomeButton_Click(object sender, EventArgs e)
 {
     this.Hide();
     HomeForm home = new HomeForm();
     home.Show();
 }
示例#12
0
        private void updateLeaveData()
        {
            string conn;

            string uid = HomeForm.getLabel();
            Connector c = new Connector();
            bool x = c.testConnection();
            if (x)
            {

                    string fromdate = DateTimeFrom.Text;
                    string todate = DateTimeTo.Text;
                    string reason;
                    if (ReasonBox.Text == "Other")
                    {
                        reason = OtherBox.Text;
                    }
                    else
                    {
                        reason = ReasonBox.Text;
                    }
                    conn = c.getConnector();
                    MySqlConnection newConnection1 = new MySqlConnection(conn);
                    MySqlCommand newCommand1 = new MySqlCommand("INSERT INTO leavedata(`userid`,`name`,`contact`, `fromdate`, `todate`, `reason`,`status`) VALUES ('" + uid + "','"+ this.textBox1.Text +"','" + this.textBox2.Text + "', '" + this.DateTimeFrom.Text + "', '" + this.DateTimeTo.Text + "', '" + reason + "','pending')",newConnection1);
                    newConnection1.Open();
                    MySqlDataReader newReader1;
                    newReader1 = newCommand1.ExecuteReader();
                    MessageBox.Show("Submitted LeaveForm");
                    newConnection1.Close();
                     HomeForm h = new HomeForm();
                string u = HomeForm.getLabel();
                h.setLabel(u);
                this.Hide();
                h.Show();
            }
        }