예제 #1
0
        private void EmployeeLogin_Click(object sender, EventArgs e)
        {
            /*
             * parameters:
             *  user(string):员工工号
             *  pwd(string):密码
             *  dt(DataTable):存储检索信息
             */
            string user = username.Text;
            string pwd  = password.Text;

            if ("".Equals(user) || user == null)
            {
                MessageBox.Show("用户名不得为空!");
            }
            else if ("".Equals(pwd) || pwd == null)
            {
                MessageBox.Show("密码不得为空!");
            }
            else
            {
                DataTable dt       = new DataTable();
                string    sql      = "select * from employee where username="******"您好," + dataRow[1] + ",恭喜你登陆成功!");
                            index inde = new index(1, user);
                            this.Hide();
                            inde.Show();
                        }
                        else
                        {
                            MessageBox.Show("您已被限制登录!状态:" + Convert.ToInt32(dataRow[4]));
                        }
                    }
                    else
                    {
                        MessageBox.Show("密码错误,请重新输入!");
                    }
                }
                if (dataRows.Count == 0)
                {
                    MessageBox.Show("未查询到该员工信息,请重新输入!");
                }
            }
        }
예제 #2
0
        private void adminLogin_Click(object sender, EventArgs e)
        {
            /*
             * parameters:
             *  user(string):员工工号
             *  pwd(string):密码
             *  dt(DataTable):存储检索信息
             */
            string user = username.Text;
            string pwd  = password.Text;

            if ("".Equals(user) || user == null)
            {
                MessageBox.Show("用户名不得为空!");
            }
            else if ("".Equals(pwd) || pwd == null)
            {
                MessageBox.Show("密码不得为空!");
            }
            else
            {
                DataTable dt       = new DataTable();
                string    sql      = "select * from admin where username="******"管理员您好,恭喜你登陆成功!");
                        index inde = new index(0, user);
                        this.Hide();
                        inde.Show();
                    }
                    else
                    {
                        MessageBox.Show("密码错误,请重新输入!");
                    }
                }
                if (dataRows.Count == 0)
                {
                    MessageBox.Show("未查询到该管理员信息,请重新输入!");
                }
            }
        }
예제 #3
0
        private void Button1_Click(object sender, EventArgs e)
        {
            string user = username.Text;
            string pwd  = password.Text;

            if ("".Equals(user) || user == null)
            {
                MessageBox.Show("用户名不得为空!");
            }
            else
            {
                if ("".Equals(pwd) || pwd == null)
                {
                    MessageBox.Show("密码不得为空!");
                }
                else
                {
                    DataTable dt       = new DataTable();
                    string    sql      = "select * from admin where username="******"管理员您好,恭喜你登陆成功!");
                            index inde = new index(0, user);
                            this.Hide();
                            inde.Show();
                        }
                        else
                        {
                            MessageBox.Show("密码错误,请重新输入!");
                        }
                    }
                    if (coldrow.Count == 0)
                    {
                        MessageBox.Show("未查询到该管理员信息,请重新输入!");
                    }
                }
            }
        }
예제 #4
0
        private void Employeelogin_Click(object sender, EventArgs e)
        {
            string user = username.Text;
            string pwd  = password.Text;

            if ("".Equals(user) || user == null)
            {
                MessageBox.Show("用户名不得为空!");
            }
            else
            {
                if ("".Equals(pwd) || pwd == null)
                {
                    MessageBox.Show("密码不得为空!");
                }
                else
                {
                    string sql = "select * from employee where username="******"ds");
                        connection.Close();
                        DataTable         dataTable = ds.Tables["ds"];
                        DataRowCollection coldrow   = dataTable.Rows;
                        DataRow           dataRow;
                        for (int i = 0; i < coldrow.Count; i++)
                        {
                            dataRow = coldrow[i];

                            if (pwd.Equals(dataRow[3]))
                            {
                                if (Convert.ToInt32(dataRow[4]) == 1)
                                {
                                    MessageBox.Show("您好," + dataRow[1] + ",恭喜你登陆成功!");
                                    index inde = new index(1, user);
                                    this.Hide();
                                    inde.Show();
                                }
                                else
                                {
                                    MessageBox.Show("您已被限制登录!状态:" + Convert.ToInt32(dataRow[4]));
                                }
                            }
                            else
                            {
                                MessageBox.Show("密码错误,请重新输入!");
                            }
                        }
                        if (coldrow.Count == 0)
                        {
                            MessageBox.Show("未查询到该员工信息,请重新输入!");
                        }
                    }
                }
            }
        }