Esempio n. 1
0
    private void ObtenerPerfiles(bool forzarBD)
    {
        if (ViewState["lista"] == null || forzarBD)
        {
            PerfilBC  perfil = new PerfilBC();
            DataTable dt     = perfil.ObtenerTodo(true);
            ViewState["lista"] = dt;
            ViewState.Remove("filtrados");
        }
        DataView dw = new DataView((DataTable)ViewState["lista"]);

        if (ViewState["filtrados"] == null)
        {
            dw = new DataView((DataTable)ViewState["lista"]);
        }
        else
        {
            dw = new DataView((DataTable)ViewState["filtrados"]);
        }
        if (ViewState["sortExpresion"] != null && ViewState["sortExpresion"].ToString() != "")
        {
            dw.Sort = (String)ViewState["sortExpresion"];
        }
        this.gv_listar.DataSource = dw;
        this.gv_listar.DataBind();
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["usuario"] == null)
        {
            Response.Redirect("~/InicioQYMS2.aspx");
        }
        user = (UsuarioBC)Session["usuario"];
        if (!IsPostBack)
        {
            Session["panel"] = null;

            SiteBC      site    = new SiteBC();
            EmpresaBC   empresa = new EmpresaBC();
            PerfilBC    perfil  = new PerfilBC();
            ProveedorBC pr      = new ProveedorBC();
            rlcli.DataSource     = site.ObtenerTodos();
            rlcli.DataTextField  = "DESCRIPCION";
            rlcli.DataValueField = "ID";
            rlcli.DataBind();
            utils.CargaDropNormal(this.ddl_editEmpresa, "ID", "NOMBRE_FANTASIA", empresa.ObtenerTodas());
            ddl_editEmpresa.Enabled = false;
            utils.CargaDrop(this.ddl_editTipoUsuario, "ID", "NOMBRE", user.ObtenerPerfilesAutorizados());
            utils.CargaDrop(this.ddl_buscarTipoUsuario, "ID", "NOMBRE", perfil.ObtenerTodo());
            utils.CargaDrop(this.ddl_editProveedores, "ID", "DESCRIPCION", pr.obtenerTodo());
            ObtenerUsuarios(true);
        }
    }
Esempio n. 3
0
        internal PerfilBC Perfil_ObtenerPorId(int id, bool mobile)
        {
            PerfilBC perfil = new PerfilBC();

            try
            {
                accesoDatos.CargarSqlComando("[dbo].[CARGA_PERFIL]");
                accesoDatos.AgregarSqlParametro("@USTI_ID", id);
                accesoDatos.AgregarSqlParametro("@MOBILE", mobile);
                accesoDatos.EjecutarSqlLector();
                while (accesoDatos.SqlLectorDatos.Read())
                {
                    perfil = cargarDatosPerfil(accesoDatos.SqlLectorDatos);
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                accesoDatos.CerrarSqlConeccion();
            }
            return(perfil);
        }
Esempio n. 4
0
        protected void getperfiles()
        {
            List <Perfil> lPerfil = new PerfilBC().getperfiles();

            this.gr_dato.DataSource = lPerfil;
            this.gr_dato.DataBind();
        }
Esempio n. 5
0
    protected void btn_grabar_Click(object sender, EventArgs e)
    {
        int nivel = Convert.ToInt32(txt_perfilPermisos.Text);

        if (nivel >= user.NIVEL_PERMISOS)
        {
            if (!string.IsNullOrEmpty(this.hf_checkMenus.Value))
            {
                PerfilBC perfil = new PerfilBC();
                perfil.NOMBRE         = txt_nombreEdita.Text;
                perfil.DESCRIPCION    = txt_perfilDescripcion.Text;
                perfil.MENU           = this.hf_checkMenus.Value;
                perfil.MOBILE         = false;
                perfil.NIVEL_PERMISOS = nivel;
                string texto;
                if (this.hf_id.Value == "")
                {
                    if (perfil.Ingresa(perfil))
                    {
                        texto = "Perfil creado con éxito!";
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "cerrarModal('modalPerfil');", true);
                    }
                    else
                    {
                        texto = "Error!";
                    }
                }
                else
                {
                    perfil.ID = int.Parse(hf_id.Value);
                    if (perfil.Modifica(perfil))
                    {
                        texto = "Perfil modificado con éxito!";
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "cerrarModal('modalPerfil');", true);
                    }
                    else
                    {
                        texto = "Ha ocurrido un problema al intentar modificar el perfil!";
                    }
                }
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('" + texto + "');", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('No hay módulos seleccionados');", true);
            }
            ObtenerPerfiles(true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Nivel de permiso no autorizado.');", true);
        }
    }
Esempio n. 6
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (this.txt_codigo.Text == "" || this.txt_nombre.Text == "")
            {
                FuncionGlobal.alerta("INGRESE LOS DATOS CORRESPONDIENTES", Page);
                return;
            }
            string add = new PerfilBC().add_Perfil(this.txt_codigo.Text, this.txt_nombre.Text);

            FuncionGlobal.alerta("PERFIL INGRESADO CON EXITO", Page);
            this.txt_nombre.Text = "";
            getperfiles();
        }
Esempio n. 7
0
    protected void btn_Eliminar_click(object sender, EventArgs e)
    {
        PerfilBC perfil = new PerfilBC();

        if (perfil.Elimina(int.Parse(hf_id.Value)))
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Todo OK');", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Error!');", true);
        }
        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "cerrarModal('modalEliminar');", true);
        ObtenerPerfiles(true);
    }
Esempio n. 8
0
    protected void btn_grabarPerfil_Click(object sender, EventArgs e)
    {
        PerfilBC perfil = new PerfilBC();

        perfil.NOMBRE         = txt_nombreEdita.Text;
        perfil.DESCRIPCION    = txt_descripcionEdita.Text;
        perfil.MENU           = this.hf_checkMenus.Value;
        perfil.MOBILE         = true;
        perfil.NIVEL_PERMISOS = Convert.ToInt32(txt_editPermisos.Text);
        if (perfil.MENU != "")
        {
            if (this.hf_id.Value == "")
            {
                if (perfil.Ingresa(perfil))
                {
                    ObtenerPerfiles(true);
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Perfil creado con éxito!');", true);
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "cerrarModal('modalPerfil');", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Error!');", true);
                }
            }
            else
            {
                perfil.ID = int.Parse(hf_id.Value);
                if (perfil.Modifica(perfil))
                {
                    ObtenerPerfiles(true);
                    string texto = "Perfil modificado con éxito!";
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('" + texto + "');", true);
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "cerrarModal('modalPerfil');", true);
                }
                else
                {
                    string texto = "Ha ocurrido un problema al intentar modificar el perfil!";
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('" + texto + "');", true);
                }
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('No hay módulos seleccionados');", true);
        }
        hf_checkMenus.Value = "";
        hf_id.Value         = "";
    }
Esempio n. 9
0
        private PerfilBC cargarDatosPerfil(SqlDataReader reader)
        {
            PerfilBC perfil = new PerfilBC();

            perfil.ID             = int.Parse(reader["ID"].ToString());
            perfil.NOMBRE         = reader["NOMBRE"].ToString();
            perfil.DESCRIPCION    = reader["DESCRIPCION"].ToString();
            perfil.NIVEL_PERMISOS = int.Parse(reader["NIVEL_PERMISOS"].ToString());
            perfil.MENU           = reader["MENUS"].ToString();
            if (reader["MOBILE"].ToString().ToLower() == "true")
            {
                perfil.MOBILE = true;
            }
            else
            {
                perfil.MOBILE = false;
            }
            return(perfil);
        }
Esempio n. 10
0
        private void add_perfilopcionmenu()
        {
            GridViewRow row;

            for (int i = 0; i < gr_dato.Rows.Count; i++)
            {
                row = gr_dato.Rows[i];
                CheckBox chk = (CheckBox)gr_dato.Rows[i].FindControl("chk");

                string codigoopcionmenu = this.gr_dato.Rows[i].Cells[0].Text;

                if (chk.Checked == true)
                {
                    string add = new PerfilBC().add_Perfilopcionmenu(id_perfil, codigoopcionmenu);
                }
                else
                {
                    string add = new PerfilBC().del_Perfilopcionmenu(id_perfil, codigoopcionmenu);
                }
            }
        }
Esempio n. 11
0
        internal bool Perfil_Crear(PerfilBC perfil)
        {
            bool exito = false;

            accesoDatos.CargarSqlComando("[dbo].[EDITA_PERFIL]");
            accesoDatos.AgregarSqlParametro("@USTI_NOMBRE", perfil.NOMBRE);
            accesoDatos.AgregarSqlParametro("@USTI_DESCRIPCION", perfil.DESCRIPCION);
            accesoDatos.AgregarSqlParametro("@MENU", perfil.MENU);
            accesoDatos.AgregarSqlParametro("@USTI_MOBILE", perfil.MOBILE);
            accesoDatos.AgregarSqlParametro("@NIVEL_PERMISOS", perfil.NIVEL_PERMISOS);
            try
            {
                accesoDatos.EjecutarSqlEscritura();
                exito = true;
            }
            catch (SqlException ex)
            {
                exito = false;
                throw (ex);
            }
            return(exito);
        }
Esempio n. 12
0
 protected void gv_listar_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "ELIMINAR")
     {
         hf_id.Value = e.CommandArgument.ToString();
         lblRazonEliminacion.Text = "Eliminar Perfil";
         msjEliminacion.Text      = "Se eliminará el perfil seleccionado, ¿desea continuar?";
         btnModalEliminar.Attributes.Remove("onclick");
         btnModalEliminar.Attributes.Add("onclick", "eliminarPerfil();");
         ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "confirmar", "modalConfirmar();", true);
     }
     if (e.CommandName == "MODIFICAR")
     {
         hf_id.Value = e.CommandArgument.ToString();
         PerfilBC perfil = new PerfilBC().ObtenerXId(Convert.ToInt32(hf_id.Value));
         txt_nombreEdita.Text       = perfil.NOMBRE;
         txt_perfilDescripcion.Text = perfil.DESCRIPCION;
         txt_perfilPermisos.Text    = perfil.NIVEL_PERMISOS.ToString();
         hf_checkMenus.Value        = perfil.MENU;
         txt_perfilPermisos.Text    = perfil.NIVEL_PERMISOS.ToString();
         ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "checkSorting", "checkSorting();modalPerfil();", true);
     }
 }
Esempio n. 13
0
    protected void gv_listaPerfiles_RowEditing(object sender, GridViewEditEventArgs e)
    {
        PerfilBC perfil = new PerfilBC();

        gv_listar.SelectedIndex = e.NewEditIndex;
        int id = int.Parse(this.gv_listar.SelectedDataKey.Value.ToString());

        perfil = perfil.ObtenerXId(id, true);
        if (perfil.ID > 0)
        {
            this.hf_id.Value               = perfil.ID.ToString();
            this.txt_nombreEdita.Text      = perfil.NOMBRE;
            this.txt_descripcionEdita.Text = perfil.DESCRIPCION;
            this.txt_editPermisos.Text     = perfil.NIVEL_PERMISOS.ToString();
            this.hf_checkMenus.Value       = perfil.MENU;
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "checkSorting", "checkSorting();", true);
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "modalPerfil();", true);
        }
        else
        {
            string texto = "No se encontró el perfil seleccionado!";
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('" + texto + "');", true);
        }
    }
Esempio n. 14
0
        protected void gr_dato_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                string nombre;

                string tipo       = this.gr_dato.DataKeys[e.Row.RowIndex].Values[0].ToString();
                string patente    = (string)e.Row.Cells[6].Text;
                int    cont       = this.gr_dato.DataKeys.Count;
                Int16  id_cliente = Convert.ToInt16(this.gr_dato.DataKeys[e.Row.RowIndex].Values[3].ToString());
                nombre = (string)e.Row.Cells[4].Text;
                var usuario   = gr_dato.DataKeys[e.Row.RowIndex]["cuenta_usuario"];
                var codEstado = Convert.ToInt32(gr_dato.DataKeys[e.Row.RowIndex]["codigo_estado"]);

                var coperfil          = new PerfilBC().GetPerfilByUsrName(Session["usrname"].ToString());
                var boton             = (ImageButton)e.Row.FindControl("reiniciar");
                var btnAnalisisManual = (ImageButton)e.Row.FindControl("iBaManual");

                if (tipo.Trim() == "INFAU" || tipo.Trim() == "CTM" || tipo.Trim() == "CTMAC" || tipo.Trim() == "CCV" || tipo.Trim() == "CTC" || tipo.Trim() == "CTMAG")
                {
                    boton.Visible = true;
                    if (codEstado == 11 || codEstado == 12)
                    {
                        btnAnalisisManual.Visible = true;
                    }
                    else
                    {
                        btnAnalisisManual.Visible = false;
                    }
                }
                else
                {
                    boton.Visible = false;
                }
            }
        }
Esempio n. 15
0
 public bool Modifica(PerfilBC perfil)
 {
     return(tran.Perfil_Modificar(perfil));
 }
Esempio n. 16
0
 public bool Ingresa(PerfilBC perfil)
 {
     return(tran.Perfil_Crear(perfil));
 }