Ejemplo n.º 1
0
        private void ValidateDemoRow(object sender, GridRowValidationEventArgs e)
        {
            e.Handled = true;
            ValidationInvoices row = e.Row as ValidationInvoices;

            if (row != null)
            {
                e.IsValid = row.OrderDate < row.RequiredDate;
                if (!e.IsValid)
                {
                    e.ErrorContent = "\"Order Date\" must be precede \"Required Date\"";
                }
            }
        }
Ejemplo n.º 2
0
        private void grid_InvalidRowException(object sender, InvalidRowExceptionEventArgs e)
        {
            ValidationInvoices row = e.Row as ValidationInvoices;

            if (row != null)
            {
                if (row.OrderDate >= row.RequiredDate)
                {
                    e.ExceptionMode = ExceptionMode.DisplayError;
                    e.WindowCaption = "Error";
                    e.ErrorText     = "\"Order Date\" must be precede \"Required Date\"";
                    return;
                }
            }
        }
Ejemplo n.º 3
0
        public GridValidationViewModel()
        {
            var    fullInvoices = NWindData <Invoices> .DataSource;
            Random rand         = new Random();

            foreach (Invoices inv in fullInvoices)
            {
                ValidationInvoices vi = new ValidationInvoices()
                {
                    CustomerID   = inv.CustomerID,
                    OrderDate    = inv.OrderDate,
                    RequiredDate = inv.RequiredDate,
                    OrderID      = rand.Next() % 7 == 0 ? -inv.OrderID : inv.OrderID,
                    ProductName  = rand.Next() % 5 == 0 ? string.Empty : inv.ProductName,
                    Freight      = rand.Next() % 11 == 0 ? -inv.Freight : inv.Freight,
                };
                Invoices.Add(vi);
            }
        }