private void ArrangementInventoryList_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            ArrangementInventoryFilteredItem item = (sender as ListView).SelectedItem as ArrangementInventoryFilteredItem;

            if (item != null)
            {
                if (Initiator is ShipmentPage)
                {
                    ShipmentInventoryItemDTO so = new ShipmentInventoryItemDTO(0, item.Id, item.Name, item.Size, 0);

                    MessagingCenter.Send <ShipmentInventoryItemDTO>(so, "SearchShipmentInventory");
                }
                else if (Initiator is ArrangementPage)
                {
                    ArrangementInventoryItemDTO ao = new ArrangementInventoryItemDTO(0, item.Id, item.Name, item.InventoryTypeId, 0);

                    MessagingCenter.Send <ArrangementInventoryItemDTO>(ao, "SearchArrangementInventory");
                }
                else
                {
                    WorkOrderInventoryItemDTO wo = new WorkOrderInventoryItemDTO(0, item.Id, item.InventoryTypeId, item.Name, item.Size, 0);

                    MessagingCenter.Send <WorkOrderInventoryItemDTO>(wo, "SearchInventory");
                }
            }

            Navigation.PopAsync();
        }
        private void DeleteButton_Clicked(object sender, EventArgs e)
        {
            Button button = sender as Button;

            if (button != null)
            {
                //remove the selected item from the "master" list
                long itemId = Int64.Parse(button.CommandParameter.ToString());

                WorkOrderInventoryItemDTO sel = siteServiceInventoryList.Where(a => a.InventoryId == itemId).FirstOrDefault();

                if (sel.InventoryId != 0)
                {
                    siteServiceInventoryList.Remove(sel);

                    ObservableCollection <WorkOrderInventoryItemDTO> list1 = new ObservableCollection <WorkOrderInventoryItemDTO>();

                    foreach (WorkOrderInventoryItemDTO wo in siteServiceInventoryList)
                    {
                        list1.Add(wo);
                    }

                    SiteServiceInventoryItemsListView.ItemsSource = list1;

                    //SetWorkOrderSalesData();
                }
            }
        }
Пример #3
0
        void RemoveItemFromInventoryList(WorkOrderViewModel dto)
        {
            if (workOrderInventoryList.Where(a => a.InventoryName == dto.InventoryName && a.Size == dto.Size && a.Quantity == dto.Quantity).Any())
            {
                WorkOrderInventoryItemDTO remove = workOrderInventoryList.Where(a => a.InventoryName == dto.InventoryName && a.Size == dto.Size && a.Quantity == dto.Quantity).First();

                workOrderInventoryList.Remove(remove);
            }
        }
Пример #4
0
        public void AddInventorySelection(long inventoryId, string inventoryName)
        {
            WorkOrderInventoryItemDTO dto = new WorkOrderInventoryItemDTO(0, inventoryId, inventoryName, String.Empty, 0);

            workOrderInventoryList.Add(dto);
            list1.Add(dto);
            this.WorkOrderInventoryListView.ItemsSource = list1;

            SetWorkOrderSalesData();
        }
Пример #5
0
 public WorkOrderViewModel(WorkOrderInventoryItemDTO dto)
 {
     WorkOrderId   = dto.WorkOrderId;
     InventoryId   = dto.InventoryId;
     InventoryName = dto.InventoryName;
     Quantity      = dto.Quantity;
     ImageId       = dto.ImageId;
     Size          = dto.Size;
     GroupId       = dto.GroupId;
 }
Пример #6
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            WorkOrderInventoryItemDTO workOrderInventoryItemDTO = (sender as Button).CommandParameter as WorkOrderInventoryItemDTO;

            workOrderInventoryList.Remove(workOrderInventoryItemDTO);

            list1.Remove(workOrderInventoryItemDTO);

            this.WorkOrderInventoryListView.ItemsSource = list1;

            SetWorkOrderSalesData();
        }
Пример #7
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            WorkOrderInventoryItemDTO searchedForInventory = ((App)App.Current).searchedForInventory;

            if (searchedForInventory != null && searchedForInventory.InventoryId != 0)
            {
                if (!workOrderInventoryList.Contains(searchedForInventory))
                {
                    searchedForInventory.Quantity = 1;

                    if (!workOrderInventoryList.Contains(searchedForInventory))
                    {
                        workOrderInventoryList.Add(searchedForInventory);

                        if (searchedForInventory.ImageId != 0)
                        {
                            EOImgData imageData = ((App)App.Current).GetImage(searchedForInventory.ImageId);

                            if (imageData.imgData != null && imageData.imgData.Length > 0)
                            {
                                TabParent.AddInventoryImage(imageData);
                            }
                        }

                        ((App)App.Current).searchedForInventory = null;
                    }
                }
            }

            GetSearchedPerson();

            GetSearchedDeliveryRecipient();

            GetSearchedArrangement();

            GetSearchedForNotInInventory();

            RedrawInventoryList();
        }
        protected override void OnAppearing()
        {
            base.OnAppearing();

            WorkOrderInventoryItemDTO searchedForInventory = ((App)App.Current).searchedForInventory;

            if (searchedForInventory != null && searchedForInventory.InventoryId != 0)
            {
                if (!siteServiceInventoryList.Contains(searchedForInventory))
                {
                    searchedForInventory.Quantity = 1;

                    siteServiceInventoryList.Add(searchedForInventory);
                    ObservableCollection <WorkOrderInventoryItemDTO> list1 = new ObservableCollection <WorkOrderInventoryItemDTO>();

                    foreach (WorkOrderInventoryItemDTO wo in siteServiceInventoryList)
                    {
                        list1.Add(wo);
                    }

                    SiteServiceInventoryItemsListView.ItemsSource = list1;

                    //SetWorkOrderSalesData();

                    ((App)App.Current).searchedForInventory = null;
                }
            }

            PersonAndAddressDTO searchedForCustomer = ((App)App.Current).searchedForPerson;

            if (searchedForCustomer != null && searchedForCustomer.Person.person_id != 0)
            {
                customerId    = searchedForCustomer.Person.person_id;
                Customer.Text = searchedForCustomer.Person.CustomerName;

                ((App)App.Current).searchedForPerson = null;
            }
        }
Пример #9
0
        //modify the underlying data lists, then call this function
        private void RedrawInventoryList()
        {
            Camera.IsEnabled = currentWorkOrderPaymentId != 0 ? false : true;

            workOrderList.Clear();

            //draw work order items in inventory
            foreach (WorkOrderInventoryItemDTO dto in workOrderInventoryList)
            {
                WorkOrderViewModel vm = new WorkOrderViewModel(dto);
                vm.ShouldEnable = currentWorkOrderPaymentId != 0 ? false : true;
                workOrderList.Add(vm);
            }

            //draw work order item Not in Inventory
            foreach (NotInInventoryDTO dto in notInInventory)
            {
                WorkOrderViewModel vm = new WorkOrderViewModel(dto);
                vm.ShouldEnable = currentWorkOrderPaymentId != 0 ? false : true;
                workOrderList.Add(vm);
            }

            //draw arangements with header row and blank rows top and bottom
            foreach (AddArrangementRequest ar in arrangementList)
            {
                //add a blank row
                workOrderList.Add(new WorkOrderViewModel()
                {
                    WorkOrderId   = currentWorkOrderId,
                    InventoryId   = 0,
                    InventoryName = String.Empty,
                    Quantity      = 0,
                    Size          = String.Empty,
                    GroupId       = ar.ArrangementInventory[0].ArrangementId
                });

                //add a Header row
                workOrderList.Add(new WorkOrderViewModel()
                {
                    WorkOrderId   = currentWorkOrderId,
                    InventoryId   = 0,
                    InventoryName = "Arrangement",
                    Quantity      = 0,
                    Size          = String.Empty,
                    GroupId       = ar.ArrangementInventory[0].ArrangementId
                });

                ar.ArrangementInventory.Where(a => a.InventoryId != 0).ToList().ForEach(aid =>
                {
                    workOrderList.Add(new WorkOrderViewModel()
                    {
                        WorkOrderId     = currentWorkOrderId,
                        InventoryId     = aid.InventoryId,
                        InventoryTypeId = aid.InventoryTypeId,
                        InventoryName   = aid.InventoryName,
                        Quantity        = aid.Quantity,
                        Size            = aid.Size,
                        GroupId         = aid.ArrangementId,
                        ShouldEnable    = currentWorkOrderPaymentId != 0 ? false : true
                    });
                });

                ar.NotInInventory.Where(b => b.ArrangementId != null && b.ArrangementId != 0).ToList().ForEach(x =>
                {
                    WorkOrderInventoryItemDTO dto =
                        new WorkOrderInventoryItemDTO()
                    {
                        WorkOrderId         = x.WorkOrderId,
                        InventoryId         = 0,
                        InventoryName       = x.NotInInventoryName,
                        Size                = x.NotInInventorySize,
                        NotInInventoryName  = x.NotInInventoryName,
                        Quantity            = x.NotInInventoryQuantity,
                        NotInInventorySize  = x.NotInInventorySize,
                        NotInInventoryPrice = x.NotInInventoryPrice,
                        GroupId             = x.ArrangementId,
                    };

                    WorkOrderViewModel vm = new WorkOrderViewModel(dto);
                    vm.ShouldEnable       = currentWorkOrderPaymentId != 0 ? false : true;
                    workOrderList.Add(vm);
                });

                //add a blank row
                workOrderList.Add(new WorkOrderViewModel()
                {
                    WorkOrderId   = currentWorkOrderId,
                    InventoryId   = 0,
                    InventoryName = String.Empty,
                    Quantity      = 0,
                    Size          = String.Empty,
                    GroupId       = ar.ArrangementInventory[0].ArrangementId
                });
            }

            InventoryItemsListView.ItemsSource = workOrderList;
        }
Пример #10
0
        //Load and possibly convert data into relevant data lists
        private void WorkOrderPaymentLoaded(WorkOrderResponse workOrder, WorkOrderPaymentDTO payment)
        {
            Device.BeginInvokeOnMainThread(() =>
            {
                currentWorkOrderId = workOrder.WorkOrder.WorkOrderId;

                searchedForPerson = new PersonAndAddressDTO();
                searchedForPerson.Person.person_id = workOrder.WorkOrder.CustomerId;
                customerId = searchedForPerson.Person.person_id;

                currentWorkOrderPaymentId = payment.WorkOrderPaymentId;

                if (currentWorkOrderPaymentId == 0)
                {
                    Save.IsEnabled    = true;
                    Payment.IsEnabled = true;
                }
                else
                {
                    if (workOrder.WorkOrder.Paid)
                    {
                        InventoryItemsListView.IsEnabled = false;
                        Save.IsEnabled         = false;
                        Payment.IsEnabled      = false;
                        AddInventory.IsEnabled = false;
                    }
                    else
                    {
                        Save.IsEnabled = true;
                        if (workOrder.WorkOrderList.Count == 0)
                        {
                            Payment.IsEnabled = false;
                        }
                        else
                        {
                            Payment.IsEnabled = true;
                        }
                    }
                }

                Buyer.Text = workOrder.WorkOrder.Buyer;

                sellerId             = workOrder.WorkOrder.SellerId;
                Seller.SelectedIndex = ((App)App.Current).GetPickerIndex(Seller, workOrder.WorkOrder.SellerId);

                DeliveryType.SelectedIndex = workOrder.WorkOrder.DeliveryType;

                deliveryUserId = workOrder.WorkOrder.DeliveryUserId;
                DeliveryPerson.SelectedIndex = ((App)App.Current).GetPickerIndex(DeliveryPerson, workOrder.WorkOrder.DeliveryUserId);

                DeliveryDate.Date = workOrder.WorkOrder.DeliveryDate;

                deliveryRecipientId = workOrder.WorkOrder.DeliveryRecipientId;

                DeliverTo.Text = workOrder.WorkOrder.DeliverTo;

                WorkOrderDate.Date = workOrder.WorkOrder.CreateDate;

                workOrderList.Clear();

                notInInventory = workOrder.NotInInventory;

                //convert between duplicate types - refactor
                foreach (var x in workOrder.WorkOrderList)
                {
                    WorkOrderInventoryItemDTO dto =
                        new WorkOrderInventoryItemDTO()
                    {
                        WorkOrderId   = x.WorkOrderId,
                        InventoryId   = x.InventoryId,
                        InventoryName = x.InventoryName,
                        Quantity      = x.Quantity,
                        Size          = x.Size,
                        GroupId       = x.GroupId
                    };

                    workOrderInventoryList.Add(dto);
                }

                foreach (GetArrangementResponse ar in workOrder.Arrangements)
                {
                    AddArrangementRequest aaReq = new AddArrangementRequest();

                    aaReq.Arrangement          = ar.Arrangement;
                    aaReq.Inventory            = ar.Inventory;
                    aaReq.ArrangementInventory = ar.ArrangementList;
                    aaReq.GroupId        = ar.Arrangement.ArrangementId;
                    aaReq.NotInInventory = ar.NotInInventory;

                    arrangementList.Add(aaReq);
                }

                RedrawInventoryList();
            });
        }
Пример #11
0
        private void Initialize(TabbedWorkOrderPage tabParent)
        {
            InitializeComponent();

            TabParent = tabParent;

            MessagingCenter.Subscribe <WorkOrderInventoryItemDTO>(this, "SearchInventory", (arg) =>
            {
                searchedForInventory = arg;
            });

            MessagingCenter.Subscribe <PersonAndAddressDTO>(this, "SearchCustomer", (arg) =>
            {
                searchedForPerson = arg as PersonAndAddressDTO;
            });

            MessagingCenter.Subscribe <PersonAndAddressDTO>(this, "SearchDeliveryRecipient", (arg) =>
            {
                searchedForDeliveryRecipient = arg as PersonAndAddressDTO;
            });

            orderType.Add(new KeyValuePair <int, string>(0, "Walk In"));
            orderType.Add(new KeyValuePair <int, string>(1, "Phone"));
            orderType.Add(new KeyValuePair <int, string>(2, "Email"));

            OrderType.ItemsSource   = orderType;
            OrderType.SelectedIndex = 0;

            deliveryTypeList.Add(new KeyValuePair <long, string>(1, "Pickup"));
            deliveryTypeList.Add(new KeyValuePair <long, string>(2, "Delivery"));
            deliveryTypeList.Add(new KeyValuePair <long, string>(3, "Site Service"));

            DeliveryType.ItemsSource   = deliveryTypeList;
            DeliveryType.SelectedIndex = 0;

            DeliverTo.Text = "Buyer";

            buyerChoiceList.Add(new KeyValuePair <int, string>(0, "Pick one"));
            buyerChoiceList.Add(new KeyValuePair <int, string>(1, "Choose Existing"));
            buyerChoiceList.Add(new KeyValuePair <int, string>(2, "Create New"));

            BuyerChoice.ItemsSource   = buyerChoiceList;
            BuyerChoice.SelectedIndex = 0;

            BuyerChoice.SelectedIndexChanged += BuyerChoice_SelectedIndexChanged;

            ((App)App.Current).GetUsers().ContinueWith(a => LoadUsers(a.Result));

            Save.IsEnabled = true;

            Save.Clicked += OnSaveWorkOrder;

            //both buttons are disabled until the work order data is saved
            Payment.IsEnabled = false;

            MessagingCenter.Subscribe <WorkOrderResponse>(this, "PaymentSuccess", (arg) =>
            {
                currentWorkOrderPaymentId = -1;
                Save.IsEnabled            = EnableSave();
                Payment.IsEnabled         = EnablePayment();
                AddInventory.IsEnabled    = false;
                RedrawInventoryList(); //disable  arrangement list view item qty text boxes and delete buttons
            });
        }
Пример #12
0
 public void LoadInventory(WorkOrderInventoryItemDTO arg)
 {
     searchedForInventory = arg;
 }