Esempio n. 1
0
        public void insertEstado(Estado estados, string usuario, ref string mensaje)
        {
            sql.Comando.CommandType = CommandType.StoredProcedure;
            sql.Comando.CommandText = "sp_insertEstado";
            sql.Comando.Parameters.AddWithValue("@idEstado", estados.idEstado);
            sql.Comando.Parameters.AddWithValue("@idEstadoTipo", estados.idEstadoTipo = (estados.documentos == true)? "DOCUMENTO" : "PROCESO");
            sql.Comando.Parameters.AddWithValue("@codigo", estados.codigo);
            sql.Comando.Parameters.AddWithValue("@observacion", estados.observacion);
            sql.Comando.Parameters.AddWithValue("@nombre", estados.nombre);
            sql.Comando.Parameters.AddWithValue("@proceso", estados.proceso);
            sql.Comando.Parameters.AddWithValue("@documentos", estados.documentos);
            sql.Comando.Parameters.AddWithValue("@Usuario", usuario);

            try
            {
                sql.AbrirConexion();
                sql.EjecutaQuery(ref mensaje);
            }
            catch (Exception ex)
            {
                mensaje = ex.Message;
            }
            finally
            {
                sql.CerrarConexion();
            }
        }
Esempio n. 2
0
        public List <AppMenu> getAllbyRol(int rolid, ref string mensaje)
        {
            List <AppMenu> menus = new List <AppMenu>();

            sql = new ConsultasSQL();
            sql.Comando.CommandType = CommandType.StoredProcedure;
            sql.Comando.CommandText = "pa_getMenu";
            sql.Comando.Parameters.AddWithValue("@RolID", rolid);

            try
            {
                sql.AbrirConexion();
                IDataReader reader = sql.EjecutaReader(ref mensaje);
                while (reader.Read())
                {
                    menus.Add(AppMenu.CreateAppMenuFromDataRecord(reader));
                }
            }
            catch (Exception ex)
            {
                mensaje = ex.Message;
            }
            finally
            {
                sql.CerrarConexion();
            }

            return(menus);
        }
Esempio n. 3
0
        public List <Usuario> getAllUsuario(ref string mensaje)
        {
            List <Usuario> usuarios = new List <Usuario>();

            sql = new ConsultasSQL();
            sql.Comando.CommandType = CommandType.StoredProcedure;
            sql.Comando.CommandText = "sp_getListUsuario";

            try
            {
                sql.AbrirConexion();
                IDataReader reader = sql.EjecutaReader(ref mensaje);
                while (reader.Read())
                {
                    usuarios.Add(Usuario.CreateUsuarioFromDataRecord(reader));
                }
            }
            catch (Exception ex)
            {
                mensaje = ex.Message;
            }
            finally
            {
                sql.CerrarConexion();
            }

            return(usuarios);
        }
Esempio n. 4
0
        public List <Pasantia> getAllPasantia(ref string mensaje)
        {
            List <Pasantia> pasantias = new List <Pasantia>();

            sql = new ConsultasSQL();
            sql.Comando.CommandType = CommandType.StoredProcedure;
            sql.Comando.CommandText = "pa_getAllPasantia";

            try
            {
                sql.AbrirConexion();
                IDataReader reader = sql.EjecutaReader(ref mensaje);
                while (reader.Read())
                {
                    pasantias.Add(Pasantia.CreatePasantiaFromDataRecord(reader));
                }
            }
            catch (Exception ex)
            {
                mensaje = ex.Message;
            }
            finally
            {
                sql.CerrarConexion();
            }

            return(pasantias);
        }
Esempio n. 5
0
        public Facultad getFacultad(int id, ref string mensaje)
        {
            Facultad facultad = new Facultad();

            sql = new ConsultasSQL();
            sql.Comando.CommandType = CommandType.StoredProcedure;
            sql.Comando.CommandText = "pa_getFacultad";
            sql.Comando.Parameters.AddWithValue("@FacultadID", id);

            try
            {
                sql.AbrirConexion();
                IDataReader reader = sql.EjecutaReader(ref mensaje);
                while (reader.Read())
                {
                    facultad = Facultad.CreateFacultadFromDataRecord(reader);
                }
            }
            catch (Exception ex)
            {
                mensaje = ex.Message;
            }
            finally
            {
                sql.CerrarConexion();
            }

            return(facultad);
        }
Esempio n. 6
0
        public List <Facultad> getAllFacultad(ref string mensaje)
        {
            List <Facultad> facultades = new List <Facultad>();

            sql = new ConsultasSQL();
            sql.Comando.CommandType = CommandType.StoredProcedure;
            sql.Comando.CommandText = "pa_getAllFacultad";

            try
            {
                sql.AbrirConexion();
                IDataReader reader = sql.EjecutaReader(ref mensaje);
                while (reader.Read())
                {
                    facultades.Add(Facultad.CreateFacultadFromDataRecord(reader));
                }
            }
            catch (Exception ex)
            {
                mensaje = ex.Message;
            }
            finally
            {
                sql.CerrarConexion();
            }

            return(facultades);
        }
Esempio n. 7
0
        public Entidades.Proceso.Proceso getProceso(int id, ref string mensaje)
        {
            Entidades.Proceso.Proceso proceso = new Entidades.Proceso.Proceso();
            sql = new ConsultasSQL();
            sql.Comando.CommandType = CommandType.StoredProcedure;
            sql.Comando.CommandText = "sp_getProceso";
            sql.Comando.Parameters.AddWithValue("@IdProceso", id);

            try
            {
                sql.AbrirConexion();
                IDataReader reader = sql.EjecutaReader(ref mensaje);
                while (reader.Read())
                {
                    proceso = Entidades.Proceso.Proceso.CreateProcesoFromDataRecord(reader);
                }
            }
            catch (Exception ex)
            {
                mensaje = ex.Message;
            }
            finally
            {
                sql.CerrarConexion();
            }

            return(proceso);
        }
Esempio n. 8
0
        public List <BandejaHistorial> getAllBandejaHistorial(ref string mensaje)
        {
            List <BandejaHistorial> procesosHistorial = new List <BandejaHistorial>();

            sql = new ConsultasSQL();
            sql.Comando.CommandType = CommandType.StoredProcedure;
            sql.Comando.CommandText = "sp_getListBandejaHistorial";

            try
            {
                sql.AbrirConexion();
                IDataReader reader = sql.EjecutaReader(ref mensaje);
                while (reader.Read())
                {
                    procesosHistorial.Add(BandejaHistorial.CreateBandejaHistorialFromDataRecord(reader));
                }
            }
            catch (Exception ex)
            {
                mensaje = ex.Message;
            }
            finally
            {
                sql.CerrarConexion();
            }

            return(procesosHistorial);
        }
Esempio n. 9
0
        public List <TipoCorrespondencia> getAllTipoCorrespondencia(ref string mensaje)
        {
            List <TipoCorrespondencia> tipoCorrespondencia = new List <TipoCorrespondencia>();

            sql = new ConsultasSQL();
            sql.Comando.CommandType = CommandType.StoredProcedure;
            sql.Comando.CommandText = "sp_getListTipoCorrespondencia";

            try
            {
                sql.AbrirConexion();
                IDataReader reader = sql.EjecutaReader(ref mensaje);
                while (reader.Read())
                {
                    tipoCorrespondencia.Add(TipoCorrespondencia.CreateTipoCorrespondenciaFromDataRecord(reader));
                }
            }
            catch (Exception ex)
            {
                mensaje = ex.Message;
            }
            finally
            {
                sql.CerrarConexion();
            }

            return(tipoCorrespondencia);
        }
Esempio n. 10
0
        public Estado getEstado(int id, ref string mensaje)
        {
            Estado estados = new Estado();

            sql = new ConsultasSQL();
            sql.Comando.CommandType = CommandType.StoredProcedure;
            sql.Comando.CommandText = "sp_getEstado";
            sql.Comando.Parameters.AddWithValue("@idEstado", id);

            try
            {
                sql.AbrirConexion();
                IDataReader reader = sql.EjecutaReader(ref mensaje);
                while (reader.Read())
                {
                    estados = Estado.CreateEstadoFromDataRecord(reader);
                }
            }
            catch (Exception ex)
            {
                mensaje = ex.Message;
            }
            finally
            {
                sql.CerrarConexion();
            }

            return(estados);
        }
Esempio n. 11
0
        public BandejaEntrada getBandejaEntrada(int id, ref string mensaje)
        {
            BandejaEntrada procesosEntrada = new BandejaEntrada();

            sql = new ConsultasSQL();
            sql.Comando.CommandType = CommandType.StoredProcedure;
            sql.Comando.CommandText = "sp_getBandejaEntrada";
            sql.Comando.Parameters.AddWithValue("@IdProceso", id);

            try
            {
                sql.AbrirConexion();
                IDataReader reader = sql.EjecutaReader(ref mensaje);
                while (reader.Read())
                {
                    procesosEntrada = BandejaEntrada.CreateBandejaEntradaFromDataRecord(reader);
                }
            }
            catch (Exception ex)
            {
                mensaje = ex.Message;
            }
            finally
            {
                sql.CerrarConexion();
            }

            return(procesosEntrada);
        }
Esempio n. 12
0
        public void insertProceso(Entidades.Proceso.Proceso proceso, string usuario, ref string mensaje)
        {
            sql.Comando.CommandType = CommandType.StoredProcedure;
            sql.Comando.CommandText = "sp_insertProceso";
            sql.Comando.Parameters.AddWithValue("@IdProceso", proceso.IdProceso);
            sql.Comando.Parameters.AddWithValue("@CodigoProceso", proceso.CodigoProceso = proceso.TipoCorrespondencia = (proceso.TipoCorrespondencia == "Comunicados")? "COM": "ISO");
            sql.Comando.Parameters.AddWithValue("@TipoCorrespondencia", proceso.TipoCorrespondencia);
            sql.Comando.Parameters.AddWithValue("@IdUsuarioOrigen", proceso.IdUsuarioOrigen);
            sql.Comando.Parameters.AddWithValue("@IdUsuarioResponsable", proceso.IdUsuarioResponsable);
            //sql.Comando.Parameters.AddWithValue("@IdUsuarioEjecuta", proceso.IdUsuarioEjecuta);
            sql.Comando.Parameters.AddWithValue("@IdDepartamento", proceso.IdDepartamento);
            sql.Comando.Parameters.AddWithValue("@PorUsuario", proceso.PorUsuario);
            sql.Comando.Parameters.AddWithValue("@PorDepartamento", proceso.PorDepartamento);
            sql.Comando.Parameters.AddWithValue("@TodosUsuarios", proceso.TodosUsuarios);
            sql.Comando.Parameters.AddWithValue("@Detalle", proceso.__Detalle);
            sql.Comando.Parameters.AddWithValue("@FechaCaduca", proceso.FechaCaduca);
            sql.Comando.Parameters.AddWithValue("@EstadoProceso", proceso.EstadoProceso = (proceso.EstadoProceso == 0)? 1 : proceso.EstadoProceso);
            //sql.Comando.Parameters.AddWithValue("@ImagenAdjunta", proceso.ImagenAdjunta);
            //sql.Comando.Parameters.AddWithValue("@BandejaEntradaOrigen", proceso.BandejaEntradaOrigen);
            //sql.Comando.Parameters.AddWithValue("@BandejaSalidaOrigen", proceso.BandejaSalidaOrigen);
            //sql.Comando.Parameters.AddWithValue("@BandejaSalidaDestino", proceso.BandejaSalidaDestino);
            //sql.Comando.Parameters.AddWithValue("@BandejaEntradaDestino", proceso.BandejaEntradaDestino);
            //sql.Comando.Parameters.AddWithValue("@BandejaEliminadaDestino", proceso.BandejaEliminadaDestino);
            //sql.Comando.Parameters.AddWithValue("@BandejaEliminadaOrigen", proceso.BandejaEliminadaOrigen);
            //sql.Comando.Parameters.AddWithValue("@BandejaHistorialDestino", proceso.BandejaHistorialDestino);
            //sql.Comando.Parameters.AddWithValue("@BandejaHistorialOrigen", proceso.BandejaHistorialOrigen);
            //sql.Comando.Parameters.AddWithValue("@ConfirmacionLecturaDestino", proceso.ConfirmacionLecturaDestino);
            //sql.Comando.Parameters.AddWithValue("@ConfirmacionLecturaOrigen", proceso.ConfirmacionLecturaOrigen);
            sql.Comando.Parameters.AddWithValue("@EnviaDocumento", proceso.EnviaDocumento);
            //sql.Comando.Parameters.AddWithValue("@Reverso", proceso.Reverso);
            //sql.Comando.Parameters.AddWithValue("@Estado", proceso.Estado);
            sql.Comando.Parameters.AddWithValue("@Usuario", usuario);

            try
            {
                sql.AbrirConexion();
                sql.EjecutaQuery(ref mensaje);
            }
            catch (Exception ex)
            {
                mensaje = ex.Message;
            }
            finally
            {
                sql.CerrarConexion();
            }
        }
Esempio n. 13
0
        public void insertFacultad(Facultad facultad, string usuario, ref string mensaje)
        {
            sql.Comando.CommandType = CommandType.StoredProcedure;
            sql.Comando.CommandText = "pa_insertFacultad";
            sql.Comando.Parameters.AddWithValue("@Nombre", facultad.Nombre);
            sql.Comando.Parameters.AddWithValue("@Usuario", usuario);

            try
            {
                sql.AbrirConexion();
                sql.EjecutaQuery(ref mensaje);
            }
            catch (Exception ex)
            {
                mensaje = ex.Message;
            }
            finally
            {
                sql.CerrarConexion();
            }
        }