public void EndEdit() { if (!inEdit) { return; } inEdit = false; backupCopy = null; }
public void BeginEdit() { if (inEdit) { return; } inEdit = true; backupCopy = this.MemberwiseClone() as NewProduct; }
public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo) { NewProduct newProduct = (value as BindingGroup).Items[0] as NewProduct; if (newProduct.Quantity == 0) { MessageBox.Show("Ingrese la cantidad de productos"); return(new ValidationResult(false, "Ingrese la cantidad de productos")); } else if (newProduct.Name == null) { MessageBox.Show("Ingrese el nombre del producto"); return(new ValidationResult(false, "Ingrese el nombre del producto")); } else if (newProduct.PurchPriceDol == null && newProduct.PurchPriceSol == null) { MessageBox.Show("Ingrese precio de compra (Soles o Dólares)"); return(new ValidationResult(false, "Ingrese precio de compra (Soles o Dólares)")); } else { return(ValidationResult.ValidResult); } }
private void AddProductsList_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e) { DataGridRow selected = e.Row; if (Validation.GetHasError(selected)) { Trace.WriteLine("3"); } else { Trace.WriteLine("4"); } if (e.EditAction == DataGridEditAction.Commit) { NewProduct np = e.Row.DataContext as NewProduct; Trace.WriteLine("1" + np.Name); } if (e.EditAction == DataGridEditAction.Cancel) { NewProduct np = e.Row.DataContext as NewProduct; Trace.WriteLine("2" + np.Name); } }