//Validação protected void btnPesquisar_Click(object sender, EventArgs e) { ControleFlagsBLL objBLL = new ControleFlagsBLL(); var user = (ConectaAD)Session["objUser"]; Regex validaNomeSemEspecial = new Regex("[a-zA-Z]"); if (txtEmp.Text == String.Empty & txtMatr.Text == String.Empty & txtNumRepr.Text == String.Empty & txtNome.Text == String.Empty) { txtEmp.Focus(); MostraMensagemTelaUpdatePanel(upUpdatePanel, "Todos os campos vazios \n"); txtEmp.BackColor = Color.LightGray; txtMatr.BackColor = Color.LightGray; txtNumRepr.BackColor = Color.LightGray; txtNome.BackColor = Color.LightGray; } else if (txtEmp.Text == String.Empty & txtMatr.Text == String.Empty & txtNome.Text != String.Empty) { if (validaNomeSemEspecial.IsMatch(txtNome.Text)) { gridFlag.DataSource = objBLL.mostrarGrid(txtNome.Text); gridFlag.DataBind(); } else { txtNome.Focus(); MostraMensagemTelaUpdatePanel(upUpdatePanel, "Use apenas caracteres alfabéticos no campo nome \n"); gridFlag.DataSource = objBLL.geraGridGeral(); gridFlag.DataBind(); } gridFlag.DataSource = objBLL.geraColunaFlag(objBLL.mostrarGrid(txtNome.Text)); gridFlag.DataBind(); } else if (txtEmp.Text != String.Empty & txtMatr.Text != String.Empty) { gridFlag.DataSource = objBLL.geraColunaFlag(objBLL.consultaGridMatr(Convert.ToInt32(txtMatr.Text))); gridFlag.DataBind(); } else if (txtEmp.Text != String.Empty) { gridFlag.DataSource = objBLL.geraColunaFlag(objBLL.geraConsultaGrid(Convert.ToInt32(txtEmp.Text))); gridFlag.DataBind(); //txtEmp.Focus(); //MostraMensagemTelaUpdatePanel(upUpdatePanel, "Campo Empresa vazio \n"); //txtEmp.BackColor = Color.LightGray; } else if (txtMatr.Text != String.Empty) { gridFlag.DataSource = objBLL.geraColunaFlag(objBLL.consultaGridMatr(Convert.ToInt32(txtMatr.Text))); gridFlag.DataBind(); } }
//GRID protected void CarregaGridGeral() { ControleFlagsBLL objBLL = new ControleFlagsBLL(); gridFlag.DataSource = objBLL.geraColunaFlag(objBLL.geraGridGeral()); gridFlag.DataBind(); }