protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int.TryParse(Request.QueryString["IdTarea"], out idTarea);
         if (idTarea > 0)
         {
             tarea.Buscar(idTarea);
             IdTextBox.Text          = idTarea.ToString();
             FechaTextBox.Text       = tarea.Fecha.ToTextFieldString();
             VenceTextBox.Text       = tarea.Vence.ToTextFieldString();
             DescripcionTextBox.Text = tarea.Descripcion;
             ResultadoTextBox.Text   = tarea.ResultadoEsperado;
             puntosDisponibles       = Math.Min((tarea.Vence.DayOfYear - DateTime.Now.DayOfYear) * 10 + 100, 100);
             if (puntosDisponibles > 0)
             {
                 PuntosLabel.ForeColor = System.Drawing.Color.Green;
             }
             else
             {
                 PuntosLabel.ForeColor = System.Drawing.Color.Red;
             }
             PuntosLabel.Text = puntosDisponibles.ToString() + "%";
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            Semestres   semestre   = new Semestres();
            Asignaturas asignatura = new Asignaturas();

            if (!IsPostBack)
            {
                Tareas tarea = new Tareas();
                if (Request.QueryString["IdTarea"] != null)
                {
                    tarea.IdTarea = Util.ObtenerEntero(Request.QueryString["IdTarea"]);
                    if (tarea.Buscar())
                    {
                        this.LLenarCampos(tarea);
                    }
                }
            }

            this.IdsemestreDropDownList.DataSource     = semestre.Listar("IdSemestre,Codigo", "1=1");
            this.IdsemestreDropDownList.DataValueField = "IdSemestre";
            this.IdsemestreDropDownList.DataTextField  = "Codigo";
            this.IdsemestreDropDownList.DataBind();

            this.IdasignaturaDropDownList.DataSource     = Asignaturas.Lista("IdAsignatura,Nombre", "1=1");
            this.IdasignaturaDropDownList.DataValueField = "IdAsignatura";
            this.IdasignaturaDropDownList.DataTextField  = "Nombre";
            this.IdasignaturaDropDownList.DataBind();
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                FechaTextBox.Text = DateTime.Today.ToString("yyyy-MM-dd");
                VenceTextBox.Text = DateTime.Today.AddDays(1).ToString("yyyy-MM-dd");

                AsignaturaDropDownList.DataSource     = Asignaturas.Listar(" IdAsignatura, Nombre ", " 1=1 ");
                AsignaturaDropDownList.DataValueField = "IdAsignatura";
                AsignaturaDropDownList.DataTextField  = "Nombre";
                AsignaturaDropDownList.DataBind();

                SemestreDropDownList.DataSource     = Semestres.Listar(" Codigo, IdSemestre", " 1=1 ");
                SemestreDropDownList.DataTextField  = "Codigo";
                SemestreDropDownList.DataValueField = "IdSemestre";
                SemestreDropDownList.DataBind();

                if (Request.QueryString["IdTarea"] != null)
                {
                    tarea.IdTarea = int.Parse(Request.QueryString["IdTarea"].ToString());
                    if (tarea.Buscar(tarea.IdTarea))
                    {
                        CodigoTareaTextBox.Text = tarea.CodigoTarea;
                        FechaTextBox.Text       = tarea.Fecha.ToString("yyyy-MM-dd");
                        VenceTextBox.Text       = tarea.Vence.ToString("yyyy-MM-dd");
                        AsignaturaDropDownList.SelectedIndex = AsignaturaDropDownList.Items.IndexOf(AsignaturaDropDownList.Items.FindByValue(tarea.IdAsignatura.ToString()));
                        SemestreDropDownList.SelectedIndex   = SemestreDropDownList.Items.IndexOf(SemestreDropDownList.Items.FindByValue(tarea.IdSemestre.ToString()));
                        DescripcionTextBox.Text       = tarea.Descripcion;
                        ResultadoEsperadoTextBox.Text = tarea.ResultadoEsperado;
                        EliminarButton.Visible        = true;
                    }
                    EliminarButton.Visible = true;
                }
            }
        }