Exemplo n.º 1
0
        public async void uploadDetail(object sender, EventArgs e)
        {
            bool done = false;

            try
            {
                if (SignatureStack.IsVisible == true)
                {
                    Stream signatureImage = await signature.GetImageStreamAsync(SignatureImageFormat.Png, strokeColor : Color.Black, fillColor : Color.White);

                    if (signatureImage != null)
                    {
                        await CommonFunction.StoreSignature(jobID, signatureImage, this);

                        //UploadImage(jobID);
                        BackgroundTask.StartTimer();
                        done = true;
                    }
                    else
                    {
                        await DisplayAlert("Signature Error", "Please sign for the job.", "OK");
                    }
                }

                if (done == true || SignatureStack.IsVisible == false)
                {
                    clsTruckingModel futile = new clsTruckingModel();

                    futile.Id         = jobID;
                    futile.Remarks    = remarkTextEditor.Text;
                    futile.ReasonCode = keyValue[ReasonPicker.SelectedIndex].Key;

                    if (Title.Equals("Cargo Return"))
                    {
                        futile.RefNo = ReferenceNo.Text;
                    }

                    var content = await CommonFunction.CallWebService(1, futile, Ultis.Settings.SessionBaseURI, ControllerUtil.postFutileTripURL(), this);

                    clsResponse futile_response = JsonConvert.DeserializeObject <clsResponse>(content);

                    if (futile_response.IsGood)
                    {
                        await DisplayAlert("Success", "Job status updated as futile.", "OK");

                        await Navigation.PopAsync();
                    }
                    else
                    {
                        await DisplayAlert("Error", futile_response.Message, "OK");
                    }
                }
            }
            catch
            {
            }
        }
Exemplo n.º 2
0
        public EquipmentDetails(string eq, clsTruckingModel truckingModel)
        {
            InitializeComponent();

            equipmentNo = eq;

            if (!(String.IsNullOrEmpty(equipmentNo)))
            {
                Task.Run(async() => { await GetEquipmentDetails(); }).Wait();
            }

            if (truckingModel != null)
            {
                latitude   = truckingModel.Latitude;
                longtitude = truckingModel.Longitude;
                DisplayTruckDetails(truckingModel.Details);
            }

            StackLayout main = new StackLayout();

            Label title1 = new Label
            {
                FontSize = 15,

                TextColor = Color.White
            };

            title1.Text = (truckingModel == null) ? eq : truckingModel.Id;

            Label title2 = new Label
            {
                FontSize  = 10,
                Text      = Ultis.Settings.SubTitle,
                TextColor = Color.White
            };

            main.Children.Add(title1);
            main.Children.Add(title2);

            NavigationPage.SetTitleView(this, main);
        }
Exemplo n.º 3
0
        public async void updateJob(object sender, EventArgs e)
        {
            bool done = false;

            if (signatureStack.IsVisible == true)
            {
                Stream signatureImage = await signature.GetImageStreamAsync(SignatureImageFormat.Png, strokeColor : Color.Black, fillColor : Color.White);

                if (signatureImage != null)
                {
                    await CommonFunction.StoreSignature(jobID, signatureImage, this);

                    UploadImage(jobID);
                    done = true;
                }
                else
                {
                    await DisplayAlert("Signature problem", "Please sign for the job.", "OK");
                }
            }

            if (done == true || signatureStack.IsVisible == false)
            {
                confirm_icon.IsEnabled = false;
                confirm_icon.Source    = "confirmDisable.png";
                futile_icon.IsEnabled  = false;
                futile_icon.Source     = "futileDisable.png";

                clsTruckingModel truck = new clsTruckingModel();
                truck.Id = jobID;
                if (!(String.IsNullOrEmpty(remarkTextEditor.Text)))
                {
                    truck.Remarks = remarkTextEditor.Text;
                }
                else
                {
                    truck.Remarks = " ";
                }

                var content = await CommonFunction.CallWebService(1, truck, Ultis.Settings.SessionBaseURI, ControllerUtil.postJobDetailURL(action), this);

                clsResponse update_response = JsonConvert.DeserializeObject <clsResponse>(content);

                if (update_response.IsGood)
                {
                    Ultis.Settings.RefreshListView = "Yes";


                    await DisplayAlert("Success", "Job updated.", "OK");

                    await Navigation.PopAsync();
                }
                else
                {
                    await DisplayAlert("Error", update_response.Message, "OK");

                    confirm_icon.IsEnabled = true;
                    confirm_icon.Source    = "confirm.png";
                    futile_icon.IsEnabled  = true;
                    futile_icon.Source     = "futile.png";
                }
            }
        }