January 11 2014

c# 11年的时候写的一个页面

 

namespace HotelMain
{
    public partial class Frmzjm : Form
    {
        bool istrue = true;
        public bool flag1 = false;
        public bool flag2 = false;
        public bool flag3 = false;
        public bool flag4 = false;
        public bool flag5 = false;
        public bool flag6 = false;
        public bool bq = false;
        bool a1 = false;
        bool a2 = false;
        bool a3 = false;
        bool a4 = false;
        bool a5 = false;
        bool a6 = false;
        DBHelp help = new DBHelp();
        //private Dictionary HotKey;
        string  q = “1001”;
        string name = “”;
        int ai = 0;
        [DllImport(“user32.dll”, SetLastError = true)]
        public static extern bool RegisterHotKey(
            IntPtr hWnd,                //要定义热键的窗口的句柄  
            int id,                     //定义热键ID(不能与其它ID重复)             
            KeyModifiers fsModifiers,   //标识热键是否在按Alt、Ctrl、Shift、Windows等键时才会生效  
            Keys vk                     //定义热键的内容  
            );

        [DllImport(“user32.dll”, SetLastError = true)]
        public static extern bool UnregisterHotKey(
            IntPtr hWnd,                //要取消热键的窗口的句柄  
            int id                      //要取消热键的ID  
            );

        //定义了辅助键的名称(将数字转变为字符以便于记忆,也可去除此枚举而直接使用数值)  
        [Flags()]
        public enum KeyModifiers
        {
            None = 0,
            Alt = 1,
            Ctrl = 2,
            Shift = 4,
            WindowsKey = 8
        }  
        public Frmzjm()
        {
            InitializeComponent();
        }
        private void btnRoom_Click(object sender, EventArgs e)
        {
            ///跳转到客房管理上
            this.Hide();
            this.WindowState = FormWindowState.Minimized;
            this.Visible = false;
            this.notifyIcon1.Visible = true;
            if (!flag1)
            {
                FrmRoom a = new FrmRoom(this, q.ToString());
                a.Show();
                flag1 = true;
            }
            else
            {
                MessageBox.Show(“已打开,无法重复打开”);
            }
        }
        private void btnlogin_Click(object sender, EventArgs e)
        {
            //登录
            if (txtUserName.Text == “”)
            {
                MessageBox.Show(“用户名不能为空”, “错误”, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            if (txtPwd.Text == “”)
            {
                MessageBox.Show(“密码不能为空”, “错误”, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            string id = txtUserName.Text;
            string pwd = txtPwd.Text;
            string sql1 = “select count(*) from Accounts where StaffUseName='” + id + “‘ and StaffPwd ='” + pwd + “‘”;
            int b = (int)help.GetScalar(sql1);
            //是否有此ID
            if (b > 0)
            {
                //查看有权限
                string sql = “select StaffNo from Accounts where StaffUseName='” + id + “‘ and StaffPwd ='” + pwd + “‘”;
                q = help.GetScalar(sql).ToString();
                string sq = “select count(*) from Extent where StaffNo='” + q + “‘”;
                int ss = (int)help.GetScalar(sq);
                if (ss == 0)
                {
                    MessageBox.Show(“你当前没有任何权限,无法登录,您可以请您的上级为您分配权限”, “无权限”);
                    return;
                }
                else
                {
                    timer3.Enabled = true;
                    this.pictureBox1.Visible = false;
                    this.button1.Text = “帮助”;
                    this.oo.Visible = true;
                    if (this.checkBox1.Checked == true)
                    {
                        string sql2 = “select count(*) from jizhu where uid='” + this.txtUserName.Text + “‘and pwd='” + this.txtPwd.Text + “‘”;
                        if ((int)help.GetScalar(sql2) == 0)
                        {
                            string jia = “insert into jizhu values(‘” + this.txtUserName.Text + “‘,'” + this.txtPwd.Text + “‘)”;
                            help.GetNonQuery(jia);
                        }
                    }
                    if (this.checkBox1.Checked == false)
                    {
                       // MessageBox.Show(“Test”);
                        string sql2 = “select count(*) from jizhu where uid='” + this.txtUserName.Text + “‘and pwd='” + this.txtPwd.Text + “‘”;
                        if ((int)help.GetScalar(sql2) != 0)
                        {
                            string jia = “delete jizhu where uid='” + this.txtUserName.Text + “‘and pwd='” + this.txtPwd.Text + “‘”;
                            help.GetNonQuery(jia);
                        }
                    }
                }
                //MessageBox.Show(a.ToString());
                this.panFunction.Enabled = true;
                this.gpblogin.Visible = false;
                this.lblts.Visible = true;
                this.toolStripStatusLabel4.Visible = true;
                //如果有的话 哪些有
                string sqll = “select * from Staff where StaffNo='” + q + “‘”;
                DataSet ds = new DataSet();
                ds = help.GetDs(sqll);
                name = ds.Tables[0].Rows[0][“StaffName”].ToString();
                string zw = ds.Tables[0].Rows[0][“StaffDuty”].ToString();
                this.toolStripStatusLabel5.Text = name + “(” + zw + “)”;
                this.toolStripStatusLabel5.Visible = true;
                string sqlla = “select * from Extent where StaffNo='” + q + “‘”;
                DataSet ds1 = new DataSet();
                ds1 = help.GetDs(sqlla);
                foreach (DataRow row in ds1.Tables[0].Rows)
                {
                    string namea = row[“extentName”].ToString();
                    foreach (Control tem in this.panFunction.Controls)
                    {
                        if (tem.Tag.ToString() == “图片”)
                        {
                           
                        }
                        if (tem.Tag.ToString() == namea)
                        {
                            if (row[“ExtentEnable”].ToString() == “可用”)
                            {
                                tem.Enabled = true;
                            }
                            else
                            {
                                tem.Enabled = false;
                            }
                        }
                    }
                }
                this.toolStripStatusLabel4.Text = “当前登录人员:”;
                this.btnzhmm.Text = “个人信息”;
                this.btnEnrol.Text = “注销登录”;
                banquan.Visible = true;
                string time = System.DateTime.Now.ToString(“yy-MM-dd”);
                string qian = “select count(*) from qiandao where riqi='” + time + “‘ and ygbh='” + q + “‘”;
                if ((int)help.GetScalar(qian) == 0)
                {
                    this.grpqd.Visible = true;
                }
                else
                {
                    grpqd.Visible = false;
                }
            }
                //没有ID
            else
            {
                MessageBox.Show(“帐号或密码有误”, “错误”, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                this.txtUserName.Focus();
                return;
            }
        }
        private void Frmzjm_Shown(object sender, EventArgs e)
        {
            cmbitem();

        }
        private void cmbitem()
        {
            this.txtUserName.Focus();
            this.lblts.Visible = false;
            string sql = “select count(*) from jizhu”;
            this.txtUserName.Items.Clear();
            if ((int)help.GetScalar(sql) == 0)
            {
                this.txtPwd.Text = “”;
                this.txtUserName.Text=””;
            }
            else
            {
                string sql1 = “select uid from jizhu”;
                DataSet ds = new DataSet();
                ds = help.GetDs(sql1);
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    this.txtUserName.Items.Add(row[0].ToString());
                }
                this.txtUserName.Text = this.txtUserName.Items[0].ToString();
                if (this.txtPwd.Text != “”)
                {
                    this.checkBox1.Checked = true;
                }
                if (this.txtUserName.Items.Count == 0)
                {
                    this.txtPwd.Text = “”;
                    this.txtUserName.Text = “”;
                }
            }
        }
        private void Icozong_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            //点击最小化按钮时
            this.Show();
        }
        private void btnLoqout_Click(object sender, EventArgs e)
        {
            //注销时
            this.panFunction.Enabled = false;
            this.gpblogin.Visible = true;
            this.lblts.Visible = false;
            this.btnEnrol.Enabled = true;
            this.toolStripStatusLabel4.Text = “当前未登录”;
            this.toolStripStatusLabel5.Text = “”;
            this.txtPwd.Text = “”;
            this.txtUserName.Text = “”;
            this.btnzhmm.Text = “找回密码”;
            this.txtUserName.Focus();
        }
        private void btnClose_Click(object sender, EventArgs e)
        {
            //关闭
            this.Close();
        }
        private void timer1_Tick_1(object sender, EventArgs e)
        {
            //时间
            this.toolStripStatusLabel2.Text = System.DateTime.Now.ToString(“yy-MM-dd  dddd  hh:mm:ss”);
            this.toolStripProgressBar1.PerformStep();

        }
        private void timer2_Tick(object sender, EventArgs e)
        {
            //滚动条走
            if (this.timer2.Interval % 5 == 0)
            {
                this.toolStripProgressBar1.PerformStep();
            }
            //滚动条藏
            if (this.toolStripProgressBar1.Value == 90)
            {
                this.toolStripProgressBar1.Visible = false;
            }
        }
        private void Frmzjm_FormClosing(object sender, FormClosingEventArgs e)
        {
            bool it = true;
            if (ai == 0)
            {
                string sql8 = “select count(*) from sfky where yong=’0′ and ming=’0′”;
                ai = (int)help.GetScalar(sql8);
            }
            if (ai == 1)
            {
                string sql12 = “delete sfky where yong=’0’ and ming=’0′”;
                help.GetNonQuery(sql12);
                e.Cancel = false;
                it = false;

            }
            if (it)
            {
                //MessageBox.Show(“Test”);
                string sql = “select count(*) from sfky where yong=’1′”;
                int y = (int)help.GetScalar(sql);
                if (y == 0)
                {
                    e.Cancel = true;
                    FrmEsc a = new FrmEsc(this);
                    a.Show();
                }
                else
                {
                    string sql1 = “select ming from sfky where yong=’1′”;
                    string sfky = help.GetScalar(sql1).ToString();
                    if (sfky == “最小化”)
                    {
                        e.Cancel = true; //取消退出
                        this.Hide(); //藏起来
                        this.WindowState = FormWindowState.Minimized;  //最小化
                        this.Visible = false;  //可见性
                        this.notifyIcon1.Visible = true;  //最小化的图标显示
                    }
                    else
                    {
                        e.Cancel = false;  // 是否取消命令  (否)
                        Application.Exit();  //关闭
                        UnregisterHotKey(Handle, 103); //销毁句炳
                    }
                }
            }
        }
        private void NewMethod(FormClosingEventArgs e)
{
            //关闭时
            if (e.CloseReason == CloseReason.UserClosing)
            {
                DialogResult a=MessageBox.Show(“是否退出? “, “提示 “, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (a==DialogResult.No)
                {
                    //选择了最小化
                    e.Cancel = true; //取消退出
                    //this.Hide(); //藏起来
                    //this.WindowState = FormWindowState.Minimized;  //最小化
                    //this.Visible = false;  //可见性
                    //this.notifyIcon1.Visible = true;  //最小化的图标显示
                }
                if (a==DialogResult.Yes)
                {

                    //最小化提示还回值为不
                    e.Cancel = false;  // 是否取消命令  (否)
                    Application.Exit();  //关闭
                    UnregisterHotKey(Handle, 103); //销毁句炳
                }
            }
}
        private void Frmzjm_Resize(object sender, EventArgs e)
        {
            //this.ClientSize = new System.Drawing.Size(552, 439)
           
            this.Size =new Size (586, 477);
        }
        private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            //左键双击
            if (e.Button == MouseButtons.Left)
            {
                this.Visible = true;  //窗体可见
                this.WindowState = FormWindowState.Normal; //还原原来的状态
                notifyIcon1.Visible = false; //最小化的图标不可见

            }

        }
        private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ai = 1;
            this.Close();
           
        }
        private void 打开ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Visible = true;
            this.WindowState = FormWindowState.Normal;
            notifyIcon1.Visible = false;
        }
        private void btnManager_Click(object sender, EventArgs e)
        {
            this.Hide();
            this.WindowState = FormWindowState.Minimized;
            this.Visible = false;
            this.notifyIcon1.Visible = true;
            if (!flag3)
            {
                FrmJLCX a = new FrmJLCX(this, q.ToString());
                a.Show();
                flag3 = true;
            }
            else
            {
                MessageBox.Show(“已打开,无法重复打开”, “错误”, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
        }
        private void btnStaff_Click(object sender, EventArgs e)
        {
            this.Hide();
            this.WindowState = FormWindowState.Minimized;
            this.Visible = false;
            this.notifyIcon1.Visible = true;
            if (!flag4)
            {
                FrmQX a = new FrmQX(this);
                a.Show();
                flag4 = true;
            }
            else
            {
                MessageBox.Show(“已打开,无法重复打开”, “错误”, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
        }
        private void btnFoot_Click(object sender, EventArgs e)
        {
            this.Hide();
            this.WindowState = FormWindowState.Minimized;
            this.Visible = false;
            this.notifyIcon1.Visible = true;
            if (!flag2)
            {
                FrmFood a = new FrmFood(this, q.ToString());
                a.Show();
                flag2 = true;
            }
            else
            {
                MessageBox.Show(“已打开,无法重复打开”, “错误”, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
        }
        private void btnSystem_Click(object sender, EventArgs e)
        {
            this.Hide();
            this.WindowState = FormWindowState.Minimized;
            this.Visible = false;
            this.notifyIcon1.Visible = true;
            if (!flag5)
            {
                Frm a = new Frm(this,q.ToString());
                a.Show();
                flag5 = true;
            }
            else
            {
                MessageBox.Show(“已打开,无法重复打开”, “错误”, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

        }
        private void btnEnrol_Click(object sender, EventArgs e)
        {
            if (btnEnrol.Text == “注册用户”)
            {
                FrmZHzc a = new FrmZHzc();
                a.Show();
            }
            else
            {
                this.panFunction.Enabled = false;
                this.gpblogin.Visible = true;
                this.oo.Visible = false;
                this.lblts.Visible = false;
                this.toolStripStatusLabel4.Text = “当前未登录”;
                this.toolStripStatusLabel5.Text = “”;
                this.btnzhmm.Text = “找回密码”;
                this.txtUserName.Focus();
                this.btnEnrol.Text = “注册用户”;
                this.button1.Text = “欢迎使用”;
                banquan.Visible = false;
                this.pictureBox1.Visible = true;
                this.timer3.Enabled = false;
                cmbitem();
               
            }
           
        }
        private void btnDepot_Click(object sender, EventArgs e)
        {
            this.Hide();
            this.WindowState = FormWindowState.Minimized;
            this.Visible = false;
            this.notifyIcon1.Visible = true;
            if (!flag6)
            {
                FrmFootjinhuo a = new FrmFootjinhuo(this);
                a.Show();
                flag6 = true;
            }
            else
            {
                MessageBox.Show(“已打开,无法重复打开”, “错误”, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
        }
        private void btnre_Click(object sender, EventArgs e)
        {
            FrmZHmm a = new FrmZHmm();
            a.Show();
        }
        private void Frmzjm_Load(object sender, EventArgs e)
        {
            //MessageBox.Show(this.contextMenuStrip2.Items.Count.ToString());
            //this.radioButton1.Checked = true;
            string skin = “select count(*) from pifu where yong='” + 1 + “‘”;
            int s = (int)help.GetScalar(skin);
            if (s == 0)
            {
            }
            else
            {
                string sq = “select pnm from pifu where yong='” + 1 + “‘”;
                string pi = help.GetScalar(sq).ToString();
                this.skinUI1.SkinFile = pi;
                //string sql22 = “select ziti from pifu where yong='” + 1 + “‘”;
                //string zi = help.GetScalar(sql22).ToString();
                ////MessageBox.Show(zi);
                //this.Font = new System.Drawing.Font(zi, 8, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            }
            RegisterHotKey(Handle, 103, KeyModifiers.Alt | KeyModifiers.Ctrl, Keys.Z);
            this.panFunction.Enabled = false;
            this.gpblogin.Visible = true;
            this.lblts.Visible = false;
            this.btnEnrol.Enabled = true;
            this.toolStripStatusLabel4.Text = “当前未登录”;
            this.toolStripStatusLabel5.Text = “”;
            tooltip();
        }
        private void tooltip()
        {
            this.toolTip1.SetToolTip(txtUserName, “请输入用户名”);
            this.toolTip1.SetToolTip(txtPwd, “请输入密码登录后操作”);
            this.toolTip1.SetToolTip(pictureBox1, “请登录后进行操作”);
        }
        protected override void WndProc(ref Message m)
        {
            const int WM_HOTKEY = 0x0312;

                switch (m.Msg)
                {
                case WM_HOTKEY:
                    switch (m.WParam.ToInt32())
                    {

                        case 103:
                            if (this.WindowState == FormWindowState.Normal)
                            {
                                    this.Hide();
                                    this.WindowState = FormWindowState.Minimized;
                                    this.Visible = false;
                                    this.notifyIcon1.Visible = true;
                            }
                            else
                            {
                                this.Visible = true;
                                this.WindowState = FormWindowState.Normal;
                                notifyIcon1.Visible = false;

                            }
                            break;
      
                    }
                    break;
            }
            base.WndProc(ref m);
        }
        private void Frmzjm_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F1)
            {
                if (button1.Text == “帮助”)
                {
                    FrmHelp a = new FrmHelp(this);
                    a.Show();
                }
            }
        }
        private void btnzhmm_Click(object sender, EventArgs e)
        {
            if (btnzhmm.Text == “找回密码”)
            {
                FrmZHmm a = new FrmZHmm();
                a.Show();
            }
            else
            {
                Frmxiugaimima a = new Frmxiugaimima(this);
                a.Show();
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.button1.Text == “帮助”)
            {
                FrmHelp a = new FrmHelp(this);
                a.Show();
            }
            else
            {
                MessageBox.Show(“请登录后进行操作”,”请先登录”,MessageBoxButtons.OK,MessageBoxIcon.Information);
                return;
            }
        }
        private void banquan_Click(object sender, EventArgs e)
        {
            if (!bq)
            {
                AboutBox1 a = new AboutBox1(this);
                a.Show();
                bq = true;
            }
            else
            {
                MessageBox.Show(“已打开,无法重复打开”, “错误”, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
        }
        private void timer3_Tick(object sender, EventArgs e)
        {
            if (lblts.Right >= this.Width)
            {
                istrue = false;

            }
            if (lblts.Left <= 0)
            {
                istrue = true;
            }
            if (istrue)
            {
                lblts.Left += 5;
                this.ForeColor = Color.Black;
                this.label1.ForeColor = Color.Black;
                lblts.ForeColor = Color.Blue;
            }
            else
            {
                lblts.Left -= 5;
                this.ForeColor = Color.Blue;
                lblts.ForeColor = Color.Black;
                this.label1.ForeColor = Color.Blue;
            }
        }
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.grpqd.Visible = false;
            string time = System.DateTime.Now.ToString(“yy-MM-dd”);
            string sql = “insert into qiandao values(‘” + q + “‘,'” + name + “‘,'” + time + “‘,’签到’)”;
            help.GetNonQuery(sql);

        }
        private void txtUserName_SelectedIndexChanged(object sender, EventArgs e)
        {
          /*  string uid = this.txtUserName.Text;
            string sql1 = “select count(*) from jizhu where uid='” + uid + “‘”;
            if ((int)help.GetScalar(sql1) == 1)
            {
                string sql = “select pwd from jizhu where uid='” + uid + “‘”;
                this.txtPwd.Text = help.GetScalar(sql).ToString();
            }*/
        }
        private void 清空所有保存ToolStripMenuItem_Click(object sender, EventArgs e)
        {
               string shan = “delete jizhu”;
              help.GetNonQuery(shan);
              this.txtUserName.Focus();
              this.txtUserName.Items.Clear();
              this.txtUserName.Text = “”;
              this.txtPwd.Text = “”;
        }
        private void Frmzjm_Activated(object sender, EventArgs e)
        {
            string sql = “select count(*) from jizhu”;
            this.txtUserName.Items.Clear();
            if ((int)help.GetScalar(sql) == 0)
            {

            }
            else
            {
                string sql1 = “select uid from jizhu”;
                DataSet ds = new DataSet();
                ds = help.GetDs(sql1);
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    this.txtUserName.Items.Add(row[0].ToString());
                }
                this.txtUserName.Text = this.txtUserName.Items[0].ToString();
            }
        }
        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {

            System.Diagnostics.Process.Start(“主界面.html”);  
        }
        private void Frmzjm_HelpButtonClicked(object sender, CancelEventArgs e)
        {
            FrmHelp a = new FrmHelp(this);
            a.Show();
        }

        private void 客房ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (a1)
            {
                ///跳转到客房管理上
                this.Hide();
                this.WindowState = FormWindowState.Minimized;
                this.Visible = false;
                this.notifyIcon1.Visible = true;
                if (!flag1)
                {
                    FrmRoom a = new FrmRoom(this, q.ToString());
                    a.Show();
                    flag1 = true;
                }
                else
                {
                    MessageBox.Show(“已打开,无法重复打开”);
                }
            }
        }
        private void 餐饮管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (a2)
            {
                this.Hide();
                this.WindowState = FormWindowState.Minimized;
                this.Visible = false;
                this.notifyIcon1.Visible = true;
                if (!flag2)
                {
                    FrmFood a = new FrmFood(this, q.ToString());
                    a.Show();
                    flag2 = true;
                }
                else
                {
                    MessageBox.Show(“已打开,无法重复打开”, “错误”, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }
            }
        }
        private void 员工权限ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (a3)
            {
                this.Hide();
                this.WindowState = FormWindowState.Minimized;
                this.Visible = false;
                this.notifyIcon1.Visible = true;
                if (!flag4)
                {
                    FrmQX a = new FrmQX(this);
                    a.Show();
                    flag4 = true;
                }
                else
                {
                    MessageBox.Show(“已打开,无法重复打开”, “错误”, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }
            }
        }
        private void 系统维护ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (a4)
            {
                this.Hide();
                this.WindowState = FormWindowState.Minimized;
                this.Visible = false;
                this.notifyIcon1.Visible = true;
                if (!flag5)
                {
                    Frm a = new Frm(this, q.ToString());
                    a.Show();
                    flag5 = true;
                }
                else
                {
                    MessageBox.Show(“已打开,无法重复打开”, “错误”, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }
            }
        }
        private void 经理管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (a5)
            {
                this.Hide();
                this.WindowState = FormWindowState.Minimized;
                this.Visible = false;
                this.notifyIcon1.Visible = true;
                if (!flag3)
                {
                    FrmJLCX a = new FrmJLCX(this, q.ToString());
                    a.Show();
                    flag3 = true;
                }
                else
                {
                    MessageBox.Show(“已打开,无法重复打开”, “错误”, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }
            }
        }
        private void 库房管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (a6)
            {
                this.Hide();
                this.WindowState = FormWindowState.Minimized;
                this.Visible = false;
                this.notifyIcon1.Visible = true;
                if (!flag6)
                {
                    FrmFootjinhuo a = new FrmFootjinhuo(this);
                    a.Show();
                    flag6 = true;
                }
                else
                {
                    MessageBox.Show(“已打开,无法重复打开”, “错误”, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }
            }
        }
        private void btnRoom_EnabledChanged(object sender, EventArgs e)
        {
            if (btnRoom.Enabled == true)
            {
                a1 = true;
                this.contextMenuStrip1.Items[2].Enabled = true;
            }
            else
            {
                a1 = false;
                this.contextMenuStrip1.Items[2].Enabled = false;
            }
        }
        private void btnFoot_EnabledChanged(object sender, EventArgs e)
        {
            if (btnFoot.Enabled == true)
            {
                a2 = true;
                this.contextMenuStrip1.Items[3].Enabled = true;
            }
            else
            {
                a2 = false;
                this.contextMenuStrip1.Items[3].Enabled = false;
            }
        }
        private void btnDepot_EnabledChanged(object sender, EventArgs e)
        {
            if (btnDepot.Enabled == false)
            {
                a6 = false;
                this.contextMenuStrip1.Items[7].Enabled = false;
            }
            else
            {
                a6 = true;
                this.contextMenuStrip1.Items[7].Enabled = true;
            }
        }
        private void btnManager_EnabledChanged(object sender, EventArgs e)
        {
            if (btnManager.Enabled == true)
            {
                a5 = true;
                this.contextMenuStrip1.Items[6].Enabled = true;
            }
            else
            {
                a5 = false;
                this.contextMenuStrip1.Items[6].Enabled = false;
            }

        }
        private void btnStaff_EnabledChanged(object sender, EventArgs e)
        {
            if (btnStaff.Enabled == true)
            {
                a3 = true;
                this.contextMenuStrip1.Items[4].Enabled = true;
            }
            else
            {
                a3 = false;
                this.contextMenuStrip1.Items[4].Enabled = false;
            }
        }
        private void btnSystem_EnabledChanged(object sender, EventArgs e)
        {
            if (btnSystem.Enabled == true)
            {
                a4 = true;
                this.contextMenuStrip1.Items[5].Enabled = true;
            }
            else
            {
                a4 = false;
                this.contextMenuStrip1.Items[5].Enabled = false;
            }
        }

        private void txtUserName_TextChanged(object sender, EventArgs e)
        {
            string uid = this.txtUserName.Text;
            string sql1 = “select count(*) from jizhu where uid='” + uid + “‘”;
            if ((int)help.GetScalar(sql1) == 1)
            {
            }
            else
            {
                this.txtPwd.Text = “”;
            }
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

 
    }
}



Copyright 2019. All rights reserved.

Posted 2014年1月11日 by ucjmh in category "c#

Leave a Reply

Your email address will not be published. Required fields are marked *