Example #1
0
        private void refresh_Click(object sender, EventArgs e)
        {
            mainform mf = new mainform(cn);

            cn.mainpnl.Controls.Clear();
            mf.TopLevel = false;
            cn.mainpnl.Controls.Add(mf);
            mf.changelabel(userinfo.username);
            mf.Show();
        }
Example #2
0
        private void Login_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            try
            {
                usernametxt.Enabled = true;
                pwdtxt.Enabled      = true;
                loading.Visible     = false;
                string result = e.Result.ToString();

                if (result == "404")
                {
                    error.Text       = "Username incorrect";
                    error.Visible    = true;
                    namelbl.Visible  = true;
                    pwdlbl.Visible   = true;
                    usernametxt.Text = "";
                    pwdtxt.Text      = "";
                    usernametxt.Focus();
                }
                else if (result == "incorrect password")
                {
                    error.Text    = "Please enter correct password";
                    error.Visible = true;
                    pwdtxt.Text   = "";
                    pwdtxt.Focus();
                    namelbl.Visible = true;
                    pwdlbl.Visible  = true;
                }
                else if (result == "Username")
                {
                    error.Text       = "Username does not exist";
                    error.Visible    = true;
                    usernametxt.Text = "";
                    pwdtxt.Text      = "";
                    namelbl.Visible  = true;
                    pwdlbl.Visible   = true;
                    usernametxt.Focus();
                }
                else if (result == "enter details")
                {
                    error.Text       = "Enter username and password";
                    error.Visible    = true;
                    usernametxt.Text = "";
                    pwdtxt.Text      = "";
                    namelbl.Visible  = true;
                    pwdlbl.Visible   = true;
                }
                else if (result == "connection")
                {
                    error.Text    = "Please check your internet connection.";
                    error.Visible = true;
                }
                else if (result == "success")
                {
                    mainform mf = new mainform(cn);
                    mf.TopLevel = false;
                    cn.mainpnl.Controls.Clear();
                    if (usertype == "1")
                    {
                        userinfo.admin = true;
                    }
                    else if (usertype == "0")
                    {
                        userinfo.admin = false;
                    }



                    userinfo.loggedin = true;
                    userinfo.username = username;
                    userinfo.email    = email;
                    userinfo.encmail  = encmail;



                    cn.mainpnl.Controls.Add(mf);

                    this.Close();
                    mf.Show();
                    mf.changelabel(username);
                }
                loginbtn.Enabled  = true;
                forgotbtn.Enabled = true;
            }catch { }
        }