Beispiel #1
0
        private bool PullDataParkingIn()
        {
            string             APIPullData = Properties.Resources.RequestDataParkingPedestrianAPIURL;
            DataResponseObject response    = (DataResponseObject)restApi.get(ip_address_server, APIPullData, true);

            if (response != null)
            {
                if (response.Status == 206)
                {
                    ParkingInPedestrian parkingInPedestrian = JsonConvert.DeserializeObject <ParkingInPedestrian>(response.Data.ToString());
                    if (TKHelper.WriteDataIntoJSONFile(parkingInPedestrian, Constant.DIR_PATH_SOURCE, Constant.PATH_FILE_MASTER_DATA_PARKING_IN))
                    {
                        return(true);
                    }
                    else
                    {
                        notifyIcon.ShowBalloonTip(Constant.NOTIFICATION_TRAY_TIMEOUT, "Error", Constant.ERROR_MESSAGE_FAIL_TO_WRITE_MASTER_DATA_FILE, ToolTipIcon.Error);
                        return(false);
                    }
                }
                else
                {
                    notifyIcon.ShowBalloonTip(Constant.NOTIFICATION_TRAY_TIMEOUT, "Error", response.Message, ToolTipIcon.Error);
                    return(false);
                }
            }
            else
            {
                notifyIcon.ShowBalloonTip(Constant.NOTIFICATION_TRAY_TIMEOUT, "Error", Constant.ERROR_MESSAGE_FAIL_TO_CONNECT_SERVER, ToolTipIcon.Error);
                return(false);
            }
        }
Beispiel #2
0
        private AutoCompleteStringCollection SearchBarcode(string keyword)
        {
            var queryParam             = "?barcode=" + keyword;
            var ApiURL                 = Properties.Resources.SearchBarcodeAPIURL + queryParam;
            DataResponseArray response = (DataResponseArray)restApi.get(ip_address_server, ApiURL, false);

            if (response != null)
            {
                if (response.Status == 206)
                {
                    string         data     = response.Data.ToString();
                    List <Barcode> barcodes = JsonConvert.DeserializeObject <List <Barcode> >(data);
                    if (barcodes.Count > 0)
                    {
                        foreach (Barcode barcode in barcodes)
                        {
                            listBarcodeSuggestion.Items.Add(barcode.barcode);
                            //autoComplete.Add(barcode.barcode);
                        }
                    }
                }
            }
            return(autoComplete);
        }