private void gdvStockOut_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        {
            try
            {
                _indexOf = gdvStockOut.FocusedRowHandle;
                if (_indexOf != _indexCompair)
                {
                    _indexCompair = _indexOf;
                    _valueQty     = Convert.ToInt16(gdvStockOut.GetRowCellDisplayText(gdvStockOut.GetSelectedRows()[0], gdvStockOut.Columns["Quantity"]));
                }

                if (gdvStockOut.FocusedColumn.FieldName == "Quantity")
                {
                    int qty, value = 0;
                    int.TryParse(e.Value as string, out value);
                    if (!int.TryParse(e.Value as string, out qty) || value <= 0)
                    {
                        e.Valid     = false;
                        e.ErrorText = "Numeric values are only accepted";
                    }
                    else if (value > _valueQty)
                    {
                        e.Valid     = false;
                        e.ErrorText = "Please don't input value small than product quantity";
                    }
                }
            }
            catch (Exception ex)
            {
                MsgBox.msgLoad("error", ex.Message);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 检查指定行的字段是否为重复
        /// </summary>
        public static bool ValidateRowRepeat(this GridControl grd, BaseContainerValidateEditorEventArgs e, string primaryKey, params string[] fieldNames)
        {
            bool result = true;

            GridView grv            = grd.FocusedView as GridView;
            string   focuseKeyValue = string.Concat(grv.GetFocusedRowCellValue(primaryKey));

            for (int i = 0; i < fieldNames.Length; i++)
            {
                string fieldName = fieldNames[i];
                if (grv.FocusedColumn.FieldName == fieldName)
                {
                    for (int r = 0; r < grv.RowCount; r++)
                    {
                        string keyValue = string.Concat(grv.GetRowCellValue(r, primaryKey));
                        if (!string.IsNullOrEmpty(keyValue) && focuseKeyValue != keyValue &&
                            string.Concat(e.Value) == string.Concat(grv.GetRowCellValue(r, fieldName)))
                        {
                            e.Valid           = false;
                            e.ErrorText       = string.Format("{0}不能重复", grv.Columns[fieldName].Caption);
                            grv.FocusedColumn = grv.Columns[fieldName];
                            result            = false;
                            return(result);
                        }
                    }
                }
            }
            return(result);
        }
Esempio n. 3
0
        private void View_Sensors_ValidatingEditor(Object sender, BaseContainerValidateEditorEventArgs e)
        {
            RowData Row = null;

            if (View_Sensors.FocusedRowHandle >= 0)
            {
                DataList[View_Sensors.FocusedRowHandle].Valid = false;
                switch (UniversalCard.VerifySensor(out Row, e.Value as String, !DataList.Select(r => r._Sensor).Where(s => !String.IsNullOrEmpty(s)).Contains(e.Value as String), DeviceState.Shipped, DeviceState.Operating))
                {
                case -2: DataList[View_Sensors.FocusedRowHandle].ToolTip = "Не введено значение!";
                    break;

                case -1: DataList[View_Sensors.FocusedRowHandle].ToolTip = "Датчик с указанным номером должен быть в состоянии «Отгружен», либо «В эксплуатации»!";
                    break;

                case 0: DataList[View_Sensors.FocusedRowHandle].ToolTip = "Датчик с указанным номером не существует!";
                    break;

                case 1:
                    if (BusySensors.Contains(e.Value as String) && !DataList.Select(r => r._Sensor).Where(s => !String.IsNullOrEmpty(s)).Contains(e.Value as String))
                    {
                        DataList[View_Sensors.FocusedRowHandle].ToolTip = "Датчик с указанным номером уже указан в данной карточке!";
                    }
                    else
                    {
                        DataList[View_Sensors.FocusedRowHandle].ToolTip = Row.GetString("Name");
                        DataList[View_Sensors.FocusedRowHandle].Valid   = true;
                    }
                    break;

                default: DataList[View_Sensors.FocusedRowHandle].ToolTip = "Обнаружена неоднозначность (по запросу обнаружено несколько записей)!";
                    break;
                }
            }
        }
Esempio n. 4
0
        public void OnValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        {
            int cnt       = 0;
            int rowHandle = gridView.FocusedRowHandle;

            try
            {
                cnt = Convert.ToInt32(e.Value);
            }
            catch
            {
                e.ErrorText = "只能输入一个整数";
                e.Valid     = false;
            }
            int qnt = Convert.ToInt32(gridView.GetRowCellValue(rowHandle, colQuantity));

            if (cnt <= 0)
            {
                e.ErrorText = "倒库数量不能小于0. ";
                e.Valid     = false;
                gridView.SetRowCellValue(rowHandle, colTranCnt, qnt);
                return;
            }
            if (cnt > qnt)
            {
                e.ErrorText = "倒库数量大于库存量. ";
                e.Valid     = false;
                gridView.SetRowCellValue(rowHandle, colTranCnt, qnt);
                return;
            }
        }
Esempio n. 5
0
        public void OnValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        {
            int cnt       = 0;
            int rowHandle = gridView.FocusedRowHandle;

            try
            {
                cnt = Convert.ToInt32(e.Value);
            }
            catch
            {
                e.ErrorText = "只能输入一个整数";
                e.Valid     = false;
            }
            ;
            if (cnt <= 0)
            {
                e.ErrorText = "倒库数量不能小于0. ";
                e.Valid     = false;
                return;
            }
            string detialId = gridView.GetRowCellValue(rowHandle, colDetailID).ToString();
            string lotno    = gridView.GetRowCellValue(rowHandle, colLotNo).ToString();
            string sizeno   = gridView.GetRowCellValue(rowHandle, colSizeNo).ToString();
            string shelfno  = gridView.GetRowCellValue(rowHandle, colShelfNoFrom).ToString();

            if (cnt > GetInventoryQuantity(lotno, sizeno, shelfno))
            {
                e.ErrorText = "倒库数量不能大于库存量. ";
                e.Valid     = false;
                return;
            }

            SaveTranCnt(cnt, detialId);
        }
Esempio n. 6
0
        void gridView1_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        {
            GridView view = sender as GridView;


            if (view.FocusedColumn.FieldName == "email")
            {
                GridColumn emailCol = view.Columns["email"];

                var emailStr = e.Value;


                //Validity criterion
                if (emailStr == null || emailStr.ToString().Trim().Length == 0)
                {
                    e.Valid     = false;
                    e.ErrorText = "Must enter value";
                    //Set errors with specific descriptions for the columns
                    //view.SetColumnError(emailCol, "Must enter valid email");
                    return;
                }
                if (!Shared.Utils.IsValidEmailFormat(emailStr.ToString()))
                {
                    e.Valid     = false;
                    e.ErrorText = "Email is not valid";
                }
            }
        }
Esempio n. 7
0
        public void OnValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        {
            ColumnTag tag = gridView.FocusedColumn.Tag as ColumnTag;

            if (tag == null || tag.DataType != ColumnTag.DataType_Integer)
            {
                return;
            }
            int num = 0, sum = 0;

            try
            {
                num = Convert.ToInt32(e.Value);
                string temp = gridView.GetFocusedRowCellValue(colSubTotal).ToString();
                if (string.IsNullOrEmpty(temp) == false)
                {
                    sum = Convert.ToInt32(temp);
                }
                sum += num;
                gridView.SetFocusedRowCellValue(colSubTotal, sum);
            }
            catch
            {
                e.ErrorText = "只能输入一个整数";
                e.Valid     = false;
            }
        }
Esempio n. 8
0
        private void gvMain_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        {
            GridView gv = sender as GridView;

            if (gv.FocusedColumn.FieldName == "colThanhTien" ||
                gv.FocusedColumn.FieldName == "colChietKhauTiLe" ||
                gv.FocusedColumn.FieldName == "colChietKhau" ||
                gv.FocusedColumn.FieldName == "colThanhToan")
            {
                double t = 0;
                if (!double.TryParse(e.Value.ToString(), out t))
                {
                    e.Valid     = false;
                    e.ErrorText = "Vui lòng chỉ nhập số !";
                }
                else if (t < 0)
                {
                    e.Valid     = false;
                    e.ErrorText = "Giá trị không hợp lệ !";
                }
                else
                {
                    e.Valid     = true;
                    e.ErrorText = "";
                }
            }
        }
Esempio n. 9
0
 private void gridView1_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
 {
     //GridView view = sender as GridView;
     //if (view.FocusedColumn.FieldName == "ApplicationName")
     //{
     //    //Get the currently edited value
     //    string code = e.Value.ToString();
     //
     //    // Check for allowable length
     //    if (code.Length > 50)
     //    {
     //        e.Valid = false;
     //        e.ErrorText = "Maximum characters allowed = 50.";
     //    }
     //
     //    // Check for duplicate values
     //    for (int i = 0; i < gridView1.RowCount -1; i++)
     //    {
     //        if (code == gridView1.GetRowCellValue(i, "ApplicationName").ToString() &&  i != gridView1.FocusedRowHandle)
     //       {
     //           e.Valid = false;
     //            e.ErrorText = "Duplicate entries are not allowed.";
     //        }
     //    }
     //}
 }
Esempio n. 10
0
 private void gvVentaDetalle_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
 {
     if (!decimal.TryParse(e.Value.ToString(), out decimal r))
     {
         //e.ErrorText = "Solo se admiten valores numéricos";
         e.Valid = false;
         return;
     }
     decimal valorcelda = Convert.ToDecimal(e.Value);
     decimal precio = Convert.ToDecimal(gvVentaDetalle.GetFocusedRowCellValue("precio"));
     decimal dc = Convert.ToDecimal(gvVentaDetalle.GetFocusedRowCellValue("dc"));
     //decimal d1 = Convert.ToDecimal(gvVentaDetalle.GetFocusedRowCellValue("d1"));
     decimal dv = Convert.ToDecimal(gvVentaDetalle.GetFocusedRowCellValue("dv"));
     decimal dv2 = Convert.ToDecimal(gvVentaDetalle.GetFocusedRowCellValue("dv2"));
     decimal importe = Convert.ToDecimal(gvVentaDetalle.GetFocusedRowCellValue("importe"));
     decimal descuento = Convert.ToDecimal(gvVentaDetalle.GetFocusedRowCellValue("descuento"));
     decimal total = Convert.ToDecimal(gvVentaDetalle.GetFocusedRowCellValue("total"));
     switch ((sender as GridView).FocusedColumn.FieldName)
     {
         case "cantidad":
             if (valorcelda < 1 || valorcelda > 1000000)
             {
                 //e.ErrorText = "No se permiten valores menores a 1 y mayores a 1000000";
                 e.Valid = false;
             }
             importe = precio * valorcelda;
             descuento = ((dc + dv) * importe) + dv2;
             total = importe - descuento;
             gvVentaDetalle.SetRowCellValue(gvVentaDetalle.FocusedRowHandle, "importe", importe);
             gvVentaDetalle.SetRowCellValue(gvVentaDetalle.FocusedRowHandle, "descuento", descuento);
             gvVentaDetalle.SetRowCellValue(gvVentaDetalle.FocusedRowHandle, "total", total);
             break;
         case "dv":
             if(valorcelda < 0 || valorcelda > 100)
             {
                 //e.ErrorText = "No se permiten valores menores a 0 y mayores a 1000000";
                 e.Valid = false;
                 return;
             }
             e.Value = valorcelda / 100;
             valorcelda = Convert.ToDecimal(e.Value);
             descuento = ((dc + valorcelda) * importe) + dv2;
             total = importe - descuento;
             gvVentaDetalle.SetRowCellValue(gvVentaDetalle.FocusedRowHandle, "descuento", descuento);
             gvVentaDetalle.SetRowCellValue(gvVentaDetalle.FocusedRowHandle, "total", total);
             break;
         case "dv2":
             if(valorcelda < 0 || valorcelda > 1000000)
             {
                 e.Valid = false;
                 return;
             }
             descuento = ((dc + dv) * importe) + valorcelda;
             total = importe - descuento;
             gvVentaDetalle.SetRowCellValue(gvVentaDetalle.FocusedRowHandle, "descuento", descuento);
             gvVentaDetalle.SetRowCellValue(gvVentaDetalle.FocusedRowHandle, "total", total);
             break;
     }
     Totales();
 }
Esempio n. 11
0
        private void onValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        {
            if (!dataAvailable())
            {
                return;
            }
            if (ValidationMode == ValidationMode.LeavingRow)
            {
                return;
            }

            var cell = RetrieveActiveCell();

            if (cell.HasInvalidHandles())
            {
                return;
            }

            var notification = cell.ValidateValue(e.Value);

            if (!notification.HasError())
            {
                return;
            }

            e.ErrorText = notification.ErrorNotification;
            e.Valid     = false;
        }
Esempio n. 12
0
        private void gridViewCheckSetting_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        {
            DevExpress.XtraGrid.Columns.GridColumn colTaskName   = gridViewCheckSetting.Columns["TaskName"];
            DevExpress.XtraGrid.Columns.GridColumn colTaskPath   = gridViewCheckSetting.Columns["Datasource"];
            DevExpress.XtraGrid.Columns.GridColumn colValidating = gridViewCheckSetting.FocusedColumn;
            int rowHandle = gridViewCheckSetting.FocusedRowHandle;

            if (colValidating == colTaskName || colValidating == colTaskPath)
            {
                string strPath = gridViewCheckSetting.GetRowCellValue(rowHandle, colTaskPath) as string;
                string strName = gridViewCheckSetting.GetRowCellValue(rowHandle, colTaskName) as string;
                if (colValidating == colTaskName)
                {
                    strName = e.Value as string;
                }
                else
                {
                    strPath = e.Value as string;
                }

                if (string.IsNullOrEmpty(strName) || !TaskHelper.TestTaskName(strName))
                {
                    XtraMessageBox.Show("名称为空或者包含非法字符!");
                    e.Valid = false;
                    return;
                }
                string strMsg = "";
                if (TaskHelper.TaskExists(strName, strPath, ref strMsg))
                {
                    XtraMessageBox.Show(strMsg);
                    e.Valid = false;
                    return;
                }
            }
        }
Esempio n. 13
0
        /// <summary>
        /// 编辑校验
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gridView2_ValidatingEditor(object sender, 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 = "逝世日期错误!";
                    }
                }
            }
        }
        private void gridView1_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        {
            GridView     view = (GridView)sender;
            XPBaseObject row  = (XPBaseObject)view.GetFocusedRow();
            Dictionary <string, object> customValues = new Dictionary <string, object>();

            customValues.Add(view.FocusedColumn.FieldName, e.Value);
            e.ErrorText = new Validator(row, customValues).Validate(view.FocusedColumn.FieldName);
            e.Valid     = string.IsNullOrEmpty(e.ErrorText);
        }
Esempio n. 15
0
        private void pledgesView_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        {
            if (pledgesView.FocusedColumn != colLinkAmount)
            {
                return;
            }
            var pledge = (Pledge)pledgesView.GetFocusedRow();

            e.ErrorText = controller.GetErrorText(pledge, (decimal)e.Value);
            e.Valid     = String.IsNullOrEmpty(e.ErrorText);
        }
Esempio n. 16
0
 void sectionView_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
 {
     if (sectionView.FocusedColumn.FieldName == "Label!")
     {
         if (((string)sectionView.EditingValue).Length > 5)
         {
             e.Valid     = false;
             e.ErrorText = "Section label must be less than or equal to 5 characters";
         }
     }
 }
Esempio n. 17
0
 private void gridViewCT_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
 {
     if ((e as EditFormValidateEditorEventArgs).Column.Name != "SOLO")
     {
         return;
     }
     if (e.Value.ToString() == string.Empty)
     {
         lkpSoLo.Focus();
         e.Valid = false;
     }
 }
Esempio n. 18
0
 private void gbList_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
 {
     if (!this.Exist(this.gcList.DataSource as DataTable, this.m_AllowanceCode))
     {
         this.gbList.OptionsView.NewItemRowPosition = NewItemRowPosition.Bottom;
     }
     else
     {
         e.ErrorText = "Trùng phụ cấp - Nhấn ESC để phục hồi trạng thái bình thường!";
         e.Valid     = false;
     }
 }
        private void validateEditor(BaseContainerValidateEditorEventArgs e)
        {
            var validationMessages = _presenter.GetValidationMessagesForWeight(e.Value.ConvertedTo <float>()).ToList();

            if (!validationMessages.Any())
            {
                return;
            }

            e.Valid     = false;
            e.ErrorText = validationMessages.First();
        }
Esempio n. 20
0
 private void gridView1_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
 {
     try
     {
         double num = Convert.ToSingle(e.Value.ToString().Replace(".", ","));
     }
     catch
     {
         e.Valid = false;
         int num = (int)XtraMessageBox.Show(Messages.IncorrectInputFormat, Messages.Error, MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
 }
Esempio n. 21
0
 public void OnValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
 {
     if (gridView.FocusedColumn == colShelfNo)
     {
         if (FindShelfNo(e.Value.ToString()) == false)
         {
             e.ErrorText = "Shelf# does not exist. ";
             e.Valid     = false;
             return;
         }
         UpdateShelfNo(gridView.FocusedRowHandle, e.Value.ToString());
     }
 }
Esempio n. 22
0
        private void gridView1_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        {
            if (gridView1.FocusedColumn.FieldName.ToUpper() == "SA004")
            {
                for (int i = 0; i < gridView1.RowCount - 1; i++)
                {
                    if (i == (sender as ColumnView).FocusedRowHandle)
                    {
                        continue;
                    }
                    if (gridView1.GetRowCellValue(i, "SA004") == null)
                    {
                        continue;
                    }

                    //如果项目相同,则校验不通过!
                    if (String.Equals(gridView1.GetRowCellValue(i, "SA004").ToString(), e.Value.ToString()))
                    {
                        e.Valid     = false;
                        e.ErrorText = "项目已经存在!";
                        break;
                    }
                }
            }
            else if (gridView1.FocusedColumn.FieldName.ToUpper() == "NUMS")
            {
                int i_num;
                if (int.TryParse(e.Value.ToString(), out i_num))
                {
                    if (i_num <= 0)
                    {
                        e.ErrorText = "请输入数量!";
                        e.Valid     = false;
                        return;
                    }
                }
            }
            else if (gridView1.FocusedColumn.FieldName.ToUpper() == "PRICE")
            {
                decimal dec_1 = decimal.Zero;
                if (decimal.TryParse(e.Value.ToString(), out dec_1))
                {
                    if (dec_1 <= 0)
                    {
                        e.ErrorText = "请输入正确的价格!";
                        e.Valid     = false;
                        return;
                    }
                }
            }
        }
Esempio n. 23
0
        private void gridView1_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        {
            GridView view = sender as GridView;

            if (view.FocusedColumn.FieldName == "SDT")
            {
                double phone = 0;
                if (!Double.TryParse(e.Value as String, out phone))
                {
                    e.Valid     = false;
                    e.ErrorText = "Hãy nhập số điện thoại của bạn ( 9-13 số ).";
                }
            }
        }
        private void gridView1_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        {
            GridView view = sender as GridView;

            if (view.FocusedColumn.FieldName == "名称" || view.FocusedColumn.FieldName == "地址")
            {
                string name = (string)e.Value;
                if (name == null || name.Trim() == "")
                {
                    e.Valid     = false;
                    e.ErrorText = "名称和IP地址不能为空";
                }
            }
        }
Esempio n. 25
0
        private void gridEditorValidating(BaseContainerValidateEditorEventArgs e)
        {
            var rowIndex    = gridView.GetFocusedDataSourceRowIndex();
            var columnIndex = gridView.FocusedColumn.AbsoluteIndex;

            var validationFailureMessages = _presenter.GetCellValidationErrorMessages(rowIndex, columnIndex, e.Value.ToString()).ToList();

            if (!validationFailureMessages.Any())
            {
                return;
            }

            e.Valid     = false;
            e.ErrorText = validationFailureMessages.First();
        }
Esempio n. 26
0
        void baysshelvesView_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        {
            GridView view = sender as GridView;

            if (view != null)
            {
                if (view.FocusedColumn.FieldName == "Label!")
                {
                    if (((string)view.EditingValue).Length > 3)
                    {
                        e.Valid     = false;
                        e.ErrorText = "Bay and shelf labels must be less than or equal to 3 characters";
                    }
                }
            }
        }
Esempio n. 27
0
        protected override void GridView_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        {
            GridView           gridView = (GridView)sender;
            ICReceiptItemsInfo item     = (ICReceiptItemsInfo)gridView.GetRow(gridView.FocusedRowHandle);

            if (e.Value != null)
            {
                if (gridView.FocusedColumn.FieldName == "ICReceiptItemProductFactor")
                {
                    if (!string.IsNullOrEmpty(e.Value.ToString()))
                    {
                        ICProductMeasureUnitsController controller  = new ICProductMeasureUnitsController();
                        ICProductMeasureUnitsInfo       measureUnit = controller.GetProductMeasureUnitByProductIDAndMeasureUnitID(item.FK_ICProductID, item.FK_ICMeasureUnitID);
                        if (measureUnit != null && measureUnit.ICProductMeasureUnitIsEdit)
                        {
                            return;
                        }

                        e.ErrorText = "Hệ số không được phép thay đổi.";
                        e.Valid     = false;
                    }
                }
                if (gridView.FocusedColumn.FieldName == "ICReceiptItemStockLotNo")
                {
                    if (!string.IsNullOrEmpty(e.Value.ToString()))
                    {
                        ICProductsController objProductsController = new ICProductsController();
                        ICProductsInfo       objProductsInfo       = new ICProductsInfo();

                        objProductsInfo = (ICProductsInfo)objProductsController.GetObjectByID(item.FK_ICProductID);
                        if (objProductsInfo == null)
                        {
                            return;
                        }

                        if (objProductsInfo.ICPriceCalculationMethodType != PriceCalculationMethod.Specific)
                        {
                            return;
                        }

                        e.ErrorText = "Không được nhập lô cho sản phẩm tính giá trung bình!";
                        e.Valid     = false;
                    }
                }
            }
        }
Esempio n. 28
0
        private void gridView_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        {
            ColumnView view   = sender as ColumnView;
            GridColumn column = (e as EditFormValidateEditorEventArgs)?.Column ?? view.FocusedColumn;

            if (!(column.Name.Equals("firstname", StringComparison.CurrentCultureIgnoreCase) ||
                  column.Name.Equals("lastname", StringComparison.CurrentCultureIgnoreCase)))
            {
                return;
            }

            var inputValue      = Convert.ToString(e.Value);
            var inputValueArray = inputValue.ToCharArray();

            if (!(inputValue.All(c => Char.IsLetter(c) || c == ' ')))
            {
                e.Valid = false;
            }
        }
        private void UiGridVistaDetalle_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        {
            var view = sender as GridView;

            if (view == null || view.FocusedColumn.FieldName != "UNITARY_PRICE")
            {
                return;
            }
            var registro = (PolizaDetalle)UiGridVistaDetalle.GetRow(view.FocusedRowHandle);

            if (Convert.ToDecimal(e.Value.ToString()) < 0)
            {
                e.Valid     = false;
                e.ErrorText = "Cantidad inválida.";
            }
            else
            {
                registro.CUSTOMS_AMOUNT = registro.QTY * Convert.ToDecimal(e.Value.ToString());
            }
        }
Esempio n. 30
0
        public void OnValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        {
            ColumnTag tag = gridView.FocusedColumn.Tag as ColumnTag;

            if (tag == null || tag.DataType != ColumnTag.DataType_Integer)
            {
                return;
            }
            int rowHandle = gridView.FocusedRowHandle;

            try
            {
                int num = Convert.ToInt32(e.Value);
            }
            catch
            {
                e.ErrorText = "只能输入一个整数";
                e.Valid     = false;
            }
        }
        private void gvToKhai_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        {
            string msg = string.Empty;

            if (gvToKhai.FocusedColumn.FieldName.Equals("TenNhomTTDB"))
            {
                if (e.Value == null) return;

                int index1 = gvToKhai.FocusedRowHandle;
                string tenNhomTTDB1 = e.Value.ToString();
                string code1 = GetString(index1, "Code");

                int index2 = index1;
                string tenNhomTTDB2 = string.Empty;
                string code2 = string.Empty;
                do
                {
                    index2--;
                    code2 = GetString(index2, "Code");
                } while (!code2.EndsWith("00"));

                do
                {
                    index2++;
                    code2 = GetString(index2, "Code");
                    tenNhomTTDB2 = GetString(index2, "TenNhomTTDB");

                    if (index1 != index2 && tenNhomTTDB2.Equals(tenNhomTTDB1))
                    {
                        msg = "Trùng mã nhóm thuế. Vui lòng chọn nhóm thuế khác.";
                        if (Config.GetValue("Language").ToString() == "1")
                            msg = UIDictionary.Translate(msg);
                        e.ErrorText = msg;
                        e.Valid = false;
                    }
                } while (!code2.EndsWith("00"));
            }
            else if (Utils.parseDecimal(e.Value) < 0)
            {
                msg = "Phải nhập số lớn hơn 0.";
                if (Config.GetValue("Language").ToString() == "1")
                    msg = UIDictionary.Translate(msg);
                e.ErrorText = msg;
                e.Valid = false;
            }
            else if (gvToKhai.FocusedColumn.FieldName.Equals("Ps2"))
            {
                decimal thueSuat = Utils.parseDecimal(gvToKhai.GetFocusedRowCellValue("ThueSuat"));
                decimal ps1 = Utils.parseDecimal(gvToKhai.GetFocusedRowCellValue("Ps1"));
                decimal ps2 = Utils.parseDecimal(e.Value);
                if (ps2 > (ps1 * thueSuat / 100))
                {
                    msg = "Thuế TTĐB được khấu trừ (8) không được lớn hơn tổng thuế TTĐB đã điều chỉnh (6 x 7 - 9).";
                    if (Config.GetValue("Language").ToString() == "1")
                        msg = UIDictionary.Translate(msg);
                    e.ErrorText = msg;
                    e.Valid = false;
                }
            }
            else if (e.Value == null)
            {
                e.Value = 0;
            }
        }
Esempio n. 32
0
 private void gviewRight_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
 {
     try
       {
     if (gviewRight.FocusedRowHandle == GridControl.AutoFilterRowHandle)
       return;
     if (this.gviewRight.FocusedColumn == this.colSlotNew && e.Value is string)
       e.Valid = this.SetSlotNumber((string)e.Value);
     else if (this.gviewRight.FocusedColumn == this.colFavorites && e.Value is string)
       e.Value = ChannelInfo.ParseFavString((string)e.Value);
     else if (gviewRight.FocusedColumn == this.colName)
     {
       var ci = this.gviewRight.GetFocusedRow() as ChannelInfo;
       this.VerifyChannelNameModified(ci, e.Value as string);
       //this.BeginInvoke((Action) (() => RefreshGrid(this.gviewLeft)));
     }
     dataRoot.NeedsSaving = true;
       } catch(Exception ex) { HandleException(ex); }
 }
 private void gridView1_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
 {
     if (e.Value is string)
         e.Value = ((string)e.Value).Trim();
 }      
Esempio n. 34
0
 void dataGrid_OnValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
 {
     isdirty = true;
 }
Esempio n. 35
0
 private void gridView1_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
 {
     GridView view = sender as GridView;
     if (view.FocusedColumn.FieldName == "QTY")
     {
         object oldEditValue = (sender as BaseView).ActiveEditor.OldEditValue;
         object newEditValue = (sender as BaseView).ActiveEditor.EditValue??0;
         if ((int) (newEditValue) == 0)
         {
             e.Value = oldEditValue;
             onePing();
         } 
     }
 }
Esempio n. 36
0
        private void gridViewCheckSetting_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
        {
            DevExpress.XtraGrid.Columns .GridColumn colTaskName=gridViewCheckSetting.Columns["TaskName"];
            DevExpress.XtraGrid.Columns.GridColumn colTaskPath=gridViewCheckSetting.Columns["Datasource"];
            DevExpress.XtraGrid.Columns.GridColumn colValidating = gridViewCheckSetting.FocusedColumn;
            int rowHandle = gridViewCheckSetting.FocusedRowHandle;
            if (colValidating == colTaskName || colValidating == colTaskPath)
            {
                string strPath = gridViewCheckSetting.GetRowCellValue(rowHandle, colTaskPath) as string;
                string strName = gridViewCheckSetting.GetRowCellValue(rowHandle, colTaskName) as string;
                if (colValidating == colTaskName)
                {
                    strName = e.Value as string;
                }
                else
                {
                    strPath = e.Value as string;
                }

                if (string.IsNullOrEmpty(strName) || !TaskHelper.TestTaskName(strName))
                {
                    XtraMessageBox.Show("名称为空或者包含非法字符!");
                    e.Valid = false;
                    return;
                }
                string strMsg="";
                if (TaskHelper.TaskExists(strName, strPath, ref strMsg))
                {
                    XtraMessageBox.Show(strMsg);
                    e.Valid = false;
                    return;
                }
            }
        }
 private void ValuesGridViewValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
 {
     e.Value = ValidateData.CheckCellDouble(e.Value.ToString());
 }
Esempio n. 38
0
 private void gridViewUsers_ValidatingEditor(object sender, BaseContainerValidateEditorEventArgs e)
 {
     if (gridViewUsers.FocusedColumn.Name == colLogin.Name)
     {
         foreach (User user in viewModel.Users)
         {
             if (user.Login == e.Value.ToString())
             {
                 e.Valid = false;
                 e.ErrorText = Program.LanguageManager.GetString(StringResources.Settings_UniqueLogin);
             }
         }
     }
 }