예제 #1
0
        public void Consulta()
        {
            if (Session["consulta"] == null)
            {
                Session["for"]      = "0";
                Session["consulta"] = "1";
                Session["tabla"]    = oFirma.Consultatodos();

                DataTable dt = (DataTable)Session["tabla"];
                Session["cont"] = dt.Rows.Count;

                int i = Convert.ToInt32(Session["for"]);


                Session["id"]          = dt.Rows[i]["idFirma"].ToString();
                lblNombreApellido.Text = dt.Rows[i]["Nombre"].ToString() + " " + dt.Rows[i]["ApellidoPaterno"].ToString() + " " + dt.Rows[i]["ApellidoMaterno"].ToString().Substring(0, 1) + ".";

                lblCargo.Text = dt.Rows[i]["Cargo"].ToString();

                lblNumeros.Text     = "C : " + dt.Rows[i]["Celular"].ToString() + " T : " + dt.Rows[i]["telefono"].ToString() + " A : " + dt.Rows[i]["anexo"].ToString();
                Session["Celular"]  = dt.Rows[i]["Celular"].ToString();
                Session["telefono"] = dt.Rows[i]["telefono"].ToString();
                Session["anexo"]    = dt.Rows[i]["anexo"].ToString();

                Session["for"] = i + 1;
            }
            else
            {
                DataTable dt = (DataTable)Session["tabla"];

                if (Convert.ToInt32(Session["cont"]) > Convert.ToInt32(Session["for"]))
                {
                    int i = Convert.ToInt32(Session["for"]);
                    Session["id"]          = dt.Rows[i]["idFirma"].ToString();
                    lblNombreApellido.Text = dt.Rows[i]["Nombre"].ToString() + " " + dt.Rows[i]["ApellidoPaterno"].ToString() + " " + dt.Rows[i]["ApellidoMaterno"].ToString().Substring(0, 1) + ".";

                    lblCargo.Text = dt.Rows[i]["Cargo"].ToString();

                    lblNumeros.Text     = "C : " + dt.Rows[i]["Celular"].ToString() + " T : " + dt.Rows[i]["telefono"].ToString() + " A : " + dt.Rows[i]["anexo"].ToString();
                    Session["Celular"]  = dt.Rows[i]["Celular"].ToString();
                    Session["telefono"] = dt.Rows[i]["telefono"].ToString();
                    Session["anexo"]    = dt.Rows[i]["anexo"].ToString();

                    Session["for"] = i + 1;
                }
                else
                {
                    Response.Redirect("http://www.google.com.pe/");
                }
            }
        }