private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e) { if (comboBox1.SelectedIndex != 0) { if (textBox1.Text != "" && textBox1.Text != "Barcode/UID Kartu") { // send data API var APIUrl = Properties.Resources.RequestUIDFareAPIURL; string uidType = TKHelper.GetUidType(UIDCard); string vehicle = comboBox1.Text.ToString(); RequestFareRequest requestFare = new RequestFareRequest(uidType, UIDCard, vehicle); var sent_param = JsonConvert.SerializeObject(requestFare); DataResponseObject response = (DataResponseObject)restApi.post(ip_address_server, APIUrl, true, sent_param); if (response != null) { switch (response.Status) { case 206: parkingIn = JsonConvert.DeserializeObject <ParkingIn>(response.Data.ToString()); txtHour.Text = TKHelper.GetValueTime(parkingIn.ParkDuration, "hour"); txtMinute.Text = TKHelper.GetValueTime(parkingIn.ParkDuration, "minute"); txtSecond.Text = TKHelper.GetValueTime(parkingIn.ParkDuration, "second"); txtGrandTotal.Text = TKHelper.IDR(parkingIn.Fare.ToString()); string[] datetimeIn = parkingIn.DatetimeIn.Split(' '); textBox3.Text = TKHelper.ConvertDatetime(datetimeIn[0], datetimeIn[1]); string[] datetimeOut = parkingIn.DatetimeOut.Split(' '); textBox4.Text = TKHelper.ConvertDatetime(datetimeOut[0], datetimeOut[1]); // Load Picture of face and plate number string faceImage = parkingIn.FaceImage; if (string.IsNullOrEmpty(faceImage)) { PictFace.Image = Properties.Resources.no_image; } else { try { string URL_pict_face = Constant.URL_PROTOCOL + Properties.Settings.Default.IPAddressServer + Properties.Resources.repo + "/" + faceImage; PictFace.Load(URL_pict_face); } catch (Exception) { PictFace.Image = Properties.Resources.no_image; } } PictFace.BackgroundImageLayout = ImageLayout.Stretch; PictFace.SizeMode = PictureBoxSizeMode.StretchImage; string plateNumberImage = parkingIn.PlateNumberImage; if (string.IsNullOrEmpty(plateNumberImage)) { PictVehicle.Image = Properties.Resources.no_image; } else { try { string URL_pict_vehicle = Constant.URL_PROTOCOL + Properties.Settings.Default.IPAddressServer + Properties.Resources.repo + "/" + parkingIn.PlateNumberImage; PictVehicle.Load(URL_pict_vehicle); } catch (Exception) { PictVehicle.Image = Properties.Resources.no_image; } } PictVehicle.BackgroundImageLayout = ImageLayout.Stretch; PictVehicle.SizeMode = PictureBoxSizeMode.StretchImage; break; default: notifyIcon.ShowBalloonTip(Constant.NOTIFICATION_TRAY_TIMEOUT, "Error", response.Message, ToolTipIcon.Error); Clear(); break; } } else { notifyIcon.ShowBalloonTip(Constant.NOTIFICATION_TRAY_TIMEOUT, "Error", Constant.ERROR_MESSAGE_FAIL_TO_CONNECT_SERVER, ToolTipIcon.Error); } } else { notifyIcon.ShowBalloonTip(Constant.NOTIFICATION_TRAY_TIMEOUT, "Error", Constant.WARNING_MESSAGE_UNTAPPED_CARD, ToolTipIcon.Error); this.ResetComboBox(); return; } } }