public static List <FuncionDTO> ListadoFuncion() { DataTable pobjDataTable = new DataTable(); YouCom.DTO.Seguridad.FuncionDTO theFuncionDTO; List <YouCom.DTO.Seguridad.FuncionDTO> collFunciones = new List <FuncionDTO>(); if (YouCom.Comun.DAL.Accesos.Funcion.ListadoFuncion(ref pobjDataTable)) { foreach (DataRow wobjDataRow in pobjDataTable.Rows) { theFuncionDTO = new FuncionDTO(); theFuncionDTO.FuncionCod = wobjDataRow["FuncionCod"] != null ? wobjDataRow["FuncionCod"].ToString() : string.Empty; theFuncionDTO.FuncionNombre = wobjDataRow["FuncionNom"] != null ? wobjDataRow["FuncionNom"].ToString() : string.Empty; theFuncionDTO.FuncionTipoCod = wobjDataRow["FuncionTipoCod"] != null ? wobjDataRow["FuncionTipoCod"].ToString() : string.Empty; theFuncionDTO.FuncionGrupoCod = wobjDataRow["FuncionGrpCod"] != null ? wobjDataRow["FuncionGrpCod"].ToString() : string.Empty; theFuncionDTO.Url = wobjDataRow["url"] != null ? wobjDataRow["url"].ToString() : string.Empty; theFuncionDTO.FuncionalidadNegocio = wobjDataRow["funcionalidadNegocio"] != null ? wobjDataRow["funcionalidadNegocio"].ToString() : string.Empty; theFuncionDTO.FechaIngreso = wobjDataRow["fechaIngreso"] != null ? wobjDataRow["fechaIngreso"].ToString() : string.Empty; theFuncionDTO.UsuarioIngreso = wobjDataRow["usuarioIngreso"] != null ? wobjDataRow["usuarioIngreso"].ToString() : string.Empty; theFuncionDTO.UsuarioModificacion = wobjDataRow["usuarioModificacion"] != null ? wobjDataRow["usuarioModificacion"].ToString() : string.Empty; theFuncionDTO.FechaModificacion = wobjDataRow["fechaModificacion"] != null ? wobjDataRow["fechaModificacion"].ToString() : string.Empty; theFuncionDTO.IdCondominio = wobjDataRow["empresa"] != null?decimal.Parse(wobjDataRow["empresa"].ToString()) : 0; theFuncionDTO.Estado = wobjDataRow["estado"] != null ? wobjDataRow["estado"].ToString() : string.Empty; collFunciones.Add(theFuncionDTO); } } return(collFunciones); }
protected IList <FuncionDTO> CargarSubMenu(string pFuncionGrupoCod) { List <OperadorDTO> operador = new List <OperadorDTO>(); operador = Session["InformacionUsuario"] as List <OperadorDTO>; IList <FuncionDTO> IFuncion = new List <FuncionDTO>(); foreach (var item in operador) { ///Menu Primer Nivel foreach (var principal in item.Grupo) { if (pFuncionGrupoCod == principal.FuncionGrupoCod) { if (principal.Funciones != null) { foreach (FuncionDTO opcionesMenu in principal.Funciones) { ///Ejemplo Sub Menu Segundo Nivel FuncionDTO /// FuncionDTO funcion = new FuncionDTO(); funcion.FuncionNombre = opcionesMenu.FuncionNombre; funcion.FuncionGrupoCod = opcionesMenu.FuncionGrupoCod; funcion.Url = "http://" + Request.Url.Authority + ResolveUrl("~/") + opcionesMenu.Url.Replace("~/", ""); funcion.GrupoCod = opcionesMenu.FuncionGrupoCod; IFuncion.Add(funcion); } } } } } return(IFuncion); }
protected IList <FuncionDTO> CargarSubMenu(string pFuncionGrupoCod) { myUsuario = (YouCom.DTO.Seguridad.UsuarioDTO)Session["usuario"]; IList <FuncionDTO> IFuncion = new List <FuncionDTO>(); foreach (YouCom.DTO.Seguridad.CondominioDTO condominio in myUsuario.TheCondominioDTO) { foreach (YouCom.DTO.ProductoDTO producto in condominio.Productos) { if (producto.Codigo.Equals(pFuncionGrupoCod)) { foreach (YouCom.DTO.Item funciones in producto.Funciones) { FuncionDTO theFuncion = new FuncionDTO(); theFuncion = YouCom.Seguridad.BLL.FuncionBLL.detalleFuncion(funciones.Codigo); if (theFuncion.PadreCod == 0) { FuncionDTO funcion = new FuncionDTO(); funcion.FuncionCod = funciones.Codigo; funcion.FuncionNombre = funciones.Descripcion; funcion.FuncionGrupoCod = theFuncion.FuncionGrupoCod; funcion.Url = "http://" + Request.Url.Authority + ResolveUrl("~/") + theFuncion.Url.Replace("~/", ""); funcion.GrupoCod = theFuncion.FuncionGrupoCod; IFuncion.Add(funcion); } } } } } return(IFuncion); }
public static bool DeleteFuncion(FuncionDTO theFuncionDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); wobjSQLHelper.SetParametro("@usuarioIngreso", SqlDbType.VarChar, 20, theFuncionDTO.UsuarioIngreso); wobjSQLHelper.SetParametro("@FuncionCod", SqlDbType.VarChar, 20, theFuncionDTO.FuncionCod); try { //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("Delete_Funcion", "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); }
public static bool ValidaEliminacionFuncion(FuncionDTO theFuncionDTO, ref DataTable pobjDatable) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); wobjSQLHelper.SetParametro("@idTipoTarea", SqlDbType.VarChar, 20, theFuncionDTO.FuncionCod); try { //==================================================================================== if (wobjSQLHelper.Ejecutar("validaEliminacionTipoTarea", "YouCom", pobjDatable) <= 0) { retorno = true; } else { retorno = false; } //==================================================================================== } catch (Exception eobjException) { throw eobjException; } return(retorno); }
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); }
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); }
public static List <FuncionDTO> ListaFuncionGrupoSistema() { SqlConnection myConnection = IMDB.GetConnection(); SqlCommand myCommand = new SqlCommand("GetFuncionalidadesSistema", myConnection); myCommand.CommandType = CommandType.StoredProcedure; SqlDataReader datos; FuncionDTO theFuncionDTO; List <FuncionDTO> funciones = new List <FuncionDTO>(); string idEmpleado = string.Empty; try { myConnection.Open(); datos = myCommand.ExecuteReader(); while (datos.Read()) { theFuncionDTO = new FuncionDTO(); try { if (!datos.IsDBNull(0)) { theFuncionDTO.FuncionCod = datos.GetInt32(0).ToString(); } } catch (Exception ex) { throw new Exception(ex.Message); } try { if (!datos.IsDBNull(1)) { theFuncionDTO.FuncionNombre = datos.GetString(1); } } catch (Exception ex) { throw new Exception(ex.Message); } funciones.Add(theFuncionDTO); } } catch (Exception e) { throw new Exception(e.Message); } finally { myConnection.Close(); } return(funciones); }
public static List <FuncionDTO> ListaPermisos(string Usuario) { SqlConnection myConnection = IMDB.GetConnection(); SqlCommand myCommand = new SqlCommand("PermisosUsuario", myConnection); myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.Add("@usuario", SqlDbType.VarChar).Value = Usuario; SqlDataReader datos; FuncionDTO theFuncionDTO; List <FuncionDTO> funciones = new List <FuncionDTO>(); try { myConnection.Open(); datos = myCommand.ExecuteReader(); while (datos.Read()) { theFuncionDTO = new FuncionDTO(); if (!datos.IsDBNull(0)) { theFuncionDTO.FuncionNombre = datos.GetString(0); } if (!datos.IsDBNull(1)) { theFuncionDTO.FuncionCod = datos.GetInt32(1).ToString(); } if (!datos.IsDBNull(2)) { theFuncionDTO.EnviaCorreo = datos.GetString(2); } //if (!datos.IsDBNull(2)) //{ // theFuncionDTO.Estado = datos.GetString(3); //} funciones.Add(theFuncionDTO); } } catch (Exception ex) { ex.Message.ToString(); } finally { myConnection.Close(); } return(funciones); }
public static bool ValidaEliminacionFuncion(FuncionDTO theFuncionDTO) { DataTable pobjDataTable = new DataTable(); bool retorno = false; if (YouCom.mantenedores.DAL.MantenedoresDAL.ValidaEliminacionFuncion(theFuncionDTO, ref pobjDataTable)) { foreach (DataRow wobjDataRow in pobjDataTable.Rows) { retorno = true; } } return(retorno); }
public static List <FuncionDTO> ListaFuncionGrupoSistema() { DataTable pobjDataTable = new DataTable(); YouCom.DTO.Seguridad.FuncionDTO theFuncionDTO; List <YouCom.DTO.Seguridad.FuncionDTO> collFunciones = new List <FuncionDTO>(); if (YouCom.Seguridad.DAL.FuncionDAL.ListaFuncionGrupoSistema(ref pobjDataTable)) { foreach (DataRow wobjDataRow in pobjDataTable.Rows) { theFuncionDTO = new FuncionDTO(); theFuncionDTO.FuncionCod = wobjDataRow["FuncionCod"] != null ? wobjDataRow["FuncionCod"].ToString() : string.Empty; theFuncionDTO.FuncionNombre = wobjDataRow["FuncionNom"] != null ? wobjDataRow["FuncionNom"].ToString() : string.Empty; collFunciones.Add(theFuncionDTO); } } return(collFunciones); }
/// <summary> /// lista Funciones Asociadas a Grupo para el perfilamiento de usuario /// </summary> /// <returns></returns> public static List <FuncionDTO> ListaFunciones(int FuncionGrupo) { SqlConnection myConnection = IMDB.GetConnection(); SqlCommand myCommand = new SqlCommand("QRY_listaFuncionesGrupo", myConnection); myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.Add("@FuncionGrupoCod", SqlDbType.Int).Value = FuncionGrupo; SqlDataReader datos; FuncionDTO theFuncionDTO; List <FuncionDTO> funciones = new List <FuncionDTO>(); try { myConnection.Open(); datos = myCommand.ExecuteReader(); while (datos.Read()) { theFuncionDTO = new FuncionDTO(); if (!datos.IsDBNull(0)) { theFuncionDTO.FuncionCod = datos.GetInt32(0).ToString(); } if (!datos.IsDBNull(1)) { theFuncionDTO.FuncionNombre = datos.GetString(1); } funciones.Add(theFuncionDTO); } } catch (Exception ex) { ex.Message.ToString(); } finally { myConnection.Close(); } return(funciones); }
protected IList <FuncionDTO> CargarSubSubMenu(string pRutUsuario, string pFuncionCod) { IList <FuncionDTO> IFuncion = new List <FuncionDTO>(); List <FuncionDTO> myFuncionDTO = new List <FuncionDTO>(); myFuncionDTO = YouCom.Seguridad.BLL.FuncionBLL.listaFuncion().Where(x => x.PadreCod == int.Parse(pFuncionCod)).ToList(); foreach (FuncionDTO opcionesMenu in myFuncionDTO) { FuncionDTO funcion = new FuncionDTO(); funcion.FuncionCod = opcionesMenu.FuncionCod; funcion.FuncionNombre = opcionesMenu.FuncionNombre; funcion.FuncionGrupoCod = opcionesMenu.FuncionGrupoCod; funcion.Url = !string.IsNullOrEmpty(opcionesMenu.Url) ? "http://" + Request.Url.Authority + ResolveUrl("~/") + opcionesMenu.Url.Replace("~/", "") : "#"; funcion.GrupoCod = opcionesMenu.FuncionGrupoCod; IFuncion.Add(funcion); } return(IFuncion); }
public static bool InsertFuncion(FuncionDTO theFuncionDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); wobjSQLHelper.SetParametro("@usuarioIngreso", SqlDbType.VarChar, 20, theFuncionDTO.UsuarioIngreso); wobjSQLHelper.SetParametro("@NombreFuncion", SqlDbType.VarChar, 20, theFuncionDTO.FuncionNombre); wobjSQLHelper.SetParametro("@Tipo", SqlDbType.Int, 20, theFuncionDTO.FuncionTipoCod); wobjSQLHelper.SetParametro("@Grupo", SqlDbType.Int, 20, theFuncionDTO.FuncionGrupoCod); wobjSQLHelper.SetParametro("@Url", SqlDbType.VarChar, 20, theFuncionDTO.Url); wobjSQLHelper.SetParametro("@FuncionalidadNegocio", SqlDbType.VarChar, 20, theFuncionDTO.EnviaCorreo); wobjSQLHelper.SetParametro("@enviaCorreo", SqlDbType.VarChar, 20, theFuncionDTO.EnviaCorreo); try { //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("INS_Funcion", "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); }
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); }
public static bool ActivaFuncion(FuncionDTO theFuncionDTO) { bool respuesta = YouCom.mantenedores.DAL.MantenedoresDAL.ActivaFuncion(theFuncionDTO); return(respuesta); }
public static bool ActivaFuncion(FuncionDTO theFuncionDTO) { bool respuesta = YouCom.Seguridad.DAL.FuncionDAL.ActivaFuncion(theFuncionDTO); return(respuesta); }
public static bool ValidaEliminacionFuncion(FuncionDTO theFuncionDTO) { bool respuesta = facade.Seguridad.Funcion.ValidaEliminacionFuncion(theFuncionDTO); return(respuesta); }
public static FuncionDTO LoadRow(SqlDataReader myDataReader) { FuncionDTO theFuncionDTO = new FuncionDTO(); try { if (myDataReader != null) { // categoria_id try { if (!myDataReader.IsDBNull(0)) { theFuncionDTO.FuncionCod = myDataReader.GetInt32(0).ToString(); } } catch (Exception ex) { throw new Exception(ex.Message); } // cate_descripcion try { if (!myDataReader.IsDBNull(1)) { theFuncionDTO.FuncionNombre = myDataReader.GetString(1); } } catch (Exception ex) { throw new Exception(ex.Message); } try { if (!myDataReader.IsDBNull(2)) { theFuncionDTO.FuncionTipoCod = myDataReader.GetInt32(2).ToString(); } } catch (Exception ex) { throw new Exception(ex.Message); } try { if (!myDataReader.IsDBNull(3)) { theFuncionDTO.FuncionGrupoCod = myDataReader.GetInt32(3).ToString(); } } catch (Exception ex) { throw new Exception(ex.Message); } try { if (!myDataReader.IsDBNull(4)) { theFuncionDTO.Url = myDataReader.GetString(4); } } catch (Exception ex) { throw new Exception(ex.Message); } try { if (!myDataReader.IsDBNull(5)) { theFuncionDTO.FuncionalidadNegocio = myDataReader.GetString(5); } } catch (Exception ex) { throw new Exception(ex.Message); } try { if (!myDataReader.IsDBNull(6)) { theFuncionDTO.UsuarioIngreso = myDataReader.GetString(7); } } catch (Exception ex) { throw new Exception(ex.Message); } try { if (!myDataReader.IsDBNull(7)) { theFuncionDTO.FechaIngreso = myDataReader.GetDateTime(6).ToString(); } } catch (Exception ex) { throw new Exception(ex.Message); } try { if (!myDataReader.IsDBNull(8)) { theFuncionDTO.UsuarioModificacion = myDataReader.GetString(8); } } catch (Exception ex) { throw new Exception(ex.Message); } try { if (!myDataReader.IsDBNull(9)) { theFuncionDTO.FechaModificacion = myDataReader.GetDateTime(9).ToString(); } } catch (Exception ex) { throw new Exception(ex.Message); } try { if (!myDataReader.IsDBNull(10)) { theFuncionDTO.TheCondominioDTO.IdCondominio = myDataReader.GetDecimal(10); } } catch (Exception ex) { throw new Exception(ex.Message); } try { if (!myDataReader.IsDBNull(11)) { theFuncionDTO.Estado = myDataReader.GetInt32(11).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(theFuncionDTO); }