Пример #1
0
 private void InitUI()
 {
     if (PublicCode.CheckRegCode())
     {
         label3.Visible     = false;
         txtRegCode.Visible = false;
         label4.Visible     = false;
     }
 }
Пример #2
0
        public Form1()
        {
            InitializeComponent();
            if (string.IsNullOrEmpty(PublicCode.UserType) && !PublicCode.CheckRegCode())
            {
                MessageBox.Show("非法访问!");
                return;
            }

            if (PublicCode.UserType == "admin")//管理员允许查看操作日志
            {
                btnQueryHistory.Visible = true;
            }
        }
Пример #3
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtRegCode.Text.Trim()))
            {
                //先验证注册码,如果正确则保存
                if (PublicCode.CheckRegCode(txtRegCode.Text.Trim()))
                {
                    UpdateConfigRegCode(txtRegCode.Text.Trim());
                }
            }
            else
            {
                //先验证注册码,如果正确则保存
                if (!PublicCode.CheckRegCode())
                {
                    MessageBox.Show("注册码不正确,请联系管理员索取!");
                    return;
                }
            }

            string userId = txtUser.Text.Trim();
            string pwd    = txtPwd.Text.Trim();

            if (userId == "admin" && pwd == "admin778899")
            {
                PublicCode.UserType = "admin";
            }
            else
            {
                PublicCode.UserType = "user";
            }

            this.Hide();
            Form1 mainFrom = new Form1();

            mainFrom.ShowDialog();
        }