protected void BuscarButton_Click1(object sender, EventArgs e)
        {
            int   Id   = 0;
            Metas meta = new Metas();

            if (ConsultaTextBox.Text.Length > 0 && ConsultaDropDownList.Text == "MetaId")
            {
                bool result = Int32.TryParse(ConsultaTextBox.Text, out Id);
                if (Id > 0)
                {
                    MetasGridView.DataSource = meta.Listado(" * ", " MetaId = " + Id, "");
                    MetasGridView.DataBind();
                    if (MetasGridView.Rows.Count <= 0)
                    {
                        ShowToast("error", "Error", "Id No Existe");
                        ConsultaTextBox.Text = "";
                        CargarGridView();
                    }
                }
                else
                {
                    ShowToast("warning", "Incorrecto", "Id Incorrecto");
                    ConsultaTextBox.Text = "";
                }
            }

            if (ConsultaDropDownList.Text == "Descripcion")
            {
                MetasGridView.DataSource = meta.Listado(" * ", "Descripcion like '" + ConsultaTextBox.Text + "%'", "");
                MetasGridView.DataBind();
            }
        }
        public void CargarGridView()
        {
            Metas meta = new Metas();

            MetasGridView.DataSource = meta.Listado(" * ", " 1=1 ", "");
            MetasGridView.DataBind();
        }
Ejemplo n.º 3
0
        public void ListadoTest()
        {
            Metas meta = new Metas();

            Assert.IsTrue(meta.Listado(" * ", " 1=1 ", " MetaId ").Rows.Count > 0);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Metas meta = new Metas();

                MetasReportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                MetasReportViewer.Reset();
                MetasReportViewer.LocalReport.ReportPath = Server.MapPath(@"~\Rpts/MetasRpt.rdlc");

                MetasReportViewer.LocalReport.DataSources.Clear();

                MetasReportViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("MetasDataSet", meta.Listado(" * ", " 1=1 ", "")));
                MetasReportViewer.LocalReport.Refresh();
            }
        }