コード例 #1
0
        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);
        }
コード例 #2
0
 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); }
 }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 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;
     }
 }
コード例 #6
0
ファイル: Form1.cs プロジェクト: syncfusion/winforms-demos
        /// <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;
            }
        }
コード例 #7
0
ファイル: Form1.cs プロジェクト: telerik/winforms-sdk
 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";
         }
     }
 }
コード例 #8
0
 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);
             }
         }
     }
 }
コード例 #9
0
 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);
             }
         }
     }
 }
コード例 #10
0
 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);
             }
         }
     }
 }
コード例 #11
0
 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);
             }
         }
     }
 }
コード例 #12
0
 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);
             }
         }
     }
 }
コード例 #13
0
        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;
        }
コード例 #14
0
        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;
                }
            }
        }
コード例 #15
0
ファイル: DOC000LView.cs プロジェクト: ferarell/DelfinGroup
 void grdItemsDetalle_RowValidating(object sender, RowValidatingEventArgs e)
 {
 }