private async void Delete(ProductToTransfer x) { var answer = await App.Current.MainPage.DisplayAlert("TSHIRT", "El registro " + x.productCode + " sera eliminado, Desea Continuar?", "SI", "NO"); if (answer) { ProductTransferCollection.Remove(x); } }
private void validateProduct() { bool isValid = true; if (this.warehouseProduct != null) { if (string.IsNullOrEmpty(this.Quantity)) { isValid = false; App.Current.MainPage.DisplayAlert("TSHIRT", "Debe ingresar la cantidad", "OK"); } else if (long.Parse(this.Quantity) > this.warehouseProduct.Quantity) { isValid = false; App.Current.MainPage.DisplayAlert("TSHIRT", "Cantidad de productos no disponible", "OK"); } } else { isValid = false; App.Current.MainPage.DisplayAlert("TSHIRT", "Debe realizar la búsqueda de un producto", "OK"); } if (isValid) { ProductToTransfer productTransfer = new ProductToTransfer() { productCode = warehouseProduct.Product.Code, productDescription = warehouseProduct.Product.Description, quantity = long.Parse(Quantity), quantityAvailable = warehouseProduct.Quantity }; if (ProductTransferCollection.Count > 0) { var result = ProductTransferCollection.FirstOrDefault(p => p.productCode.Equals(warehouseProduct.ProductCode)); if (result != null) { ProductTransferCollection.Remove(result); } } ProductTransferCollection.Add(productTransfer); HeightList = (ProductTransferCollection.Count * 45) + (ProductTransferCollection.Count * 5); resetProduct(); App.Current.MainPage.Navigation.NavigationStack.Last().FindByName <Entry>("EntProducto").Focus(); } }
private async void validateTransfer() { if (ProductTransferCollection.Count == 0) { await App.Current.MainPage.DisplayAlert("TSHIRT", "Debe ingresar uno o más productos a transferir", "OK"); } else { var answer = await App.Current.MainPage.DisplayAlert("TSHIRT", "Desea Guardar la solicitud?", "SI", "NO"); if (answer) { int pendiente = (int)ProductTransferEstatus.Pendiente; ProductTransfer productsTransfer = new ProductTransfer() { warehouseOrigin = _warehouseOriginSelect, warehouseDestiny = _warehouseDestinySelect, products = ProductTransferCollection.ToList(), dateCreated = DateTime.Now.ToString("dd/MM/yyyy hh:mm"), status = pendiente.ToString(), observation = Observation }; var result = await _productTransferServices.SaveProductTransfer(productsTransfer); if (result != null) { string id = string.Concat("00", result.Id.ToString()); id = id.Substring(id.Length - 3); await Application.Current.MainPage.Navigation.PushAsync(new Result(id)); } else { await App.Current.MainPage.DisplayAlert("TSHIRT", "Error al registrar la solicitud", "OK"); } } } }