Example #1
0
        public string modificarCierreHC(IngresoClinica ingresoClinica)
        {
            try
            {
                var cierreHC = new IngresoClinica {
                    idIngresoClinica = ingresoClinica.idIngresoClinica
                };
                using (var context = new ApplicationDbContext())
                {
                    context.ingresoClinicaContext.Attach(cierreHC);
                    cierreHC.idIngresoClinica = ingresoClinica.idIngresoClinica;
                    cierreHC.estadoHC         = true;
                    cierreHC.estadoRemision   = true;
                    //cierreHC.idUsuario = ingresoClinica.idUsuario;
                    context.SaveChanges();
                }

                return("Exito");
            }
            catch (Exception e)
            {
                System.ArgumentException argxEx = new System.ArgumentException("No se pudo modificar el cierre.", e.Message);
                return(argxEx.ToString());
            }
        }
Example #2
0
        public string modificarConsultaDocumentoGeneral(Consulta consulta)
        {
            try
            {
                var consult = new Consulta {
                    idConsulta = consulta.idConsulta
                };
                using (var context = new ApplicationDbContext())
                {
                    context.consultaContext.Attach(consult);

                    consult.resultadoAutoevaluacion                    = consulta.resultadoAutoevaluacion;
                    consult.hipotesisPsicologica                       = consulta.hipotesisPsicologica;
                    consult.objetivosTerapeuticos                      = consulta.objetivosTerapeuticos;
                    consult.estrategiasTecnicasTerapeuticas            = consulta.estrategiasTecnicasTerapeuticas;
                    consult.logrosAlcanzadosSegunObjetivosTerapeuticos = consulta.logrosAlcanzadosSegunObjetivosTerapeuticos;
                    consult.logrosAlcanzadosSegunConsultante           = consulta.logrosAlcanzadosSegunConsultante;
                    consult.resumen = consulta.resumen;
                    consult.observacionesRecomendaciones = consulta.observacionesRecomendaciones;
                    context.SaveChanges();
                }
            }
            catch (Exception e)
            {
                System.ArgumentException argxEx = new System.ArgumentException("No se pudo actualizar la informacion de ingreso nueva.", e.Message);
                return(argxEx.ToString());
            }
            return("Exito");
        }
Example #3
0
        public string modificarPaciente(Paciente paciente)
        {
            try
            {
                using (var db = new ApplicationDbContext())
                {
                    var result = db.pacienteContext.SingleOrDefault(b => b.numeroHistoriaClinica == paciente.numeroHistoriaClinica);
                    if (result != null)
                    {
                        result.estadoHC = false;
                        db.SaveChanges();
                    }
                }

                //var pacienteModificado = new Paciente { numeroHistoriaClinica = paciente.numeroHistoriaClinica, estadoHC = false };
                //using (var context = new ApplicationDbContext())
                //{
                //    context.pacienteContext.Attach(pacienteModificado);
                //    pacienteModificado.nombre = "A";
                //    //pacienteModificado.estadoHC = false;
                //    //pacienteModificado.estadoHC = pacienteModificado.estadoHC;
                //    context.SaveChanges();
                //}
            }
            catch (Exception e)
            {
                System.ArgumentException argxEx = new System.ArgumentException("No se pudo actualizar el paciente creado.", e.Message);
                return(argxEx.ToString());
            }
            return("Exito");
        }
Example #4
0
 public string modificarRemision(List <IngresoClinica> ingresoPaciente)
 {
     try
     {
         foreach (var item in ingresoPaciente)
         {
             var cierreHC = new IngresoClinica {
                 idIngresoClinica = item.idIngresoClinica
             };
             using (var context = new ApplicationDbContext())
             {
                 context.ingresoClinicaContext.Attach(cierreHC);
                 cierreHC.idIngresoClinica = item.idIngresoClinica;
                 cierreHC.estadoRemision   = false;
                 cierreHC.id_paciente      = item.id_paciente;
                 cierreHC = item;
                 context.SaveChanges();
             }
             context.SaveChanges();
         }
         return("Exito");
     }
     catch (Exception e)
     {
         System.ArgumentException argxEx = new System.ArgumentException("No se pudo modificar la remision.", e.Message);
         return(argxEx.ToString());
     }
 }
Example #5
0
        public void Verify_Log_ExceptionOverload()
        {
            Random random = new Random(DateTime.Now.Millisecond);
            string theTestMessage = string.Format(TEST_MESSAGE, random.Next(10000)); // a message with a unique-enough number in it, so we can identify it when we look for entries we have written
            Exception theException = new ArgumentException(theTestMessage);

            Logging.LogClient = EventLogMockFactory.GetEventLogMock().Instance;  // inject the mock event log into the logging class

            Logging.Log(ADMINISTRATIVE_EVENT_ID, EventLogEntryType.Warning, EVENT_SOURCE_NAME, theException);
            CheckNewLogEntry(ADMINISTRATIVE_EVENT_ID, EVENT_SOURCE_NAME, theException.ToString());

            Logging.Log(OPERATIONAL_EVENT_ID, EventLogEntryType.Warning, EVENT_SOURCE_NAME, theException);
            CheckNewLogEntry(OPERATIONAL_EVENT_ID, EVENT_SOURCE_NAME, theException.ToString());

            Logging.Log(ANALYTIC_EVENT_ID, EventLogEntryType.Warning, EVENT_SOURCE_NAME, theException);
            CheckNewLogEntry(ANALYTIC_EVENT_ID, EVENT_SOURCE_NAME, theException.ToString());

            Logging.Log(DEBUG_EVENT_ID, EventLogEntryType.Warning, EVENT_SOURCE_NAME, theException);
            CheckNewLogEntry(DEBUG_EVENT_ID, EVENT_SOURCE_NAME, theException.ToString());

            Logging.Log(APIUSAGE_EVENT_ID, EventLogEntryType.Warning, EVENT_SOURCE_NAME, theException);
            CheckNewLogEntry(APIUSAGE_EVENT_ID, EVENT_SOURCE_NAME, theException.ToString());

            Logging.Log(MAX_EVENT_ID, EventLogEntryType.Warning, EVENT_SOURCE_NAME, theException);
            CheckNewLogEntry(MAX_EVENT_ID, EVENT_SOURCE_NAME, theException.ToString());

            Logging.LogClient = null;  // reset the test injection
        }
Example #6
0
 public string agregarCierreHC(CierreHC cierre)
 {
     try
     {
         hcDALC = new HistoriaClinicaDALC();
         return(hcDALC.agregarCierre(cierre));
     }
     catch (Exception e)
     {
         System.ArgumentException argxEx = new System.ArgumentException(e.Message);
         return(argxEx.ToString());
     }
 }
Example #7
0
 //Se modifica el ingreso clínica ya que se cierra la HC
 public string modificarCierreHCIngresoClinica(IngresoClinica ingresoCl)
 {
     try
     {
         hcDALC = new HistoriaClinicaDALC();
         hcDALC.modificarCierreHCIngresoCl(ingresoCl);
         return("Proceso Exitoso");
     }
     catch (Exception e)
     {
         System.ArgumentException argxEx = new System.ArgumentException(e.Message);
         return(argxEx.ToString());
     }
 }
Example #8
0
        public string modificarRecepcionCasoModel(RecepcionCaso recepcionC)  //, Paciente pacienteEx) {
        {
            try
            {
                HC = new HistoriaClinicaBO();
                Remitido       remitido       = new Remitido();
                IngresoClinica ingresoClinica = new IngresoClinica();
                Paciente       paciente       = new Paciente();
                var            recepCaso      = recepcionC;
                //recepCaso.paciente.fechaNacimiento = pacienteEx.fechaNacimiento;
                //recepCaso.paciente.consecutivo = recepcionC.consecutivo.numeroConsecutivo;
                var user    = System.Web.HttpContext.Current.User.Identity.GetUserId();
                var usuario = (from item in HC.listarUsuario() where item.Id == user select item).FirstOrDefault();
                recepCaso.ingresoClinica.idUser = usuario.Id;//System.Web.HttpContext.Current.User.Identity.GetUserId();
                //HC.modificarPaciente(recepCaso.paciente);
                //var pacienteIngr = (from item in HC.listarPaciente() where item.numeroDocumento == recepcionC.paciente.numeroDocumento select item).LastOrDefault();
                recepcionC.ingresoClinica.id_paciente = recepcionC.paciente.numeroHistoriaClinica;
                ingresoClinica = recepcionC.ingresoClinica;
                recepcionC.paciente.estadoHC = false;
                paciente = recepcionC.paciente;
                HC.modificarPaciente(paciente);

                if (recepcionC.consultante.cedula != null)
                {
                    var existe = (from item in hcDALC.listarConsultante() where recepcionC.consultante.cedula == item.cedula select item).LastOrDefault();
                    if (existe == null)
                    {
                        //recepcionC.consultante.numeroDocumentoPaciente = pacienteIngr.numeroDocumento;
                        HC.agregarConsultante(recepcionC.consultante);
                        ingresoClinica.id_Consultante = recepcionC.consultante.cedula;
                    }
                }
                HC.ingresoClinica(ingresoClinica);
                var listaHCIngreso = HC.listarIngresoClinica().LastOrDefault();
                recepcionC.cierre.id_ingresoClinica = listaHCIngreso.idIngresoClinica;
                HC.agregarCierreHC(recepcionC.cierre);
                if (recepcionC.remitido.nombreEntidad != null)
                {
                    recepcionC.remitido.id_ingresoCl = recepcionC.ingresoClinica.idIngresoClinica;
                    remitido = recepcionC.remitido;
                    HC.agregarRemitido(remitido);
                }
                return("proceso exitoso");
            }
            catch (Exception e)
            {
                System.ArgumentException argxEx = new System.ArgumentException(e.Message);
                return(argxEx.ToString());
            }
        }
Example #9
0
 public string agregarEstrategiaEva(IngresoEstrategiasEvaluacion ingresoEstrategia)
 {
     try
     {
         bd = new ApplicationDbContext();
         bd.ingresoEstrategiasEvaluacionContext.Add(ingresoEstrategia);
         bd.SaveChanges();
     }
     catch (Exception e)
     {
         System.ArgumentException argxEx = new System.ArgumentException("No se pudo guardar la estrategia creada.", e.Message);
         return(argxEx.ToString());
     }
     return("Exito");
 }
Example #10
0
 public string agregarCierre(CierreHC cierre)
 {
     try
     {
         bd = new ApplicationDbContext();
         bd.cierreHcContext.Add(cierre);
         bd.SaveChanges();
         return("Cierre creado exitoso");
     }
     catch (Exception e)
     {
         System.ArgumentException argxEx = new System.ArgumentException("No se pudo crear el cierre.", e);
         return(argxEx.ToString());
     }
 }
Example #11
0
 public string agregarConsulta(Consulta consulta)
 {
     try
     {
         bd = new ApplicationDbContext();
         bd.consultaContext.Add(consulta);
         bd.SaveChanges();
     }
     catch (Exception e)
     {
         System.ArgumentException argxEx = new System.ArgumentException("No se pudo guardar la consulta creada.", e.Message);
         return(argxEx.ToString());
     }
     return("Exito");
 }
Example #12
0
 public string guardarBarrio(Barrios barrio)
 {
     try
     {
         bd = new ApplicationDbContext();
         bd.barriosContext.Add(barrio);
         bd.SaveChanges();
         return("Proceso exitoso");
     }
     catch (Exception e)
     {
         System.ArgumentException argxEx = new System.ArgumentException("No se pudo crear el barrio.", e);
         return(argxEx.ToString());
     }
 }
Example #13
0
 public string agregarInasistencia(Inasistencias inasistencia)
 {
     try
     {
         bd = new ApplicationDbContext();
         bd.inasistenciasContext.Add(inasistencia);
         bd.SaveChanges();
         return("Inasistencia creado");
     }
     catch (Exception e)
     {
         System.ArgumentException argxEx = new System.ArgumentException("No se pudo crear la inasistencia.", e);
         return(argxEx.ToString());
     }
 }
Example #14
0
 public string agregarIngresoClinica(IngresoClinica ingresoClinica)
 {
     try
     {
         bd = new ApplicationDbContext();
         bd.ingresoClinicaContext.Add(ingresoClinica);
         //bd.Entry(ingresoClinica.EntidadRemitente).State = EntityState.Detached;
         bd.SaveChanges();
         return("Éxito");
     }
     catch (Exception e)
     {
         System.ArgumentException argxEx = new System.ArgumentException("Error al guardar los datos de ingreso.", e.Message);
         return(argxEx.ToString());
     }
 }
Example #15
0
 public string agregarConsultante(Consultante consultante)
 {
     try
     {
         bd = new ApplicationDbContext();
         bd.consultanteContext.Add(consultante);
         //bd.Entry(consultante.tipoDocumento).State = EntityState.Unchanged;//Esto permite que en la tabla barrio no se agregue otro registro que viene del formulario
         bd.SaveChanges();
         return("Consultante creado existosamente");
     }
     catch (Exception e)
     {
         System.ArgumentException argxEx = new System.ArgumentException("No se pudo crear el paciente ya existe un consultante con ese documento registrado.", e);
         return(argxEx.ToString());
     }
 }
Example #16
0
 public string guardarDiagnosticoConsultasInformes(List <ConsultaDiagnostico> listaConDiag)
 {
     try
     {
         foreach (var item in listaConDiag)
         {
             bd.consultaDiagnosticoContext.Add(item);
             bd.SaveChanges();
         }
         return("Proceso Exitoso");
     }
     catch (Exception e)
     {
         System.ArgumentException argxEx = new System.ArgumentException("No se pudo crear la categorizacion y consulta.", e);
         return(argxEx.ToString());
     }
 }
Example #17
0
 public string agregarRemisionL(List <Remision> remision)
 {
     try
     {
         bd = new ApplicationDbContext();
         foreach (var item in remision)
         {
             bd.remisionContext.Add(item);
         }
         bd.SaveChanges();
         return("Se ha creado correctamente la remisión.");
     }
     catch (Exception ex)
     {
         System.ArgumentException argxEx = new System.ArgumentException("No se pudo crear la remisión.", ex.Message);
         return(argxEx.ToString());
     }
 }
		public void CreateEntityWithPropertiesShouldGenerateValidEntity()
		{
			var timestamp = new DateTimeOffset(2014, 12, 01, 18, 42, 20, 666, TimeSpan.FromHours(2));
			var exception = new ArgumentException("Some exceptional exception happened");
			var level = LogEventLevel.Information;
			var messageTemplate = "Template {Temp} {Prop}";
			var template = new MessageTemplateParser().Parse(messageTemplate);
			var properties = new List<LogEventProperty> {
				new LogEventProperty("Temp", new ScalarValue("Temporary")),
				new LogEventProperty("Prop", new ScalarValue("Property"))
			};
			var additionalRowKeyPostfix = "Some postfix";

			var logEvent = new Events.LogEvent(timestamp, level, exception, template, properties);

			var entity = AzureTableStorageEntityFactory.CreateEntityWithProperties(logEvent, null, additionalRowKeyPostfix);

			// Partition key
			var expectedPartitionKey = "0" + new DateTime(logEvent.Timestamp.Year, logEvent.Timestamp.Month, logEvent.Timestamp.Day, logEvent.Timestamp.Hour, logEvent.Timestamp.Minute, 0).Ticks;
			Assert.AreEqual(expectedPartitionKey, entity.PartitionKey);

			// Row Key
			var expectedRowKeyWithoutGuid = "Information|Template {Temp} {Prop}|Some postfix|";
			var rowKeyWithoutGuid = entity.RowKey.Substring(0, expectedRowKeyWithoutGuid.Length);
			var rowKeyGuid = entity.RowKey.Substring(expectedRowKeyWithoutGuid.Length);

			Assert.AreEqual(expectedRowKeyWithoutGuid, rowKeyWithoutGuid);
			Assert.DoesNotThrow(() => Guid.Parse(rowKeyGuid));
			Assert.AreEqual(Guid.Parse(rowKeyGuid).ToString(), rowKeyGuid);

			// Timestamp
			Assert.AreEqual(logEvent.Timestamp, entity.Timestamp);

			// Properties
			Assert.AreEqual(6, entity.Properties.Count);

			Assert.AreEqual(new EntityProperty(messageTemplate), entity.Properties["MessageTemplate"]);
			Assert.AreEqual(new EntityProperty("Information"), entity.Properties["Level"]);
			Assert.AreEqual(new EntityProperty("Template \"Temporary\" \"Property\""), entity.Properties["RenderedMessage"]);
			Assert.AreEqual(new EntityProperty(exception.ToString()), entity.Properties["Exception"]);
			Assert.AreEqual(new EntityProperty("Temporary"), entity.Properties["Temp"]);
			Assert.AreEqual(new EntityProperty("Property"), entity.Properties["Prop"]);
		}
Example #19
0
 public string agregarPaciente(Paciente paciente)
 {
     try
     {
         bd = new ApplicationDbContext();
         bd.pacienteContext.Add(paciente);
         //bd.Entry(paciente.barrio).State = EntityState.Unchanged;//Esto permite que en la tabla barrio no se agregue otro registro que viene del formulario
         //bd.Entry(paciente.eps).State = EntityState.Unchanged;
         //bd.Entry(paciente.localidad).State = EntityState.Unchanged;
         //bd.Entry(paciente.tipoDocumento).State = EntityState.Unchanged;
         //bd.Entry(paciente.paises).State = EntityState.Unchanged;
         //bd.Entry(paciente.id_estrato).State = EntityState.Unchanged;
         bd.SaveChanges();
         return("paciente creado existosamente");
     }
     catch (Exception e)
     {
         System.ArgumentException argxEx = new System.ArgumentException("No se pudo crear el paciente es posible que el numero de historica clínica ya exista.", e);
         return(argxEx.ToString());
     }
 }
Example #20
0
 public string remitirModificarPaciente(Paciente paciente)
 {
     try
     {
         using (var db = new ApplicationDbContext())
         {
             var result = db.pacienteContext.SingleOrDefault(b => b.numeroHistoriaClinica == paciente.numeroHistoriaClinica);
             if (result != null)
             {
                 result.estadoHC = true;
                 db.SaveChanges();
             }
         }
     }
     catch (Exception e)
     {
         System.ArgumentException argxEx = new System.ArgumentException("No se pudo actualizar el paciente creado.", e.Message);
         return(argxEx.ToString());
     }
     return("Exito");
 }
Example #21
0
        //Sentencia que modifica en base de datos el cierre de una historia clínica
        public string modificarCierre(CierreHC cierre)
        {
            try
            {
                using (var db = new ApplicationDbContext())
                {
                    var result = db.cierreHcContext.SingleOrDefault(b => b.idCierreHC == cierre.idCierreHC);
                    if (result != null)
                    {
                        result.fechaFinalizaionPsicoterapia = cierre.fechaFinalizaionPsicoterapia;
                        result.fechaInicioPsicoterapia      = cierre.fechaInicioPsicoterapia;
                        result.id_UsuarioCierraCaso         = cierre.id_UsuarioCierraCaso;
                        result.instrumentosEvaluacion       = cierre.instrumentosEvaluacion;
                        result.resultadoObtenidoEvaluacion  = cierre.resultadoObtenidoEvaluacion;

                        if (cierre.numeroCitasAsignadas != "0")
                        {
                            result.numeroCitasAsignadas = cierre.numeroCitasAsignadas;
                        }

                        if (cierre.numeroSesionesRealizadas != "0")
                        {
                            result.numeroSesionesRealizadas = cierre.numeroSesionesRealizadas;
                        }

                        if (cierre.especificacionMotivoCierre != "0")
                        {
                            result.especificacionMotivoCierre = cierre.especificacionMotivoCierre;
                        }
                        db.SaveChanges();
                    }
                }
                return("Exito");
            }
            catch (Exception e)
            {
                System.ArgumentException argxEx = new System.ArgumentException("No se pudo modificar el cierre.", e.Message);
                return(argxEx.ToString());
            }
        }
Example #22
0
        public string eliminarIngresoEstrategiaEvaluacionDocumentoGeneral(IngresoEstrategiasEvaluacion ingresoEstrategiaEvaluacion)
        {
            try
            {
                var ingresoEstrategiaEv = new IngresoEstrategiasEvaluacion {
                    idEstrategiaEvaluacion = ingresoEstrategiaEvaluacion.idEstrategiaEvaluacion
                };
                using (var context = new ApplicationDbContext())
                {
                    context.ingresoEstrategiasEvaluacionContext.Attach(ingresoEstrategiaEv);
                    context.ingresoEstrategiasEvaluacionContext.Remove(ingresoEstrategiaEv);
                    context.SaveChanges();
                }

                return("Exito");
            }
            catch (Exception e)
            {
                System.ArgumentException argxEx = new System.ArgumentException("No se pudo eliminar el documento general del paciente.", e.Message);
                return(argxEx.ToString());
            }
        }
Example #23
0
        public string eliminarConsultaDoumentoGeneralExistente(Consulta consulta)
        {
            try
            {
                var consult = new Consulta {
                    idConsulta = consulta.idConsulta
                };
                using (var context = new ApplicationDbContext())
                {
                    context.consultaContext.Attach(consult);
                    context.consultaContext.Remove(consult);
                    context.SaveChanges();
                }

                return("Exito");
            }
            catch (Exception e)
            {
                System.ArgumentException argxEx = new System.ArgumentException("No se pudo eliminar el documento general del paciente.", e.Message);
                return(argxEx.ToString());
            }
        }
Example #24
0
        //Eliminar un permiso a un paciente
        public string eliminarUsuarioAsignadoHC(PermisosUsuariosPaciente permisoUsuarioPaciente)
        {
            try
            {
                var permisoUsuarioPac = new PermisosUsuariosPaciente {
                    idPermisosUsuario = permisoUsuarioPaciente.idPermisosUsuario
                };
                using (var context = new ApplicationDbContext())
                {
                    context.permisosUsuariosPacienteContext.Attach(permisoUsuarioPac);
                    context.permisosUsuariosPacienteContext.Remove(permisoUsuarioPac);
                    context.SaveChanges();
                }

                return("Exito");
            }
            catch (Exception e)
            {
                System.ArgumentException argxEx = new System.ArgumentException("No se pudo eliminar el permiso usuario paciente.", e.Message);
                return(argxEx.ToString());
            }
        }
Example #25
0
        public string modificarIngresoCl(IngresoClinica ingresoCl)
        {
            try
            {
                var ingresoNuevo = new IngresoClinica {
                    idIngresoClinica = ingresoCl.idIngresoClinica
                };
                using (var context = new ApplicationDbContext())
                {
                    context.ingresoClinicaContext.Attach(ingresoNuevo);

                    if (ingresoCl.estadoCivil != null)
                    {
                        ingresoNuevo.estadoCivil = ingresoCl.estadoCivil;
                    }

                    if (ingresoCl.religion != null)
                    {
                        ingresoNuevo.religion = ingresoCl.religion;
                    }

                    ingresoNuevo.motivoConsulta         = ingresoCl.motivoConsulta;
                    ingresoNuevo.problematicaActual     = ingresoCl.problematicaActual;
                    ingresoNuevo.historiaPersonal       = ingresoCl.historiaPersonal;
                    ingresoNuevo.antecedentes           = ingresoCl.antecedentes;
                    ingresoNuevo.historiaFamiliar       = ingresoCl.historiaFamiliar;
                    ingresoNuevo.genograma              = ingresoCl.genograma;
                    ingresoNuevo.estadoDocumentoGeneral = ingresoCl.estadoDocumentoGeneral;
                    context.SaveChanges();
                }
            }
            catch (Exception e)
            {
                System.ArgumentException argxEx = new System.ArgumentException("No se pudo actualizar la informacion de ingreso nueva.", e.Message);
                return(argxEx.ToString());
            }
            return("Exito");
        }
Example #26
0
        public string guardarCategorizacionesCAPDiagnosticoConsultas(List <CategorizacionHC> listaCatHC, List <ConsultaDiagnostico> listaConDiag)
        {
            try
            {
                bd = new ApplicationDbContext();
                foreach (var item in listaCatHC)
                {
                    bd.categorizcionHcContext.Add(item);
                    bd.SaveChanges();
                }

                foreach (var item in listaConDiag)
                {
                    bd.consultaDiagnosticoContext.Add(item);
                    bd.SaveChanges();
                }
                return("Proceso Exitoso");
            }
            catch (Exception e)
            {
                System.ArgumentException argxEx = new System.ArgumentException("No se pudo crear la categorizacion y consulta.", e);
                return(argxEx.ToString());
            }
        }
Example #27
0
        public GameTask Add(GameTask gameTask)
        {
            bool taskMatureTimeUnique = false;
            uint attempts = 0;

            while (taskMatureTimeUnique == false) {
                ArgumentException aex = new ArgumentException();

                if (this.Queue.ContainsKey(gameTask.MatureTime.Ticks)) {
                    taskMatureTimeUnique = false;
                } else {
                    taskMatureTimeUnique = true;

                    try {
                        Queue.Add(gameTask.MatureTime.Ticks, gameTask);
                    } catch (ArgumentException aexNew) {
                        MessageBox.Show("Failed to add task with key: '" + gameTask.MatureTime.Ticks + "'.");
                        aex = aexNew;
                    }
                }

                if (taskMatureTimeUnique == false) {
                    gameTask = gameTask.AddTicks(1);
                }

                attempts += 1;

                if (attempts > 500) {
                    MessageBox.Show("GameTaskQueue::Add(): Error adding task: " + aex.ToString());
                }
            }

            return gameTask;
        }
 public decimal ConvertCurrency(CurrencyType currencyHave,
     decimal currencyHaveAmount, CurrencyType currencyWant)
 {
     if (IsCurrencySupported(currencyHave) == false)
     {
         ArgumentException ex =
             new ArgumentException("Unsupported currency type", "currencyHave");
         Debug.WriteLine("***ERROR*** BreakingThroughToDotNetExample1.CurrencyConverter.ConvertCurrency Error: " + ex.ToString());
         throw ex;
     }
     else if(IsCurrencySupported(currencyWant) == false)
     {
         ArgumentException ex =
             new ArgumentException("Unsupported currency type", "currencyWant");
         Debug.WriteLine("***ERROR*** BreakingThroughToDotNetExample1.CurrencyConverter.ConvertCurrency Error: " + ex.ToString());
         throw ex;
     }
     else
     {
         decimal currencyWantAmount =
             currencyHaveAmount / GetCurrentExchangeRateAgainstUSD(currencyHave);
         currencyWantAmount *= GetCurrentExchangeRateAgainstUSD(currencyWant);
         return currencyWantAmount;
     }
 }
Example #29
0
        public string crearRecepcionCasoModel(RecepcionCaso recepcionC)
        {
            try
            {
                HC = new HistoriaClinicaBO();
                Remitido       remitido       = new Remitido();
                Consecutivo    consecutivo    = new Consecutivo();
                IngresoClinica ingresoClinica = new IngresoClinica();
                Paciente       paciente       = new Paciente();
                consecutivo          = recepcionC.consecutivo;
                paciente             = recepcionC.paciente;
                paciente.estadoHC    = false;
                paciente.consecutivo = consecutivo.numeroConsecutivo;

                if (recepcionC.ingresoClinica.tieneEpc == null)
                {
                    recepcionC.ingresoClinica.tieneEpc = "NO";
                }

                if (recepcionC.ingresoClinica.tieneEps == null)
                {
                    recepcionC.ingresoClinica.tieneEps = "NO";
                }

                var pacienteExst = (from item in HC.listarPaciente() where item.numeroHistoriaClinica == recepcionC.paciente.numeroHistoriaClinica select item).LastOrDefault();
                if (pacienteExst == null)
                {
                    HC.agregarConsecutivo(consecutivo);
                    paciente.consecutivo = consecutivo.idConsecutivo;
                    HC.agregarpaciente(paciente);
                    var usuarioId       = System.Web.HttpContext.Current.User.Identity.GetUserId();
                    var usuarioExitente = (from item in HC.listarUsuario() where item.Id == usuarioId select item).FirstOrDefault();
                    recepcionC.ingresoClinica.idUser = usuarioExitente.Id; //System.Web.HttpContext.Current.User.Identity.GetUserId();
                    var pacienteIngr = (from item in HC.listarPaciente() where item.numeroHistoriaClinica == recepcionC.paciente.numeroHistoriaClinica select item).LastOrDefault();
                    recepcionC.ingresoClinica.id_paciente = recepcionC.paciente.numeroHistoriaClinica;
                    ingresoClinica = recepcionC.ingresoClinica;
                    if (recepcionC.consultante.cedula != null)
                    {
                        Consultante existe           = null;
                        var         listaConsultante = hcDALC.listarConsultante();
                        if (listaConsultante != null)
                        {
                            existe = (from item in hcDALC.listarConsultante() where recepcionC.consultante.cedula == item.cedula select item).LastOrDefault();
                        }
                        if (existe == null)
                        {
                            recepcionC.ingresoClinica.id_Consultante = recepcionC.consultante.cedula;
                            //recepcionC.consultante.numeroDocumentoPaciente = pacienteIngr.numeroHistoriaClinica;
                            HC.agregarConsultante(recepcionC.consultante);
                        }
                        recepcionC.ingresoClinica.id_Consultante = recepcionC.consultante.cedula;
                    }
                    HC.ingresoClinica(ingresoClinica);
                    var listaHCIngreso = HC.listarIngresoClinica().LastOrDefault();
                    recepcionC.cierre.id_ingresoClinica = listaHCIngreso.idIngresoClinica;
                    recepcionC.cierre.idUsuario         = usuarioExitente.Id; //System.Web.HttpContext.Current.User.Identity.GetUserId();
                    HC.agregarCierreHC(recepcionC.cierre);
                    if (recepcionC.remitido.nombreEntidad != null)
                    {
                        recepcionC.remitido.id_ingresoCl = recepcionC.ingresoClinica.idIngresoClinica;
                        remitido = recepcionC.remitido;
                        HC.agregarRemitido(remitido);
                    }


                    return("proceso exitoso");
                }
                return("proceso exitoso");
            }
            catch (Exception e)
            {
                System.ArgumentException argxEx = new System.ArgumentException(e.Message);
                return(argxEx.ToString());
            }
        }