Пример #1
0
        private void btnTrackDriver_Click(object sender, EventArgs e)
        {
            frmTrackDriver trackDriverForm = new frmTrackDriver();

            trackDriverForm.Show();
            this.Hide();
        }
Пример #2
0
        private void btnTrackDriver_Click(object sender, EventArgs e)
        {
            string passWord;

            userName = txtUserName.Text;
            passWord = txtPassword.Text;

            lblError1.Visible     = false;
            lblErrorStar1.Visible = false;
            lblErrorStar2.Visible = false;
            lblError1.Text        = "";
            txtPassword.Text      = null;
            txtUserName.Text      = null;

            if (userName == "" || passWord == "")
            {
                lblError1.Visible     = true;
                lblErrorStar1.Visible = true;
                lblErrorStar2.Visible = true;
                lblError1.Text        = "Must enter a Username and Password";
                txtPassword.Text      = null;
                txtUserName.Text      = null;
            }
            else if (userName == "admin" || userName == "driver")
            {
                //Display error
                lblError1.Visible     = true;
                lblError1.Text        = "Must be a user to track your driver";
                lblErrorStar1.Visible = true;
                lblErrorStar2.Visible = true;

                txtPassword.Text = null;
                txtUserName.Text = null;
            }
            else
            {
                frmTrackDriver trackDriverForm = new frmTrackDriver();
                trackDriverForm.Show();
                this.Hide();
            }
        }