private void validarRegistro(Control container) { if (container != null && beanDataSet != null && beanDataSet.Count > 0) { foreach (Control c in container.Controls) { if (c.Controls.Count > 0) { setValidadores(c); } else { if (c is REFTextBox) { REFTextBox t = (REFTextBox)c; if (t.isDataBaseItem && t.tipo == TipoTextBox.REQUIRED && t.Text == "") { t.Select(); throw new ValueRequiredException("Campo de preenchimento obrigatório."); } } } } } }
private void salvarFiltros(Control container) { if (container != null) { foreach (Control c in container.Controls) { if (c.Controls.Count > 0) { salvarFiltros(c); } else { if (c is REFTextBox) { REFTextBox t = (REFTextBox)c; if (t.isPK || t.isDataBaseItem) { if (t.beanItemName != "") { _filterList.Add(t.beanItemName, t.Text); } } } } } } }
protected void validarRegistro(Control container) { if (container != null) { foreach (Control c in container.Controls) { if (c.Controls.Count > 0) { validarRegistro(c); } else { if (c is REFTextBox) { REFTextBox t = (REFTextBox)c; if (t.tipo == TipoTextBox.REQUIRED && t.Text == "") { t.Select(); throw new ValueRequiredException("Campo de preenchimento obrigatório."); } } else if (c is REFComboBox) { REFComboBox t = (REFComboBox)c; if (t.tipo == TipoComboBox.REQUIRED && t.Text == "") { t.Select(); throw new ValueRequiredException("Campo de preenchimento obrigatório."); } } } } } }
protected int getNumberFromText(REFTextBox t) { try { return((t.Text != null && t.Text != "") ? Convert.ToInt32(t.Text) : 0); } catch (FormatException e) { throw new InvalidPropertyValueException("Valor " + t.Text + " não é um número válido", e); } }
private void prepararFields(Control container) { if (container != null) { foreach (Control c in container.Controls) { if (c.Controls.Count > 0) { prepararFields(c); } else { if (c is REFTextBox) { REFTextBox t = (REFTextBox)c; if (this.cadFormStatus == CadFormStatus.CONSULTA) { t.Text = ""; if (t.isFilterItem) { t.Enabled = true; t.ReadOnly = false; t.BackColor = Color.LightYellow; } else { t.Enabled = false; t.BackColor = Color.LightGray; } if (!_isFirstFilter) { try { t.Text = _filterList[t.beanItemName].ToString(); } catch (NullReferenceException e) { t.Text = ""; throw e; } } } else { t.tipo = t.tipo; t.Text = ""; } } } } } }
private void setValidadores(Control container) { if (container != null) { foreach (Control c in container.Controls) { if (c.Controls.Count > 0) { setValidadores(c); } else { if (c is REFTextBox) { REFTextBox t = (REFTextBox)c; if (t.isDataBaseItem) { t.Validating += new System.ComponentModel.CancelEventHandler(this.validador); } } } } } }