123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- 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 ConsignmentEditItemsView
- {
- public ConsignmentEditItemsView()
- {
- InitializeComponent();
- }
- public override void Refresh()
- {
- //throw new NotImplementedException();
- }
- private void _search_OnTextChanged(object sender, MobileSearchBarTextChangedArgs args)
- {
- //throw new NotImplementedException();
- //Refresh();
- }
- public void AddPOItems()
- {
- ShowPopup(() => SelectionView.Execute<PurchaseOrderShell>(
- (columns) =>
- {
- columns.Add(new MobileGridTextColumn<PurchaseOrderShell>()
- {
- Column = x => x.PONumber,
- Width = GridLength.Auto,
- Caption = "Number",
- Alignment = TextAlignment.Start
- });
- columns.Add(new MobileGridTextColumn<PurchaseOrderShell>()
- {
- Column = x => x.SupplierName,
- Width = GridLength.Star,
- Caption = "Select Purchase Order",
- Alignment = TextAlignment.Start
- });
- },
- (refresh) =>
- {
- var model = new PurchaseOrderModel(App.Data,
- () => new Filter<PurchaseOrder>(x => x.IssuedDate).IsNotEqualTo(DateTime.MinValue)
- .And(x=>x.ClosedDate).IsEqualTo(DateTime.MinValue)
- .And(x=>x.CancelledDate).IsEqualTo(DateTime.MinValue)
- .And(x=>x.Unreceived).IsNotEqualTo(FilterConstant.Null)) { FileName = "consigment_orders.index" };
- return model.Refresh(false);
- },
- (orders) =>
- {
- var model = new PurchaseOrderItemModel(App.Data,
- () => new Filter<PurchaseOrderItem>(x => x.PurchaseOrderLink.ID).IsEqualTo(orders.FirstOrDefault()?.ID ?? Guid.Empty));
- model.Refresh(false);
- foreach (var item in model.Items)
- {
- var newitem = ViewModel.Items.AddItem();
- newitem.Row.LoadValues(item.Row.Values);
- }
- Dispatcher.BeginInvokeOnMainThread(() =>
- {
- _itemsList.ItemsSource = null;
- _itemsList.ItemsSource = ViewModel.Items;
- });
- DismissPopup();
- }));
- }
- private void SelectPOItem_Clicked(object sender, EventArgs e)
- {
- if ((sender as MobileCard)?.BindingContext is PurchaseOrderItemShell item)
- {
- var page = new ConsignmentEditItem(item);
- Navigation.PushAsync(page);
- }
- }
- }
- }
|