示例#1
0
        private void GuardarResultado(string m_idDetalleProtocolo, string valorItem)
        {
            DetalleProtocolo oDet = new DetalleProtocolo();

            oDet = (DetalleProtocolo)oDet.Get(typeof(DetalleProtocolo), int.Parse(m_idDetalleProtocolo));
            ////////////
            ISession  m_session = NHibernateHttpModule.CurrentSession;
            ICriteria crit      = m_session.CreateCriteria(typeof(Derivacion));

            crit.Add(Expression.Eq("IdDetalleProtocolo", oDet));
            Derivacion oDetalle = (Derivacion)crit.UniqueResult();

            if (oDetalle == null)
            {
                oDetalle.IdDetalleProtocolo = oDet;
                oDetalle.Estado             = 2;
                oDetalle.FechaRegistro      = DateTime.Now;
                oDetalle.IdUsuarioRegistro  = int.Parse(Session["idUsuario"].ToString());
            }
            if (valorItem != "")
            {
                oDetalle.Resultado          = valorItem;
                oDetalle.IdUsuarioResultado = int.Parse(Session["idUsuario"].ToString());
                oDetalle.FechaResultado     = DateTime.Now;
                oDetalle.Save();
            }
        }
示例#2
0
        public ExpedienteBandejaDTO registrarDerivacion(Expediente expediente, string userId)
        {
            Derivacion derivacion = new Derivacion();

            derivacion = expediente.derivaciones.FirstOrDefault();
            derivacion.usuarioreceptor = userId;

            var filter = Builders <Expediente> .Filter.Eq(exp => exp.id, expediente.id);

            var update = Builders <Expediente> .Update.Push("derivaciones", derivacion);

            _expedientes.UpdateOne(filter, update);

            BandejaDocumento bandejaDocumento = new BandejaDocumento();

            bandejaDocumento.idexpediente = expediente.id;
            bandejaDocumento.iddocumento  = expediente.documentos.Last().iddocumento;

            UpdateDefinition <Bandeja> updateBandeja = Builders <Bandeja> .Update.Push("bandejaentrada", bandejaDocumento);

            _bandejas.UpdateOne(band => band.usuario == userId, updateBandeja);

            UpdateDefinition <Bandeja> updateBandejaS = Builders <Bandeja> .Update.Pull("bandejasalida", bandejaDocumento);

            _bandejas.UpdateOne(band => band.usuario == derivacion.usuarioemisor, updateBandejaS);

            UpdateDefinition <Bandeja> updateBandejaE = Builders <Bandeja> .Update.Pull("bandejaentrada", bandejaDocumento);

            _bandejas.UpdateOne(band => band.usuario == derivacion.usuarioemisor, updateBandejaE);

            Proceso proceso = new Proceso();

            proceso.area           = derivacion.areaprocedencia;
            proceso.fechaemision   = DateTime.Now;
            proceso.fecharecepcion = DateTime.Now;
            proceso.idemisor       = derivacion.usuarioemisor;
            proceso.idreceptor     = userId;

            UpdateDefinition <Documento> updateDocumento = Builders <Documento> .Update.Push("historialproceso", proceso);

            _documentos.UpdateOne(doc => doc.id == bandejaDocumento.iddocumento, updateDocumento);

            ExpedienteBandejaDTO ex = new ExpedienteBandejaDTO();

            ex = obtenerExpedienteBandeja(expediente.id);



            return(ex);
        }