void AssociatedObject_RowValidating(object sender, RowValidatingEventArgs args) { var data = args.RowData as BranchesDto; if (data == null) { args.ErrorMessages.Add("General", "Invalid insert"); args.IsValid = false; return; } long codeValue = Convert.ToInt64(data.BranchId); if (codeValue <= 0) { args.ErrorMessages.Add("ErrorCode", "Code no valido"); args.IsValid = false; } if (lastChangedObject == null) { lastChangedObject = data; } Dictionary <string, object> objectName = new Dictionary <string, object>(); objectName["DataObject"] = ControlExt.GetDataSource(AssociatedObject); objectName["ChangedValue"] = data; objectName["PreviousValue"] = new BranchesDto(lastChangedObject); }
void grdItemsDetalle_RowValidating(object sender, RowValidatingEventArgs e) { try { e.Row.ErrorText = string.Empty; if (e.Row is GridViewDataRowInfo) { if (e.Row.Cells["PACK_Codigo"].Value == null || ((Int32)(e.Row.Cells["PACK_Codigo"].Value) == 0)) { e.Row.ErrorText = "Debe ingresar servicio "; e.Row.Cells[4].ErrorText = "Debe ingresar servicio "; e.Cancel = true; e.Row.Cells[4].Style.DrawFill = true; e.Row.Cells[4].Style.NumberOfColors = 1; e.Row.Cells[4].Style.GradientStyle = GradientStyles.Solid; e.Row.Cells[4].Style.CustomizeBorder = true; e.Row.Cells[4].Style.DrawBorder = true; e.Row.Cells[4].Style.BorderWidth = 2; e.Row.Cells[4].Style.BorderGradientStyle = GradientStyles.Solid; e.Row.Cells[4].Style.BorderColor = Color.Red; } else { e.Row.Cells[4].Style.Reset(); } } } catch (Exception ex) { Infrastructure.WinForms.Controls.Dialogos.MostrarMensajeError(Presenter.Title, "Ha ocurrido un error al validar el registro." + ex.Message); } }
void AssociatedObject_RowValidating(object sender, RowValidatingEventArgs args) { var data = args.RowData as OrderInfo; decimal columnData = 0; decimal compareData = 0; double total = data.Freight + data.Expense; decimal.TryParse(total.ToString(), out columnData); decimal.TryParse("3000", out compareData); NumberFormatInfo numberFormatInfo = new NumberFormatInfo() { CurrencyDecimalDigits = NumberFormatInfo.CurrentInfo.CurrencyDecimalDigits, CurrencyDecimalSeparator = NumberFormatInfo.CurrentInfo.CurrencyDecimalSeparator, CurrencyGroupSeparator = NumberFormatInfo.CurrentInfo.CurrencyGroupSeparator, CurrencyNegativePattern = NumberFormatInfo.CurrentInfo.CurrencyNegativePattern, CurrencyPositivePattern = NumberFormatInfo.CurrentInfo.CurrencyPositivePattern, CurrencySymbol = NumberFormatInfo.CurrentInfo.CurrencySymbol, }; if (Convert.ToDouble(columnData) < Convert.ToDouble(compareData)) { args.ErrorMessages.Add("Expense", "Sum of Expense and Freight should be a minimum of 3000 to be eligible for Discount."); args.IsValid = false; } }
void AssociatedObject_RowValidating(object sender, RowValidatingEventArgs args) { var data = args.RowData as MaintainanceDto; if (data == null) { args.ErrorMessages.Add("General", "Invalid insert"); args.IsValid = false; return; } decimal codeValue = 0; if (!decimal.TryParse(data.MaintananceCode, out codeValue)) { args.ErrorMessages.Add("MainteanceCode", "Code no valido"); args.IsValid = false; } if (codeValue <= 0) { args.ErrorMessages.Add("ErrorCode", "Code no valido"); args.IsValid = false; } if (lastChangedObject == null) { lastChangedObject = data; } Dictionary <string, object> objectName = new Dictionary <string, object>(); objectName["DataObject"] = ControlExt.GetDataSource(AssociatedObject); objectName["ChangedValue"] = data; objectName["PreviousValue"] = new MaintainanceDto(lastChangedObject); }
void OnRowValidating(object sender, RowValidatingEventArgs args) { if (args.RowData != null && string.IsNullOrEmpty((args.RowData as OrderInfo).CustomerID)) { args.ErrorMessages.Add("CustomerID", "Customer ID field should not be null or empty"); args.IsValid = false; } }
/// <summary> /// Occurs when the row is validating. /// </summary> private void SfDataGrid1_RowValidating(object sender, RowValidatingEventArgs args) { var data = args.DataRow.RowData as OrderInfo; double total = data.Freight + data.Expense; if (total < 3000) { args.ErrorMessage = "Sum of Expense and Freight should be a minimum of 3000 to be eligible for Discount."; args.IsValid = false; } }
private void radGridView1_RowValidating(object sender, RowValidatingEventArgs e) { e.Row.ErrorText = string.Empty; if (e.Row is GridViewDataRowInfo) { if (e.Row.Cells[1].Value == null || String.IsNullOrEmpty(e.Row.Cells[1].Value.ToString())) { e.Row.ErrorText = "Empty value is not allowed"; e.Cancel = true; this.radGridView1.Tag = "RowNotValidated"; } } }
private void MechanicDataGrid_RowValidating(object sender, RowValidatingEventArgs args) { if (MechanicDataGrid.IsAddNewIndex(args.RowIndex)) { var mechanic = args.RowData as Mechanic; var error = getManager.Mechanic.Validate(mechanic); if (error.Count > 0) { args.IsValid = false; foreach (var item in error) { args.ErrorMessages.Add(item.Key, item.Value); } } } }
private void ServiceDataGrid_RowValidating(object sender, RowValidatingEventArgs args) { if (ServiceDataGrid.IsAddNewIndex(args.RowIndex)) { var service = args.RowData as Service; var error = getManager.Service.Validate(service); if (error.Count > 0) { args.IsValid = false; foreach (var item in error) { args.ErrorMessages.Add(item.Key, item.Value); } } } }
private void AccesoriesDataGrid_RowValidating(object sender, RowValidatingEventArgs args) { if (ProviderDataGrid.IsAddNewIndex(args.RowIndex)) { var accesory = args.RowData as Accessory; var error = getManager.Accessory.Validate(accesory); if (error.Count > 0) { args.IsValid = false; foreach (var item in error) { args.ErrorMessages.Add(item.Key, item.Value); } } } }
private void ClientsDataGrid_RowValidating(object sender, RowValidatingEventArgs args) { if (ClientsDataGrid.IsAddNewIndex(args.RowIndex)) { var client = args.RowData as Client; var error = getManager.Client.Validate(client); if (error.Count > 0) { args.IsValid = false; foreach (var item in error) { args.ErrorMessages.Add(item.Key, item.Value); } } } }
private void UserDataGrid_RowValidating(object sender, RowValidatingEventArgs args) { if (UserDataGrid.IsAddNewIndex(args.RowIndex)) { var user = args.RowData as User; var error = getManager.User.Validate(user); if (error.Count > 0) { args.IsValid = false; foreach (var item in error) { args.ErrorMessages.Add(item.Key, item.Value); } } } }
void AssociatedObject_RowValidating(object sender, RowValidatingEventArgs args) { var data = args.RowData as ContactsDto; if (data == null) { args.ErrorMessages.Add("General", "Invalid insert"); args.IsValid = false; return; } if (lastChangedObject == null) { lastChangedObject = data; } Dictionary <string, object> objectName = new Dictionary <string, object>(); objectName["DataObject"] = ControlExt.GetDataSource(AssociatedObject); objectName["ChangedValue"] = data; objectName["PreviousValue"] = lastChangedObject; }
protected override void Invoke(object parameter) { if (parameter is RowValidatingEventArgs) { RowValidatingEventArgs args = parameter as RowValidatingEventArgs; var data = args.RowData as OrderInfo; decimal columnData = 0; decimal compareData = 0; double total = data.Freight + data.Expense; decimal.TryParse(total.ToString(), out columnData); decimal.TryParse("3000", out compareData); NumberFormatInfo numberFormatInfo = new NumberFormatInfo() { CurrencyDecimalDigits = NumberFormatInfo.CurrentInfo.CurrencyDecimalDigits, CurrencyDecimalSeparator = NumberFormatInfo.CurrentInfo.CurrencyDecimalSeparator, CurrencyGroupSeparator = NumberFormatInfo.CurrentInfo.CurrencyGroupSeparator, CurrencyNegativePattern = NumberFormatInfo.CurrentInfo.CurrencyNegativePattern, CurrencyPositivePattern = NumberFormatInfo.CurrentInfo.CurrencyPositivePattern, CurrencySymbol = NumberFormatInfo.CurrentInfo.CurrencySymbol, }; if (Convert.ToDouble(columnData) < Convert.ToDouble(compareData)) { args.ErrorMessages.Add("Expense", "Sum of Expense and Freight should be a minimum of 3000 to be eligible for Discount."); args.IsValid = false; } } else { CurrentCellValidatingEventArgs args = parameter as CurrentCellValidatingEventArgs; if (args.Column.MappingName == "Discount" && Convert.ToDouble(args.NewValue) > 40) { args.ErrorMessage = "Discount should not exceed 40 percent."; args.IsValid = false; } } }
void grdItemsDetalle_RowValidating(object sender, RowValidatingEventArgs e) { }