protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            FuncionesBLL oFunciones = new FuncionesBLL();

            Modelos.Funciones funcion = new Modelos.Funciones();

            try
            {
                funcion.id         = Convert.ToInt32(GridView1.DataKeys[e.RowIndex]["Id"]);
                funcion.IdPelicula = Convert.ToInt32(((DropDownList)GridView1.Rows[e.RowIndex].FindControl("ddlPelicula")).SelectedValue);
                funcion.IdSala     = Convert.ToInt32(((DropDownList)GridView1.Rows[e.RowIndex].FindControl("ddlSala")).SelectedValue);
                funcion.precio     = Convert.ToInt32(((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtPrecio")).Text);
                funcion.descuento  = Convert.ToInt32(((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtDescuento")).Text);
                funcion.fecha      = Convert.ToDateTime(((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtFecha")).Text);

                oFunciones.Actualizar(funcion);


                GridView1.EditIndex = -1;
                CargarGrid();
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #2
0
        protected void btnAgregarPelicula(object sender, EventArgs e)
        {
            FuncionesBLL oFuncion = new FuncionesBLL();

            Modelos.Funciones funcion = new Modelos.Funciones();


            funcion.fecha      = Convert.ToDateTime(txtFecha.Text);
            funcion.precio     = Convert.ToDouble(txtPrecio.Text);
            funcion.descuento  = Convert.ToDouble(txtDescuento.Text);
            funcion.IdPelicula = Convert.ToInt32(ddlPelicula.Text);
            funcion.IdSala     = Convert.ToInt32(ddlSala.Text);

            lblMensajeFuncion.Text = oFuncion.CrearFuncion(funcion);
        }
Example #3
0
        public List <FuncionesBO> obtFunciones(ref GlobalResponse globalResponse)
        {
            var funciones = new List <FuncionesBO>();

            try
            {
                var resultados = new FuncionesBLL().sp_sel_funcionesBLL();
                funciones.AddRange(from DataRow row in resultados.Rows select new FuncionesBO {
                    Fun_cod = Convert.ToInt32(row[0].ToString()), Fun_nom = row[1].ToString()
                });
            }
            catch (Exception ex)
            {
                globalResponse.Message  = ex.Message;
                globalResponse.HasError = true;
            }

            return(funciones);
        }
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            FuncionesBLL oFunciones = new FuncionesBLL();

            Modelos.Funciones funcion = new Modelos.Funciones();

            try
            {
                funcion.id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex]["Id"]);

                oFunciones.Eliminar(funcion);

                GridView1.EditIndex = -1;
                CargarGrid();
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #5
0
    public static string eliminarFuncion(string codigo)
    {
        int         id           = Convert.ToInt32(codigo);
        DataTable   dt           = new DataTable();
        FuncionesBO func         = new FuncionesBO();
        string      codigostring = "";

        try
        {
            func.Fun_cod = id;
            dt           = new FuncionesBLL().sp_del_funcionesBLL(func);
        }
        catch (Exception ex)
        {
            throw ex;
        }
        codigostring = dt.Rows[0].ItemArray[0].ToString();

        return(codigostring);
    }
Example #6
0
    private void cargarGrilla()
    {
        StringBuilder strblVideo = new StringBuilder();
        Literal       lTabla     = new Literal();
        string        tabla      = string.Empty;

        DataTable dt = new DataTable();

        dt = new FuncionesBLL().sp_sel_funcionesBLL();
        strblVideo.Append("<thead>");
        strblVideo.Append("<th>ELIMINAR</th>");
        strblVideo.Append("<th>EDITAR</th>");
        strblVideo.Append("<th>CODIGO</th>");
        strblVideo.Append("<th>NOMBRE</th>");
        strblVideo.Append("<th>PERMISO</th>");
        strblVideo.Append("</thead>");
        strblVideo.Append("<tbody>");
        foreach (DataRow row in dt.Rows)
        {
            strblVideo.Append("<tr class=odd gradeX>");
            strblVideo.Append("<td><button id=" + row["cod_funcion"] + " runat=\"server\" onclick=\"eliminar(this.id); \" class=\"btn red\" >" +
                              "<i class=\"fa fa-trash-o\"></i></button>" + "</td>");
            strblVideo.Append("<td><button id=" + row["cod_funcion"] + " runat=\"server\" onclick=\"modificar(this.id);\" class=\"btn blue\" >" +
                              "<i class=\"fa fa-edit\"></i></button>" + "</td>");
            strblVideo.Append("<td>" + row["cod_funcion"] + "</td>");
            strblVideo.Append("<td>" + row["gls_nombre_fun"] + "</td>");
            strblVideo.Append("<td>" + row["cod_permiso"] + "</td>");
            strblVideo.Append("</tr>");
        }

        strblVideo.Append("</tbody>");

        tabla       = strblVideo.ToString();
        lTabla.Text = tabla;

        pnlTablaVideos.Controls.Add(lTabla);
        pnlTablaVideos.Visible = true;
        UpdatePanel1.Update();
        UpdatePanel1.Visible = true;
    }
Example #7
0
    protected void btnModificar_Click(object sender, EventArgs e)
    {
        if (!ValidarCamposMod())
        {
            return;
        }

        FuncionesBO funcion = new FuncionesBO();

        int    permiso, codigo;
        string nombre;

        codigo  = Convert.ToInt32(txtCodMod.Text);
        nombre  = txtNomMod.Text;
        permiso = int.Parse(ddlPermisoMod.SelectedValue);

        funcion.Fun_cod = codigo;
        funcion.Fun_nom = nombre;
        funcion.Per_cod = permiso;

        DataTable dt = new DataTable();

        try
        {
            dt = new FuncionesBLL().sp_updt_funcionesBLL(funcion);
        }
        catch (Exception ex)
        {
            var visibilityClass = "alert alert-danger";
            var style           = "display:block;";
            mensajeError.Attributes["class"] = visibilityClass;
            mensajeError.Attributes["style"] = style;
            cv_Resultado.Text = "Ocurrio un error al cargar los datos: " + ex.Message;
        }


        limpiarFormulario();
        Response.Redirect("FuncionesDesc.aspx");
    }
Example #8
0
    public static Dictionary <string, string> modificarFuncion(string codigo)
    {
        int       id = Convert.ToInt32(codigo);
        DataTable dt = new DataTable();

        try
        {
            dt = new FuncionesBLL().sp_sel_funcionIDBLL(id);
        }
        catch (Exception ex)
        {
            throw ex;
        }

        Dictionary <string, string> func = new Dictionary <string, string>();

        func.Add("cod_funcion", dt.Rows[0].ItemArray[0].ToString());
        func.Add("gls_nombre_funcion", dt.Rows[0].ItemArray[1].ToString());
        func.Add("cod_permiso", dt.Rows[0].ItemArray[2].ToString());

        return(func);
    }