//int timeData = 0;
        //bool btFlag = true;



        private void Back_btn_Click(object sender, EventArgs e)
        {
            StaffManagement staffManagement = new StaffManagement();

            this.Hide();
            staffManagement.ShowDialog(this);
        }
Beispiel #2
0
        private void Login_btn_Click(object sender, EventArgs e)
        {
            if (DBConnect())
            {


                if (UserName_txt.Text[0].ToString() == "U")
                //Customer login
                {
                  
                    DBConnect();
                    strsql = string.Format("select count(*) from VotingUsers where UserId ='{0}' and Password='******' ", UserName_txt.Text, Password_txt.Text);
                    // link customer of datebase
                    command = new SqlCommand(strsql, mycon);
                    

                    try
                    {
                        

                        if (User_button.Checked == true)
                        {
                            Topic topic  = new Topic();
                            this.Hide();
                            topic.ShowDialog(this);
                            // to jump form "Service"
                        }
                        else
                            MessageBox.Show("Login faill!!!!!!");
                    }
                    catch
                    {
                        MessageBox.Show("Sql statement error!!?");
                    }
                }

                if (UserName_txt.Text[0].ToString() == "S")
                {
                    strsql = string.Format("select count(*) from VotingStaff where StaffId ='{0}' and Password='******'", UserName_txt.Text, Password_txt.Text);
                    // link customer of datebase
                    command = new SqlCommand(strsql, mycon);
                    s = Staff_button.Text;
                    try
                    {
                        
                        if (Staff_button.Checked == true)
                        {
                            StaffManagement staffManagement = new StaffManagement();
                            this.Hide();
                            staffManagement.ShowDialog(this);
                            // to jump form "Work"
                        }
                        else
                            MessageBox.Show("Login faill!");
                    }
                    catch
                    {
                        MessageBox.Show("Sql statement error!");
                    }
                }

                if (UserName_txt.Text[0].ToString() == "C")
                {
                    strsql = string.Format("select count(*) from VotingComptoller where ComptollerId ='{0}' and Password='******'", UserName_txt.Text, Password_txt.Text);
                    // link customer of datebase
                    command = new SqlCommand(strsql, mycon);
                    s = Staff_button.Text;
                    try
                    {

                        if (Comptoller_button.Checked == true)
                        {
                            DataForm dataForm = new DataForm();
                            this.Hide();
                            dataForm.ShowDialog(this);
                            // to jump form "Work"
                        }
                        else
                            MessageBox.Show("Login faill!");
                    }
                    catch
                    {
                        MessageBox.Show("Sql statement error!");
                    }
                }
            }

            else
            {
                MessageBox.Show("User is empty or password is empty");
            }
        }
Beispiel #3
0
        private void Login_btn_Click(object sender, EventArgs e)
        { //Set up the login button action
            if (DBConnect())
            {
                if (UserName_txt.Text[0].ToString() == "U")
                //Customer login
                {
                    DBConnect();
                    strsql = string.Format("select count(*) from VotingUsers where UserId ='{0}' and Password='******' ", UserName_txt.Text, Password_txt.Text);
                    //connect to the VotingUsers table of datebase
                    command = new SqlCommand(strsql, mycon);


                    try
                    {
                        if (User_button.Checked == true)
                        {
                            Topic topic = new Topic();
                            this.Hide();
                            topic.ShowDialog(this);
                            //jump to the Topic.cs
                        }
                        else
                        {
                            MessageBox.Show("Login failed");
                        }
                    }
                    catch
                    {
                        MessageBox.Show("Sql statement error");
                    }
                }

                if (UserName_txt.Text[0].ToString() == "S")
                {
                    strsql = string.Format("select count(*) from VotingStaff where StaffId ='{0}' and Password='******'", UserName_txt.Text, Password_txt.Text);
                    // connect to the VotingStaff table of datebase
                    command = new SqlCommand(strsql, mycon);
                    s       = Staff_button.Text;
                    try
                    {
                        if (Staff_button.Checked == true)
                        {
                            StaffManagement staffManagement = new StaffManagement();
                            this.Hide();
                            staffManagement.ShowDialog(this);
                            //jump to the staffManagement.cs
                        }
                        else
                        {
                            MessageBox.Show("Login failed");
                        }
                    }
                    catch
                    {
                        MessageBox.Show("Sql statement error!");
                    }
                }

                if (UserName_txt.Text[0].ToString() == "C")
                {
                    strsql = string.Format("select count(*) from VotingComptoller where ComptollerId ='{0}' and Password='******'", UserName_txt.Text, Password_txt.Text);
                    // connect VotingComptoller table of datebase
                    command = new SqlCommand(strsql, mycon);
                    s       = Staff_button.Text;
                    try
                    {
                        if (Comptoller_button.Checked == true)
                        {
                            DataForm dataForm = new DataForm();
                            this.Hide();
                            dataForm.ShowDialog(this);
                            //jump to DataForm.cs
                        }
                        else
                        {
                            MessageBox.Show("Login failed");
                        }
                    }
                    catch
                    {
                        MessageBox.Show("Sql statement error!");
                    }
                }
            }

            else
            {
                MessageBox.Show("Username is empty or password is empty");
            }
        }