private async void GetPhoto()
        {
            try
            {
                using (var client = ClientHelper.GetClient(CrossSettings.Current.GetValueOrDefault("token", "")))
                {
                    ManageOrderService.InitializeClient(client);
                    var o_data = new ServiceResponseObject <SuccessResponse>();
                    o_data = await ManageOrderService.GetPhoto(StaticOrder.Order_id);

                    if (o_data.Status == HttpStatusCode.OK)
                    {
                        ///дописать
                        StaticOrder.File_Name     = o_data.Message;
                        StaticOrder.MessageResult = "0";
                        StartUp.StartTracking(Activity, 2);
                    }
                    else
                    {
                        Toast.MakeText(Activity, o_data.Message, ToastLength.Long).Show();
                    }
                }
            }
            catch (System.Exception ex)
            {
                Toast.MakeText(Activity, ex.Message, ToastLength.Long).Show();
            }
        }
Exemple #2
0
        private async void GetPhoto(string id, AlertDialog.Builder alert)
        {
            try
            {
                using (var client = ClientHelper.GetClient(CrossSettings.Current.GetValueOrDefault("token", "")))
                {
                    ManageOrderService.InitializeClient(client);
                    var o_data = new ServiceResponseObject <SuccessResponse>();
                    o_data = await ManageOrderService.GetPhoto(id);

                    if (o_data.Status == HttpStatusCode.OK)
                    {
                        StaticOrder.File_Name     = o_data.Message;
                        StaticOrder.MessageResult = "0";
                        StartUp.StartTracking(context, 2);
                    }
                    else
                    {
                        Toast.MakeText(context, o_data.Message, ToastLength.Long).Show();
                    }
                }
            }
            catch (Exception ex)
            {
                Toast.MakeText(context, ex.Message, ToastLength.Long).Show();
            }
        }
Exemple #3
0
        private async void UpdateFileData(Context context, string file_name)
        {
            var        authValue = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes($"{CrossSettings.Current.GetValueOrDefault("token", "")}:")));
            HttpClient client    = new HttpClient()
            {
                DefaultRequestHeaders = { Authorization = authValue },
                BaseAddress           = new Uri("https://smartboxcity.ru/media.php?media=")
            };

            if (CrossSettings.Current.GetValueOrDefault("role", "") == "driver")
            {
                BoxService.InitializeClient(client);
                var o_data = await BoxService.CheckFile(file_name);

                if (o_data.Status == System.Net.HttpStatusCode.OK)
                {
                    StaticOrder.MessageResult = o_data.Message;
                    //дописать
                    if (o_data.Message == "1")
                    {
                        StartUp.StopTracking(context, 2);
                    }

                    return;
                }
                else
                {
                    return;
                }
            }
            else
            {
                ManageOrderService.InitializeClient(client);
                var o_data = await ManageOrderService.CheckFile(file_name);

                if (o_data.Status == System.Net.HttpStatusCode.OK)
                {
                    StaticOrder.MessageResult = o_data.Message;
                    //дописать
                    if (o_data.Message == "1")
                    {
                        StartUp.StopTracking(context, 2);
                    }

                    return;
                }
                else
                {
                    return;
                }
            }
        }
        private async void MakeLock(bool checkBox)
        {
            try
            {
                using (var client = ClientHelper.GetClient(CrossSettings.Current.GetValueOrDefault("token", "")))
                {
                    ManageOrderService.InitializeClient(client);
                    var o_data = new ServiceResponseObject <SuccessResponse>();
                    o_data = await ManageOrderService.LockRollete(StaticOrder.Order_id);

                    if (o_data.Status == HttpStatusCode.OK)
                    {
                        Android.App.AlertDialog.Builder alert1 = new Android.App.AlertDialog.Builder(Activity);
                        alert1.SetTitle("Закрытие контейнера");
                        alert1.SetMessage(o_data.Message);
                        alert1.SetPositiveButton("Закрыть", (senderAlert1, args1) =>
                        {
                        });
                        Dialog dialog1 = alert1.Create();
                        dialog1.Show();

                        if (checkBox == true)
                        {
                            //btn_Lock.Clickable = false;
                            //btn_Lock.Focusable = false;
                            //btn_Lock.LongClickable = false;
                            btn_Lock.Visibility = ViewStates.Gone;
                            Lock.Text           = "Опущена";
                        }
                        else
                        {
                            btn_Lock.Text = "Поднять";
                            Lock.Text     = "Опущена";
                        }

                        //FragmentTransaction transaction1 = this.FragmentManager.BeginTransaction();
                        //ManageOrderActivity content2 = new ManageOrderActivity();
                        //transaction1.Replace(Resource.Id.framelayout, content2);
                        //transaction1.Commit();
                    }
                }
            }
            catch (System.Exception ex)
            {
                Toast.MakeText(Activity, ex.Message, ToastLength.Long).Show();
            }
        }
Exemple #5
0
        private async void GetVideo()
        {
            try
            {
                if (CrossSettings.Current.GetValueOrDefault("role", "") == "driver")
                {
                    using (var client = ClientHelper.GetClient(CrossSettings.Current.GetValueOrDefault("token", "")))
                    {
                        BoxService.InitializeClient(client);
                        var o_data = new ServiceResponseObject <SuccessResponse>();
                        o_data = await BoxService.GetVideo(StaticBox.id);

                        if (o_data.Status == HttpStatusCode.OK)
                        {
                            StaticOrder.File_Name = o_data.Message;
                        }
                        else
                        {
                            Toast.MakeText(context, o_data.Message, ToastLength.Long).Show();
                        }
                    }
                }
                else
                {
                    using (var client = ClientHelper.GetClient(CrossSettings.Current.GetValueOrDefault("token", "")))
                    {
                        ManageOrderService.InitializeClient(client);
                        var o_data = new ServiceResponseObject <SuccessResponse>();
                        o_data = await ManageOrderService.GetVideo(StaticBox.id);

                        if (o_data.Status == HttpStatusCode.OK)
                        {
                            StaticOrder.File_Name = o_data.Message;
                        }
                        else
                        {
                            Toast.MakeText(context, o_data.Message, ToastLength.Long).Show();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Toast.MakeText(context, ex.Message, ToastLength.Long).Show();
            }
        }
        private async void MakePayment()
        {
            try
            {
                using (var client = ClientHelper.GetClient(CrossSettings.Current.GetValueOrDefault("token", "")))
                {
                    ManageOrderService.InitializeClient(client);
                    var o_data = new ServiceResponseObject <SuccessResponse>();
                    o_data = await ManageOrderService.MakePayment(StaticOrder.Order_id);

                    if (o_data.Status == HttpStatusCode.OK)
                    {
                        Android.App.AlertDialog.Builder alert1 = new Android.App.AlertDialog.Builder(Activity);
                        alert1.SetTitle("Внесение оплаты");
                        alert1.SetMessage(o_data.Message);
                        alert1.SetPositiveButton("Закрыть", (senderAlert1, args1) =>
                        {
                        });
                        Dialog dialog1 = alert1.Create();
                        dialog1.Show();

                        FragmentTransaction transaction1 = this.FragmentManager.BeginTransaction();
                        ManageOrderActivity content2     = new ManageOrderActivity();
                        transaction1.Replace(Resource.Id.framelayout, content2);
                        transaction1.Commit();
                    }
                    else
                    {
                        Toast.MakeText(Activity, o_data.Message, ToastLength.Long).Show();
                    }
                }
            }
            catch (System.Exception ex)
            {
                Toast.MakeText(Activity, ex.Message, ToastLength.Long).Show();
            }
        }