Esempio n. 1
0
        //public void deleteTaller(DtoTaller tall)
        //{
        //    SqlCommand cmd = new SqlCommand("sp_deleteTaller", conexion);
        //    cmd.CommandType = CommandType.StoredProcedure;

        //    cmd.Parameters.AddWithValue("@codTaller", tall.codTaller);

        //    conexion.Open();
        //    cmd.ExecuteNonQuery();
        //    conexion.Close();
        //}

        public bool getTaller(DtoTaller taller)
        {
            SqlCommand cmd = new SqlCommand("sp_getTaller", conexion);

            cmd.CommandType = CommandType.StoredProcedure;

            conexion.Open();
            bool hayRegistros;

            SqlDataReader reader = cmd.ExecuteReader();

            hayRegistros = reader.Read();

            if (hayRegistros)
            {
                taller.codTaller   = Convert.ToInt32(reader[0].ToString());
                taller.nombre      = reader[1].ToString();
                taller.nivel       = reader[2].ToString();
                taller.rango       = reader[3].ToString();
                taller.descripcion = reader[4].ToString();
                taller.totalHoras  = Convert.ToInt32(reader[5].ToString());
                taller.urlSilabo   = reader[6].ToString();
            }
            conexion.Close();
            return(hayRegistros);
        }
Esempio n. 2
0
        public void insertTaller(DtoTaller tall)
        {
            SqlCommand cmd = new SqlCommand("sp_insertTaller", conexion);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@nombre", tall.nombre);
            cmd.Parameters.AddWithValue("@nivel", tall.nivel);
            cmd.Parameters.AddWithValue("@rango", tall.rango);
            cmd.Parameters.AddWithValue("@descripcion", tall.descripcion);
            cmd.Parameters.AddWithValue("@totalHoras", tall.totalHoras);
            cmd.Parameters.AddWithValue("@urlSilabo", tall.urlSilabo);

            conexion.Open();
            cmd.ExecuteNonQuery();
            conexion.Close();
        }
Esempio n. 3
0
        public void cargarDatos()
        {
            CtrTaller ctrTal = new CtrTaller();
            DtoTaller dtoTal = new DtoTaller();

            dtoTal.codTaller = int.Parse(Request["c"]);

            ctrTal.consultarTaller(dtoTal);

            txtNombTaller.Text    = dtoTal.nombre;
            lbNivel.SelectedValue = dtoTal.nivel;
            string rangoTaller = dtoTal.rango;

            for (int i = 0; i < rangoTaller.Length; i++)
            {
                if (rangoTaller[i] != '-')
                {
                    cbSecciones.SelectedValue = rangoTaller[i] + "";
                }
            }
            txtHoras.Text       = dtoTal.totalHoras + "";
            txtDescripcion.Text = dtoTal.descripcion;
            lbl_mensaje_3.Text  = dtoTal.urlSilabo;
        }
Esempio n. 4
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            DtoTaller dtoTal = new DtoTaller();

            dtoTal.nombre = txtNombTaller.Text;
            dtoTal.nivel  = lbNivel.SelectedItem.Text;
            string rangoTaller = "";

            for (int i = 0; i < cbSecciones.Items.Count; i++)
            {
                if (cbSecciones.Items[i].Selected)
                {
                    rangoTaller += cbSecciones.Items[i].Value + "-";
                }
            }
            dtoTal.rango       = rangoTaller;
            dtoTal.totalHoras  = Convert.ToInt32(txtHoras.Text);
            dtoTal.descripcion = txtDescripcion.Text;
            dtoTal.urlSilabo   = lbl_mensaje_3.Text;

            CtrTaller ctrTal = new CtrTaller();

            ctrTal.actualizarTaller(dtoTal);
        }
Esempio n. 5
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                if (validarDatos())
                {
                    DtoTaller dtoTal = new DtoTaller();
                    dtoTal.nombre = txtNombTaller.Text;
                    dtoTal.nivel  = lbNivel.SelectedItem.Text;
                    string rangoTaller = "";
                    for (int i = 0; i < cbSecciones.Items.Count; i++)
                    {
                        if (cbSecciones.Items[i].Selected)
                        {
                            rangoTaller += cbSecciones.Items[i].Value + "-";
                        }
                    }
                    if (rangoTaller.Equals(null))
                    {
                        lbl_mensaje_4.Text = "Seleccione al menos una sección para el taller.";
                    }
                    dtoTal.rango       = rangoTaller;
                    dtoTal.totalHoras  = Convert.ToInt32(txtHoras.Text);
                    dtoTal.descripcion = txtDescripcion.Text;
                    dtoTal.urlSilabo   = lbl_mensaje_3.Text;
                    //falta "Las clases incluyen"
                    CtrTaller ctrTal = new CtrTaller();
                    ctrTal.registrarTaller(dtoTal);
                    //confirmar registro correcto
                    lbl_mensaje_4.Text = "Registrado correctamente.";

                    limpiar();
                }
            }
            catch { lbl_mensaje_4.Text = "Error al intentar registrar el taller."; }
        }
Esempio n. 6
0
 public bool consultarTaller(DtoTaller tall)
 {
     return(dattall.getTaller(tall));
 }
Esempio n. 7
0
 public void actualizarTaller(DtoTaller tall)
 {
     dattall.updateTaller(tall);
 }
Esempio n. 8
0
 public void registrarTaller(DtoTaller tall)
 {
     dattall.insertTaller(tall);
 }