Exemple #1
0
        protected void BtnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                var result = new CursoBll().Update(
                    new Domain.Curso()
                {
                    Id           = Convert.ToInt32(Convert.ToInt32(this.Request.QueryString["Id"])),
                    Nombre       = this.TxtName.Text,
                    Costo        = Convert.ToDecimal(this.TxtCosto.Text),
                    Cupo         = Convert.ToInt32(this.TxtCupo.Text),
                    DisciplinaId = (DisciplinaType)Convert.ToInt32(this.DdlDisciplina.SelectedValue),
                    FechaLimite  = Convert.ToDateTime(this.TxtFechaLimite.Text),
                });

                if (result > 0)
                {
                    this.Response.Redirect("/Curso", false);
                }
                else
                {
                    this.ShowError("Se produjo un error inesperado, inténtalo de nuevo.", true);
                }
            }
            catch (Exception ex)
            {
                this.ShowError(ex.Message, true);
            }
        }
Exemple #2
0
        private void Build()
        {
            var id = Convert.ToInt32(this.Request.QueryString["Id"]);

            if (id == 0)
            {
                this.ShowError("Elemento no encontrado.");
            }
            else
            {
                var result = new CursoBll().Read(id);

                if (result == null)
                {
                    this.ShowError("Elemento no encontrado.");
                }
                else
                {
                    foreach (DisciplinaType type in Enum.GetValues(typeof(DisciplinaType)))
                    {
                        DdlDisciplina.Items.Add(new ListItem(type.ToString(), ((int)type).ToString()));
                    }

                    this.DdlDisciplina.SelectedValue = ((int)result.DisciplinaId).ToString();

                    this.TxtCosto.Text        = result.Costo.ToString();
                    this.TxtCupo.Text         = result.Cupo.ToString();
                    this.TxtFechaLimite.Text  = result.FechaLimite.ToShortDateString();
                    this.FldFechaLimite.Value = result.FechaLimite.ToString("yyyy-MM-dd");
                    this.TxtName.Text         = result.Nombre;
                }
            }
        }
Exemple #3
0
        protected void BtnCreate_Click(object sender, EventArgs e)
        {
            try
            {
                var curso = new Domain.Curso()
                {
                    Id = Convert.ToInt32(this.DdlCurso.SelectedValue),
                };

                curso.Inscripciones.Add(new Inscripcion()
                {
                    CursoId  = Convert.ToInt32(this.DdlCurso.SelectedValue),
                    AlumnoId = Convert.ToInt32(this.DdlAlumno.SelectedValue),
                    Beca     = (BecaType)Convert.ToInt32(this.DdlBeca.SelectedValue)
                });

                var result = new CursoBll().Inscribe(curso);

                if (result > 0)
                {
                    this.Response.Redirect("/Curso", false);
                }
                else
                {
                    this.ShowError(GetErrorMessage(result), true);
                }
            }
            catch (Exception ex)
            {
                this.ShowError(ex.Message, true);
            }
        }
Exemple #4
0
        private void Build()
        {
            this.BtnCreate.NavigateUrl = "/Curso/Create";

            var result = new CursoBll().Read();

            if (result.Count > 0)
            {
                decimal total = 0;

                foreach (var item in result)
                {
                    total += GetTotal(item);
                }

                this.LblTotal.Text = $"$ {total}";

                this.RptData.ItemDataBound += this.RptData_ItemDataBound;
                this.RptData.DataSource     = result;
                this.RptData.DataBind();
            }
            else
            {
                this.ShowError("No hay elementos.", true);
            }
        }
Exemple #5
0
        private void Build()
        {
            var cursos  = new CursoBll().Read();
            var alumnos = new AlumnoBll().Read();

            foreach (var item in cursos)
            {
                this.DdlCurso.Items.Add(new ListItem(item.Nombre, item.Id.ToString()));
            }

            foreach (var item in alumnos)
            {
                this.DdlAlumno.Items.Add(new ListItem(item.Nombre, item.Id.ToString()));
            }

            this.DdlBeca.Items.Add(new ListItem("Regular", ((int)BecaType.Regular).ToString()));
            this.DdlBeca.Items.Add(new ListItem("Media Beca", ((int)BecaType.MediaBeca).ToString()));
            this.DdlBeca.Items.Add(new ListItem("80%", ((int)BecaType.Beca80).ToString()));
        }