Example #1
0
        private void ConfirmNewManager_Click(object sender, EventArgs e)
        {
            connection CN2 = new connection();

            CN2.thisConnection.Open();
            OracleDataAdapter    thisAdapter = new OracleDataAdapter("SELECT * FROM userinfo", CN2.thisConnection);
            OracleCommandBuilder thisBuilder = new OracleCommandBuilder(thisAdapter);
            DataSet thisDataSet = new DataSet();

            thisAdapter.Fill(thisDataSet, "userinfo");
            DataRow thisRow = thisDataSet.Tables["userinfo"].NewRow();

            try
            {
                thisRow["id"]       = NewManagerUsername.Text;
                thisRow["password"] = NewManagerPass.Text;
                thisDataSet.Tables["userinfo"].Rows.Add(thisRow);
                thisAdapter.Update(thisDataSet, "userinfo");
                MessageBox.Show("New Manager Added");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            CN2.thisConnection.Close();

            AdminDashboard nxtform = new AdminDashboard();

            nxtform.Show();
            this.Hide();
        }
 private void AdminVerification()
 {
     try
     {
         connection CN = new connection();
         CN.thisConnection.Open();
         OracleCommand thisCommand = new OracleCommand();
         thisCommand.Connection  = CN.thisConnection;
         thisCommand.CommandText = "SELECT * From userinfo WHERE id='" + adminUsername.Text + "' AND password='******'";
         OracleDataReader thisReader = thisCommand.ExecuteReader();
         if (thisReader.Read())
         {
             AdminDashboard nxtform = new AdminDashboard();
             nxtform.Show();
             this.Hide();
         }
         else
         {
             MessageBox.Show("incorect password or username");
         }
         CN.thisConnection.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Example #3
0
        private void CancelNewManager_Click(object sender, EventArgs e)
        {
            AdminDashboard nxtform = new AdminDashboard();

            nxtform.Show();
            this.Hide();
        }
        private void ConfirmRemovingManager_Click(object sender, EventArgs e)
        {
            connection CN = new connection();

            CN.thisConnection.Open();
            OracleCommand thisCommand1 = CN.thisConnection.CreateCommand();

            thisCommand1.CommandText = "delete userinfo where id= '" + ManagerID.Text + "'";
            thisCommand1.Connection  = CN.thisConnection;
            thisCommand1.CommandType = CommandType.Text;
            try
            {
                thisCommand1.ExecuteNonQuery();
                MessageBox.Show("Manager Removed");
                AdminDashboard nxtform = new AdminDashboard();
                nxtform.Show();
                this.Hide();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }