Example #1
0
        private void dataGridView5_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try {
                this.reff    = dataGridView5.CurrentRow.Cells[0].Value.ToString();
                this.name    = dataGridView5.CurrentRow.Cells[1].Value.ToString();
                this.owner   = dataGridView5.CurrentRow.Cells[2].Value.ToString();
                this.resdate = dataGridView5.CurrentRow.Cells[3].Value.ToString();
                this.email   = dataGridView5.CurrentRow.Cells[4].Value.ToString();
                this.phone   = dataGridView5.CurrentRow.Cells[5].Value.ToString();
                this.days    = dataGridView5.CurrentRow.Cells[6].Value.ToString();
            } catch (Exception) { }

            dbClass      db     = new dbClass();
            DialogResult result = MessageBox.Show("Check in?", "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (result.Equals(DialogResult.OK))
            {
                db.dbUpdate("UPDATE room SET owner = '" + this.owner + "', state='reserved', reserveddate='" + this.resdate + "', email='" + this.email + "', phone='" + this.phone + "', days='" + this.days + "', reference='" + this.reff + "' WHERE name='" + this.name + "'");
                db.dbUpdate("DELETE FROM room_ind WHERE reference='" + this.reff + "'");
                setRoomState();
                getRoomsCount();
                getCheckoutLog();
                showHide("client", false);
                showHide("menu", true);
                MessageBox.Show(this.owner + " has been checked in!");
            }
            else
            {
            }
        }
Example #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            dbClass db = new dbClass();

            db.dbUpdate("UPDATE security SET email = '" + txtEmail.Text + "', password = '******', usertype = '" + cmbType.Text + "', fullname = '" + txtFullName.Text + "' WHERE id = " + this.userid);
            this.Hide();
            MessageBox.Show("User Updated!");
        }
Example #3
0
        private void btnPaid_Click(object sender, EventArgs e)
        {
            dbClass db = new dbClass();

            db.dbUpdate("UPDATE room SET state='occupied' WHERE id='" + txtRoomId.Text + "'");
            showHide("client", false);
            showHide("menu", true);
            setRoomState();
            getCheckoutLog();
            MessageBox.Show("Success!");
        }
Example #4
0
        private void btnAvailable_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Checkout", "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (result.Equals(DialogResult.OK))
            {
                dbClass db = new dbClass();
                db.dbUpdate("UPDATE room SET owner = '', state='available', reserveddate='', email='', phone='', days=1, reference='' WHERE id=" + txtRoomId.Text);
                db.dbUpdate("UPDATE reservelog SET state='checkout', checkoutdate='" + getDateTime() + "' WHERE reference='" + labelRef.Text + "'");
                showHide("menu", true);
                showHide("client", false);
                setRoomState();
                getRoomsCount();
                getCheckoutLog();
                RecentCheckOutTab.Hide();
                RecentCheckOutTab.Show();
                MessageBox.Show("Room " + txtRoomId.Text + " is now available!");
            }
            else
            {
            }
        }
Example #5
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (txtEmail.Text.Contains('@'))
     {
         dbClass db = new dbClass();
         if (txtRoomOwner.Text == "" || txtEmail.Text == "")
         {
             MessageBox.Show("Fill up all forms!");
         }
         else
         {
             if (checkDateIfExist() == false)
             {
                 System.Data.DataTable owner = db.dbSelect("SELECT * FROM client WHERE name='" + txtRoomOwner.Text + "'");
                 if (owner.Rows.Count == 0)
                 {
                     db.dbInsert("INSERT INTO client (name, email, phone) VALUES('" + txtRoomOwner.Text + "', '" + txtEmail.Text + "', '" + txtMobile.Text + "')");
                 }
                 else
                 {
                     db.dbUpdate("UPDATE client SET name = '" + txtRoomOwner.Text + "', email='" + txtEmail.Text + "', phone='" + txtMobile.Text + "' WHERE name='" + txtRoomOwner.Text + "'");
                 }
                 decimal percent = (decimal)0.70;
                 double  formula = Convert.ToDouble((noOfDays.Value * 2000) - (((noOfDays.Value * 2000) * percent)));
                 db.dbInsert("INSERT INTO room_ind (name, owner, reserveddate, email, phone, days, reference) VALUES('Room " + txtRoomId.Text + "', '" + txtRoomOwner.Text + "', '" + dateTimeFrom.Text + "', '" + txtEmail.Text + "', '" + txtMobile.Text + "', '" + noOfDays.Value + "', '" + this.reference + "')");
                 db.dbInsert("INSERT INTO reservelog (name, owner, reserveddate, email, phone, days, balance, reference) VALUES('Room " + txtRoomId.Text + "', '" + txtRoomOwner.Text + "', '" + dateTimeFrom.Text + "', '" + txtEmail.Text + "', '" + txtMobile.Text + "', '" + noOfDays.Value + "', '" + formula + "', '" + this.reference + "')");
                 showHide("client", false);
                 showHide("menu", true);
                 setRoomState();
                 getRoomsCount();
                 getCheckoutLog();
                 sendMail(txtRoomOwner.Text, txtEmail.Text, txtRoomId.Text, dateTimeFrom.Text, noOfDays.Value);
                 RecentCheckOutTab.Hide();
                 RecentCheckOutTab.Show();
                 MessageBox.Show("Room Reserved to " + txtRoomOwner.Text);
                 clearFields();
                 genReference();
             }
             else
             {
                 MessageBox.Show("Reservation date exist!");
             }
         }
     }
     else
     {
         MessageBox.Show("Enter valid email address!");
     }
 }
Example #6
0
        private void btnCancel_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Cancel", "Confirm", MessageBoxDefaultButton.Button1, MessageBoxIcon.Information);

            if (result.Equals(DialogResult.OK))
            {
                dbClass db = new dbClass();
                db.dbUpdate("UPDATE room SET owner = '', state='available', reserveddate='', email='', phone='', days=1 WHERE id=" + txtRoomId.Text);
                showHide("menu", true);
                showHide("client", false);
                setRoomState();
                getRoomsCount();
                getCheckoutLog();
                RecentCheckOutTab.Hide();
                RecentCheckOutTab.Show();
                MessageBox.Show("Room " + txtRoomId.Text + " is now available!");
            }
            else
            {
            }
        }