| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Comal.Classes;
- using InABox.Core;
- using InABox.Mobile;
- using Xamarin.Forms;
- using Xamarin.Forms.Xaml;
- namespace PRS.Mobile
- {
- [XamlCompilation(XamlCompilationOptions.Compile)]
- public partial class SiteManufacturingSetouts : ContentView
- {
-
- private String _currentFilter;
-
- public SetoutModel Setouts { get; set; }
- public ManufacturingPacketModel Packets { get; set; }
-
- public SetoutDocumentModel Documents { get; set; }
-
- public Guid JobID { get; set; }
-
- public SiteManufacturingSetouts()
- {
- InitializeComponent();
- }
-
- public event EventHandler RefreshRequested;
-
- public void Refresh()
- {
- Setouts.Search(FilterShell);
- _items.ItemsSource ??= Setouts.Items;
- }
-
- private void _search_OnTextChanged(object sender, MobileSearchBarTextChangedArgs args)
- {
- _currentFilter = args.Text.ToUpper();
- Refresh();
- }
- private bool FilterShell(SetoutShell shell)
- {
- var bOK =
- String.IsNullOrWhiteSpace(_currentFilter)
- || shell.Number?.ToUpper().Contains(_currentFilter) == true
- || shell.Description?.ToUpper().Contains(_currentFilter) == true
- || shell.JobNumber?.ToUpper().Contains(_currentFilter) == true
- || shell.JobName?.ToUpper().Contains(_currentFilter) == true;
- return bOK;
- }
-
- private void ListView_Tapped(object sender, EventArgs e)
- {
- if ((sender as Frame)?.BindingContext is SetoutShell shell)
- {
- Documents.Search((doc) => doc.Entity.EntityLink.ID == shell.ID);
- var editor = new SiteManufacturingSetout(
- shell,
- Packets.Items.Where(x=>x.SetoutID == shell.ID).ToArray(),
- Documents
- );
- Navigation.PushAsync(editor);
- }
- }
-
- private void _items_OnRefreshRequested(object sender, MobileListRefreshEventArgs args)
- {
- RefreshRequested?.Invoke(this, EventArgs.Empty);
- }
- }
- }
|