Exemple #1
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string putUrl = "http://localhost/phptest/web_service/sample2.php/Booking/BookingId/";
            string data;
            string id;
            //DateTime today = DateTime.Today;
            //MessageBox.Show(today.ToString());
            if (e.ColumnIndex == 6 && e.RowIndex >= 0)
            {
                if (dataGridView1.Rows[e.RowIndex].Cells[5].Value.ToString() == "" || dataGridView1.Rows[e.RowIndex].Cells[5].Value.ToString() == "-") return;
                else{
                //delete booking on card and on database
                    try
                    {

                       id = Regex.Replace(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(), "[^.0-9]", "");
                       data = send_http_request("PUT", "http://localhost/phptest/web_service/sample2.php/Booking/BookingId/delete/" + id, new { string_delete = "delete" });
                       //MessageBox.Show(data);
                        uBook = jser.Deserialize<Booking>(data);

                            if (uBook.error == "true")
                            {
                                MessageBox.Show("Fail to delete booking1");
                            }
                            else
                            {
                                //delete ticket on card, update radio button
                                if (delete_ticket(id))
                                {
                                    MessageBox.Show("Ticket Deleted!");
                                    dataGridView1.Rows.Clear();
                                    dataGridView1.Columns.RemoveAt(6);
                                    fetch_ticket();

                                    //MessageBox.Show(data);
                                }
                                else MessageBox.Show("Fail to delete booking on card!");
                            }
                    }
                    catch
                    {
                        logBox1.Items.Add("Fail to delete booking!");
                    }
                }
            }
        }
Exemple #2
0
        private void fetch_ticket()
        {
            string temp_book_id = "";
            string temp_title = "";
            string temp_venue = "";
            string temp_sched = "";
            string temp_e_tclass = "";
            string temp_status = "";
            string temp_book_id2 = "";
            string bData;
            string sb3 = "http://localhost/phptest/web_service/sample2.php/Booking/BookingId/";
            JavaScriptSerializer ser2 = new JavaScriptSerializer();
            Booking userBooking = new Booking();
            //select first ticket object
            SelectFile(0xBB, 0x22);

            if (retcode != ModWinsCard.SCARD_S_SUCCESS)
            {
                logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                return;
            }

            //read flag
            readRecord(0x00, 0x32);

            if (retcode != ModWinsCard.SCARD_S_SUCCESS)
            {
                logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                return;
            }

            // Display data read from card to textbox
            string tmpStr = "";
            indx = 0;

            while (RecvBuff[indx] != 0x00)
            {

                tmpStr = tmpStr + Chr(RecvBuff[indx]);
                indx = indx + 1;
            }
            tmpStr = tmpStr.Substring(0,11);    //remove trailing characters since size is 50
            if (tmpStr == "unallocated")
            {
                this.dataGridView1.Rows.Add("-", "-", "-", "-", "-", "-");
                radioButton1.Enabled = true;
                //this.dataGridView1.Rows.Insert(0, "one", "two", "three", "four","five");
            }

            else { //read rest of the record
                //read book id
                readRecord(0x01, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_book_id = tmpStr;
                temp_book_id2 = Regex.Replace(tmpStr, "[^.0-9]", "");
                //MessageBox.Show(temp_book_id.Length.ToString());
                //read title
                readRecord(0x02, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_title = tmpStr;

                //read venue
                readRecord(0x03, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_venue = tmpStr;

                //read sched
                readRecord(0x04, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_sched = tmpStr;

                //read status
                /*
                readRecord(0x05, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_status = tmpStr;
                */

                //try to get status in web service
                try
                {
                    bData = send_http_request("GET", sb3 + temp_book_id2, null);
                    userBooking = ser2.Deserialize<Booking>(bData);
                    temp_status = userBooking.status;
                }
                catch {
                    temp_status = "Unavailable";
                }

                //read ticket class
                readRecord(0x06, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_e_tclass = tmpStr;

                this.dataGridView1.Rows.Add(temp_book_id, temp_title, temp_venue, temp_sched, temp_e_tclass, temp_status);
                radioButton1.Enabled = false;
            }

            //select second ticket object
            SelectFile(0xCC, 0x33);

            if (retcode != ModWinsCard.SCARD_S_SUCCESS)
            {
                logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                return;
            }

            //read flat
            readRecord(0x00, 0x32);

            if (retcode != ModWinsCard.SCARD_S_SUCCESS)
            {
                logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                return;
            }

            // Display data read from card to textbox
            tmpStr = "";
            indx = 0;

            while (RecvBuff[indx] != 0x00)
            {

                tmpStr = tmpStr + Chr(RecvBuff[indx]);
                indx = indx + 1;
            }
            tmpStr = tmpStr.Substring(0, 11);    //remove trailing characters since size is 50
            if (tmpStr == "unallocated")
            {
                this.dataGridView1.Rows.Add("-", "-", "-", "-", "-", "-");
                radioButton2.Enabled = true;
                //this.dataGridView1.Rows.Insert(0, "one", "two", "three", "four","five");
            }
            else
            { //read rest of the record
                //read book id
                readRecord(0x01, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_book_id = tmpStr;
                temp_book_id2 = Regex.Replace(tmpStr, "[^.0-9]", "");
                //read title
                readRecord(0x02, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_title = tmpStr;

                //read venue
                readRecord(0x03, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_venue = tmpStr;

                //read sched
                readRecord(0x04, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_sched = tmpStr;

                //read status
                /*
                readRecord(0x05, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_status = tmpStr;
                */
                //try to get status in web service
                try
                {
                    bData = send_http_request("GET", sb3 + temp_book_id2, null);
                    userBooking = ser2.Deserialize<Booking>(bData);
                    temp_status = userBooking.status;
                }
                catch
                {
                    temp_status = "Unavailable";
                }

                //read ticket class
                readRecord(0x06, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_e_tclass = tmpStr;

                this.dataGridView1.Rows.Add(temp_book_id, temp_title, temp_venue, temp_sched, temp_e_tclass, temp_status);

                radioButton2.Enabled = false;
            }

            //select third ticket object
            SelectFile(0xDD, 0x44);

            if (retcode != ModWinsCard.SCARD_S_SUCCESS)
            {
                logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                return;
            }

            //read flat
            readRecord(0x00, 0x32);

            if (retcode != ModWinsCard.SCARD_S_SUCCESS)
            {
                logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                return;
            }

            // Display data read from card to textbox
            tmpStr = "";
            indx = 0;

            while (RecvBuff[indx] != 0x00)
            {

                tmpStr = tmpStr + Chr(RecvBuff[indx]);
                indx = indx + 1;
            }
            tmpStr = tmpStr.Substring(0, 11);    //remove trailing characters since size is 50
            if (tmpStr == "unallocated")
            {
                this.dataGridView1.Rows.Add("-", "-", "-", "-", "-", "-");
                radioButton3.Enabled = true;
                //this.dataGridView1.Rows.Insert(0, "one", "two", "three", "four","five");
            }
            else
            { //read rest of the record
                //read book id
                readRecord(0x01, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_book_id = tmpStr;
                temp_book_id2 = Regex.Replace(tmpStr, "[^.0-9]", "");
                //read title
                readRecord(0x02, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_title = tmpStr;

                //read venue
                readRecord(0x03, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_venue = tmpStr;

                //read sched
                readRecord(0x04, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_sched = tmpStr;

                //read status
                /*
                readRecord(0x05, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox13.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_status = tmpStr;
                */
                try
                {
                    bData = send_http_request("GET", sb3 + temp_book_id2, null);
                    userBooking = ser2.Deserialize<Booking>(bData);
                    temp_status = userBooking.status;
                }
                catch
                {
                    temp_status = "Unavailable";
                }

                //read ticket class
                readRecord(0x06, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_e_tclass = tmpStr;

                this.dataGridView1.Rows.Add(temp_book_id, temp_title, temp_venue, temp_sched, temp_e_tclass, temp_status);

                radioButton3.Enabled = false;
            }

            //select 4th ticket object
            SelectFile(0xEE, 0x55);

            if (retcode != ModWinsCard.SCARD_S_SUCCESS)
            {
                logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                return;
            }

            //read flat
            readRecord(0x00, 0x32);

            if (retcode != ModWinsCard.SCARD_S_SUCCESS)
            {
                logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                return;
            }

            // Display data read from card to textbox
            tmpStr = "";
            indx = 0;

            while (RecvBuff[indx] != 0x00)
            {

                tmpStr = tmpStr + Chr(RecvBuff[indx]);
                indx = indx + 1;
            }
            tmpStr = tmpStr.Substring(0, 11);    //remove trailing characters since size is 50
            if (tmpStr == "unallocated")
            {
                this.dataGridView1.Rows.Add("-", "-", "-", "-", "-", "-");
                radioButton4.Enabled = true;
                //this.dataGridView1.Rows.Insert(0, "one", "two", "three", "four","five");
            }
            else
            { //read rest of the record
                //read book id
                readRecord(0x01, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_book_id = tmpStr;
                temp_book_id2 = Regex.Replace(tmpStr, "[^.0-9]", "");

                //read title
                readRecord(0x02, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_title = tmpStr;

                //read venue
                readRecord(0x03, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_venue = tmpStr;

                //read sched
                readRecord(0x04, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_sched = tmpStr;

                //read status
                /*
                readRecord(0x05, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_status = tmpStr;
                */
                //try to get status in web service
                try
                {
                    bData = send_http_request("GET", sb3 + temp_book_id2, null);
                    userBooking = ser2.Deserialize<Booking>(bData);
                    temp_status = userBooking.status;
                }
                catch
                {
                    temp_status = "Unavailable";
                }

                //read ticket class
                readRecord(0x06, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_e_tclass = tmpStr;

                this.dataGridView1.Rows.Add(temp_book_id, temp_title, temp_venue, temp_sched, temp_e_tclass, temp_status);

                radioButton4.Enabled = false;
            }

            //select 5th ticket object
            SelectFile(0xE1, 0x66);

            if (retcode != ModWinsCard.SCARD_S_SUCCESS)
            {
                logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                return;
            }

            //read flat
            readRecord(0x00, 0x32);

            if (retcode != ModWinsCard.SCARD_S_SUCCESS)
            {
                logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                return;
            }

            // Display data read from card to textbox
            tmpStr = "";
            indx = 0;

            while (RecvBuff[indx] != 0x00)
            {

                tmpStr = tmpStr + Chr(RecvBuff[indx]);
                indx = indx + 1;
            }
            tmpStr = tmpStr.Substring(0, 11);    //remove trailing characters since size is 50
            if (tmpStr == "unallocated")
            {
                this.dataGridView1.Rows.Add("-", "-", "-", "-", "-", "-");
                radioButton5.Enabled = true;
                //this.dataGridView1.Rows.Insert(0, "one", "two", "three", "four","five");
            }
            else
            { //read rest of the record
                //read book id
                readRecord(0x01, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_book_id = tmpStr;
                temp_book_id2 = Regex.Replace(tmpStr, "[^.0-9]", "");
                //read title
                readRecord(0x02, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_title = tmpStr;

                //read venue
                readRecord(0x03, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_venue = tmpStr;

                //read sched
                readRecord(0x04, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_sched = tmpStr;

                //read status
                /*
                readRecord(0x05, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_status = tmpStr;
                */
                //try to get status in web service
                try
                {
                    bData = send_http_request("GET", sb3 + temp_book_id2, null);
                    userBooking = ser2.Deserialize<Booking>(bData);
                    temp_status = userBooking.status;
                }
                catch
                {
                    temp_status = "Unavailable";
                }
                //read ticket class
                readRecord(0x06, 0x32);

                if (retcode != ModWinsCard.SCARD_S_SUCCESS)
                {
                    logBox1.Items.Add(ModWinsCard.GetScardErrMsg(retcode));
                    return;
                }

                // Display data read from card to textbox
                tmpStr = "";
                indx = 0;

                while (RecvBuff[indx] != 0x00)
                {

                    tmpStr = tmpStr + Chr(RecvBuff[indx]);
                    indx = indx + 1;
                }
                temp_e_tclass = tmpStr;

                this.dataGridView1.Rows.Add(temp_book_id, temp_title, temp_venue, temp_sched, temp_e_tclass, temp_status);

                radioButton5.Enabled = false;
            }

            logBox1.Items.Add("Data read from card is displayed");
            logBox1.SelectedIndex = logBox1.Items.Count - 1;

            DataGridViewButtonColumn btn2 = new DataGridViewButtonColumn();
            dataGridView1.Columns.Add(btn2);
            btn2.HeaderText = "Action";
            btn2.Text = "Delete";
            btn2.Name = "btn2";
            btn2.FlatStyle = FlatStyle.Popup;
            btn2.UseColumnTextForButtonValue = true;
            edit_deleteButton();
        }