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(); } }