Exemplo n.º 1
0
        public notification(Form mfcopy, Form hpcopy)
        {
            mf = mfcopy as mainform;
            hp = hpcopy as Homepage;

            InitializeComponent();
        }
Exemplo n.º 2
0
        private void signupbtn_Click(object sender, EventArgs e)
        {
            if (fnameok && lnameok && usernameok && emailok && passwordok && confirmok && phoneok && dobok && tcbox.Checked == true)
            {
                String cmd;
                inclbl.Visible = false;
                cmd            = "Insert into admin values ('" + usernametxt.Text + "','" + fnametxt.Text + "','" + lnametxt.Text + "','" + emailtxt.Text + "','" + pwdtxt.Text + "','" + phonetxt.Text + "','" + yeartxt.Text + "//" + montxt.Text + "//" + daytxt.Text + "',null)";
                obj.nonQuery(cmd);

                MySqlDataReader dr;
                dr = obj.Query("select * from admin where username='******'");
                dr.Read();
                MessageBox.Show("Registration Successful.\nAdmin created with the Username: "******"");
                obj.closeConnection();
                this.Close();
                mainform mf = new mainform(hp);
                hp.mainpnl.Controls.Clear();
                mf.TopLevel = false;
                hp.mainpnl.Controls.Add(mf);
                mf.Show();
            }
            else
            {
                inclbl.Visible = true;
            }
        }
Exemplo n.º 3
0
        private void loginbtn_Click(object sender, EventArgs e)
        {
            if (usernametxt.Text.Contains("'") || pwdtxt.Text.Contains("'") || usernametxt.Text.Contains("\\") || pwdtxt.Text.Contains("\\"))
            {
                error.Text       = "Is that a trick? Enter valid details";
                error.Visible    = true;
                usernametxt.Text = "";
                pwdtxt.Text      = "";
            }
            else if (usernametxt.Text != "" && pwdtxt.Text != "")
            {
                int i;
                i = obj.Count("Select Count(*) from admin where username='******';");
                if (i == 1)
                {
                    MySqlDataReader dr;
                    dr = obj.Query("Select * from admin where username='******';");
                    dr.Read();
                    if (dr[4].Equals(pwdtxt.Text))
                    {
                        userinfo.loggedin = true;
                        userinfo.username = dr[0].ToString();

                        mainform mf = new mainform(hp);
                        mf.changelabel("Welcome, " + dr[0] + "");
                        mf.signout();

                        this.Close();

                        hp.mainpnl.Controls.Clear();
                        mf.TopLevel = false;
                        hp.mainpnl.Controls.Add(mf);
                        mf.Show();
                    }
                    else
                    {
                        error.Text       = "Please Enter Correct Password";
                        error.Visible    = true;
                        usernametxt.Text = "";
                        pwdtxt.Text      = "";
                    }
                    obj.closeConnection();
                }
                else
                {
                    error.Text       = "Username does not exist";
                    error.Visible    = true;
                    usernametxt.Text = "";
                    pwdtxt.Text      = "";
                }
            }
            else
            {
                error.Text       = "Enter username and password";
                error.Visible    = true;
                usernametxt.Text = "";
                pwdtxt.Text      = "";
            }
        }
Exemplo n.º 4
0
        private void back_Click(object sender, EventArgs e)
        {
            mainform mf = new mainform(hp);

            mf.TopLevel = false;
            hp.mainpnl.Controls.Clear();
            hp.mainpnl.Controls.Add(mf);
            mf.Show();
        }
Exemplo n.º 5
0
 public loginform(Form hpcopy, Form mfcopy)
 {
     mf = mfcopy as mainform;
     hp = hpcopy as Homepage;
     InitializeComponent();
 }
Exemplo n.º 6
0
 public admin(Form hpcopy, Form mfcopy)
 {
     hp = hpcopy as Homepage;
     mf = mfcopy as mainform;
     InitializeComponent();
 }