Exemplo n.º 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 ConfirmNewBook_Click(object sender, EventArgs e)
        {
            connection CN2 = new connection();

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

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

            try
            {
                thisRow["isbn"]           = IsbnOfTheBook.Text;
                thisRow["book_name"]      = NameOfTheBook.Text;
                thisRow["writer_name"]    = NameOfTheWriter.Text;
                thisRow["book_category"]  = CategoryOfTheBook.Text;
                thisRow["entry_date"]     = DateOfEntry.Text;
                thisRow["year_published"] = YearOfPublication.Text;
                thisRow["book_qty"]       = NumberOfBook.Text;
                thisDataSet.Tables["bookinfo"].Rows.Add(thisRow);
                thisAdapter.Update(thisDataSet, "bookinfo");
                MessageBox.Show("A New Book Added");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            CN2.thisConnection.Close();
            ManagerDashboard nxtForm = new ManagerDashboard();

            nxtForm.Show();
            this.Hide();
        }
 private void ManagerVerification()
 {
     try
     {
         connection CN = new connection();
         CN.thisConnection.Open();
         OracleCommand thisCommand = new OracleCommand();
         thisCommand.Connection  = CN.thisConnection;
         thisCommand.CommandText = "SELECT * From userinfo WHERE id='" + mngrUsername.Text + "' AND password='******'";
         OracleDataReader thisReader = thisCommand.ExecuteReader();
         if (thisReader.Read())
         {
             ManagerDashboard nxtform = new ManagerDashboard();
             nxtform.Show();
             this.Hide();
         }
         else
         {
             MessageBox.Show("incorect password or username");
         }
         CN.thisConnection.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemplo n.º 4
0
        private void button2_Click(object sender, EventArgs e)
        {
            connection sv = new connection();

            sv.thisConnection.Open();
            OracleCommand thisCommand = sv.thisConnection.CreateCommand();

            thisCommand.CommandText = "update bookinfo set book_qty = '" + NewQty.Text + "'where book_name= '" + BookNameToUpdate.Text + "'";
            thisCommand.Connection  = sv.thisConnection;
            thisCommand.CommandType = CommandType.Text;
            try
            {
                thisCommand.ExecuteNonQuery();
                MessageBox.Show("Quantity Updated");
                //this.Hide();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            sv.thisConnection.Close();
            ManagerDashboard nxtForm = new ManagerDashboard();

            nxtForm.Show();
            this.Hide();
        }
Exemplo n.º 5
0
        private void GetSearchResultButton_Click(object sender, EventArgs e)
        {
            //lsvItem.Items.Clear();
            connection CN = new connection();

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

            thisCommand.CommandText = "SELECT * FROM bookinfo where book_name= '" + SearchText.Text + "'";
            OracleDataReader thisReader = thisCommand.ExecuteReader();

            while (thisReader.Read())
            {
                ListViewItem lsvItem = new ListViewItem();
                //lsvItem.Clear();
                listView1.Items.Clear();
//                lsvItem.SubItems.Clear();
                lsvItem.Text = thisReader["book_name"].ToString();
                lsvItem.SubItems.Add(thisReader["writer_name"].ToString());
                lsvItem.SubItems.Add(thisReader["book_qty"].ToString());
                lsvItem.SubItems.Add(thisReader["book_category"].ToString());
                listView1.Items.Add(lsvItem);
            }
            CN.thisConnection.Close();
        }
        /*public string GetSearchText()
         * {
         *  return SearchText.Text;
         * }*/
        private void ViewBookList_Load(object sender, EventArgs e)
        {
            connection CN = new connection();

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

            thisCommand.CommandText = "SELECT * FROM bookinfo order by book_name";
            OracleDataReader thisReader = thisCommand.ExecuteReader();

            while (thisReader.Read())
            {
                ListViewItem lsvItem = new ListViewItem();
                lsvItem.Text = thisReader["book_name"].ToString();
                lsvItem.SubItems.Add(thisReader["writer_name"].ToString());
                lsvItem.SubItems.Add(thisReader["book_qty"].ToString());
                lsvItem.SubItems.Add(thisReader["book_category"].ToString());
                listView1.Items.Add(lsvItem);
            }
            CN.thisConnection.Close();
        }
        private void ConfirmRemovingBook_Click(object sender, EventArgs e)
        {
            connection CN = new connection();

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

            thisCommand1.CommandText = "delete bookinfo where book_name= '" + BookNameToRemove.Text + "'";
            thisCommand1.Connection  = CN.thisConnection;
            thisCommand1.CommandType = CommandType.Text;
            try
            {
                thisCommand1.ExecuteNonQuery();
                MessageBox.Show("Book Removed");
                ManagerDashboard nxtform = new ManagerDashboard();
                nxtform.Show();
                this.Hide();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }