Ejemplo n.º 1
0
        protected void btnFiltroServico_Click(object sender, EventArgs e)
        {
            String sOpcao = DDLServicos.SelectedValue;

            switch (sOpcao)
            {
            case "1":
                if (!string.IsNullOrEmpty(txtPesquisaServico.Text))
                {
                    string Cod = txtPesquisaServico.Text;
                    GridServicos.DataSource = SrvDAL.Detalhes(Cod);
                    GridServicos.DataBind();

                    if (GridServicos.Rows.Count == 0)
                    {
                        ClientScript.RegisterStartupScript(GetType(), "alert", "ShowModal('Consulta sem resultado.','Sua pesquisa não retornou nenhum resultado. Tente novamente.')", true);
                    }
                }
                else
                {
                    ClientScript.RegisterStartupScript(GetType(), "alert", "ShowModal('Campo em branco','Por favor, preencha um valor no Textbox para pesquisa.')", true);
                }
                break;

            case "2":
                if (!string.IsNullOrEmpty(txtPesquisaServico.Text))
                {
                    string Titulo = txtPesquisaServico.Text;
                    GridServicos.DataSource = SrvDAL.DetalhesTitulo(Titulo);
                    GridServicos.DataBind();

                    if (GridServicos.Rows.Count == 0)
                    {
                        ClientScript.RegisterStartupScript(GetType(), "alert", "ShowModal('Consulta sem resultado.','Sua pesquisa não retornou nenhum resultado. Tente novamente.')", true);
                    }
                }
                else
                {
                    ClientScript.RegisterStartupScript(GetType(), "alert", "ShowModal('Campo em branco','Por favor, preencha um valor no Textbox para pesquisa.')", true);
                }
                break;
            }
        }
Ejemplo n.º 2
0
        protected void GVServicosOS_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("Selecionar"))
            {
                int linhaGVServicosOS = Convert.ToInt32(e.CommandArgument);
                int idServico         = Convert.ToInt32(GVServicosOS.DataKeys[linhaGVServicosOS].Value.ToString());

                DtServicos = ServDal.Detalhes(idServico);

                txtCodItem.Text    = DtServicos.Rows[0]["Codigo"].ToString();
                txtTituloItem.Text = DtServicos.Rows[0]["Titulo"].ToString();
                txtValUnit.Text    = DtServicos.Rows[0]["Preco"].ToString();
                HFieldID.Value     = DtServicos.Rows[0]["IdServico"].ToString();
            }
        }