private void btnSearch_Click(object sender, EventArgs e)
        {
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("SELECT COUNT(*) FROM RESERVATION WHERE RESERVATION_ID=:p1", dbms.con);

            cmd.Parameters.Add("p1", resId.Text);
            OracleDataReader reader = cmd.ExecuteReader();

            reader.Read();
            if (reader["COUNT(*)"].ToString() == "1")
            {
                panel.Visible = true;
                //change panel to recipt
                this.Size = new Size(619, 419);
                panel.Controls.Clear();
                receipt uc = new receipt(resId.Text);
                panel.Controls.Add(uc);
                uc.Dock = DockStyle.Fill;
                uc.BringToFront();
            }
            else
            {
                MessageBox.Show("Invalid reservation ID", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (itemName.Text == "")
            {
                MessageBox.Show("Enter valid name", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (Convert.ToInt32(itemPrice.Text) <= 0)
            {
                MessageBox.Show("Enter valid price", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("INSERT INTO ITEMS (ITEM_NAME, ITEM_PRICE) VALUES (:p1, :p2)", dbms.con);

            cmd.Parameters.Add("p1", itemName.Text);
            cmd.Parameters.Add("p2", itemPrice.Text);
            try
            {
                cmd.ExecuteNonQuery();
                cmd = new OracleCommand("SELECT ITEM_ID_SEQ.CURRVAL FROM DUAL", dbms.con);
                OracleDataReader reader = cmd.ExecuteReader();
                reader.Read();
                MessageBox.Show("Item added successfully ID:" + reader[0].ToString(), "Success");
                ((Form)this.TopLevelControl).Close();
            }
            catch (Exception exp)
            {
                MessageBox.Show("Item not added\n" + exp.Message, "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("SELECT NO_OF_BEDS, PRICE, ROOM_DESC, TOTAL_ROOMS FROM ROOM_TYPE WHERE ROOM_TYPE=:p1", dbms.con);

            cmd.Parameters.Add("p1", roomType.Text);
            OracleDataReader reader = cmd.ExecuteReader();

            if (reader.Read())
            {
                noOfBeds.Value    = Convert.ToInt32(reader["NO_OF_BEDS"].ToString());
                roomPrice.Text    = reader["PRICE"].ToString();
                roomDesc.Text     = reader["ROOM_DESC"].ToString();
                roomTotal.Text    = reader["TOTAL_ROOMS"].ToString();
                panel.Visible     = false;
                roomType.Enabled  = false;
                btnSearch.Enabled = false;
                originalBeds      = Convert.ToInt32(reader["NO_OF_BEDS"].ToString());
                originalTotal     = Convert.ToInt32(reader["TOTAL_ROOMS"].ToString());
            }
            else
            {
                MessageBox.Show("Room type ID not found", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("SELECT * FROM RESERVATION WHERE RESERVATION_ID=:p1", dbms.con);

            cmd.Parameters.Add("p1", resId.Text);
            OracleDataReader reader = cmd.ExecuteReader();

            if (reader.Read())
            {
                noOfGuests.Text   = reader["NO_OF_GUESTS"].ToString();
                checkInDate.Text  = reader["CHECK_IN"].ToString();
                checkOutDate.Text = reader["CHECK_OUT"].ToString();
                if (checkInDate.Value.Date < DateTime.Now.Date)
                {
                    MessageBox.Show("Cannot modify", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                panel.Visible     = false;
                resId.Enabled     = false;
                btnSearch.Enabled = false;
            }
            else
            {
                MessageBox.Show("Reservation ID not found", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #5
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            string        empId;
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("INSERT INTO EMPLOYEES (NAME, ADDRESS, AADHAR_NO, MOBILE_NO, USER_ID, SALARY) VALUES (:p1, :p2, :p3, :p4, :p5, :p6)", dbms.con);

            cmd.Parameters.Add("p1", name.Text);
            cmd.Parameters.Add("p2", address.Text);
            cmd.Parameters.Add("p3", aadharNo.Text);
            cmd.Parameters.Add("p4", mobileNo.Text);
            cmd.Parameters.Add("p5", userId.Text);
            cmd.Parameters.Add("p6", salary.Text);
            try
            {
                cmd.ExecuteNonQuery();
                cmd = new OracleCommand("SELECT EMP_ID_SEQ.CURRVAL FROM DUAL", dbms.con);
                OracleDataReader reader = cmd.ExecuteReader();
                reader.Read();
                empId = reader[0].ToString();
                cmd   = new OracleCommand("INSERT INTO EMP_LOGIN (EMP_ID, USER_ID, PASSWORD, ROLE) VALUES (:p1, :p2, :p3, :p4)", dbms.con);
                cmd.Parameters.Add("p1", empId);
                cmd.Parameters.Add("p2", userId.Text);
                cmd.Parameters.Add("p3", password.Text);
                cmd.Parameters.Add("p4", role.Text);
                cmd.ExecuteNonQuery();
                MessageBox.Show("Employee added successfully ID:" + empId, "Success");
                ((Form)this.TopLevelControl).Close();
            }
            catch (Exception exp)
            {
                MessageBox.Show("Employee not added\n" + exp.Message, "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #6
0
        private void Login_Click(object sender, EventArgs e)
        {
            dbconnect dbms = new dbconnect();

            dbms.connect();
            OracleCommand cmd = new OracleCommand("SELECT COUNT(*) FROM EMP_LOGIN WHERE USERID= :p1 AND PASSWORD= :p2", dbms.con);

            cmd.Parameters.Add("p1", user.Text);
            cmd.Parameters.Add("p2", pass.Text);
            OracleDataReader reader = cmd.ExecuteReader();

            reader.Read();
            if (reader["COUNT(*)"].ToString() == "1")
            {
                cmd = new OracleCommand("SELECT USERID, ROLE FROM EMP_LOGIN WHERE USERID= :p1 AND PASSWORD= :p2", dbms.con);
                cmd.Parameters.Add("p1", user.Text);
                cmd.Parameters.Add("p2", pass.Text);
                reader = cmd.ExecuteReader();
                reader.Read();
                globalVar.loginStatus = true;
                globalVar.userid      = reader["USERID"].ToString();
                globalVar.role        = reader["ROLE"].ToString();
                MessageBox.Show("User " + globalVar.userid + " logged in as " + globalVar.role, "Success");
                this.Close();
            }
            else
            {
                MessageBox.Show("Username/Password invalid");
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("SELECT * FROM EMPLOYEES WHERE EMP_ID=:p1", dbms.con);

            cmd.Parameters.Add("p1", empId.Text);
            OracleDataReader reader = cmd.ExecuteReader();

            if (reader.Read())
            {
                panel.Visible     = false;
                empId.Enabled     = false;
                btnSearch.Enabled = false;
                name.Text         = reader["NAME"].ToString();
                address.Text      = reader["ADDRESS"].ToString();
                aadharNo.Text     = reader["AADHAR_NO"].ToString();
                mobileNo.Text     = reader["MOBILE_NO"].ToString();
                userId.Text       = reader["USER_ID"].ToString();
                salary.Text       = reader["SALARY"].ToString();
            }
            else
            {
                MessageBox.Show("Employee ID not found", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("INSERT INTO CUSTOMER (NAME, ADDRESS, DATE_OF_BIRTH, AADHAR_NO, MOBILE_NO, EMAIL_ID) VALUES (:p1, :p2, :p3, :p4, :p5, :p6)", dbms.con);

            cmd.Parameters.Add("p1", name.Text);
            cmd.Parameters.Add("p2", address.Text);
            cmd.Parameters.Add("p3", dob.Value.Date);
            cmd.Parameters.Add("p4", aadharNo.Text);
            cmd.Parameters.Add("p5", mobileNo.Text);
            cmd.Parameters.Add("p6", email.Text);
            try
            {
                cmd.ExecuteNonQuery();
                cmd = new OracleCommand("SELECT CUST_ID_SEQ.CURRVAL FROM DUAL", dbms.con);
                OracleDataReader reader = cmd.ExecuteReader();
                reader.Read();
                MessageBox.Show("Customer added successfully ID:" + reader[0].ToString(), "Success");
                ((Form)this.TopLevelControl).Close();
            }
            catch (Exception exp)
            {
                MessageBox.Show("Customer not added\n" + exp.Message, "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            dbconnect dbms = new dbconnect();

            dbms.connect();
            OracleCommand cmd = new OracleCommand("UPDATE CUSTOMER SET NAME=:p1, ADDRESS=:p2, DATE_OF_BIRTH=:p3, AADHAR_NO=:p4, MOBILE_NO=:p5, EMAIL_ID=:p6 WHERE CUST_ID=:p7", dbms.con);

            cmd.Parameters.Add("p1", name.Text);
            cmd.Parameters.Add("p2", address.Text);
            cmd.Parameters.Add("p3", dob.Value.Date);
            cmd.Parameters.Add("p4", aadharNo.Text);
            cmd.Parameters.Add("p5", mobileNo.Text);
            cmd.Parameters.Add("p6", email.Text);
            cmd.Parameters.Add("p7", custId.Text);
            try
            {
                cmd.ExecuteNonQuery();
                MessageBox.Show("Customer modified successfully", "Success");
                ((Form)this.TopLevelControl).Close();
            }
            catch (Exception exp)
            {
                MessageBox.Show("Customer not modified\n" + exp.Message, "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            dbconnect dbms = new dbconnect();

            dbms.connect();
            OracleCommand cmd = new OracleCommand("SELECT * FROM CUSTOMER WHERE CUST_ID=:p1", dbms.con);

            cmd.Parameters.Add("p1", custId.Text);
            OracleDataReader reader = cmd.ExecuteReader();

            if (reader.Read())
            {
                panel.Visible = false;
                name.Text     = reader["NAME"].ToString();
                address.Text  = reader["ADDRESS"].ToString();
                dob.Text      = reader["DATE_OF_BIRTH"].ToString();
                aadharNo.Text = reader["AADHAR_NO"].ToString();
                mobileNo.Text = reader["MOBILE_NO"].ToString();
                email.Text    = reader["EMAIL_ID"].ToString();
            }
            else
            {
                MessageBox.Show("Customer ID not found", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("UPDATE EMPLOYEES SET NAME=:p1, ADDRESS=:p2, AADHAR_NO=:p3, MOBILE_NO=:p4, USER_ID=:p5, SALARY=:p6 WHERE EMP_ID=:p7", dbms.con);

            cmd.Parameters.Add("p1", name.Text);
            cmd.Parameters.Add("p2", address.Text);
            cmd.Parameters.Add("p3", aadharNo.Text);
            cmd.Parameters.Add("p4", mobileNo.Text);
            cmd.Parameters.Add("p5", userId.Text);
            cmd.Parameters.Add("p6", salary.Text);
            cmd.Parameters.Add("p7", empId.Text);
            try
            {
                cmd.ExecuteNonQuery();
                cmd = new OracleCommand("UPDATE EMP_LOGIN SET USER_ID=:p1 , PASSWORD=:p2 , ROLE=:p3 WHERE EMP_ID=:p4", dbms.con);
                cmd.Parameters.Add("p1", userId.Text);
                cmd.Parameters.Add("p2", password.Text);
                cmd.Parameters.Add("p3", role.Text);
                cmd.Parameters.Add("p4", empId);
                cmd.ExecuteNonQuery();
                MessageBox.Show("Employee modified successfully ID:" + empId.Text, "Success");
                ((Form)this.TopLevelControl).Close();
            }
            catch (Exception exp)
            {
                MessageBox.Show("Employee not modified\n" + exp.Message, "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private bool checkAvailability()
        {
            int           booked;
            int           total;
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("SELECT TOTAL_ROOMS FROM ROOM_TYPE WHERE ROOM_TYPE=:p1", dbms.con);

            cmd.Parameters.Add("p1", btnChoose.Text);
            OracleDataReader reader = cmd.ExecuteReader();

            reader.Read();
            total = Convert.ToInt32(reader["TOTAL_ROOMS"].ToString());

            for (DateTime date = checkInDate.Value; date <= checkOutDate.Value; date = date.AddDays(1))
            {
                cmd = new OracleCommand("SELECT COUNT(*) FROM RESERVATION WHERE ROOM_TYPE=:p1 AND CHECK_IN<=:p2 AND CHECK_OUT>=:p2 AND RESERVATION_ID!= :p3", dbms.con);
                cmd.Parameters.Add("p1", btnChoose.Text);
                cmd.Parameters.Add("p2", date.Date);
                cmd.Parameters.Add("p2", date.Date);
                cmd.Parameters.Add("p3", resId.Text);
                reader = cmd.ExecuteReader();
                reader.Read();
                booked = Convert.ToInt32(reader["COUNT(*)"].ToString());
                if ((total - booked) <= 0)
                {
                    return(false);
                }
            }
            return(true);
        }
Beispiel #13
0
 private void btnPay_Click(object sender, EventArgs e)
 {
     if (rbCard.Checked == true)
     {
         if (cardNo.Text == "")
         {
             MessageBox.Show("Enter valid card number", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         if (cardName.Text == "")
         {
             MessageBox.Show("Enter valid name on card", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         if (cardExpDate.Value <= DateTime.Now)
         {
             MessageBox.Show("Card expired", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         if (cardCvv.Text == "")
         {
             MessageBox.Show("Enter valid card cvv", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         dbconnect     dbms = new dbconnect();
         OracleCommand cmd  = new OracleCommand("INSERT INTO TRANSACTION (PAYMENT_METHOD, CARD_TYPE, CARD_NO, CARD_NAME, CARD_EXP, CARD_CVV, PAYMENT_DATE) values (:p1, :p2, :p3, :p4, :p5, :p6, :p7)", dbms.con);
         cmd.Parameters.Add("p1", rbCard.Text);
         if (rbVisa.Checked)
         {
             cmd.Parameters.Add("p2", rbVisa.Text);
         }
         else
         {
             cmd.Parameters.Add("p2", rbMaster.Text);
         }
         cmd.Parameters.Add("p3", cardNo.Text);
         cmd.Parameters.Add("p4", cardName.Text);
         cmd.Parameters.Add("p5", cardExpDate.Value.Date);
         cmd.Parameters.Add("p6", cardCvv.Text);
         cmd.Parameters.Add("p7", DateTime.Now.Date);
         try
         {
             cmd.ExecuteNonQuery();
             cmd = new OracleCommand("SELECT TRANSACTION_ID_SEQ.CURRVAL FROM DUAL", dbms.con);
             OracleDataReader reader = cmd.ExecuteReader();
             reader.Read();
             MessageBox.Show("Payment successful ID:" + reader[0].ToString(), "Success");
             transId      = reader[0].ToString();
             transSuccess = true;
         }
         catch (Exception exp)
         {
             MessageBox.Show("Payment not successful\n" + exp.Message, "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Beispiel #14
0
        private void btnEmployees_Click(object sender, EventArgs e)
        {
            dbconnect        dbms      = new dbconnect();
            OracleCommand    cmd       = new OracleCommand("SELECT * FROM EMPLOYEES e INNER JOIN EMP_LOGIN el ON e.EMP_ID=el.EMP_ID", dbms.con);
            OracleDataReader reader    = cmd.ExecuteReader();
            DataTable        dataTable = new DataTable();

            dataTable.Load(reader);
            dataGridView.DataSource = dataTable;
        }
Beispiel #15
0
        private void btnTransaction_Click(object sender, EventArgs e)
        {
            dbconnect        dbms      = new dbconnect();
            OracleCommand    cmd       = new OracleCommand("SELECT * FROM TRANSACTION", dbms.con);
            OracleDataReader reader    = cmd.ExecuteReader();
            DataTable        dataTable = new DataTable();

            dataTable.Load(reader);
            dataGridView.DataSource = dataTable;
        }
Beispiel #16
0
        private void btnCustomer_Click(object sender, EventArgs e)
        {
            dbconnect        dbms      = new dbconnect();
            OracleCommand    cmd       = new OracleCommand("SELECT * FROM CUSTOMER", dbms.con);
            OracleDataReader reader    = cmd.ExecuteReader();
            DataTable        dataTable = new DataTable();

            dataTable.Load(reader);
            dataGridView.DataSource = dataTable;
        }
Beispiel #17
0
        private void roomChooseForm_Load(object sender, EventArgs e)
        {
            dbconnect        dbms   = new dbconnect();
            OracleCommand    cmd    = new OracleCommand("SELECT ROOM_TYPE, ROOM_DESC, NO_OF_BEDS, PRICE FROM ROOM_TYPE", dbms.con);
            OracleDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                this.dataGridView.Rows.Add(reader["ROOM_TYPE"], reader["ROOM_DESC"], reader["NO_OF_BEDS"], reader["PRICE"]);
            }
        }
Beispiel #18
0
        private void itemChooseForm_Load(object sender, EventArgs e)
        {
            dbconnect        dbms   = new dbconnect();
            OracleCommand    cmd    = new OracleCommand("SELECT ITEM_ID, ITEM_NAME, ITEM_PRICE FROM ITEMS", dbms.con);
            OracleDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                this.dataGridView.Rows.Add(reader["ITEM_ID"], reader["ITEM_NAME"], reader["ITEM_PRICE"]);
            }
        }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (btnChoose.Enabled == true)
            {
                MessageBox.Show("Please choose a room", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (checkInDate.Value > checkOutDate.Value)
            {
                MessageBox.Show("Check-out date can't be before check-in", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (Convert.ToInt32(noOfGuests.Text) > roomSize)
            {
                MessageBox.Show("Room too small! Choose again", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                btnChoose.Text    = "Choose";
                btnChoose.Enabled = true;
                return;
            }
            if (!checkAvailability())
            {
                MessageBox.Show("Room type not available on selected days", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                btnChoose.Text    = "Choose";
                btnChoose.Enabled = true;
                return;
            }
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("INSERT INTO RESERVATION (NO_OF_GUESTS, CHECK_IN, CHECK_OUT, CUST_ID, ROOM_TYPE) VALUES (:p1, :p2, :p3, :p4, :p5)", dbms.con);

            cmd.Parameters.Add("p1", noOfGuests.Text);
            cmd.Parameters.Add("p2", checkInDate.Value.Date);
            cmd.Parameters.Add("p3", checkOutDate.Value.Date);
            cmd.Parameters.Add("p4", custId.Text);
            cmd.Parameters.Add("p5", btnChoose.Text);
            try
            {
                cmd.ExecuteNonQuery();
                cmd = new OracleCommand("SELECT RESERVATION_ID_SEQ.CURRVAL FROM DUAL", dbms.con);
                OracleDataReader reader = cmd.ExecuteReader();
                reader.Read();
                MessageBox.Show("Reservation created successfully ID:" + reader[0].ToString(), "Success");
                ((Form)this.TopLevelControl).Close();
            }
            catch (Exception exp)
            {
                MessageBox.Show("Reservation not created\n" + exp.Message, "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("DELETE FROM RESERVATION WHERE RESERVATION_ID=:p1", dbms.con);

            cmd.Parameters.Add("p1", resId.Text);
            try
            {
                cmd.ExecuteNonQuery();
                MessageBox.Show("Reservation successfully deleted", "Success");
                ((Form)this.TopLevelControl).Close();
            }
            catch (Exception exp)
            {
                MessageBox.Show("Reservation not deleted\n" + exp.Message, "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (btnChoose.Enabled == true)
            {
                MessageBox.Show("Please choose a room", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (checkInDate.Value > checkOutDate.Value)
            {
                MessageBox.Show("Check-out date can't be before check-in", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (Convert.ToInt32(noOfGuests.Text) > roomSize)
            {
                MessageBox.Show("Room too small! Choose again", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                btnChoose.Text    = "Choose";
                btnChoose.Enabled = true;
                return;
            }
            if (!checkAvailability())
            {
                MessageBox.Show("Room type not available on selected days", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                btnChoose.Text    = "Choose";
                btnChoose.Enabled = true;
                return;
            }
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("UPDATE RESERVATION SET NO_OF_GUESTS= :p1, CHECK_IN= :p2, CHECK_OUT= :p3, ROOM_TYPE= :p4 WHERE RESERVATION_ID= :p5", dbms.con);

            cmd.Parameters.Add("p1", noOfGuests.Text);
            cmd.Parameters.Add("p2", checkInDate.Value.Date);
            cmd.Parameters.Add("p3", checkOutDate.Value.Date);
            cmd.Parameters.Add("p4", btnChoose.Text);
            cmd.Parameters.Add("p5", resId.Text);
            try
            {
                cmd.ExecuteNonQuery();
                MessageBox.Show("Reservation successfully modified ID:" + resId.Text, "Success");
                ((Form)this.TopLevelControl).Close();
            }
            catch (Exception exp)
            {
                MessageBox.Show("Reservation not created\n" + exp.Message, "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("UPDATE ORDERS SET ITEM_ID=:p1 WHERE ORDER_ID=:p2", dbms.con);

            cmd.Parameters.Add("p1", btnChoose.Text);
            cmd.Parameters.Add("p2", orderId.Text);
            try
            {
                cmd.ExecuteNonQuery();
                MessageBox.Show("Order modified successfully ID:" + orderId.Text, "Success");
                ((Form)this.TopLevelControl).Close();
            }
            catch (Exception exp)
            {
                MessageBox.Show("Order not modified\n" + exp.Message, "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #23
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (Convert.ToInt32(roomPrice.Text) <= 0)
            {
                MessageBox.Show("Enter valid price", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (Convert.ToInt32(roomTotal.Text) < originalTotal)
            {
                MessageBox.Show("Enter valid no. of rooms", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                roomTotal.Text = originalTotal.ToString();
                return;
            }
            if (Convert.ToInt32(noOfBeds.Text) < originalBeds)
            {
                MessageBox.Show("Enter valid no. of beds", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                noOfBeds.Text = originalBeds.ToString();
                return;
            }
            if (roomDesc.Text == "")
            {
                MessageBox.Show("Enter valid room type description", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("UPDATE ROOM_TYPE SET NO_OF_BEDS= :p1, PRICE= :p2, ROOM_DESC= :p3, TOTAL_ROOMS= :p4 WHERE ROOM_TYPE=:p5", dbms.con);

            cmd.Parameters.Add("p1", noOfBeds.Text);
            cmd.Parameters.Add("p2", roomPrice.Text);
            cmd.Parameters.Add("p3", roomDesc.Text);
            cmd.Parameters.Add("p4", roomTotal.Text);
            cmd.Parameters.Add("p5", roomType.Text);
            try
            {
                cmd.ExecuteNonQuery();
                MessageBox.Show("Room type modified successfully ID:" + roomType.Text, "Success");
                ((Form)this.TopLevelControl).Close();
            }
            catch (Exception exp)
            {
                MessageBox.Show("Room type not modified\n" + exp.Message, "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #24
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("UPDATE ITEMS SET ITEM_NAME=:p1, ITEM_PRICE=:p2 WHERE ITEM_ID=:p3", dbms.con);

            cmd.Parameters.Add("p1", itemName.Text);
            cmd.Parameters.Add("p2", itemPrice.Text);
            cmd.Parameters.Add("p3", itemId.Text);
            try
            {
                cmd.ExecuteNonQuery();
                MessageBox.Show("Item modified successfully ID:" + itemId.Text, "Success");
                ((Form)this.TopLevelControl).Close();
            }
            catch (Exception exp)
            {
                MessageBox.Show("Item not modified\n" + exp.Message, "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("DELETE FROM EMPLOYEES WHERE EMP_ID=:p1", dbms.con);

            cmd.Parameters.Add("p1", empId.Text);
            try
            {
                cmd.ExecuteNonQuery();
                cmd = new OracleCommand("DELETE FROM EMP_LOGIN WHERE EMP_ID=:p1", dbms.con);
                cmd.Parameters.Add("p1", empId.Text);
                cmd.ExecuteNonQuery();
                MessageBox.Show("Employee deleted successfully ID:" + empId.Text, "Success");
                ((Form)this.TopLevelControl).Close();
            }
            catch (Exception exp)
            {
                MessageBox.Show("Employee not deleted\n" + exp.Message, "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("SELECT COUNT(*) FROM CUSTOMER WHERE CUST_ID=:p1", dbms.con);

            cmd.Parameters.Add("p1", custId.Text);
            OracleDataReader reader = cmd.ExecuteReader();

            reader.Read();
            if (reader["COUNT(*)"].ToString() == "1")
            {
                panel.Visible     = false;
                custId.Enabled    = false;
                btnSearch.Enabled = false;
            }
            else
            {
                MessageBox.Show("Customer ID not found", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("SELECT ITEM_ID FROM ORDERS WHERE ORDER_ID=:p1", dbms.con);

            cmd.Parameters.Add("p1", orderId.Text);
            OracleDataReader reader = cmd.ExecuteReader();

            if (reader.Read())
            {
                panel.Visible     = false;
                orderId.Enabled   = false;
                btnSearch.Enabled = false;
                btnChoose.Text    = reader["ITEM_ID"].ToString();
            }
            else
            {
                MessageBox.Show("Order ID not found", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #28
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("SELECT * FROM ITEMS WHERE ITEM_ID=:p1", dbms.con);

            cmd.Parameters.Add("p1", itemId.Text);
            OracleDataReader reader = cmd.ExecuteReader();

            if (reader.Read())
            {
                panel.Visible     = false;
                itemId.Enabled    = false;
                btnSearch.Enabled = false;
                itemName.Text     = reader["ITEM_NAME"].ToString();
                itemPrice.Text    = reader["ITEM_PRICE"].ToString();
            }
            else
            {
                MessageBox.Show("Item ID not found", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #29
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("INSERT INTO ORDERS (RESERVATION_ID, ITEM_ID, ORDER_DATE) VALUES (:p1, :p2, :p3)", dbms.con);

            cmd.Parameters.Add("p1", resId.Text);
            cmd.Parameters.Add("p2", btnChoose.Text);
            cmd.Parameters.Add("p3", DateTime.Now.Date);
            try
            {
                cmd.ExecuteNonQuery();
                cmd = new OracleCommand("SELECT ORDER_ID_SEQ.CURRVAL FROM DUAL", dbms.con);
                OracleDataReader reader = cmd.ExecuteReader();
                reader.Read();
                MessageBox.Show("Order created successfully ID:" + reader[0].ToString(), "Success");
                ((Form)this.TopLevelControl).Close();
            }
            catch (Exception exp)
            {
                MessageBox.Show("Order not created\n" + exp.Message, "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #30
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (Convert.ToInt32(roomPrice.Text) <= 0)
            {
                MessageBox.Show("Enter valid price", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (Convert.ToInt32(roomTotal.Text) <= 0)
            {
                MessageBox.Show("Enter valid no. of rooms", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (roomDesc.Text == "")
            {
                MessageBox.Show("Enter valid room type description", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            dbconnect     dbms = new dbconnect();
            OracleCommand cmd  = new OracleCommand("INSERT INTO ROOM_TYPE (NO_OF_BEDS, PRICE, ROOM_DESC, TOTAL_ROOMS) VALUES (:p1, :p2, :p3, :p4)", dbms.con);

            cmd.Parameters.Add("p1", noOfBeds.Text);
            cmd.Parameters.Add("p2", roomPrice.Text);
            cmd.Parameters.Add("p3", roomDesc.Text);
            cmd.Parameters.Add("p4", roomTotal.Text);
            try
            {
                cmd.ExecuteNonQuery();
                cmd = new OracleCommand("SELECT ROOM_TYPE_SEQ.CURRVAL FROM DUAL", dbms.con);
                OracleDataReader reader = cmd.ExecuteReader();
                reader.Read();
                MessageBox.Show("Room type added successfully ID:" + reader[0].ToString(), "Success");
                ((Form)this.TopLevelControl).Close();
            }
            catch (Exception exp)
            {
                MessageBox.Show("Room type not added\n" + exp.Message, "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }