private void executeValidateOrderType(GridCellValidationEventArgs eventArgs)
        {
            if (eventArgs.Value == null)
            {
                eventArgs.IsValid = false;
                eventArgs.SetError("Invalid item.");
                return;
            }
            string  value = eventArgs.Value.ToString();
            InvType item  = MarketTypes.SingleOrDefault(f => f.TypeName == value);

            if (item == null)
            {
                eventArgs.IsValid = false;
                eventArgs.SetError("Invalid item.");
            }
            else
            {
                if (Orders.SingleOrDefault(order => order.Order.TypeId == item.TypeId) != null)
                {
                    eventArgs.IsValid = false;
                    eventArgs.SetError("An order for this item already exists.");
                }
                else
                {
                    ((OrderVm)eventArgs.Row).Order.TypeId  = item.TypeId;
                    ((OrderVm)eventArgs.Row).Order.InvType = item;
                }
            }
        }
Esempio n. 2
0
        void colHoursActive_Validate(object sender, GridCellValidationEventArgs e)
        {
            double value = Convert.ToDouble(e.Value, e.Culture);

            if (value <= 0 || 1000 < value)
            {
                e.SetError("The Hours Active value must be greater than zero and less than or equal to 1000", ErrorType.Default);
            }
        }
Esempio n. 3
0
 private void OnValidateCell(object sender, GridCellValidationEventArgs e)
 {
     if (e.Row != null)
     {
         if (e.CellValue != e.Value)
         {
             if (e.Value == null)
             {
                 e.Handled = false;
                 e.SetError(e.Column.Header + " can't be empty!", DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical);
             }
             else if (e.Row is BrowserData)
             {
                 B item = (B)e.Row;
                 e.Handled = EditProperty(item, e);
             }
         }
         else
         {
             e.Handled = true;
         }
     }
 }
 private void Column_Validate(object sender, GridCellValidationEventArgs e)
 {
     if (e.Row != null)
     {
         string errorMessage;
         if ((e.Row as AnimationCustomerGroup).IsValidProperty(e.Column.FieldName, e.Value, out errorMessage) == false)
             e.SetError(errorMessage);
     }
 }
        private void AllocationQuantity_Validate(object sender, GridCellValidationEventArgs e)
        {
            if (e.Row != null && e.Value != null)
            {
                int value;
                if (int.TryParse(e.Value.ToString(), out value) == false)
                    value = 0;

                if (value > 0)
                {
                    AnimationProductDetail apd = e.Row as AnimationProductDetail;
                    if (apd.ForecastProcQuantity == null || apd.ForecastProcQuantity.Value < value)
                    {
                        e.SetError("Allocation Quantity cannot exceed Forecast Procurement Quantity.");
                    }
                }
            }
        }