示例#1
0
        private void loginToolStripMenuItem_Click(object sender, EventArgs e)
        {
            loginform login = new loginform();

            login.Show();
            login.MdiParent = this;
        }
示例#2
0
        public void checkSubmit()
        {
            button24.Enabled = false;
            DialogResult res = MessageBox.Show("Do you want to Submit Answer?", "Submission of Test Answer", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (res == DialogResult.Yes)
            {
                groupBox1.Hide();
                groupBox2.Hide();
                readHashTable(qkey);
                DialogResult result = MessageBox.Show("Your score is " + correctAnswer + " .For more Info login again.", "Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (result == DialogResult.OK)
                {
                    DialogResult check = MessageBox.Show("Click ok to login.", "Login Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Question);
                    if (check == DialogResult.OK)
                    {
                        loginform log = new loginform();
                        log.MdiParent    = this.MdiParent;
                        log.txtname.Text = label29.Text;
                        log.Show();
                        this.Close();
                    }
                }
            }
        }
        private void logOutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //menu strip and assigning the MDI parent
            loginform login = new loginform();

            login.MdiParent = this.MdiParent;
            login.Show();
            this.Show();
        }
示例#4
0
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            insertMarks();
            loginform student = new loginform();

            student.txtname.Text = label29.Text;
            student.Show();
            student.MdiParent = this.MdiParent;
            this.Close();
        }
        public bool registerAddUpdate(string operation, string label, string txt1, string txt2, string txt3, string txt4, string txt5)
        {
            SqlConnection con = new SqlConnection("Data Source=Suhas;Initial Catalog=project;User ID=sa;Password=admin");
            SqlCommand    cmd = new SqlCommand();

            con.Open();
            cmd.Connection  = con;
            cmd.CommandText = "registerOperation";
            cmd.CommandType = CommandType.StoredProcedure;

            SqlParameter paramuserId   = new SqlParameter("@staffId", SqlDbType.Int);
            SqlParameter paramusername = new SqlParameter("@userName", SqlDbType.VarChar, 50);
            SqlParameter paramemailid  = new SqlParameter("@emailId", SqlDbType.VarChar, 50);
            SqlParameter parampwd      = new SqlParameter("@pwd", SqlDbType.VarChar, 50);
            SqlParameter parammobno    = new SqlParameter("@mobileNo", SqlDbType.BigInt);
            SqlParameter paramaddr     = new SqlParameter("@userAddress", SqlDbType.VarChar, 50);
            SqlParameter paramtype     = new SqlParameter("@userType", SqlDbType.VarChar, 50);
            SqlParameter paramop       = new SqlParameter("@op", SqlDbType.VarChar, 20);

            cmd.Parameters.Add(paramuserId);
            cmd.Parameters.Add(paramusername);
            cmd.Parameters.Add(paramemailid);
            cmd.Parameters.Add(parampwd);
            cmd.Parameters.Add(parammobno);
            cmd.Parameters.Add(paramaddr);
            cmd.Parameters.Add(paramtype);
            cmd.Parameters.Add(paramop);

            if (operation == null) //insert for registration page
            {
                paramop.Value       = "insert";
                paramuserId.Value   = 0;
                paramusername.Value = txtname.Text.ToString();
                paramemailid.Value  = txtemailid.Text.ToString();
                parampwd.Value      = txtpwd.Text.ToString();
                parammobno.Value    = Convert.ToInt64(txtmobileno.Text);
                paramaddr.Value     = txtaddress.Text.ToString();
                paramtype.Value     = "students";

                if (cmd.ExecuteNonQuery() >= 0)
                {
                    MessageBox.Show("Welcome " + txtname.Text.ToString() + " .Your Account has been created.");
                    loginform login = new loginform();
                    login.txtname.Text = txtemailid.Text.ToString();
                    login.MdiParent    = this.MdiParent;
                    login.Show();
                    this.Close();
                    return(true);
                }
                else
                {
                    MessageBox.Show("Try Again!!");
                    return(false);
                }
            }
            else //Add or update for admin page
            {
                paramusername.Value = txt1;
                paramemailid.Value  = txt2;
                parampwd.Value      = txt3;
                parammobno.Value    = txt4;
                paramaddr.Value     = txt5;
                paramtype.Value     = "staff";
                if (operation == "insert")
                {
                    paramuserId.Value = 0;
                    paramop.Value     = "insert";
                    if (cmd.ExecuteNonQuery() >= 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    paramuserId.Value = Convert.ToString(label);
                    paramop.Value     = "update";
                    if (cmd.ExecuteNonQuery() >= 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }