Exemplo n.º 1
0
        private void bandedGridView1_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
        {
            decimal parseResult = -1;

            foreach (KeyValuePair <string, CheckItem> kv in m_dicCheckItems)
            {
                if (kv.Key.Equals(this.bandedGridView1.FocusedColumn.FieldName))
                {
                    string val = e.Value.ToString().Trim();//当前单元格中的值
                    if (string.IsNullOrEmpty(val))
                    {
                        return;
                    }
                    if (decimal.TryParse(val, out parseResult)) //如果转换成功
                    {
                        if (parseResult < kv.Value.minValue || parseResult > kv.Value.maxValue)
                        {
                            e.Valid     = false;
                            e.ErrorText = kv.Value.caption + "的值超过区间【" + kv.Value.minValue.ToString() + " - " + kv.Value.maxValue + "】";
                        }
                    }
                    else
                    {
                        e.Valid     = false;
                        e.ErrorText = "请确认输入的值为数字类型";
                    }
                    break;
                }
            }
        }
Exemplo n.º 2
0
 private void gridView1_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
 {
     try
     {
         ////if (gridView1.FocusedColumn == colName)
         ////{
         ////    if (e.Value == null || ((string)e.Value) == string.Empty)
         ////    {
         ////        e.Valid = false;
         ////        e.ErrorText = "Name must have a value";
         ////    }
         ////    else
         ////        if (e.Value.ToString().Length > 50)
         ////        {
         ////            e.Valid = false;
         ////        }
         ////}
         ////else
         ////    if (gridView1.FocusedColumn == colCategoryID)
         ////    {
         ////        if (e.Value == null || ((string)e.Value) == string.Empty)
         ////        {
         ////            e.Valid = false;
         ////            e.ErrorText = "Category must have a value";
         ////        }
         ////    }
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Exemplo n.º 3
0
        void rootGridViewFuncRoles_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
        {
            try
            {
                bool     validatingError = false;
                GridView view            = sender as GridView;

                if (view.FocusedColumn.FieldName == eFunctionalityRoleColumns.FunctionalityId.ToString() && (int)e.Value < 1)
                {
                    validatingError = true;
                }
                else if (view.FocusedColumn.FieldName == eFunctionalityRoleColumns.RoleId.ToString() && string.IsNullOrEmpty(e.Value as string))
                {
                    validatingError = true;
                }

                if (validatingError)
                {
                    e.Valid     = false;
                    e.ErrorText = GlobalSetting.ResManager.GetString("FieldRequired");
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 编辑校验
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gridView1_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
        {
            string colName = (sender as ColumnView).FocusedColumn.FieldName.ToUpper();

            if (colName.Equals("RO003"))
            {
                if (String.IsNullOrEmpty(e.Value.ToString()))
                {
                    e.Valid     = false;
                    e.ErrorText = "角色名称不能为空!";
                }
                else
                {
                    for (int i = 0; i < gridView1.RowCount - 1; i++)
                    {
                        if (i == (sender as ColumnView).FocusedRowHandle)
                        {
                            continue;
                        }
                        if (gridView1.GetRowCellValue(i, "RO003") == null)
                        {
                            continue;
                        }

                        //如果角色名字相同,则校验不通过!
                        if (String.Equals(gridView1.GetRowCellValue(i, "RO003").ToString(), e.Value.ToString()))
                        {
                            e.Valid     = false;
                            e.ErrorText = "角色名称已经存在!";
                            break;
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
        private void UiPropertyGridZona_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
        {
            var vGrid = sender as PropertyGridControl;

            if (vGrid.FocusedRow.Name == "UiRowZone")
            {
                e.Valid = e.Value.ToString().All(c => Char.IsLetterOrDigit(c) || c.Equals('_'));
            }
        }
Exemplo n.º 6
0
        private void gridView2_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
        {
            string colName = (sender as ColumnView).FocusedColumn.FieldName.ToUpper();

            if (colName.Equals("AC113"))
            {
                if (String.IsNullOrEmpty(e.Value.ToString()))
                {
                    e.Valid     = false;
                    e.ErrorText = "逝者名称不能为空!";
                }
                else
                {
                    for (int i = 0; i < gridView2.RowCount - 1; i++)
                    {
                        if (i == (sender as ColumnView).FocusedRowHandle)
                        {
                            continue;
                        }
                        if (gridView2.GetRowCellValue(i, "AC113") == null)
                        {
                            continue;
                        }

                        //如果角色名字相同,则校验不通过!
                        if (String.Equals(gridView2.GetRowCellValue(i, "AC113").ToString(), e.Value.ToString()))
                        {
                            e.Valid     = false;
                            e.ErrorText = "逝者名称已经存在!";
                            break;
                        }
                    }
                }
            }
            else if (colName.Equals("AC116"))  //出生日期
            {
                if (e.Value != null && !(e.Value is DBNull))
                {
                    if (DateTime.Compare(Convert.ToDateTime(e.Value.ToString()), DateTime.Today) > 0)
                    {
                        e.Valid     = false;
                        e.ErrorText = "出生日期错误!";
                    }
                }
            }
            else if (colName.Equals("AC118"))  //逝世时间
            {
                if (e.Value != null && !(e.Value is DBNull))
                {
                    if (DateTime.Compare(Convert.ToDateTime(e.Value.ToString()), DateTime.Today) > 0)
                    {
                        e.Valid     = false;
                        e.ErrorText = "逝世日期错误!";
                    }
                }
            }
        }
Exemplo n.º 7
0
 private void customerView_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
 {
     //if (sender is ColumnView view) {
     //  if (view.FocusedColumn.FieldName == "Name") {
     //    //view.ActiveEditor.EditValue
     //    e.Valid = false;
     //    e.ErrorText = "Something is wrong with the value";
     //  }
     //}
 }
Exemplo n.º 8
0
 private void gridView1_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
 {
     try
     {
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
 private void gridView1_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
 {
     //var _column = gridView1.FocusedColumn;
     //if (_column != colImporte) return;
     //var descuentoAcumulado = Convert.ToDecimal(AGlobalOrdenDeTrabajo.Descuento);
     //if (descuentoAcumulado + Convert.ToDecimal(e.Value) > AGlobalOrdenDeTrabajo.Agrupacion.GetDeuda(AGlobalOrdenDeTrabajo.TipoMonedaId))
     //{
     //    e.Valid = false;
     //    e.ErrorText = "El descuento total no puede sobrepasar la deuda de la Unidad Artística";
     //}
 }
 private void gvGrid_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
 {
     if (gvGrid.FocusedRowHandle == GridControl.AutoFilterRowHandle)
     {
         return;
     }
     if (gvGrid.FocusedRowHandle == GridControl.NewItemRowHandle &&
         gvGrid.GetRow(GridControl.NewItemRowHandle) == null)
     {
         return;
     }
     e.Valid = true;
 }
Exemplo n.º 11
0
        private void gv_Detail_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
        {
            var view = sender as DevExpress.XtraGrid.Views.Grid.GridView;

            if (Object.Equals(view.FocusedColumn.Tag, "NotNull"))
            {
                if (Object.Equals(string.Empty, e.Value) || Object.Equals(null, e.Value) || Object.Equals(DBNull.Value, e.Value))
                {
                    e.Valid     = false;
                    e.ErrorText = view.FocusedColumn.Caption + "不能为空!";
                }
            }
        }
Exemplo n.º 12
0
        private void gridViewReceipt_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
        {
            if (textAmt.EditValue.ToString() == "")
            {
                return;
            }
            decimal amt     = 0;
            decimal dTotAmt = Convert.ToDecimal(textAmt.EditValue);

            for (int t = 0; t < gridViewReceipt.RowCount; t++)
            {
                amt = amt + Convert.ToDecimal(gridViewReceipt.GetRowCellValue(t, "CurrentAmount").ToString());
            }
            textAmt.EditValue = amt.ToString();
        }
Exemplo n.º 13
0
        private void gvDetailHistory_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
        {
            GridView gv = (sender as GridView);

            if (gv.FocusedColumn.FieldName == coldtStartTime.FieldName)
            {
                DateTime date = new DateTime();
                //var value = gv.GetRowCellValue(gv.FocusedRowHandle, coldtStartTime);
                if (e.Value == null)
                {
                    e.Valid     = false;
                    e.ErrorText = "Start Time can't be empty";
                }
                else
                {
                    if (String.IsNullOrEmpty(e.Value.ToString()))
                    {
                        e.Valid     = false;
                        e.ErrorText = "Start Time can't be empty";
                    }
                    else
                    {
                        if (!DateTime.TryParse(e.Value.ToString(), out date))
                        {
                            e.Valid     = false;
                            e.ErrorText = "Start Time isn't valid date";
                        }
                        else
                        {
                            if (date == DateTime.MinValue)
                            {
                                e.Valid     = false;
                                e.ErrorText = "Start Time isn't valid date";
                            }
                        }
                    }
                }
            }
            if (gv.FocusedColumn.FieldName == coldtPeriod.FieldName)
            {
                if (e.Value == null)
                {
                    e.Valid     = false;
                    e.ErrorText = "Please select one item";
                }
                else
                {
                    if (String.IsNullOrEmpty(e.Value.ToString()))
                    {
                        e.Valid     = false;
                        e.ErrorText = "Please select one item";
                    }
                    else
                    {
                        if (int.Parse(e.Value.ToString()) == 0)
                        {
                            e.Valid     = false;
                            e.ErrorText = "Please select one item";
                        }
                        else
                        {
                            bool valid = true;
                            for (int i = 0; i < gv.DataRowCount; i++)
                            {
                                //valid = false;
                                //foreach (GridColumn column in gv.Columns)
                                //{

                                if (i != gv.FocusedRowHandle)
                                {
                                    if (gv.GetRowCellValue(i, coldtPeriod).Equals(e.Value))
                                    {
                                        //valid = true;
                                        valid = false;
                                        break;
                                    }
                                }
                                //}
                                //if (!valid) break;
                            }
                            if (!valid)
                            {
                                e.Valid     = false;
                                e.ErrorText = "Please select another period, this period is duplicated";
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 14
0
 private void gridViewPago_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
 {
 }
Exemplo n.º 15
0
 private void ophLayoutView_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
 {
     e.Valid = true;
 }