コード例 #1
0
        private void label4_Click(object sender, EventArgs e)
        {
            Close();
            adminLogin am = new adminLogin(2);

            am.ShowDialog(this);
        }
コード例 #2
0
        private void 强制命令ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string         getEmployee = "select enum, position, username, password from employee";
            SqlDataAdapter adapter     = new SqlDataAdapter(getEmployee, HotelCon);

            dataset.Clear();
            adapter.Fill(dataset, "employee");

            if (Program.currentId == "")
            {
                MessageBox.Show("请先登录", "提示");
            }
            else
            {
                bool admin = false;
                for (int i = 0; i < dataset.Tables["employee"].Rows.Count; i++)
                {
                    string num      = dataset.Tables["employee"].Rows[i][0].ToString().Trim();
                    string position = dataset.Tables["employee"].Rows[i][1].ToString().Trim();
                    if (Program.currentId == num && (position == "总经理" || position == "管理员"))
                    {
                        changestyle();
                        BackgroundImage = Properties.Resources.big;
                        admin           = true;
                        panel1.Controls.Clear();
                        forceManage fm = new forceManage {
                            TopLevel = false, FormBorderStyle = FormBorderStyle.None
                        };
                        panel1.Controls.Add(fm);
                        fm.Show();
                        break;
                    }
                }
                if (!admin)
                {
                    this.panel1.Controls.Clear();
                    adminLogin al = new adminLogin(1);
                    al.ShowDialog(this);
                }
            }
        }