示例#1
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);
        }
示例#2
0
        public List <BandejaEntrada> getAllBandejaEntrada(ref string mensaje)
        {
            List <BandejaEntrada> ProcesosEntrada = new List <BandejaEntrada>();

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

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

            return(ProcesosEntrada);
        }
示例#3
0
        public void MarcarFavorito(int id, int estado)
        {
            ColegioContext objCnn = new ColegioContext();

            BandejaEntrada _mensaje = objCnn.bandeja_entrada.Find(id);

            _mensaje.BanDestacado = estado;

            objCnn.SaveChanges();
        }
示例#4
0
        public ResponseDTO Recibido(int id)
        {
            ResponseDTO obj = new ResponseDTO();

            ColegioContext objCnn = new ColegioContext();

            BandejaEntrada _mensaje = objCnn.bandeja_entrada.Find(id);

            _mensaje.BanOkRecibido = 1;
            //_mensaje.BanOkRecibidoFecha = DateTime.Now;

            //objCnn.bandeja_entrada.Add(new BandejaEntrada() {

            //    BanEstado=0,
            //    BanMsnId=_mensaje.BanMsnId,
            //});

            objCnn.SaveChanges();

            return(obj);
        }
示例#5
0
        public ResponseDTO MarcarLeido(LeidoDTO mensaje, int usuario)
        {
            ResponseDTO    objresponse = new ResponseDTO();
            ColegioContext objCnn      = new ColegioContext();

            BandejaEntrada _mensaje = objCnn.bandeja_entrada.Where(c => c.BanId == mensaje.IdBandeja && c.BanUsuario == usuario).FirstOrDefault();

            if (_mensaje != null)
            {
                if (_mensaje.BanHoraLeido == null)
                {
                    _mensaje.BanHoraLeido = DateTime.Now;
                }
                if (_mensaje.BanOkRecibido == 0)
                {
                    _mensaje.BanOkRecibido = mensaje.OkRecibido;
                }
                objCnn.SaveChanges();
            }



            return(objresponse);
        }
        public BandejaEntrada getBandejaEntrada(String titulo, int prioridadId, int estadoId, int responsableId, int categoriaId,
                                                int elementosPorPagina, int paginaActual, String ordenamiento, String ascendenteDescendente)
        {
            BandejaEntrada bandejaEntrada = new BandejaEntrada();

            bandejaEntrada.listaTickets = new List <Tickets>();
            Paginacion paginacion = new Paginacion()
            {
                elementosPorPagina = elementosPorPagina,
                paginaActual       = paginaActual
            };
            SqlDataReader reader;

            try
            {
                using (SqlConnection conexion = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString))
                {
                    using (SqlCommand comando = new SqlCommand("AAA_BETicketsSEL", conexion))
                    {
                        comando.CommandType = CommandType.StoredProcedure;
                        comando.Parameters.Add("@Titulo", SqlDbType.VarChar).Value                = titulo;
                        comando.Parameters.Add("@PrioridadId", SqlDbType.Int).Value               = prioridadId;
                        comando.Parameters.Add("@EstadoId", SqlDbType.Int).Value                  = estadoId;
                        comando.Parameters.Add("@ResponsableId", SqlDbType.Int).Value             = responsableId;
                        comando.Parameters.Add("@CategoriaId", SqlDbType.Int).Value               = categoriaId;
                        comando.Parameters.Add("@ElementosPorPagina", SqlDbType.Int).Value        = elementosPorPagina;
                        comando.Parameters.Add("@PaginaActual", SqlDbType.Int).Value              = paginaActual;
                        comando.Parameters.Add("@Ordenamiento", SqlDbType.VarChar).Value          = ordenamiento;
                        comando.Parameters.Add("AscendenteDescendente", SqlDbType.NVarChar).Value = ascendenteDescendente;
                        comando.Parameters.Add("@ElementosTotales", SqlDbType.Int).Direction      = ParameterDirection.Output;
                        comando.Parameters.Add("@PaginasTotales", SqlDbType.Int).Direction        = ParameterDirection.Output;

                        conexion.Open();
                        reader = comando.ExecuteReader();

                        while (reader.Read())
                        {
                            bandejaEntrada.listaTickets.Add(new Tickets()
                            {
                                Id            = reader["Id"] != DBNull.Value ? (int)reader["Id"] : 0,
                                Nombre        = reader["Nombre"] != DBNull.Value ? (string)reader["Nombre"] : null,
                                Estado        = reader["Estado"] != DBNull.Value ? (string)reader["Estado"] : null,
                                Prioridad     = reader["Prioridad"] != DBNull.Value ? (string)reader["Prioridad"] : null,
                                Categoria     = reader["Categoria"] != DBNull.Value ? (string)reader["Categoria"] : null,
                                Responsable   = reader["Responsable"] != DBNull.Value ? (string)reader["Responsable"] : null,
                                FechaCreacion = reader["FechaCreacion"] != DBNull.Value ? (DateTime)reader["FechaCreacion"] : new DateTime(),
                                Version       = reader["Version"] != DBNull.Value ? (int)reader["Version"] : 0
                            });
                        }
                        reader.Close();

                        paginacion.ElementosTotales = comando.Parameters["@ElementosTotales"].Value == null ? 0 : int.Parse(comando.Parameters["@ElementosTotales"].Value.ToString());
                        paginacion.paginasTotales   = comando.Parameters["@PaginasTotales"].Value == null ? 0 : int.Parse(comando.Parameters["@PaginasTotales"].Value.ToString());
                        bandejaEntrada.paginacion   = paginacion;
                    }
                }

                return(bandejaEntrada);
            }
            finally
            {
                bandejaEntrada = null;
                reader         = null;
            }
        }