예제 #1
0
        protected void Button1_registrar_Click(object sender, EventArgs e)
        {
            clsCurso obj = new clsCurso();
            obj.Nombre = TextBox1.Text;
            String IDia,IMes,IAño,FDia,FMes,FAño;

            IDia = DropDownList1.SelectedValue;
            IMes = DropDownList2.SelectedValue;
            IAño = DropDownList3.SelectedValue;

            obj.FechaInicio = Convert.ToDateTime(IDia + "-" + IMes + "-" + IAño);

            FDia = DropDownList4.SelectedValue;
            FMes = DropDownList5.SelectedValue;
            FAño = DropDownList6.SelectedValue;

            obj.FechaFin = Convert.ToDateTime(FDia + "-" + FMes + "-" + FAño);

            obj.Precio = Convert.ToDecimal(TextBox2.Text);
            obj.Capacidad = Convert.ToInt32(TextBox3.Text);
            obj.Estado = CheckBox1.Checked;

            clsCursoDAO dao = new clsCursoDAO();
            if (dao.REGISTRARCURSO(obj))
            {
                MessageBox.Show("La CATEGORIA " + obj.Nombre + " ha sido registrada corecctamente.");
                Response.Redirect("/GestionCursos/buscar.aspx");
            }
        }
예제 #2
0
 public List<clsCurso> OBTENERPORDESCRIPCION(String Descripcion)
 {
     SqlConnection con = new SqlConnection();
     clsConexion Conexion = new clsConexion();
     String cadena = Conexion.OBTENERCADENA();
     con.ConnectionString = cadena;
     SqlCommand cmd = new SqlCommand("clsCurso_ObtenerPorDescripcion_PA", con);
     cmd.CommandType = CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("Nombre", Descripcion);
     con.Open();
     List<clsCurso> coleccion = new List<clsCurso>();
     SqlDataReader dr = cmd.ExecuteReader();
     while (dr.Read())
     {
         clsCurso obj = new clsCurso();
         obj.IdCurso = (Int32)dr["IdCurso"];
         obj.Nombre = dr["Nombre"].ToString();
         obj.FechaInicio = (DateTime)dr["FechaInicio"];
         obj.FechaFin=(DateTime)dr["FechaFin"];
         obj.Precio=(Decimal)dr["Precio"];
         obj.Capacidad = (Int32)dr["Capacidad"];
         obj.Estado = (Boolean)dr["Estado"];
         coleccion.Add(obj);
     }
     con.Close();
     return coleccion;
 }
예제 #3
0
 public Boolean ELIMINARCURSO(clsCurso entidad)
 {
     SqlConnection con = new SqlConnection();
     clsConexion Conexion = new clsConexion();
     String cadena = Conexion.OBTENERCADENA();
     con.ConnectionString = cadena;
     SqlCommand cmd = new SqlCommand("clsCurso_Eliminar_PA", con);
     cmd.CommandType = CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("IdCurso", entidad.IdCurso);
     con.Open();
     cmd.ExecuteNonQuery();
     con.Close();
     return true;
 }
예제 #4
0
 public Boolean ACTUALIZARNOMBRE(clsCurso entidad)
 {
     SqlConnection con = new SqlConnection(); ;
     clsConexion Conexion = new clsConexion();
     String cadena = Conexion.OBTENERCADENA();
     con.ConnectionString = cadena;
     SqlCommand cmd = new SqlCommand("clsCurso_ActualizarNombre_PA", con);
     cmd.CommandType = CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("IdCurso", entidad.IdCurso);
     cmd.Parameters.AddWithValue("Nombre", entidad.Nombre);
     con.Open();
     cmd.ExecuteNonQuery();
     con.Close();
     return true;
 }
예제 #5
0
 public clsCurso OBTENERPORID(Int32 IdCurso)
 {
     SqlConnection con = new SqlConnection();
     clsConexion Conexion = new clsConexion();
     String cadena = Conexion.OBTENERCADENA();
     con.ConnectionString = cadena;
     SqlCommand cmd = new SqlCommand("clsCurso_ObtenerPorId_PA", con);
     cmd.CommandType = CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("IdCurso", IdCurso);
     con.Open();
     clsCurso obj = new clsCurso();
     SqlDataReader dr = cmd.ExecuteReader();
     while (dr.Read())
     {
         obj.IdCurso = (Int32)dr["IdCurso"];
         obj.Nombre = dr["Nombre"].ToString();
         obj.FechaInicio = (DateTime)dr["FechaInicio"];
         obj.FechaFin = (DateTime)dr["FechaFin"];
         obj.Precio = (Decimal)dr["Precio"];
         obj.Capacidad = (Int32)dr["Capacidad"];
         obj.Estado = (Boolean)dr["Estado"];
     }
     con.Close();
     return obj;
 }
예제 #6
0
 public Boolean REGISTRARCURSO(clsCurso entidad)
 {
     SqlConnection con = new SqlConnection();
     clsConexion Conexion = new clsConexion();
     String cadena = Conexion.OBTENERCADENA();
     con.ConnectionString = cadena;
     SqlCommand cmd = new SqlCommand("clsCurso_Registrar_PA", con);//invocando al procedimiento almacenado
     cmd.CommandType = CommandType.StoredProcedure;
     SqlParameter paramCODIGO = new SqlParameter("IdCurso", SqlDbType.Int, 8);
     paramCODIGO.Direction = ParameterDirection.Output;
     cmd.Parameters.Add(paramCODIGO);
     cmd.Parameters.AddWithValue("Nombre", entidad.Nombre);
     cmd.Parameters.AddWithValue("FechaInicio", entidad.FechaInicio);
     cmd.Parameters.AddWithValue("FechaFin", entidad.FechaFin);
     cmd.Parameters.AddWithValue("Precio", entidad.Precio);
     cmd.Parameters.AddWithValue("Capacidad", entidad.Capacidad);
     cmd.Parameters.AddWithValue("Estado", entidad.Estado);
     con.Open();
     cmd.ExecuteNonQuery();//devuelve la ejecucion del procedimiento almacenado
     con.Close();
     entidad.IdCurso = (Int32)paramCODIGO.Value;
     return true;
 }