Example #1
0
        private void block_but_Click(object sender, RoutedEventArgs e)
        {
            if (room_no.Text != "" && blockdate.SelectedDate != null && block_time.Text != "" && releasedate.SelectedDate != null && release_time.Text != "")
            {
                if (block_remark.Text == null)
                {
                    block_remark.Text = "nil";
                }

                room_update block = new room_update();
                block.room_no       = room_no.Text;
                block.room_type     = rtype.Text;
                block.status        = "3";
                block.s_name        = dbhandler.name;
                block.checkin_date  = blockdate.Text;
                block.checkin_time  = block_time.Text;
                block.checkout_date = releasedate.Text;
                block.checkout_time = release_time.Text;
                block.remark        = block_remark.Text;
                block.phonenumber   = "0";
                bool success = dbhandler.room_status_update(block);

                switch (success)
                {
                case true:
                    dbhandler.msgbox("ROOM:\n" + room_no.Text + "\nMOVED TO BLOCK STATE", "ROOM BLOCK", "Ok", "", false);
                    clear();
                    break;

                case false:
                    MaterialMessageBox.ShowError("ROOM NOT BLOCKED\n" + room_no.Text);
                    clear();
                    break;
                }
            }
            else
            {
                MaterialMessageBox.ShowError("EMPTY CREDENTIALS");
            }
        }
        private void release_but_Click(object sender, RoutedEventArgs e)
        {
            if (room_no.Text != "")
            {
                if (release_remark.Text == null)
                {
                    release_remark.Text = "clean";
                }
                room_update block = new room_update();
                block.room_no       = room_no.Text;
                block.room_type     = rtype.Text;
                block.status        = "1";
                block.s_name        = dbhandler.name;
                block.checkin_date  = "0";
                block.checkin_time  = "0";
                block.checkout_date = releasedate.Text;
                block.checkout_time = release_time.Text;
                block.remark        = release_remark.Text;
                block.phonenumber   = "0";
                bool success = dbhandler.room_status_update(block);

                switch (success)
                {
                case true:
                    dbhandler.msgbox("ROOM:\n" + room_no.Text + "\nCLEANED AND MOVED TO VACANT STATE", "ROOM CLEAN", "Ok", "", false);
                    clear();
                    break;

                case false:
                    MaterialMessageBox.ShowError("ROOM:\n" + room_no.Text + "\nNOT CLEANED");
                    clear();
                    break;
                }
            }
            else
            {
                MaterialMessageBox.ShowError("EMPTY CREDENTIALS");
            }
        }