예제 #1
0
 public CameraPage(ManagerDispatchMob managerDispatchMob, string idDriver, int indexCurrent, InitDasbordDelegate initDasbordDelegate,
                   TruckCar truckCar = null)
 {
     fullPhotoTruckVM = new FullPhotoTruckVM(managerDispatchMob, idDriver, indexCurrent, Navigation, truckCar, initDasbordDelegate);
     InitializeComponent();
     Xamarin.Forms.NavigationPage.SetHasNavigationBar(this, false);
     On <iOS>().SetPrefersStatusBarHidden(StatusBarHiddenMode.True)
     .SetPreferredStatusBarUpdateAnimation(UIStatusBarAnimation.Fade);
     BindingContext = fullPhotoTruckVM;
     InitElement();
 }
        private int GetData(string respJsonStr, ref bool isPlate, ref TruckCar truckCar, ref string description)
        {
            respJsonStr = respJsonStr.Replace("\\", "");
            respJsonStr = respJsonStr.Remove(0, 1);
            respJsonStr = respJsonStr.Remove(respJsonStr.Length - 1);
            var    responseAppS = JObject.Parse(respJsonStr);
            string status       = responseAppS.Value <string>("Status");

            description = responseAppS.Value <string>("Description");
            if (status == "success")
            {
                isPlate  = Convert.ToBoolean(responseAppS.Value <bool>("ResponseStr"));
                truckCar = JsonConvert.DeserializeObject <TruckCar>(responseAppS.SelectToken("ResponseStr1").ToString());
                return(3);
            }
            else
            {
                return(2);
            }
        }
예제 #3
0
        private void btnSetCar_Click(object sender, EventArgs e)
        {
            int    id     = int.Parse(tbxId.Text);
            string vendor = tbxVendor.Text;
            string model  = tbxModel.Text;
            int    year   = int.Parse(tbxYear.Text);
            Car    car;

            switch (cbxType.SelectedIndex)
            {
            case 0:
                car = new Car();
                break;

            case 1:
                car = new TruckCar {
                    Capacity = double.Parse(tbxType.Text, CultureInfo.GetCultureInfo("en-US"))
                };
                break;

            case 2:
                car = new PassengerCar {
                    Passengers = int.Parse(tbxType.Text, CultureInfo.GetCultureInfo("en-US"))
                };
                break;

            default:
                car = new Car();
                break;
            }

            car.Id     = id;
            car.Vendor = vendor;
            car.Model  = model;
            car.Year   = year;

            _client.SetCar(car);
        }
        public int CheckInspectionDriver(string token, ref string description, ref bool isInspection, ref int indexPhoto, ref TruckCar truckCar)
        {
            IRestResponse response = null;
            string        content  = null;

            try
            {
                RestClient  client  = new RestClient(Config.BaseReqvesteUrl);
                RestRequest request = new RestRequest("Mobile/Driver/CheckInspectionDriver", Method.POST);
                client.Timeout = 60000;
                request.AddHeader("Accept", "application/json");
                request.AddParameter("token", token);
                response = client.Execute(request);
                content  = response.Content;
            }
            catch (Exception)
            {
                return(4);
            }
            if (content == "" || response.StatusCode == System.Net.HttpStatusCode.NotFound)
            {
                return(4);
            }
            else
            {
                return(GetData(content, ref description, ref isInspection, ref indexPhoto, ref truckCar));
            }
        }
        internal int SetPlate(string token, string plateTruck, string plateTrailer, string nowCheck, ref string description, ref bool isPlate, ref TruckCar truckCar)
        {
            IRestResponse response = null;
            string        content  = null;

            try
            {
                RestClient  client  = new RestClient(Config.BaseReqvesteUrl);
                RestRequest request = new RestRequest("Mobile/Driver/PlateTrackAndPlate", Method.POST);
                client.Timeout = 10000;
                request.AddHeader("Accept", "application/json");
                request.AddParameter("token", token);
                request.AddParameter("plateTruck", plateTruck);
                request.AddParameter("plateTrailer", plateTrailer);
                request.AddParameter("nowCheck", nowCheck);
                response = client.Execute(request);
                content  = response.Content;
            }
            catch (Exception)
            {
                return(4);
            }
            if (content == "" || response.StatusCode == System.Net.HttpStatusCode.NotFound)
            {
                return(4);
            }
            else
            {
                return(GetData(content, ref isPlate, ref truckCar, ref description));
            }
        }
예제 #6
0
        internal int SetPlate(string token, string plateTruck, string plateTrailer, string nowCheck, ref string description, ref bool isPlate, ref TruckCar truckCar)
        {
            driverInspecktion = new DriverInspecktion();
            //WaiteNoramalReqvestCount();
            CountReqvest++;
            int statePay = 1;

            if (CrossConnectivity.Current.IsConnected)
            {
                statePay = driverInspecktion.SetPlate(token, plateTruck, plateTrailer, nowCheck, ref description, ref isPlate, ref truckCar);
            }
            driverInspecktion = null;
            CountReqvest--;
            return(statePay);
        }
예제 #7
0
        public int DriverWork(string typeDriver, string token, ref string description, ref bool isInspection, ref int indexPhoto, ref TruckCar truckCar)
        {
            driverInspecktion = new DriverInspecktion();
            //WaiteNoramalReqvestCount();
            CountReqvest++;
            int stateDriver = 1;

            if (CrossConnectivity.Current.IsConnected)
            {
                if (typeDriver == "CheckInspeacktion")
                {
                    stateDriver = driverInspecktion.CheckInspectionDriver(token, ref description, ref isInspection, ref indexPhoto, ref truckCar);
                }
            }
            driverInspecktion = null;
            CountReqvest--;
            return(stateDriver);
        }