コード例 #1
0
        private void Save_Clicked(object sender, EventArgs e)
        {
            if (forWorkOrder)
            {
                if (selectedCustomerContainerId != 0)
                {
                    CustomerContainerDTO cc = customerContainersOC.Where(a => a.CustomerContainerId == selectedCustomerContainerId).FirstOrDefault();
                    MessagingCenter.Send <CustomerContainerDTO>(cc, "AddCustomerContainerToWorkOrder");
                    Navigation.PopAsync();
                }
                else
                {
                    DisplayAlert("?", "Please select a customer container", "OK");
                }
            }
            else
            {
                if (String.IsNullOrEmpty(Label.Text))
                {
                    DisplayAlert("Error", "To save a customer container, you must have at least, a label value", "OK");
                }
                else
                {
                    string errorMsg = String.Empty;

                    //save the customer container object first - if successful, save image, if successful, update customer container with newly minted image id
                    CustomerContainerRequest request = new CustomerContainerRequest();
                    request.CustomerContainer.CustomerContainerId = selectedCustomerContainerId;
                    request.CustomerContainer.CustomerId          = Person.Person.person_id;
                    request.CustomerContainer.Label   = Label.Text;
                    request.CustomerContainer.ImageId = selectedCustomerContainerImageId;
                    ((App)App.Current).AddUpdateCustomerContainers(request).ContinueWith(a => AddCustomerContainerImage(request, a.Result));
                }
            }
        }
コード例 #2
0
        private void AddCustomerContainerImage(CustomerContainerRequest request, ApiResponse response)
        {
            if (response.Success)
            {
                request.CustomerContainer.CustomerContainerId = response.Id;

                List <EOImgData> images = ((App)App.Current).GetImageData();

                if (images != null && images.Count > 0)
                {
                    AddImageRequest imageRequest = new AddImageRequest();
                    imageRequest.imgBytes = images[0].imgData;
                    ((App)App.Current).AddImage(imageRequest).ContinueWith(a => UpdateCustomerContainerWithImage(request, response, a.Result));
                }
                else
                {
                    CustomerContainerSaveComplete(response);
                }
            }
            else
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    DisplayAlert("Error", "Problem saving customer container", "Ok");
                });
            }
        }
コード例 #3
0
        public async Task <CustomerContainerResponse> GetCustomerContainers(long customerId)
        {
            CustomerContainerRequest request = new CustomerContainerRequest();

            request.CustomerContainer.CustomerId = customerId;
            CustomerContainerResponse response = await PostRequest <CustomerContainerRequest, CustomerContainerResponse>("GetCustomerContainers", request);

            return(response);
        }
コード例 #4
0
        private async void LoadCustomerContainers(long customerId)
        {
            CustomerContainerRequest request = new CustomerContainerRequest();

            request.CustomerContainer.CustomerId = Customer.person_id;
            ((App)App.Current).PostRequest <CustomerContainerRequest, CustomerContainerResponse>("GetCustomerContainers", request).ContinueWith(a =>
            {
                CustomerContainersLoaded(a.Result);
            });
        }
コード例 #5
0
        private void UpdateCustomerContainerWithImage(CustomerContainerRequest request, ApiResponse containerResponse, ApiResponse imageResponse)
        {
            //request has customerID - containerResponse has CustomerContainerId, imageResponse has ImageId

            if (imageResponse.Success)
            {
                request.CustomerContainer.ImageId = imageResponse.Id;
                ((App)App.Current).AddUpdateCustomerContainers(request).ContinueWith(a => CustomerContainerSaveComplete(a.Result));
            }
        }
コード例 #6
0
        private void DeleteCustomerContainer_Clicked(object sender, EventArgs e)
        {
            CustomerContainerDTO customerContainer = (CustomerContainerDTO)((Button)sender).BindingContext;

            if (customerContainer != null)
            {
                CustomerContainerRequest request = new CustomerContainerRequest();
                request.CustomerContainer.CustomerContainerId = customerContainer.CustomerContainerId;
                request.CustomerContainer.CustomerId          = customerContainer.CustomerId;
                ((App)App.Current).DeleteCustomerContainer(request).ContinueWith(a => CustomerContainerSaveComplete(a.Result));
            }
        }
コード例 #7
0
 public ApiResponse DeleteCustomerContainer(CustomerContainerRequest request)
 {
     return(inventoryManager.DeleteCustomerContainer(request));
 }
コード例 #8
0
 public CustomerContainerResponse GetCustomerContainers(CustomerContainerRequest request)
 {
     return(inventoryManager.GetCustomerContainers(request));
 }
コード例 #9
0
 public ApiResponse DeleteCustomerContainer(CustomerContainerRequest request)
 {
     return(persistence.DeleteCustomerContainer(request));
 }
コード例 #10
0
 public ApiResponse AddUpdateCustomerContainer(CustomerContainerRequest request)
 {
     return(persistence.AddUpdateCustomerContainer(request));
 }
コード例 #11
0
 public CustomerContainerResponse GetCustomerContainers(CustomerContainerRequest request)
 {
     return(persistence.GetCustomerContainers(request));
 }
コード例 #12
0
        public async Task <ApiResponse> DeleteCustomerContainer(CustomerContainerRequest request)
        {
            ApiResponse response = await PostRequest <CustomerContainerRequest, CustomerContainerResponse>("DeleteCustomerContainer", request);

            return(response);
        }