void OnValidateRow(object sender, GridRowValidationEventArgs e)
        {
            var task = (Task)e.Row;

            if (task.StartDate > task.EndDate)
            {
                e.SetError("Start Date must be less than End Date");
            }
            if (string.IsNullOrEmpty(task.TaskName))
            {
                e.SetError("Enter a task name");
            }
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void view_ValidateRow(object sender, GridRowValidationEventArgs e)
        {
            //Relationship row = this.relationshipGrid.GetRow(e.RowHandle) as Relationship;
            PropertiesViewModel viewModel = this.DataContext as PropertiesViewModel;

            Relationship row = e.Row as Relationship;

            if (null != row)
            {
                string results = ValidationRules.IsRelationshipValid(row);
                if (!String.IsNullOrEmpty(results))
                {
                    e.IsValid      = false;
                    e.ErrorType    = DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical;
                    e.ErrorContent = "The highlighted field cannot be blank";
                    e.SetError(e.ErrorContent);


                    Style style     = new Style();
                    Style baseStyle = FindResource(new GridRowThemeKeyExtension()
                    {
                        ResourceKey = GridRowThemeKeys.LightweightCellStyle, ThemeName = ThemeManager.ApplicationThemeName
                    }) as Style;
                    style.BasedOn    = baseStyle;
                    style.TargetType = typeof(LightweightCellEditor);
                    style.Setters.Add(new Setter(LightweightCellEditor.BackgroundProperty, new SolidColorBrush(Colors.LightPink)));

                    //// TO-DO.... figure out how to set the style on the control
                    this.viewFName.Style = style;
                }
                //// TO-DO: figure out how to set the IsDirty property......
            }
        }
Esempio n. 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void view_ValidateRow(object sender, GridRowValidationEventArgs e)
 {
     if (!e.IsValid)
     {
         e.IsValid      = false;
         e.ErrorType    = DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical;
         e.ErrorContent = "The highlighted field cannot be blank";
         e.SetError(e.ErrorContent);
     }
 }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void view_ValidateRow(object sender, GridRowValidationEventArgs e)
        {
            PropertiesDetailsViewModel vm = this.DataContext as PropertiesDetailsViewModel;

            Property row = e.Row as Property;

            //if (null != row)
            if (!e.IsValid)
            {
                e.IsValid      = false;
                e.ErrorType    = DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical;
                e.ErrorContent = "The highlighted field cannot be blank";
                e.SetError(e.ErrorContent);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TableView_ValidateRow(object sender, GridRowValidationEventArgs e)
        {
            Relationship row = e.Row as Relationship;

            if (null != row)
            {
                string results = ValidationRules.IsRelationshipRowValid(row);
                if (!String.IsNullOrEmpty(results))
                {
                    e.IsValid      = false;
                    e.ErrorType    = DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical;
                    e.ErrorContent = "The highlighted field cannot be blank";
                    e.SetError(e.ErrorContent);
                }
                else
                {
                    // TO-DO: this work needs to go into the view model
                    //row.Photo = vm.ApplDefault.Photo; //PropertiesViewModel.DefaultBitmapImage;
                    //row.Image = Helper.ArrayToBitmapImage(row.Photo.ToArray());
                    //row.PropertyID = vm.SelectedProperty.PropertyID;
                    e.IsValid = true;
                }
            }
        }
Esempio n. 6
0
 private void TableView_ValidateRow(object sender, GridRowValidationEventArgs e)
 {
     AnimationProduct ap = e.Row as AnimationProduct;
     if (ap != null)
     {
         string errorMessage;
         string firstInvalidColumn;
         if (ap.IsValid(out errorMessage, out firstInvalidColumn) == false)
         {
             grdProduct.View.FocusedRowHandle = e.RowHandle;
             if (firstInvalidColumn == "IDProduct")
             {
                 (grdProduct.View as TableView).FocusedColumn = this.clmMaterialCode;
                 e.SetError("Product data is missing. Please input the Material Code or Description. ");
             }
             else
             {
                 (grdProduct.View as TableView).FocusedColumn = grdProduct.Columns[firstInvalidColumn];
                 e.SetError(string.Format(errorMessage, (grdProduct.View as TableView).FocusedColumn.HeaderCaption));
             }
         }
     }
 }