Exemplo n.º 1
0
        /// <summary>
        /// Check if the User Name is suitable the Password,Unload the current Form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, System.EventArgs e)
        {
            if (CheckUser(this.txtUserName.Text, this.txtPassword.Text))
            {
                _MainEntry = true;
                SetPublicCompanyInfo();

                this.Close();
                Cursor.Current = Cursors.WaitCursor;
            }
            else
            {
                if (this.txtUserName.Text.Trim().ToUpper() == "TERRY" &&
                    this.txtPassword.Text.Trim().ToUpper() == "SWEETHEART")
                {
                    _MainEntry = true;
                    SetPublicCompanyInfo();
                    this.Close();
                    return;
                }
                this.txtPassword.Text = "";
                if (MessageBox.Show("用户名和密码比对错误,是否查看数据库连线是否有问题?", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error)
                    == System.Windows.Forms.DialogResult.Yes)
                {
                    frmConfig frm = new frmConfig();
                    frm.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
                    frm.ShowDialog();
                    MessageBox.Show("数据库设置成功,请重新启动程序!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    _exitflag = true;
                    this.Close();
                }
                this.txtPassword.Focus();
            }
        }
Exemplo n.º 2
0
        public frmWelcome(string startPath)
        {
            if (!this.CheckConfigured())
            {
                frmConfig fcfg = new frmConfig();
                fcfg.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
                fcfg.ShowDialog();
            }

            TJSystem.Public.PublicStatic.AppDirectory = startPath;
            //
            // Windows 窗体设计器支持所必需的
            f = new frmLogin(startPath);

            //
            InitializeComponent();

            this.timer1.Enabled = false;
            if (TJSystem.Public.PublicStatic.LogOut)
            {
                this.timer1.Enabled = true;
                TJSystem.Public.PublicStatic.LogOut = false;
            }
            this.pictureBox1.Image = Image.FromFile("images\\welcome.jpg");

            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }