Ejemplo n.º 1
0
        protected void btnSession_Click(object sender, EventArgs e)
        {
            EcuacionPutnam ecuacionPutnam = new EcuacionPutnam();

            ecuacionPutnam.L       = int.Parse(inputL.Text);
            ecuacionPutnam.Ck      = int.Parse(inputCK.Text);
            ecuacionPutnam.tdMonth = int.Parse(inputTD.Text);
            Session["Ecuacion"]    = ecuacionPutnam;
            Response.Redirect("tp1result.aspx?t=session");
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            EcuacionPutnam ecuacionPutnam = new EcuacionPutnam();
            string         tipo           = Request.QueryString["t"] ?? "";

            switch (tipo)
            {
            case "session":
                ecuacionPutnam = (EcuacionPutnam)Session["Ecuacion"];
                break;

            case "cookie":
                try
                {
                    string l  = Request.Cookies["local.uai.ecuacionputman"]["L"];
                    string ck = Request.Cookies["local.uai.ecuacionputman"]["CK"];
                    string td = Request.Cookies["local.uai.ecuacionputman"]["TD"];
                    ecuacionPutnam.L       = int.Parse(l);
                    ecuacionPutnam.Ck      = int.Parse(ck);
                    ecuacionPutnam.tdMonth = int.Parse(td);
                    Response.Cookies.Remove("local.uai.ecuacionputman");
                }
                catch
                {
                    Response.Redirect("TP1.aspx");
                }
                break;

            default:
                Response.Redirect("TP1.aspx");
                break;
            }
            ecuacionPutnam.Evaluar();

            inputL.Text  = ecuacionPutnam.L.ToString();
            inputCK.Text = ecuacionPutnam.Ck.ToString();
            inputTD.Text = ecuacionPutnam.tdYear.ToString();
            inputK.Text  = ecuacionPutnam.K.ToString();
        }