private void controlOperationsView_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { GridView gv = sender as GridView; JointTestResult jointTestResult = gv.GetRow(e.RowHandle) as JointTestResult; if (jointTestResult.Operation == null) { gv.SetColumnError(controlTypeGridColumn, Program.LanguageManager.GetString(StringResources.Validation_ValueRequired)); e.Valid = false; } if (jointTestResult.Date == null) { gv.SetColumnError(controlDateGridColumn, Program.LanguageManager.GetString(StringResources.Validation_ValueRequired)); e.Valid = false; } if (jointTestResult.Inspectors.Count == 0) { gv.SetColumnError(inspectorsGridColumn, Program.LanguageManager.GetString(StringResources.Validation_ValueRequired)); e.Valid = false; } if (jointTestResult.Status == 0) { gv.SetColumnError(resultGridColumn, Program.LanguageManager.GetString(StringResources.Validation_ValueRequired)); e.Valid = false; } }
private void gdvUnknown_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { try { ColumnView view = sender as ColumnView; if (!_newRow) { if (MessageBox.Show("Do you want to save the current row?", "Confirm update", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) != DialogResult.Yes) { gdvUnknown.CancelUpdateCurrentRow(); _saveRowToDatabase = false; } else { _saveRowToDatabase = true; } } else { _saveRowToDatabase = true; _newRow = false; } } catch (System.Exception exception1) { System.Exception thisException = exception1; Management.ShowException(thisException); } }
private void gvPO_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { DataRow row = gvPO.GetDataRow(e.RowHandle); var EnsureMandatoryColumn = new Func <GridColumn, string, bool>((col, msg) => { if (row[col.FieldName] == DBNull.Value) { e.Valid = false; e.ErrorText = msg; return(true); } return(false); }); if (EnsureMandatoryColumn(colPODate, "Need to enter PO date.")) { return; } if (EnsureMandatoryColumn(colSupplierCode, "Need to select a Supplier.")) { return; } if (EnsureMandatoryColumn(colProjectCode, "Need to select a Project.")) { return; } }
private bool rapairOperationValidator(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { GridView gv = sender as GridView; JointWeldResult jointWeldResult = gv.GetRow(e.RowHandle) as JointWeldResult; if (jointWeldResult.Operation == null) { gv.SetColumnError(repairTypeGridColumn, Program.LanguageManager.GetString(StringResources.Validation_ValueRequired)); e.Valid = false; } else if (jointWeldResult.Date == null) { gv.SetColumnError(repairDateGridColumn, Program.LanguageManager.GetString(StringResources.Validation_ValueRequired)); e.Valid = false; } else if (jointWeldResult.Operation.Type == JointOperationType.Weld && jointWeldResult.Welders.Count == 0) { gv.SetColumnError(weldersGridColumn, Program.LanguageManager.GetString(StringResources.Validation_ValueRequired)); e.Valid = false; } else if (!jointWeldResult.IsCompleted) { gv.SetColumnError(completedGridColumn, Program.LanguageManager.GetString(StringResources.Validation_ValueRequired)); e.Valid = false; } return(e.Valid); }
void gridView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { try { GridView view = sender as GridView; GridColumn IDProducto = view.Columns["IDProducto"]; object vIDProducto = (object)(view.GetRowCellValue(e.RowHandle, IDProducto)); // Validacion de Productos Unicos en la lista if (e.Row == null) { return; } //Get the value of the first column int iIDProducto = (view.GetRowCellValue(e.RowHandle, IDProducto) != null) ? Convert.ToInt32(view.GetRowCellValue(e.RowHandle, IDProducto)) : -1; //Validity criterion DataView Dv = new DataView(); Dv.Table = ((DataView)view.DataSource).ToTable(); Dv.RowFilter = string.Format("IdProducto={0}", iIDProducto); if (Dv.ToTable().Rows.Count > 1) { e.Valid = false; //Set errors with specific descriptions for the columns view.SetColumnError(IDProducto, "El producto debe ser unico en la lista"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void gridView2_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { ColumnView view = sender as ColumnView; GridColumn column1 = view.Columns["Type"]; GridColumn column2 = view.Columns["Code"]; GridColumn column3 = view.Columns["Cat"]; string val1 = (string)view.GetRowCellValue(e.RowHandle, column1); string val2 = (string)view.GetRowCellValue(e.RowHandle, column2); string val3 = (string)view.GetRowCellValue(e.RowHandle, column3); if (string.IsNullOrWhiteSpace(val1)) { e.Valid = false; view.SetColumnError(column1, "Type cannot be blank in a row."); } if (string.IsNullOrWhiteSpace(val2) && val1 != "QRY") { e.Valid = false; view.SetColumnError(column2, "Code cannot be blank in a row."); } if (string.IsNullOrWhiteSpace(val3) && val1 != "QRY") { e.Valid = false; view.SetColumnError(column3, "Category cannot be blank in a row."); } }
private void viewListado_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { try { GridView view = sender as GridView; GridColumn inOrdenCol = view.Columns["colOrden"]; ro_nomina_tipo_liqui_orden_Info oFila = new ro_nomina_tipo_liqui_orden_Info(); oFila = (ro_nomina_tipo_liqui_orden_Info)viewListado.GetRow(e.RowHandle); int cont = 0; cont = (from a in oLstOrdenRubrosNomina_Info where a.Orden == oFila.Orden select a).Count(); if (cont > 1) { e.Valid = false; view.SetColumnError(inOrdenCol, "El Orden se encuentra repetido, revise por favor"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); Log_Error_bus.Log_Error(ex.ToString()); } }
private void inspectionsGridView_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { GridView gv = sender as GridView; PipeTestResultStatus result = (PipeTestResultStatus)gv.GetRowCellValue(e.RowHandle, inspectionResultGridColumn); DateTime? date = (DateTime?)gv.GetRowCellValue(e.RowHandle, controlDateGridColumn); var op = (string)gv.GetRowCellValue(e.RowHandle, inspectionCodeGridColumn); if (string.IsNullOrWhiteSpace(op)) { gv.SetColumnError(inspectionCodeGridColumn, Program.LanguageManager.GetString(StringResources.Validation_ValueRequired)); e.Valid = false; } switch (result) { case PipeTestResultStatus.Passed: case PipeTestResultStatus.Failed: case PipeTestResultStatus.Repair: if (date == null || date > DateTime.Now) { gv.SetColumnError(controlDateGridColumn, Program.LanguageManager.GetString(StringResources.MillPipe_ErrorEmptyOrFutureDate)); e.Valid = false; } break; default: break; } }
private void gridView2_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { DataRowView rowdata = e.Row as DataRowView; if (rowdata == null) { return; } if (rowdata["CB021"] is System.DBNull) { e.ErrorText = "请选择项目!"; e.Valid = false; return; } else if (rowdata["CB030"] is System.DBNull) { e.ErrorText = "请输入数量!"; e.Valid = false; return; } else if (decimal.Parse(rowdata["CB030"].ToString()) <= 0) { e.ErrorText = "数量必须大于0!"; e.Valid = false; return; } }
private void OnValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { Object obj = gridView.GetFocusedRowCellValue(colOutboundNo); if (obj == null) { e.ErrorText = "P.O#不能为空."; e.Valid = false; return; } string tmp = gridView.GetFocusedRowCellValue(colOutboundNo).ToString(); if (string.IsNullOrEmpty(tmp)) { e.ErrorText = "P.O#不能为空."; e.Valid = false; return; } obj = gridView.GetFocusedRowCellValue(colRcvdAmount); if (obj == null) { e.ErrorText = "收款金额不能为空."; e.Valid = false; return; } }
void gridView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { ErrorInfo info = new ErrorInfo(); (e.Row as BankImportClass).GetError(info); e.Valid = info.ErrorText == ""; }
private void gridView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { ColumnView view_sender = sender as ColumnView; GridColumn col1 = view_sender.Columns["Heso_Chucvu"]; GridColumn col2 = view_sender.Columns["Luong_Chucvu"]; heso_phucap = view_sender.GetRowCellValue(e.RowHandle, col1); luong_phucap = view_sender.GetRowCellValue(e.RowHandle, col2); }
/// <summary> /// 行验证 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GridView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { string value = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "SI003").ToString(); if (String.IsNullOrEmpty(value)) { e.Valid = false; (sender as ColumnView).SetColumnError(gridView1.Columns["SI003"], "名称不能为空!"); } }
private void inspectionsView_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { var gv = sender as GridView; var inspResult = gv.GetRow(e.RowHandle) as InspectionTestResult; if (inspResult.Inspectors == null || inspResult.Inspectors.Count <= 0) { gv.SetColumnError(colInspector, Program.LanguageManager.GetString(StringResources.Value_Required)); e.Valid = false; } }
private void grvUCList_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { DataRow r = grvUCList.GetFocusedDataRow(); ColumnView view = sender as ColumnView; GridColumn column1 = view.Columns["SoTien"]; string str = view.GetRowCellValue(e.RowHandle, column1).ToString(); if (decimal.Parse(str) > 1000000 || decimal.Parse(str) < 500000) { e.Valid = false; view.SetColumnError(view.Columns["SoTien"], "Tiền tạm ứng tối thiểu là 500000, tối đa là 1000000"); } }
private void componentParametersView_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { GridView gv = sender as GridView; var diameter = (int)gv.GetRowCellValue(e.RowHandle, diameterGridColumn); if (diameter <= 0) { gv.SetColumnError(diameterGridColumn, Program.LanguageManager.GetString(StringResources.ComponentNewEdit_DiameterValueValidation)); e.Valid = false; } }
private void gvDetail_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { DataRow row = gvDetail.GetDataRow(e.RowHandle); var EnsureMandatoryColumn = new Func <GridColumn, string, bool>((col, msg) => { if (row[col.FieldName] == DBNull.Value) { e.Valid = false; e.ErrorText = msg; return(true); } return(false); }); if (EnsureMandatoryColumn(colDetailDescription, "Need to enter a description.")) { return; } if (colDetailLevel1Code.Visible && EnsureMandatoryColumn(colDetailLevel1Code, $"Need to select a {colDetailLevel1Code.Caption}.")) { return; } if (colDetailLevel2Code.Visible && EnsureMandatoryColumn(colDetailLevel2Code, $"Need to select a {colDetailLevel2Code.Caption}.")) { return; } if (colDetailLevel3Code.Visible && EnsureMandatoryColumn(colDetailLevel3Code, $"Need to select a {colDetailLevel3Code.Caption}.")) { return; } if (colDetailLevel4Code.Visible && EnsureMandatoryColumn(colDetailLevel4Code, $"Need to select a {colDetailLevel4Code.Caption}.")) { return; } if (EnsureMandatoryColumn(colDetailComponent, $"Need to select a Component Type.")) { return; } if (EnsureMandatoryColumn(colDetailAmount, "Need to enter an Amount.")) { return; } if (Convert.ToDecimal(row[colDetailAmount.FieldName]) <= 0) { e.Valid = false; e.ErrorText = "Amount must bigger than 0."; return; } }
private bool componentValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { GridView gv = sender as GridView; var diameter = Convert.ToDecimal(gv.GetRowCellValue(e.RowHandle, diameterGridColumn)); if (diameter <= 0) { gv.SetColumnError(diameterGridColumn, Program.LanguageManager.GetString(StringResources.ComponentNewEdit_DiameterValueValidation)); e.Valid = false; } return(e.Valid); }
/// <summary> /// 行校验 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gridView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { if (gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "TI002") == null) { e.Valid = false; (sender as ColumnView).SetColumnError(gridView1.Columns["TI002"], "税收分类编码不能为空!"); return; } //value = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "TI003").ToString(); if (gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "TI003") == null) { e.Valid = false; (sender as ColumnView).SetColumnError(gridView1.Columns["TI003"], "项目名称不能为空!"); return; } }
private void gvEquipment_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { DataRow row = gvEquipment.GetDataRow(e.RowHandle); var EnsureMandatoryColumn = new Func <GridColumn, string, bool>((col, msg) => { if (row[col.FieldName] == DBNull.Value) { e.Valid = false; e.ErrorText = msg; return(true); } return(false); }); if (EnsureMandatoryColumn(colEqpNum, "Must select an Equipment.")) { return; } if (EnsureMandatoryColumn(colQuantity, "Need to enter Quantity.")) { return; } if (EnsureMandatoryColumn(colBillCycle, "Must select a Bill Cycle.")) { return; } if (colLevel1Code.Visible && EnsureMandatoryColumn(colLevel1Code, $"Need to select a {colLevel1Code.Caption}.")) { return; } if (colLevel2Code.Visible && EnsureMandatoryColumn(colLevel2Code, $"Need to select a {colLevel2Code.Caption}.")) { return; } if (colLevel3Code.Visible && EnsureMandatoryColumn(colLevel3Code, $"Need to select a {colLevel3Code.Caption}.")) { return; } if (colLevel4Code.Visible && EnsureMandatoryColumn(colLevel4Code, $"Need to select a {colLevel4Code.Caption}.")) { return; } }
private void gridView_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { GridView view = sender as GridView; ConfigPath row = (ConfigPath)e.Row; row.Normalize( ); if (!row.IsValid) { e.Valid = false; { GridColumn col = view.Columns[ConfigPath.PATHDIR_DISPLAYNAME]; view.SetColumnError(col, "Invalid conbination [pathdir] or [basedir]"); } //{ // GridColumn col = view.Columns[ ConfigPath.BASEDIR_DISPLAYNAME ]; // view.SetColumnError( col, "Invalid combination [pathdir] or [basedir]" ); //} } }
private void layoutViewOrderDetails_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { ColumnView view = sender as ColumnView; GridColumn col = view.Columns["Unit"]; int temp = (int)view.GetRowCellValue(e.RowHandle, col); if (temp < 1) { e.Valid = false; view.SetColumnError(col, "Unit is not accepted less than 1!"); } int quantity = (int)view.GetRowCellValue(e.RowHandle, view.Columns["Quantity"]); if (temp > quantity) { e.Valid = false; view.SetColumnError(col, "Unit is not accepted less than product's quantity!"); } }
private void advBandedGridView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { ColumnView view = sender as ColumnView; GridColumn column1 = view.Columns["CODE"]; GridColumn column2 = view.Columns["ITIN"]; string val1 = (string)view.GetRowCellValue(e.RowHandle, column1); string val2 = (string)view.GetRowCellValue(e.RowHandle, column2); if (string.IsNullOrWhiteSpace(val1)) { e.Valid = false; view.SetColumnError(column1, "Code cannot be blank in a row."); } if (string.IsNullOrWhiteSpace(val2)) { e.Valid = false; view.SetColumnError(column2, "Itinerary cannot be blank in a row."); } }
void gridView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { //string[] split; //if (txtEPeriod.EditValue == null) //{ // Common.setEmptyField("Transaction Period", Program.ApplicationName); // txtEPeriod.Focus(); return; //} //else //{ // split =txtEPeriod.EditValue.ToString().Split(new Char[] { '/' }); //} ////if (txtPeriod.Text == null) ////{ //// Common.setEmptyField("Transaction Period", Program.ApplicationName); //// txtPeriod.Focus(); return; ////} ////else ////{ //// split = txtPeriod.Text.Trim().Split(new Char[] { '/' }); ////} //ColumnView view = sender as ColumnView; ////split2[1].ToString(); //GridColumn column1 = view.Columns["Date"]; ////Get the value of the first column //DateTime time1 = (DateTime)view.GetRowCellValue(e.RowHandle, column1); //if (time1.Month != Convert.ToInt32(split[0]) || time1.Year != Convert.ToInt32(split[1])) //{ // Common.setMessageBox("Date Not Withing the Transaction Period", Program.ApplicationName, 1); return; // e.Valid = false; //} }
private void repairOperationsView_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { GridView gv = sender as GridView; JointWeldResult jointWeldResult = gv.GetRow(e.RowHandle) as JointWeldResult; if (jointWeldResult.Operation == null) { gv.SetColumnError(repairTypeGridColumn, Program.LanguageManager.GetString(StringResources.Validation_ValueRequired)); e.Valid = false; } if (jointWeldResult.Date == null) { gv.SetColumnError(repairDateGridColumn, Program.LanguageManager.GetString(StringResources.Validation_ValueRequired)); e.Valid = false; } if (jointWeldResult.Operation.Type == JointOperationType.Weld && jointWeldResult.Welders.Count == 0) { gv.SetColumnError(weldersGridColumn, Program.LanguageManager.GetString(StringResources.Validation_ValueRequired)); e.Valid = false; } jointStatus.EditValue = viewModel.JointConstructionStatus; }
private void gridView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { using (Session session1 = new Session()) { session1.BeginTransaction(); try { ColumnView view = sender as ColumnView; GridColumn column1 = view.Columns["Link_Table"]; GridColumn column2 = view.Columns["Link_Column"]; GridColumn column3 = view.Columns["Description"]; string val1 = (string)view.GetRowCellValue(e.RowHandle, column1); string val2 = (string)view.GetRowCellValue(e.RowHandle, column2); string val3 = (string)view.GetRowCellValue(e.RowHandle, column3); if (string.IsNullOrWhiteSpace(val1)) { e.Valid = false; view.SetColumnError(column1, "Link Table cannot be blank in a row."); } if (string.IsNullOrWhiteSpace(val2)) { e.Valid = false; view.SetColumnError(column2, "Link Column cannot be blank in a row."); } if (string.IsNullOrWhiteSpace(val3)) { e.Valid = false; view.SetColumnError(column3, "Description cannot be blank in a row."); } session1.CommitTransaction(); } catch { session1.RollbackTransaction(); } } }
private void gridView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { ColumnView view = sender as ColumnView; GridColumn col = view.Columns["Point"]; float temp = (float)view.GetRowCellValue(e.RowHandle, col); if (temp == null || temp > 4f || temp < 0.5f) { e.Valid = false; view.SetColumnError(col, "The point is not to accepte null and it's less than 4.0 and more than 0.5!"); saveToolStripMenuItem.Enabled = false; } else if (_repository.Find(w => w.Point == temp && w.AdminID == currMember.UseName).ToList().Count > 0) { e.Valid = false; view.SetColumnError(col, "This point is exited!"); saveToolStripMenuItem.Enabled = false; } else { saveToolStripMenuItem.Enabled = true; } }
private void gridView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { DataRowView rowdata = e.Row as DataRowView; if (rowdata == null) { return; } if (rowdata["CB002"] != null && rowdata["CB002"].ToString() == "0" && rowdata["CB005"] is System.DBNull) { e.Valid = false; e.ErrorText = "关联服务必须选择!"; } else if (rowdata["CB003"] == null || string.IsNullOrEmpty(rowdata["CB003"].ToString())) { e.Valid = false; e.ErrorText = "套餐名称必须输入!"; } else if (rowdata["CB002"] == null || rowdata["CB002"] is System.DBNull) { e.Valid = false; e.ErrorText = "套餐类别必须输入!"; } }
private void gridView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { }
private void pipesSizeListGridView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { //save previous IsModified state bool wasModified = IsModified; GridView view = sender as GridView; object sizeType = view.GetRow(view.FocusedRowHandle); var eArg = new DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs( view.FocusedRowHandle, pipesSizeListGridView.GetDataRow(view.FocusedRowHandle) ); pipesSizeListGridView_ValidateRow(pipesSizeListGridView, eArg); if (sizeType != null) { viewModel.UpdatePipeTests(sizeType); } CurrentPipeMillSizeType = sizeType as PipeMillSizeType; viewModel.CurrentPipeMillSizeType = CurrentPipeMillSizeType; viewModel.ModifiableView.UpdateState(); // IsModified state depends on previous state despite all properties were changed (prevent *) IsModified = (wasModified) ? true : false; }
private void repairOperationsView_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { rapairOperationValidator(sender, e); }