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)); } } }
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"); }); } }
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); }
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); }); }
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)); } }
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)); } }
public ApiResponse DeleteCustomerContainer(CustomerContainerRequest request) { return(inventoryManager.DeleteCustomerContainer(request)); }
public CustomerContainerResponse GetCustomerContainers(CustomerContainerRequest request) { return(inventoryManager.GetCustomerContainers(request)); }
public ApiResponse DeleteCustomerContainer(CustomerContainerRequest request) { return(persistence.DeleteCustomerContainer(request)); }
public ApiResponse AddUpdateCustomerContainer(CustomerContainerRequest request) { return(persistence.AddUpdateCustomerContainer(request)); }
public CustomerContainerResponse GetCustomerContainers(CustomerContainerRequest request) { return(persistence.GetCustomerContainers(request)); }
public async Task <ApiResponse> DeleteCustomerContainer(CustomerContainerRequest request) { ApiResponse response = await PostRequest <CustomerContainerRequest, CustomerContainerResponse>("DeleteCustomerContainer", request); return(response); }