Beispiel #1
0
        public static bool ValidaEliminacionFuncionGrupo(FuncionGrupoDTO theFuncionGrupoDTO, ref DataTable pobjDatable)
        {
            bool retorno = false;

            YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper();

            wobjSQLHelper.SetParametro("@FuncionGrpCod", SqlDbType.VarChar, 20, theFuncionGrupoDTO.FuncionGrupoCod);

            try
            {
                //====================================================================================
                if (wobjSQLHelper.Ejecutar("validaEliminacionFuncionGrupo", "YouCom", pobjDatable) <= 0)
                {
                    retorno = true;
                }
                else
                {
                    retorno = false;
                }
                //====================================================================================
            }
            catch (Exception eobjException)
            {
                throw eobjException;
            }
            return(retorno);
        }
        public static List <FuncionGrupoDTO> ListadoFuncionGrupo()
        {
            DataTable pobjDataTable = new DataTable();

            YouCom.DTO.Seguridad.FuncionGrupoDTO        theFuncionGrupoDTO;
            List <YouCom.DTO.Seguridad.FuncionGrupoDTO> collFuncionesGrupo = new List <FuncionGrupoDTO>();

            if (YouCom.Comun.DAL.Accesos.FuncionGrupo.ListadoFuncionGrupo(ref pobjDataTable))
            {
                foreach (DataRow wobjDataRow in pobjDataTable.Rows)
                {
                    theFuncionGrupoDTO = new FuncionGrupoDTO();
                    theFuncionGrupoDTO.FuncionGrupoCod     = wobjDataRow["FunciongrpCod"] != null ? wobjDataRow["FunciongrpCod"].ToString() : string.Empty;
                    theFuncionGrupoDTO.FuncionGrupoNombre  = wobjDataRow["FuncionGrpNom"] != null ? wobjDataRow["FuncionGrpNom"].ToString() : string.Empty;
                    theFuncionGrupoDTO.UsuarioIngreso      = wobjDataRow["usuarioingreso"] != null ? wobjDataRow["usuarioingreso"].ToString() : string.Empty;
                    theFuncionGrupoDTO.FechaIngreso        = wobjDataRow["fechaingreso"] != null ? wobjDataRow["fechaingreso"].ToString() : string.Empty;
                    theFuncionGrupoDTO.UsuarioModificacion = wobjDataRow["usuariomodificacion"] != null ? wobjDataRow["usuariomodificacion"].ToString() : string.Empty;
                    theFuncionGrupoDTO.FechaModificacion   = wobjDataRow["fechamodificacion"] != null ? wobjDataRow["fechamodificacion"].ToString() : string.Empty;
                    theFuncionGrupoDTO.IdCondominio        = wobjDataRow["empresa"] != null?decimal.Parse(wobjDataRow["empresa"].ToString()) : 0;

                    theFuncionGrupoDTO.Estado = wobjDataRow["estado"] != null ? wobjDataRow["estado"].ToString() : string.Empty;
                    collFuncionesGrupo.Add(theFuncionGrupoDTO);
                }
            }
            return(collFuncionesGrupo);
        }
Beispiel #3
0
    /// <summary>
    /// Carga Menu Dinamico desde BD
    /// </summary>
    protected IList <FuncionGrupoDTO> CargarMenu()
    {
        IList <FuncionGrupoDTO> IFuncionGrupo = new List <FuncionGrupoDTO>();

        IList <OperadorDTO> operador = new List <OperadorDTO>();

        operador = (IList <OperadorDTO>)Session["InformacionUsuario"];

        string grupoCod = string.Empty;

        foreach (OperadorDTO ope in operador)
        {
            ///Menu Primer Nivel
            foreach (var principal in ope.Grupo)
            {
                if (grupoCod == principal.FuncionGrupoCod)
                {
                }
                else
                {
                    FuncionGrupoDTO funcionGrupo = new FuncionGrupoDTO();

                    funcionGrupo.FuncionGrupoCod    = principal.FuncionGrupoCod;
                    funcionGrupo.FuncionGrupoNombre = principal.FuncionGrupoNombre;
                    funcionGrupo.FuncionGrupoTipo   = principal.FuncionGrupoTipo;

                    IFuncionGrupo.Add(funcionGrupo);
                    grupoCod = principal.FuncionGrupoCod;
                }
            }
        }

        return(IFuncionGrupo);
    }
Beispiel #4
0
        public static bool DeleteFuncionGrupo(FuncionGrupoDTO theFuncionGrupoDTO)
        {
            bool retorno = false;

            YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper();

            wobjSQLHelper.SetParametro("@usuarioIngreso", SqlDbType.VarChar, 20, theFuncionGrupoDTO.UsuarioIngreso);
            wobjSQLHelper.SetParametro("@FuncionGrpCod", SqlDbType.VarChar, 20, theFuncionGrupoDTO.FuncionGrupoCod);

            try
            {
                //====================================================================================
                switch (wobjSQLHelper.EjecutarNQ("Delete_FuncionGrupo", "YouCom"))
                {
                case 0:
                    throw new Exception("No se pudo grabar.");

                case -1:
                    throw new Exception("Hubo un error.");

                case -2:
                    throw new Exception("Hubo un error.");
                }
                //====================================================================================
                retorno = true;
            }
            catch (Exception eobjException)
            {
                throw eobjException;
            }
            return(retorno);
        }
Beispiel #5
0
    /// <summary>
    /// Carga Menu Dinamico desde BD
    /// </summary>
    protected IList <FuncionGrupoDTO> CargarMenu()
    {
        IList <FuncionGrupoDTO> IFuncionGrupo = new List <FuncionGrupoDTO>();

        myUsuario = (YouCom.DTO.Seguridad.UsuarioDTO)Session["usuario"];

        string grupoCod = string.Empty;

        foreach (YouCom.DTO.Seguridad.CondominioDTO condominio in myUsuario.TheCondominioDTO)
        {
            foreach (YouCom.DTO.ProductoDTO producto in condominio.Productos)
            {
                FuncionGrupoDTO funcionGrupo = new FuncionGrupoDTO();

                funcionGrupo.FuncionGrupoCod    = producto.Codigo;
                funcionGrupo.FuncionGrupoNombre = producto.Descripcion;
                //funcionGrupo.FuncionGrupoTipo = principal.FuncionGrupoTipo;

                IFuncionGrupo.Add(funcionGrupo);
                //grupoCod = principal.FuncionGrupoCod;
            }
        }

        return(IFuncionGrupo);
    }
Beispiel #6
0
        public List <YouCom.DTO.Seguridad.UsuarioDTO> LoginUsuario(string mvarUsuarioCod, string mvarPassword)
        {
            YouCom.DTO.Seguridad.UsuarioDTO theOperador = new YouCom.DTO.Seguridad.UsuarioDTO();
            try
            {
                if (!string.IsNullOrEmpty(mvarUsuarioCod))
                {
                    theOperadorDTO = AuntetificaUsuario(mvarUsuarioCod, mvarPassword);
                }
                else
                {
                    throw new Exception("Debe indicarse UsuarioCod");
                }
                List <FuncionGrupoDTO> grupos             = new List <FuncionGrupoDTO>();
                FuncionGrupoDTO        theFuncionGrupoDTO = new FuncionGrupoDTO();
                FuncionDTO             theFuncionDTO;
                theOperador.Grupo = new List <FuncionGrupoDTO>();
                theOperador       = GetGrupos(theOperadorDTO.Usuario.ToString());

                foreach (var item in grupos)
                {
                    ///Carga Funciones de Menu General
                    theFuncionGrupoDTO.FuncionGrupoCod    = item.FuncionGrupoCod;
                    theFuncionGrupoDTO.FuncionGrupoNombre = item.FuncionGrupoNombre;
                    theFuncionGrupoDTO.FuncionGrupoTipo   = item.FuncionGrupoTipo;


                    theFuncionGrupoDTO.Funciones = new List <FuncionDTO>();
                    ///Carga Opciones de Menu y Configuracion de Negocio
                    foreach (var opciones in item.Funciones)
                    {
                        theFuncionDTO = new FuncionDTO();
                        theFuncionDTO.FuncionGrupoCod      = opciones.FuncionGrupoCod;
                        theFuncionDTO.FuncionNombre        = opciones.FuncionNombre;
                        theFuncionDTO.FuncionTipoCod       = opciones.FuncionTipoCod;
                        theFuncionDTO.FuncionalidadNegocio = opciones.FuncionalidadNegocio;
                        theFuncionDTO.Url = opciones.Url;

                        theFuncionGrupoDTO.Funciones.Add(theFuncionDTO);
                    }
                }

                theOperador.Usuario = theOperadorDTO.Usuario;
                theOperador.Nombres = theOperadorDTO.Nombres;
                theOperador.Paterno = theOperadorDTO.Paterno;
                theOperador.Materno = theOperadorDTO.Materno;
                theOperador.Grupo.Add(theFuncionGrupoDTO);


                operador.Add(theOperador);
            }
            catch (Exception eobjException)
            {
                throw new Exception(eobjException.Message);
            }

            return(operador);
        }
Beispiel #7
0
        public static YouCom.DTO.Seguridad.UsuarioDTO GetGrupos(string pvarUsuarioCod)
        {
            SqlConnection myConnection = IMDB.GetConnection();
            SqlCommand    myCommand    = new SqlCommand("QRY_Permiso3", myConnection);

            myCommand.CommandType = CommandType.StoredProcedure;
            SqlDataReader          datos;
            List <FuncionGrupoDTO> ListfuncionGrupo = new List <FuncionGrupoDTO>();
            FuncionGrupoDTO        theFuncionGrupo;
            FuncionDTO             theFuncionDTO;

            YouCom.DTO.Seguridad.UsuarioDTO theOperador = new YouCom.DTO.Seguridad.UsuarioDTO();
            theOperador.Grupo = new List <FuncionGrupoDTO>();

            myCommand.Parameters.Add("@pUSU_RUT", SqlDbType.VarChar).Value = pvarUsuarioCod;

            try
            {
                myConnection.Open();
                datos = myCommand.ExecuteReader();
                while (datos.Read())
                {
                    theFuncionDTO             = new FuncionDTO();
                    theFuncionGrupo           = new FuncionGrupoDTO();
                    theFuncionGrupo.Funciones = new List <FuncionDTO>();
                    ListfuncionGrupo          = new List <FuncionGrupoDTO>();
                    ///Carga Grupo
                    theFuncionGrupo.FuncionGrupoCod    = datos.GetInt32(0).ToString();
                    theFuncionGrupo.FuncionGrupoNombre = datos.GetString(1);
                    theFuncionGrupo.FuncionGrupoTipo   = datos.GetString(5);

                    ///Carga Funcionalidades de Grupo y Funcionalidades Internas del Negocio
                    theFuncionDTO.FuncionCod           = datos.GetInt32(2).ToString();
                    theFuncionDTO.FuncionNombre        = datos.GetString(3);
                    theFuncionDTO.Url                  = datos.GetString(4);
                    theFuncionDTO.FuncionalidadNegocio = datos.GetString(5);
                    theFuncionGrupo.Funciones.Add(theFuncionDTO);

                    //  ListfuncionGrupo.Add(theFuncionGrupo);
                    theOperador.Grupo.Add(theFuncionGrupo);
                }
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            finally
            {
                myConnection.Close();
            }
            return(theOperador);
        }
Beispiel #8
0
        public static List <FuncionGrupoDTO> ListaGruposSistema()
        {
            SqlConnection myConnection = IMDB.GetConnection();
            SqlCommand    myCommand    = new SqlCommand("getFuncionGrupoSistema", myConnection);

            myCommand.CommandType = CommandType.StoredProcedure;
            SqlDataReader          datos;
            FuncionGrupoDTO        theFuncionGrupoDTO;
            List <FuncionGrupoDTO> grupos = new List <FuncionGrupoDTO>();
            string idEmpleado             = string.Empty;

            try
            {
                myConnection.Open();
                datos = myCommand.ExecuteReader();
                while (datos.Read())
                {
                    theFuncionGrupoDTO = new FuncionGrupoDTO();
                    try
                    {
                        if (!datos.IsDBNull(0))
                        {
                            theFuncionGrupoDTO.FuncionGrupoCod = datos.GetInt32(0).ToString();
                        }
                    }

                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                    try
                    {
                        if (!datos.IsDBNull(1))
                        {
                            theFuncionGrupoDTO.FuncionGrupoNombre = datos.GetString(1);
                        }
                    }

                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                    grupos.Add(theFuncionGrupoDTO);
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            finally
            {
                myConnection.Close();
            }

            return(grupos);
        }
        public static bool ValidaEliminacionFuncionGrupo(FuncionGrupoDTO theFuncionGrupoDTO)
        {
            DataTable pobjDataTable = new DataTable();
            bool      retorno       = false;

            if (YouCom.mantenedores.DAL.MantenedoresDAL.ValidaEliminacionFuncionGrupo(theFuncionGrupoDTO, ref pobjDataTable))
            {
                foreach (DataRow wobjDataRow in pobjDataTable.Rows)
                {
                    retorno = true;
                }
            }
            return(retorno);
        }
Beispiel #10
0
        public static List <FuncionGrupoDTO> ListaGruposSistema()
        {
            DataTable pobjDataTable = new DataTable();

            YouCom.DTO.Seguridad.FuncionGrupoDTO        theFuncionGrupoDTO;
            List <YouCom.DTO.Seguridad.FuncionGrupoDTO> collFuncionesGrupo = new List <FuncionGrupoDTO>();

            if (YouCom.Seguridad.DAL.FuncionGrupoDAL.ListaGruposSistema(ref pobjDataTable))
            {
                foreach (DataRow wobjDataRow in pobjDataTable.Rows)
                {
                    theFuncionGrupoDTO = new FuncionGrupoDTO();
                    theFuncionGrupoDTO.FuncionGrupoCod    = wobjDataRow["FunciongrpCod"] != null ? wobjDataRow["FunciongrpCod"].ToString() : string.Empty;
                    theFuncionGrupoDTO.FuncionGrupoNombre = wobjDataRow["FuncionGrpNom"] != null ? wobjDataRow["FuncionGrpNom"].ToString() : string.Empty;

                    collFuncionesGrupo.Add(theFuncionGrupoDTO);
                }
            }
            return(collFuncionesGrupo);
        }
Beispiel #11
0
        public static FuncionGrupoDTO LoadRow(SqlDataReader myDataReader)
        {
            FuncionGrupoDTO theFuncionGrupoDTO = new FuncionGrupoDTO();

            try
            {
                if (myDataReader != null)
                {
                    // categoria_id
                    try
                    {
                        if (!myDataReader.IsDBNull(0))
                        {
                            theFuncionGrupoDTO.FuncionGrupoCod = myDataReader.GetInt32(0).ToString();
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                    // cate_descripcion
                    try
                    {
                        if (!myDataReader.IsDBNull(1))
                        {
                            theFuncionGrupoDTO.FuncionGrupoNombre = myDataReader.GetString(1);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }

                    try
                    {
                        if (!myDataReader.IsDBNull(2))
                        {
                            theFuncionGrupoDTO.UsuarioIngreso = myDataReader.GetString(2);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                    try
                    {
                        if (!myDataReader.IsDBNull(3))
                        {
                            theFuncionGrupoDTO.FechaIngreso = myDataReader.GetDateTime(3).ToString();
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                    try
                    {
                        if (!myDataReader.IsDBNull(4))
                        {
                            theFuncionGrupoDTO.UsuarioModificacion = myDataReader.GetString(4);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                    try
                    {
                        if (!myDataReader.IsDBNull(5))
                        {
                            theFuncionGrupoDTO.FechaModificacion = myDataReader.GetDateTime(5).ToString();
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                    try
                    {
                        if (!myDataReader.IsDBNull(6))
                        {
                            theFuncionGrupoDTO.TheCondominioDTO.IdCondominio = myDataReader.GetDecimal(6);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                    try
                    {
                        if (!myDataReader.IsDBNull(7))
                        {
                            theFuncionGrupoDTO.Estado = myDataReader.GetInt32(7).ToString();
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            finally
            {
            }
            return(theFuncionGrupoDTO);
        }
Beispiel #12
0
        public static bool ValidaEliminacionFuncionGrupo(FuncionGrupoDTO theFuncionGrupoDTO)
        {
            bool respuesta = facade.FuncionGrupo.ValidaEliminacionFuncionGrupo(theFuncionGrupoDTO);

            return(respuesta);
        }
Beispiel #13
0
        public static bool ActivaFuncionGrupo(FuncionGrupoDTO theFuncionGrupoDTO)
        {
            bool respuesta = YouCom.mantenedores.DAL.MantenedoresDAL.ActivaFuncionGrupo(theFuncionGrupoDTO);

            return(respuesta);
        }
        public static bool ActivaFuncionGrupo(FuncionGrupoDTO theFuncionGrupoDTO)
        {
            bool respuesta = YouCom.Seguridad.DAL.FuncionGrupoDAL.ActivaFuncionGrupo(theFuncionGrupoDTO);

            return(respuesta);
        }
Beispiel #15
0
        public List <YouCom.DTO.Seguridad.OperadorDTO> LoginPrivado(string mvarUsuarioCod, string mvarPassword)
        {
            YouCom.DTO.Seguridad.OperadorDTO theOperador = new YouCom.DTO.Seguridad.OperadorDTO();
            try
            {
                if (!string.IsNullOrEmpty(mvarUsuarioCod))
                {
                    theOperadorDTO = AuntetificaUsuario(mvarUsuarioCod, mvarPassword);

                    if (theOperadorDTO.ThePerfilDTO.IdPerfil == 3)
                    {
                        familia = getListadoFamilia().Where(x => x.Estado == "1").ToList();

                        if (familia.Any())
                        {
                            familia = familia.Where(x => x.RutFamilia == mvarUsuarioCod).ToList();
                            if (familia.Any())
                            {
                                existe = true;
                            }
                        }
                    }
                }
                else
                {
                    throw new Exception("Debe indicarse UsuarioCod");
                }

                if (existe)
                {
                    List <FuncionGrupoDTO> grupos             = new List <FuncionGrupoDTO>();
                    FuncionGrupoDTO        theFuncionGrupoDTO = new FuncionGrupoDTO();
                    FuncionDTO             theFuncionDTO;
                    theOperador.Grupo = new List <FuncionGrupoDTO>();
                    theOperador       = GetGrupos(theOperadorDTO.Usuario.ToString());

                    foreach (var item in grupos)
                    {
                        ///Carga Funciones de Menu General
                        theFuncionGrupoDTO.FuncionGrupoCod    = item.FuncionGrupoCod;
                        theFuncionGrupoDTO.FuncionGrupoNombre = item.FuncionGrupoNombre;
                        theFuncionGrupoDTO.FuncionGrupoTipo   = item.FuncionGrupoTipo;


                        theFuncionGrupoDTO.Funciones = new List <FuncionDTO>();
                        ///Carga Opciones de Menu y Configuracion de Negocio
                        foreach (var opciones in item.Funciones)
                        {
                            theFuncionDTO = new FuncionDTO();
                            theFuncionDTO.FuncionGrupoCod      = opciones.FuncionGrupoCod;
                            theFuncionDTO.FuncionNombre        = opciones.FuncionNombre;
                            theFuncionDTO.FuncionTipoCod       = opciones.FuncionTipoCod;
                            theFuncionDTO.FuncionalidadNegocio = opciones.FuncionalidadNegocio;
                            theFuncionDTO.PadreCod             = opciones.PadreCod;
                            theFuncionDTO.Url = opciones.Url;

                            theFuncionGrupoDTO.Funciones.Add(theFuncionDTO);
                        }
                    }

                    theOperador.Usuario = theOperadorDTO.Usuario;
                    theOperador.Nombres = theOperadorDTO.Nombres;
                    theOperador.Paterno = theOperadorDTO.Paterno;
                    theOperador.Materno = theOperadorDTO.Materno;

                    theOperador.TheComunidadDTO  = familia.First().TheComunidadDTO;
                    theOperador.TheCondominioDTO = familia.First().TheCondominioDTO;
                    theOperador.TheCasaDTO       = familia.First().TheCasaDTO;

                    theOperador.Grupo.Add(theFuncionGrupoDTO);

                    operador.Add(theOperador);
                }
                else
                {
                    throw new Exception("El usuario ingresado no pertenece a una comunidad");
                }
            }
            catch (Exception eobjException)
            {
                throw new Exception(eobjException.Message);
            }

            return(operador);
        }