Ejemplo n.º 1
0
        async void GeneratePallet(object sender, System.EventArgs e)
        {
            try
            {
                clsWhsHeader productList = new clsWhsHeader();

                productList.Id    = uploadID;
                productList.Items = items;

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

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

                if (update_response.IsGood)
                {
                    await DisplayAlert("Success", "List uploaded", "OK");

                    await Navigation.PopAsync();
                }
                else
                {
                    await DisplayAlert("Error", update_response.Message, "OK");
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Error", ex.Message, "OK");
            }
        }
        public async void GetRecordDetails()
        {
            loading.IsVisible = true;

            try
            {
                var content = await CommonFunction.CallWebService(0, null, Ultis.Settings.SessionBaseURI, uri, this);

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

                if (response.IsGood)
                {
                    recordDetails = JObject.Parse(content)["Result"].ToObject <clsWhsHeader>();

                    desc.Children.Clear();

                    Label topBlank = new Label();
                    desc.Children.Add(topBlank);
                    foreach (clsCaptionValue summary in recordDetails.Summary)
                    {
                        Label caption = new Label();
                        caption.FontSize = 13;
                        if (summary.Caption.Equals(""))
                        {
                            caption.Text           = "    " + summary.Value;
                            caption.FontAttributes = FontAttributes.Bold;
                            Title = record.Name + " # " + summary.Value;
                        }
                        else
                        {
                            caption.Text = "    " + summary.Caption + ": " + summary.Value;
                        }

                        if (summary.Caption.Equals(""))
                        {
                            Title = record.Name + " # " + summary.Value;
                        }

                        desc.Children.Add(caption);
                    }
                    Label bottomBlank = new Label();
                    desc.Children.Add(bottomBlank);

                    dataGrid.AutoGenerateColumns = false;
                    dataGrid.ItemsSource         = recordDetails.Items;

                    dataGrid.Columns.Clear();

                    foreach (clsKeyValue gridField in recordDetails.ItemColumns)
                    {
                        GridTextColumn gridColumn = new GridTextColumn();
                        gridColumn.MappingName = gridField.Key;
                        //gridColumn.Width = (recordDetails.ItemColumns.Count == 3) ? 100 : 150;
                        gridColumn.Width = recordDetails.ItemColumns.Count * 33;

                        gridColumn.HeaderTemplate = new DataTemplate(() =>
                        {
                            ViewCell viewCell = new ViewCell();

                            Label label = new Label
                            {
                                Text                    = gridField.Value,
                                BackgroundColor         = Color.Transparent,
                                VerticalOptions         = LayoutOptions.CenterAndExpand,
                                HorizontalOptions       = LayoutOptions.CenterAndExpand,
                                HorizontalTextAlignment = TextAlignment.Center,
                                FontAttributes          = FontAttributes.Bold
                            };

                            viewCell.View = label;
                            return(viewCell);
                        });

                        dataGrid.Columns.Add(gridColumn);
                    }

                    if (!(String.IsNullOrEmpty(recordDetails.Id)))
                    {
                        pickingID = recordDetails.Id;
                    }
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Error", ex.Message, "OK");
            }

            loading.IsVisible = false;
        }