Example #1
0
        public static int CreateMedicalEvent(MedicalEventBE medicalEvent, Guid createdUserId)
        {

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {

                MedicalEvent medicalEvent_db = new MedicalEvent();


                medicalEvent_db.MedicalEventId_Parent = medicalEvent.MedicalEventId_Parent;
                medicalEvent_db.ProfesionalId = medicalEvent.ProfesionalId;

                medicalEvent_db.PatientId = medicalEvent.PatientId;

                medicalEvent_db.IdEspesialidad = medicalEvent.IdEspesialidad;
                medicalEvent_db.IdTipoConsulta = medicalEvent.IdTipoConsulta;

                medicalEvent_db.Motivo = medicalEvent.Motivo;
   
                medicalEvent_db.MetodoComplementario = medicalEvent.MetodoComplementario;
                medicalEvent_db.Evolucion = medicalEvent.Evolucion;
                medicalEvent_db.AppointmentId = medicalEvent.AppointmentId;

                medicalEvent_db.CreatedDate = System.DateTime.Now;
                medicalEvent_db.CreatedUserId = createdUserId;
                medicalEvent_db.HealthInstitutionId = medicalEvent.HealthInstitutionId;

                dc.MedicalEvents.AddObject(medicalEvent_db);
                dc.SaveChanges();
                return medicalEvent_db.MedicalEventId;
            }
        }
Example #2
0
        public static void UpdateMedicalEvent(MedicalEventBE medicalEvent, Guid createdUserId)
        {

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {

                MedicalEvent medicalEvent_db = dc.MedicalEvents.Where(p => p.MedicalEventId.Equals(medicalEvent.MedicalEventId)).FirstOrDefault<MedicalEvent>();


                medicalEvent_db.MedicalEventId_Parent = medicalEvent.MedicalEventId_Parent;
                medicalEvent_db.ProfesionalId = medicalEvent.ProfesionalId;

                medicalEvent_db.PatientId = medicalEvent.PatientId;

                medicalEvent_db.IdEspesialidad = medicalEvent.IdEspesialidad;
                medicalEvent_db.IdTipoConsulta = medicalEvent.IdTipoConsulta;

                medicalEvent_db.Motivo = medicalEvent.Motivo;
      
                medicalEvent_db.Evolucion = medicalEvent.Evolucion;

   
                medicalEvent_db.MetodoComplementario = medicalEvent.MetodoComplementario;
                medicalEvent_db.AppointmentId = medicalEvent.AppointmentId;
                medicalEvent_db.HealthInstitutionId = medicalEvent.HealthInstitutionId;
                //medicalEvent_db.CreatedDate = System.DateTime.Now;
                //medicalEvent_db.CreatedUserId = createdUserId;
                dc.SaveChanges();

            }
        }
Example #3
0
        public static void Create(Health.BE.PersonaBE personaBE)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Health.Back.BE.Persona persona = new Health.Back.BE.Persona();
                persona.UserId = personaBE.UserId;
                persona.Apellido = personaBE.Apellido;
                persona.Nombre = personaBE.Nombre;
                persona.NroDocumento = personaBE.NroDocumento;
                persona.TipoDocumento = personaBE.TipoDocumento;
                persona.IdEstadocivil = personaBE.IdEstadocivil;
                persona.FechaNacimiento = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(personaBE.FechaNacimiento);
                persona.FechaAlta = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(System.DateTime.Now);
                persona.LastAccessTime = persona.FechaAlta;
                persona.LastAccessUserId = personaBE.LastAccessUserId;

                persona.Street = personaBE.Street;
                persona.StreetNumber = personaBE.StreetNumber;
                persona.Floor = personaBE.Floor;
                persona.CountryId = personaBE.CountryId;
                persona.ProvinceId = personaBE.ProvinceId;
                persona.CityId = personaBE.CityId;
                persona.Neighborhood = personaBE.Neighborhood;
                persona.mail = personaBE.mail;
                persona.Telefono1 = personaBE.Telefono1;
                persona.Telefono2 = personaBE.Telefono2;
                persona.ZipCode = persona.ZipCode;
                persona.Foto = personaBE.Foto;

                dc.Personas.AddObject(persona);
                dc.SaveChanges();
                personaBE.FechaAlta = persona.FechaAlta;
                personaBE.IdPersona = persona.IdPersona;
            }
        }
Example #4
0
        public static void Create(Health.BE.PersonaBE personaBE)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Health.Back.BE.Persona persona = new Health.Back.BE.Persona();
                persona.UserId           = personaBE.UserId;
                persona.Apellido         = personaBE.Apellido;
                persona.Nombre           = personaBE.Nombre;
                persona.NroDocumento     = personaBE.NroDocumento;
                persona.TipoDocumento    = personaBE.TipoDocumento;
                persona.IdEstadocivil    = personaBE.IdEstadocivil;
                persona.FechaNacimiento  = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(personaBE.FechaNacimiento);
                persona.FechaAlta        = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(System.DateTime.Now);
                persona.LastAccessTime   = persona.FechaAlta;
                persona.LastAccessUserId = personaBE.LastAccessUserId;

                persona.Calle       = personaBE.Calle;
                persona.CalleNumero = personaBE.CalleNumero;
                persona.Piso        = personaBE.Piso;
                persona.IdPais      = personaBE.IdPais;
                persona.IdProvincia = personaBE.IdProvincia;
                persona.IdLocalidad = personaBE.IdLocalidad;
                persona.Barrio      = personaBE.Barrio;
                persona.mail        = personaBE.mail;
                persona.Telefono1   = personaBE.Telefono1;
                persona.Telefono2   = personaBE.Telefono2;
                persona.Foto        = personaBE.Foto;

                dc.Personas.AddObject(persona);
                dc.SaveChanges();
                personaBE.FechaAlta = persona.FechaAlta;
                personaBE.IdPersona = persona.IdPersona;
            }
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="personaBE"></param>
        public static void Update(PersonaBE personaBE)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Persona wPersona = dc.Personas.Where(p => p.IdPersona.Equals(personaBE.IdPersona)).FirstOrDefault <Persona>();

                wPersona.Apellido        = personaBE.Apellido;
                wPersona.Nombre          = personaBE.Nombre;
                wPersona.NroDocumento    = personaBE.NroDocumento;
                wPersona.TipoDocumento   = personaBE.TipoDocumento;
                wPersona.IdEstadocivil   = personaBE.IdEstadocivil;
                wPersona.FechaNacimiento = personaBE.FechaNacimiento;
                wPersona.Sexo            = personaBE.Sexo;

                wPersona.Calle       = personaBE.Calle;
                wPersona.CalleNumero = personaBE.CalleNumero;
                wPersona.Piso        = personaBE.Piso;
                wPersona.IdPais      = personaBE.IdPais;
                wPersona.IdProvincia = personaBE.IdProvincia;
                wPersona.IdLocalidad = personaBE.IdLocalidad;
                wPersona.Barrio      = personaBE.Barrio;
                wPersona.mail        = personaBE.mail;
                wPersona.Telefono1   = personaBE.Telefono1;
                wPersona.Telefono2   = personaBE.Telefono2;
                wPersona.Foto        = personaBE.Foto;

                wPersona.LastAccessTime   = System.DateTime.Now;
                wPersona.LastAccessUserId = personaBE.LastAccessUserId;
                wPersona.LastAccessTime   = wPersona.LastAccessTime;
                wPersona.LastAccessUserId = personaBE.LastAccessUserId;
                dc.SaveChanges();
            }
        }
        /// <summary>
        /// Asigna y/o crea un rol
        /// </summary>
        /// <param name="pHealthInstitutionId"></param>
        /// <param name="pProfesionalId_ToAssign"></param>
        /// <param name="pUserId"></param>
        /// <param name="roleName"></param>
        public static void Profesional_UsersInRoles_Assign(Guid pHealthInstitutionId, Int32 pProfesionalId_ToAssign, Guid pUserId, string roleName)
        {
            Back.BE.HealthInstitution_Profesional wHealthInstitution_Profesional = new Back.BE.HealthInstitution_Profesional();
            Back.BE.HealtInstitute_UsersInRoles   wHealtInstitute_UsersInRoles   = new BE.HealtInstitute_UsersInRoles();
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                //Si no existe la relacion del profesional con la inst.. se genera
                if (!dc.HealthInstitution_Profesional.Any(p =>
                                                          p.HealthInstitutionId.Equals(pHealthInstitutionId) &&
                                                          p.Profesional.IdProfesional.Equals(pProfesionalId_ToAssign)))
                {
                    wHealthInstitution_Profesional.HealthInstitutionId = pHealthInstitutionId;
                    wHealthInstitution_Profesional.ProfesionalId       = pProfesionalId_ToAssign;
                    wHealthInstitution_Profesional.UserId      = pUserId;
                    wHealthInstitution_Profesional.IsLockedOut = false;
                    wHealthInstitution_Profesional.ActiveFlag  = true;

                    if (roleName.Equals("inst_owner") || roleName.Equals("inst_admin"))
                    {
                        wHealthInstitution_Profesional.IsAdmin = roleName.Equals("inst_admin");
                        wHealthInstitution_Profesional.IsOwner = roleName.Equals("inst_owner");
                    }
                    dc.HealthInstitution_Profesional.AddObject(wHealthInstitution_Profesional);
                }


                wHealtInstitute_UsersInRoles.UserId = pUserId;
                wHealtInstitute_UsersInRoles.HealthInstitutionId = pHealthInstitutionId;
                wHealtInstitute_UsersInRoles.RoleName            = roleName;

                dc.HealtInstitute_UsersInRoles.AddObject(wHealtInstitute_UsersInRoles);

                dc.SaveChanges();
            }
        }
Example #7
0
        static void Insert(CEI_10List list)
        {

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                CEI_10 wCEI_10;
                try
                {
                    foreach (CEI_10BE c in list)
                    {
                        //falla i10
                        wCEI_10 = new CEI_10();
                        wCEI_10.ParentCode = c.ParentCode.Trim();
                        wCEI_10.Code = c.Code.Trim();
                        wCEI_10.Description = c.Description;
                        wCEI_10.HasChilds = c.HasChilds;

                        dc.CEI_10.AddObject(wCEI_10);
                        dc.SaveChanges();
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }

            }
        }
Example #8
0
        public static void Update(PatientBE Patient)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Patient wPatient = dc.Patients.Where(p => p.PatientId.Equals(Patient.PatientId)).FirstOrDefault <Patient>();

                wPatient.Persona.Apellido        = Patient.Persona.Apellido;
                wPatient.Persona.Nombre          = Patient.Persona.Nombre;
                wPatient.Persona.NroDocumento    = Patient.Persona.NroDocumento;
                wPatient.Persona.TipoDocumento   = Patient.Persona.TipoDocumento;
                wPatient.Persona.IdEstadocivil   = Patient.Persona.IdEstadocivil;
                wPatient.Persona.FechaNacimiento = Patient.Persona.FechaNacimiento;
                wPatient.Persona.Sexo            = Patient.Persona.Sexo;

                wPatient.Persona.Street       = Patient.Persona.Street;
                wPatient.Persona.StreetNumber = Patient.Persona.StreetNumber;
                wPatient.Persona.Floor        = Patient.Persona.Floor;
                wPatient.Persona.CountryId    = Patient.Persona.CountryId;
                wPatient.Persona.ProvinceId   = Patient.Persona.ProvinceId;
                wPatient.Persona.CityId       = Patient.Persona.CityId;
                wPatient.Persona.Neighborhood = Patient.Persona.Neighborhood;
                wPatient.Persona.mail         = Patient.Persona.mail;
                wPatient.Persona.Telefono1    = Patient.Persona.Telefono1;
                wPatient.Persona.Telefono2    = Patient.Persona.Telefono2;
                wPatient.Persona.Foto         = Patient.Persona.Foto;

                wPatient.LastAccessTime           = System.DateTime.Now;
                wPatient.LastAccessUserId         = Patient.LastAccessUserId;
                wPatient.Persona.LastAccessTime   = wPatient.LastAccessTime.Value;
                wPatient.Persona.LastAccessUserId = Patient.Persona.LastAccessUserId;
                dc.SaveChanges();
            }
        }
Example #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pResourceSchedulingList"></param>
        /// <param name="userId"></param>
        public static void Create(ResourceSchedulingList pResourceSchedulingList, Guid userId)
        {
            ResourceScheduling r            = null;
            DateTime           creationDate = System.DateTime.Now;

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                foreach (ResourceSchedulingBE rbe in pResourceSchedulingList)
                {
                    r = new ResourceScheduling();

                    r.CreationDate        = creationDate;
                    r.CreationUserId      = userId;
                    r.DateEnd             = rbe.DateEnd;
                    r.DateStart           = rbe.DateStart;
                    r.Description         = rbe.Description;
                    r.Duration            = rbe.Duration;
                    r.TimeEnd             = rbe.TimeEnd;
                    r.TimeStart           = rbe.TimeStart;
                    r.ResourceId          = rbe.ResourceId;
                    r.WeekDays            = rbe.WeekDays;
                    r.HealthInstitutionId = rbe.HealthInstitutionId;
                    dc.ResourceSchedulings.AddObject(r);
                }
                dc.SaveChanges();
            }
        }
Example #10
0
        public static void Create(Health.BE.PersonaBE personaBE)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Health.Back.BE.Persona persona = new Health.Back.BE.Persona();
                persona.UserId = personaBE.UserId;
                persona.Apellido = personaBE.Apellido;
                persona.Nombre = personaBE.Nombre;
                persona.NroDocumento = personaBE.NroDocumento;
                persona.TipoDocumento = personaBE.TipoDocumento;
                persona.IdEstadocivil = personaBE.IdEstadocivil;
                persona.FechaNacimiento = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(personaBE.FechaNacimiento);
                persona.FechaAlta = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(System.DateTime.Now);
                persona.LastAccessTime = persona.FechaAlta;
                persona.LastAccessUserId = personaBE.LastAccessUserId;

                persona.Calle = personaBE.Calle;
                persona.CalleNumero = personaBE.CalleNumero;
                persona.Piso = personaBE.Piso;
                persona.IdPais = personaBE.IdPais;
                persona.IdProvincia = personaBE.IdProvincia;
                persona.IdLocalidad = personaBE.IdLocalidad;
                persona.Barrio = personaBE.Barrio;
                persona.mail = personaBE.mail;
                persona.Telefono1 = personaBE.Telefono1;
                persona.Telefono2 = personaBE.Telefono2;
                persona.Foto = personaBE.Foto;

                dc.Personas.AddObject(persona);
                dc.SaveChanges();
                personaBE.FechaAlta = persona.FechaAlta;
                personaBE.IdPersona = persona.IdPersona;
            }
        }
Example #11
0
        public static void AddPatientMedicaments(PatientMedicament_ViewBE patientMedicament_View, Guid createdUserId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PatientMedicament patientMedicament_db = new PatientMedicament();

                patientMedicament_db.Status = patientMedicament_View.Status;

                patientMedicament_db.MedicalEventId = patientMedicament_View.MedicalEventId;
                patientMedicament_db.PatientId      = patientMedicament_View.PatientId;
                if (patientMedicament_View.PatientMedicamentId_Parent >= 0)
                {
                    patientMedicament_db.PatientMedicamentId_Parent = patientMedicament_View.PatientMedicamentId_Parent;
                }

                patientMedicament_db.MedicamentName         = patientMedicament_View.MedicamentName;
                patientMedicament_db.MedicamentPresentation = patientMedicament_View.MedicamentPresentation;
                patientMedicament_db.Dosis             = patientMedicament_View.Dosis;
                patientMedicament_db.Periodicity_hours = patientMedicament_View.Periodicity_hours;
                patientMedicament_db.CreatedDate       = System.DateTime.Now;
                patientMedicament_db.CreatedUserId     = createdUserId;
                patientMedicament_db.DaysCount         = patientMedicament_View.DaysCount;
                patientMedicament_db.Enabled           = true;
                dc.PatientMedicaments.AddObject(patientMedicament_db);
                dc.SaveChanges();
            }
        }
Example #12
0
        static void Insert(CEI_10List list)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                CEI_10 wCEI_10;
                try
                {
                    foreach (CEI_10BE c in list)
                    {
                        //falla i10
                        wCEI_10             = new CEI_10();
                        wCEI_10.ParentCode  = c.ParentCode.Trim();
                        wCEI_10.Code        = c.Code.Trim();
                        wCEI_10.Description = c.Description;
                        wCEI_10.HasChilds   = c.HasChilds;

                        dc.CEI_10.AddObject(wCEI_10);
                        dc.SaveChanges();
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Example #13
0
        public static void Update(ResourceSchedulingList resourceSchedulingList, Guid userId)
        {
            ResourceScheduling r_db = null;
            DateTime updateDate = System.DateTime.Now;
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                foreach (ResourceSchedulingBE rbe in resourceSchedulingList)
                {

                    r_db = dc.ResourceSchedulings.Where(p => p.IdSheduler.Equals(rbe.IdSheduler)).FirstOrDefault<ResourceScheduling>();

                    r_db.UpdatedDate = updateDate;
                    r_db.UpdateUserId = userId;

                    r_db.DateEnd = rbe.DateEnd;
                    r_db.DateStart = rbe.DateStart;
                    r_db.Description = rbe.Description;
                    r_db.Duration = rbe.Duration;
                    r_db.TimeEnd = rbe.TimeEnd;
                    r_db.TimeStart = rbe.TimeStart;
                    
                    r_db.WeekDays = rbe.WeekDays;
                    
                }
                dc.SaveChanges();

            }
        }
Example #14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="personaBE"></param>
        public static void Update(PersonaBE personaBE)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Persona wPersona = dc.Personas.Where(p => p.IdPersona.Equals(personaBE.IdPersona)).FirstOrDefault <Persona>();

                wPersona.Apellido        = personaBE.Apellido;
                wPersona.Nombre          = personaBE.Nombre;
                wPersona.NroDocumento    = personaBE.NroDocumento;
                wPersona.TipoDocumento   = personaBE.TipoDocumento;
                wPersona.IdEstadocivil   = personaBE.IdEstadocivil;
                wPersona.FechaNacimiento = personaBE.FechaNacimiento;
                wPersona.Sexo            = personaBE.Sexo;

                wPersona.Street       = personaBE.Street;
                wPersona.StreetNumber = personaBE.StreetNumber;
                wPersona.Floor        = personaBE.Floor;
                wPersona.CountryId    = personaBE.CountryId;
                wPersona.ProvinceId   = personaBE.ProvinceId;
                wPersona.CityId       = personaBE.CityId;
                wPersona.Neighborhood = personaBE.Neighborhood;
                wPersona.mail         = personaBE.mail;
                wPersona.Telefono1    = personaBE.Telefono1;
                wPersona.Telefono2    = personaBE.Telefono2;
                wPersona.ZipCode      = personaBE.ZipCode;
                wPersona.Foto         = personaBE.Foto;

                wPersona.LastAccessTime   = System.DateTime.Now;
                wPersona.LastAccessUserId = personaBE.LastAccessUserId;
                wPersona.LastAccessTime   = wPersona.LastAccessTime;
                wPersona.LastAccessUserId = personaBE.LastAccessUserId;
                dc.SaveChanges();
            }
        }
Example #15
0
        public static void Update(PatientBE Patient)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Patient wPatient = dc.Patients.Where(p => p.PatientId.Equals(Patient.PatientId)).FirstOrDefault <Patient>();

                wPatient.Persona.Apellido        = Patient.Persona.Apellido;
                wPatient.Persona.Nombre          = Patient.Persona.Nombre;
                wPatient.Persona.NroDocumento    = Patient.Persona.NroDocumento;
                wPatient.Persona.TipoDocumento   = Patient.Persona.TipoDocumento;
                wPatient.Persona.IdEstadocivil   = Patient.Persona.IdEstadocivil;
                wPatient.Persona.FechaNacimiento = Patient.Persona.FechaNacimiento;
                wPatient.Persona.Sexo            = Patient.Persona.Sexo;

                wPatient.Persona.Calle       = Patient.Persona.Calle;
                wPatient.Persona.CalleNumero = Patient.Persona.CalleNumero;
                wPatient.Persona.Piso        = Patient.Persona.Piso;
                wPatient.Persona.IdPais      = Patient.Persona.IdPais;
                wPatient.Persona.IdProvincia = Patient.Persona.IdProvincia;
                wPatient.Persona.IdLocalidad = Patient.Persona.IdLocalidad;
                wPatient.Persona.Barrio      = Patient.Persona.Barrio;
                wPatient.Persona.mail        = Patient.Persona.mail;
                wPatient.Persona.Telefono1   = Patient.Persona.Telefono1;
                wPatient.Persona.Telefono2   = Patient.Persona.Telefono2;
                wPatient.Persona.Foto        = Patient.Persona.Foto;

                wPatient.LastAccessTime           = System.DateTime.Now;
                wPatient.LastAccessUserId         = Patient.LastAccessUserId;
                wPatient.Persona.LastAccessTime   = wPatient.LastAccessTime.Value;
                wPatient.Persona.LastAccessUserId = Patient.Persona.LastAccessUserId;
                dc.SaveChanges();
            }
        }
Example #16
0
        public static void UpdateMedicalEvent(MedicalEventBE medicalEvent, Guid createdUserId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                MedicalEvent medicalEvent_db = dc.MedicalEvents.Where(p => p.MedicalEventId.Equals(medicalEvent.MedicalEventId)).FirstOrDefault <MedicalEvent>();


                medicalEvent_db.MedicalEventId_Parent = medicalEvent.MedicalEventId_Parent;
                medicalEvent_db.ProfesionalId         = medicalEvent.ProfesionalId;

                medicalEvent_db.PatientId = medicalEvent.PatientId;

                medicalEvent_db.IdEspesialidad = medicalEvent.IdEspesialidad;
                medicalEvent_db.IdTipoConsulta = medicalEvent.IdTipoConsulta;

                medicalEvent_db.Motivo = medicalEvent.Motivo;

                medicalEvent_db.Evolucion = medicalEvent.Evolucion;


                medicalEvent_db.MetodoComplementario = medicalEvent.MetodoComplementario;
                medicalEvent_db.AppointmentId        = medicalEvent.AppointmentId;
                medicalEvent_db.HealthInstitutionId  = medicalEvent.HealthInstitutionId;
                //medicalEvent_db.CreatedDate = System.DateTime.Now;
                //medicalEvent_db.CreatedUserId = createdUserId;
                dc.SaveChanges();
            }
        }
Example #17
0
        public static void UpdatePatientAllergy(PatientAllergyBE patientAllergyBE, Guid lastAccessUserId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PatientAllergy patientAllergy_db = dc.PatientAllergies.Where(p => p.PatientId.Equals(patientAllergyBE.PatientId)).FirstOrDefault <PatientAllergy>();

                patientAllergy_db.AnimalAllergy      = patientAllergyBE.AnimalAllergy;
                patientAllergy_db.ChemicalAllergy    = patientAllergyBE.ChemicalAllergy;
                patientAllergy_db.FoodAllergy        = patientAllergyBE.FoodAllergy;
                patientAllergy_db.InsectAllergy      = patientAllergyBE.InsectAllergy;
                patientAllergy_db.MedicamentsAllergy = patientAllergyBE.MedicamentsAllergy;
                patientAllergy_db.MiteAllergy        = patientAllergyBE.MiteAllergy;
                patientAllergy_db.PollenAllergy      = patientAllergyBE.PollenAllergy;
                patientAllergy_db.SunAllergy         = patientAllergyBE.SunAllergy;

                patientAllergy_db.Observation  = patientAllergyBE.Observation;
                patientAllergy_db.OtherAllergy = patientAllergyBE.OtherAllergy;

                patientAllergy_db.GeneralDetails   = patientAllergyBE.GeneralDetails;
                patientAllergy_db.Enabled          = patientAllergyBE.Enabled;
                patientAllergy_db.LastAccessTime   = System.DateTime.Now;
                patientAllergy_db.LastAccessUserId = lastAccessUserId;
                dc.SaveChanges();
            }
        }
Example #18
0
        public static void Update_MutualPorPaciente(MutualPorPacienteList MutualPorPacienteList, int pPatientId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                MutualPorPaciente wMutual = null;

                foreach (MutualPorPacienteBE wMutualBE in MutualPorPacienteList)
                {
                    if (wMutualBE.EntityState == Fwk.Bases.EntityState.Added)
                    {
                        wMutual                   = new MutualPorPaciente();
                        wMutual.IdPaciente        = pPatientId;
                        wMutual.IdMutual          = wMutualBE.IdMutual;
                        wMutual.NroAfiliadoMutual = wMutualBE.NroAfiliadoMutual;
                        wMutual.IsActive          = true;
                        dc.MutualPorPacientes.AddObject(wMutual);
                    }

                    if (wMutualBE.EntityState == Fwk.Bases.EntityState.Changed)
                    {
                        wMutual = dc.MutualPorPacientes.Where(p => p.IdMutual.Equals(wMutualBE.IdMutual)).FirstOrDefault();
                        wMutual.NroAfiliadoMutual = wMutualBE.NroAfiliadoMutual;
                        wMutual.IsActive          = wMutualBE.IsActive;
                    }
                }
                dc.SaveChanges();
            }
        }
Example #19
0
        public static int CreateMedicalEvent(MedicalEventBE medicalEvent, Guid createdUserId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                MedicalEvent medicalEvent_db = new MedicalEvent();


                medicalEvent_db.MedicalEventId_Parent = medicalEvent.MedicalEventId_Parent;
                medicalEvent_db.ProfesionalId         = medicalEvent.ProfesionalId;

                medicalEvent_db.PatientId = medicalEvent.PatientId;

                medicalEvent_db.IdEspesialidad = medicalEvent.IdEspesialidad;
                medicalEvent_db.IdTipoConsulta = medicalEvent.IdTipoConsulta;

                medicalEvent_db.Motivo = medicalEvent.Motivo;

                medicalEvent_db.MetodoComplementario = medicalEvent.MetodoComplementario;
                medicalEvent_db.Evolucion            = medicalEvent.Evolucion;
                medicalEvent_db.AppointmentId        = medicalEvent.AppointmentId;

                medicalEvent_db.CreatedDate         = System.DateTime.Now;
                medicalEvent_db.CreatedUserId       = createdUserId;
                medicalEvent_db.HealthInstitutionId = medicalEvent.HealthInstitutionId;

                dc.MedicalEvents.AddObject(medicalEvent_db);
                dc.SaveChanges();
                return(medicalEvent_db.MedicalEventId);
            }
        }
Example #20
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="profesional"></param>
        public static void Update(ProfesionalBE profesional)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Health.Back.BE.Profesional wProfesional = dc.Profesionals.Where(p => p.IdProfesional.Equals(profesional.IdProfesional)).FirstOrDefault <Health.Back.BE.Profesional>();

                wProfesional.Persona.Apellido        = profesional.Persona.Apellido;
                wProfesional.Persona.Nombre          = profesional.Persona.Nombre;
                wProfesional.Persona.NroDocumento    = profesional.Persona.NroDocumento;
                wProfesional.Persona.TipoDocumento   = profesional.Persona.TipoDocumento;
                wProfesional.Persona.IdEstadocivil   = profesional.Persona.IdEstadocivil;
                wProfesional.Persona.FechaNacimiento = profesional.Persona.FechaNacimiento;
                wProfesional.Persona.Sexo            = profesional.Persona.Sexo;

                wProfesional.Persona.Street       = profesional.Persona.Street;
                wProfesional.Persona.StreetNumber = profesional.Persona.StreetNumber;
                wProfesional.Persona.Floor        = profesional.Persona.Floor;
                wProfesional.Persona.CountryId    = profesional.Persona.CountryId;
                wProfesional.Persona.ProvinceId   = profesional.Persona.ProvinceId;
                wProfesional.Persona.CityId       = profesional.Persona.CityId;
                wProfesional.Persona.Neighborhood = profesional.Persona.Neighborhood;
                wProfesional.Persona.mail         = profesional.Persona.mail;
                wProfesional.Persona.Telefono1    = profesional.Persona.Telefono1;
                wProfesional.Persona.Telefono2    = profesional.Persona.Telefono2;
                wProfesional.Persona.Foto         = profesional.Persona.Foto;
                wProfesional.Matricula            = profesional.Matricula;

                wProfesional.LastAccessTime           = System.DateTime.Now;
                wProfesional.LastAccessUserId         = profesional.LastAccessUserId;
                wProfesional.Persona.LastAccessTime   = wProfesional.LastAccessTime.Value;
                wProfesional.Persona.LastAccessUserId = profesional.LastAccessUserId.Value;
                dc.SaveChanges();
            }
        }
Example #21
0
        public static void CreatePatientAllergy(PatientAllergyBE patientAllergyBE, Guid lastAccessUserId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PatientAllergy patientAllergy_db = new PatientAllergy();
                patientAllergy_db.PatientId = patientAllergyBE.PatientId;

                patientAllergy_db.AnimalAllergy      = patientAllergyBE.AnimalAllergy;
                patientAllergy_db.ChemicalAllergy    = patientAllergyBE.ChemicalAllergy;
                patientAllergy_db.FoodAllergy        = patientAllergyBE.FoodAllergy;
                patientAllergy_db.InsectAllergy      = patientAllergyBE.InsectAllergy;
                patientAllergy_db.MedicamentsAllergy = patientAllergyBE.MedicamentsAllergy;
                patientAllergy_db.MiteAllergy        = patientAllergyBE.MiteAllergy;
                patientAllergy_db.PollenAllergy      = patientAllergyBE.PollenAllergy;
                patientAllergy_db.SunAllergy         = patientAllergyBE.SunAllergy;

                patientAllergy_db.Observation  = patientAllergyBE.Observation;
                patientAllergy_db.OtherAllergy = patientAllergyBE.OtherAllergy;


                patientAllergy_db.GeneralDetails   = patientAllergyBE.GeneralDetails;
                patientAllergy_db.MedicalEventId   = patientAllergyBE.MedicalEventId;
                patientAllergy_db.Enabled          = true;
                patientAllergy_db.LastAccessTime   = System.DateTime.Now;
                patientAllergy_db.LastAccessUserId = lastAccessUserId;

                dc.PatientAllergies.AddObject(patientAllergy_db);
                dc.SaveChanges();
            }
        }
Example #22
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="patientMedicament_View"></param>
        /// <param name="createdUserId"></param>
        public static void UpdatePatientMedicaments(PatientMedicament_ViewBE patientMedicament_View, Guid createdUserId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PatientMedicament patientMedicament_db = dc.PatientMedicaments.Where(p => p.PatientMedicamentId.Equals(patientMedicament_View.PatientMedicamentId)).FirstOrDefault <PatientMedicament>();

                if (patientMedicament_db == null)
                {
                    return;
                }

                patientMedicament_db.Status = patientMedicament_View.Status;

                patientMedicament_db.MedicalEventId = patientMedicament_View.MedicalEventId;
                patientMedicament_db.PatientId      = patientMedicament_View.PatientId;

                patientMedicament_db.PatientMedicamentId_Parent = patientMedicament_View.PatientMedicamentId_Parent;
                patientMedicament_db.MedicamentName             = patientMedicament_View.MedicamentName;
                patientMedicament_db.MedicamentPresentation     = patientMedicament_View.MedicamentPresentation;
                patientMedicament_db.Dosis             = patientMedicament_View.Dosis;
                patientMedicament_db.Periodicity_hours = patientMedicament_View.Periodicity_hours;
                patientMedicament_db.CreatedDate       = System.DateTime.Now;
                patientMedicament_db.CreatedUserId     = createdUserId;
                patientMedicament_db.Enabled           = patientMedicament_View.Enabled;
                patientMedicament_db.DaysCount         = patientMedicament_View.DaysCount;

                dc.SaveChanges();
            }
        }
Example #23
0
        public static void Create(Health.BE.PersonaBE personaBE)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Health.Back.BE.Persona persona = new Health.Back.BE.Persona();
                persona.UserId           = personaBE.UserId;
                persona.Apellido         = personaBE.Apellido;
                persona.Nombre           = personaBE.Nombre;
                persona.NroDocumento     = personaBE.NroDocumento;
                persona.TipoDocumento    = personaBE.TipoDocumento;
                persona.IdEstadocivil    = personaBE.IdEstadocivil;
                persona.FechaNacimiento  = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(personaBE.FechaNacimiento);
                persona.FechaAlta        = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(System.DateTime.Now);
                persona.LastAccessTime   = persona.FechaAlta;
                persona.LastAccessUserId = personaBE.LastAccessUserId;

                persona.Street       = personaBE.Street;
                persona.StreetNumber = personaBE.StreetNumber;
                persona.Floor        = personaBE.Floor;
                persona.CountryId    = personaBE.CountryId;
                persona.ProvinceId   = personaBE.ProvinceId;
                persona.CityId       = personaBE.CityId;
                persona.Neighborhood = personaBE.Neighborhood;
                persona.mail         = personaBE.mail;
                persona.Telefono1    = personaBE.Telefono1;
                persona.Telefono2    = personaBE.Telefono2;
                persona.ZipCode      = persona.ZipCode;
                persona.Foto         = personaBE.Foto;

                dc.Personas.AddObject(persona);
                dc.SaveChanges();
                personaBE.FechaAlta = persona.FechaAlta;
                personaBE.IdPersona = persona.IdPersona;
            }
        }
Example #24
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pResourceSchedulingList"></param>
        /// <param name="userId"></param>
        public static void Create(ResourceSchedulingList pResourceSchedulingList,Guid userId)
        {
            ResourceScheduling r = null;
            DateTime creationDate = System.DateTime.Now;
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                foreach (ResourceSchedulingBE rbe in pResourceSchedulingList)
                {
                    r = new ResourceScheduling();

                    r.CreationDate = creationDate;
                    r.CreationUserId = userId;
                    r.DateEnd = rbe.DateEnd;
                    r.DateStart = rbe.DateStart;
                    r.Description = rbe.Description;
                    r.Duration = rbe.Duration;
                    r.TimeEnd = rbe.TimeEnd;
                    r.TimeStart = rbe.TimeStart;
                    r.ResourceId = rbe.ResourceId;
                    r.WeekDays = rbe.WeekDays;
                    r.HealthInstitutionId = rbe.HealthInstitutionId;
                    dc.ResourceSchedulings.AddObject(r);
                }
                dc.SaveChanges();

            }
        }
Example #25
0
        public static void Update(ResourceSchedulingList resourceSchedulingList, Guid userId)
        {
            ResourceScheduling r_db       = null;
            DateTime           updateDate = System.DateTime.Now;

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                foreach (ResourceSchedulingBE rbe in resourceSchedulingList)
                {
                    r_db = dc.ResourceSchedulings.Where(p => p.IdSheduler.Equals(rbe.IdSheduler)).FirstOrDefault <ResourceScheduling>();

                    r_db.UpdatedDate  = updateDate;
                    r_db.UpdateUserId = userId;

                    r_db.DateEnd     = rbe.DateEnd;
                    r_db.DateStart   = rbe.DateStart;
                    r_db.Description = rbe.Description;
                    r_db.Duration    = rbe.Duration;
                    r_db.TimeEnd     = rbe.TimeEnd;
                    r_db.TimeStart   = rbe.TimeStart;

                    r_db.WeekDays = rbe.WeekDays;
                }
                dc.SaveChanges();
            }
        }
Example #26
0
 public static void RemoveAppointment(int appointmentId)
 {
     using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
     {
         var appointment_db = dc.Appointments.Where <Appointment>(p => p.AppointmentId.Equals(appointmentId)).FirstOrDefault();
         dc.Appointments.DeleteObject(appointment_db);
         dc.SaveChanges();
     }
 }
Example #27
0
        public static void Remove_MedicalEventDetail(int pMedicalEventDetailsId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                MedicalEventDetail medicalEventDetail_db = dc.MedicalEventDetails.Where(p => p.Id.Equals(pMedicalEventDetailsId)).FirstOrDefault <MedicalEventDetail>();

                dc.MedicalEventDetails.DeleteObject(medicalEventDetail_db);
                dc.SaveChanges();
            }
        }
Example #28
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pPatientMedicamentId"></param>
        public static void RemovePatientMedicaments(int pPatientMedicamentId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PatientMedicament patientMedicament_db = dc.PatientMedicaments.Where(p => p.PatientMedicamentId.Equals(pPatientMedicamentId)).FirstOrDefault <PatientMedicament>();

                dc.PatientMedicaments.DeleteObject(patientMedicament_db);
                dc.SaveChanges();
            }
        }
Example #29
0
 public static void Update_MedicalEventDetail(MedicalEventDetailBE medicalEventDetail, Guid guid)
 {
     using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
     {
         MedicalEventDetail medicalEventDetail_db = dc.MedicalEventDetails.Where(p => p.Id.Equals(medicalEventDetail.Id)).FirstOrDefault <MedicalEventDetail>();
         medicalEventDetail_db.Code           = medicalEventDetail.Code;
         medicalEventDetail_db.Description    = medicalEventDetail.Description;
         medicalEventDetail_db.MedicalEventId = medicalEventDetail.MedicalEventId;
         dc.SaveChanges();
     }
 }
Example #30
0
        public static void Create(MutualBE pMutualBE)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Mutual wMutual = new Mutual();
                wMutual.Nombre        = pMutualBE.Nombre;
                wMutual.ExigeCoseguro = pMutualBE.ExigeCoseguro;

                dc.Mutuals.AddObject(wMutual);
                dc.SaveChanges();
                wMutual.IdMutual = wMutual.IdMutual;
            }
        }
Example #31
0
        public static void Create(MutualBE pMutualBE)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Mutual wMutual = new Mutual();
                wMutual.Nombre = pMutualBE.Nombre;
                wMutual.ExigeCoseguro = pMutualBE.ExigeCoseguro;

                dc.Mutuals.AddObject(wMutual);
                dc.SaveChanges();
                wMutual.IdMutual = wMutual.IdMutual;
            }
        }
Example #32
0
        public static void DisablePatientMedicaments(int patientMedicamentId, Guid guid, MedicamentStatus status)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PatientMedicament patientMedicament_db = dc.PatientMedicaments.Where(p => p.PatientMedicamentId.Equals(patientMedicamentId)).FirstOrDefault <PatientMedicament>();

                if (patientMedicament_db != null)
                {
                    patientMedicament_db.Status  = (int)status;
                    patientMedicament_db.Enabled = false;
                }
                dc.SaveChanges();
            }
        }
        /// <summary>
        /// Bloquea un Profesional IsLockedOut = true
        /// </summary>
        /// <param name="pHealthInstitutionId"></param>
        /// <param name="pProfesionalId"></param>
        /// <param name="lockout">Si True : bloquea</param>
        public static void Profesional_Lock_Unlock(Guid pHealthInstitutionId, Int32 pProfesionalId, bool lockout)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                var wHealthInstitution_Profesional = dc.HealthInstitution_Profesional.Where(p =>
                                                                                            p.HealthInstitutionId.Equals(pHealthInstitutionId) &&
                                                                                            p.Profesional.IdProfesional.Equals(pProfesionalId)).FirstOrDefault();

                wHealthInstitution_Profesional.IsLockedOut = lockout;



                dc.SaveChanges();
            }
        }
Example #34
0
        public static void Update_Appointment_Status(int AppointmentId, AppoimantsStatus_SP status, Guid userId)
        {
            DateTime updateDate = System.DateTime.Now;

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                var appointment_db = dc.Appointments.Where <Appointment>(p => p.AppointmentId.Equals(AppointmentId)).FirstOrDefault();

                appointment_db.UpdatedDate  = updateDate;
                appointment_db.UpdateUserId = userId;
                appointment_db.Status       = (int)status;

                dc.SaveChanges();
            }
        }
Example #35
0
        public static void Create_PatientAllergy_History(PatientAllergyBE patientAllergyBE, Guid lastAccessUserId)
        {
            CreatePatientAllergy(patientAllergyBE, lastAccessUserId);

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PatientAllergy atientAllergy_new = dc.PatientAllergies.Where(p => p.PatientId.Equals(patientAllergyBE.PatientId)).FirstOrDefault <PatientAllergy>();

                atientAllergy_new.Enabled = false;

                atientAllergy_new.LastAccessTime   = System.DateTime.Now;
                atientAllergy_new.LastAccessUserId = lastAccessUserId;
                dc.SaveChanges();
            }
        }
Example #36
0
        public static void Update_FechaNAcimiento_PlanVacunacion(int idPatient, DateTime fechaActual, DateTime fechaNueva)
        {
            System.TimeSpan t = fechaNueva - fechaActual;

            using (Health.Back.BE.HealthEntities dc =
                       new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                var planList = dc.PlanVacunacions.Where(p => p.PatientId.Equals(idPatient));
                foreach (PlanVacunacion plan in planList)
                {
                    plan.FechaPlaneada = plan.FechaPlaneada + t;
                }
                dc.SaveChanges();
            }
        }
Example #37
0
        /// <summary>
        /// crea un Patient asociandolo a una persona existente
        /// </summary>
        /// <param name="PatientBE"></param>
        public static void Asociar(PatientBE PatientBE)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Patient p = new Patient();
                p.IdPersona        = PatientBE.Persona.IdPersona;
                p.FechaAlta        = System.DateTime.Now;
                p.LastAccessTime   = p.FechaAlta;
                p.LastAccessUserId = PatientBE.LastAccessUserId;

                dc.Patients.AddObject(p);
                dc.SaveChanges();
                PatientBE.PatientId = p.PatientId;
            }
        }
        /// <summary>
        /// Elimina rol a Institución
        /// Si es inst_owner o inst_admin establece .IsAdmin o.IsOwbner a falce respectivamente y posteriormente elimina el rol
        /// Si NO : l SOLO Elimina el rol
        /// </summary>
        /// <param name="pHealthInstitutionId"></param>
        /// <param name="userId"></param>
        /// <param name="rolName"></param>
        public static void Profesional_RemoveRol(Guid pHealthInstitutionId, Int32 pProfesionalId, Guid userId, string rolName)
        {
            Back.BE.HealthInstitution_Profesional wHealthInstitution_Profesional = null;
            Back.BE.HealtInstitute_UsersInRoles   wHealtInstitute_UsersInRoles   = null;
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                wHealthInstitution_Profesional = dc.HealthInstitution_Profesional.Where(p =>
                                                                                        p.HealthInstitutionId.Equals(pHealthInstitutionId) &&
                                                                                        p.Profesional.IdProfesional.Equals(pProfesionalId)).FirstOrDefault();

                //Si solo queda un unico rol el cual sera removido el usuario queda automaticamente en estado no vigente
                if (dc.HealtInstitute_UsersInRoles.Count(p => p.UserId.Equals(userId) && p.HealthInstitutionId.Equals(pHealthInstitutionId)) == 1)
                {
                    wHealthInstitution_Profesional.ActiveFlag = false;
                    wHealthInstitution_Profesional.IsOwner    = false;
                    wHealthInstitution_Profesional.IsAdmin    = false;
                }
                else
                {
                    if (rolName.Equals("inst_owner") || rolName.Equals("inst_admin"))
                    {
                        if (rolName.Equals("inst_owner"))
                        {
                            wHealthInstitution_Profesional.IsOwner = false;
                        }

                        if (rolName.Equals("inst_admin"))
                        {
                            wHealthInstitution_Profesional.IsAdmin = false;
                        }
                    }
                }

                //busca la entidad HealtInstitute_UsersInRoles
                wHealtInstitute_UsersInRoles = dc.HealtInstitute_UsersInRoles.Where(p =>
                                                                                    p.UserId.Equals(userId) &&
                                                                                    p.HealthInstitutionId.Equals(pHealthInstitutionId) &&
                                                                                    p.RoleName.Equals(rolName)).FirstOrDefault();

                //Elimina la entidad HealtInstitute_UsersInRoles
                if (wHealtInstitute_UsersInRoles != null)
                {
                    dc.HealtInstitute_UsersInRoles.DeleteObject(wHealtInstitute_UsersInRoles);
                }

                dc.SaveChanges();
            }
        }
Example #39
0
        public static void Create_MutualPorPaciente(MutualPorPacienteList pMutualesDelPatient, int pIdPatient)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {

                MutualPorPaciente wMutual =null;

                foreach (MutualPorPacienteBE wMutualBE in pMutualesDelPatient)
                {
                    wMutual = new MutualPorPaciente();
                    wMutual.IdPaciente = pIdPatient;
                    wMutual.IdMutual = wMutualBE.IdMutual;
                    wMutual.NroAfiliadoMutual = wMutualBE.NroAfiliadoMutual;

                    dc.MutualPorPacientes.AddObject(wMutual);
                 
                 
                }
                dc.SaveChanges();
            }
        }
        /// <summary>
        /// Crea una Institución
        /// Establece como profesional owner de  pHealthInstitution a pProfesionalId/pUserId
        /// </summary>
        /// <param name="pHealthInstitution">Institución</param>
        /// <param name="pProfesionalId">Profesional</param>
        /// <param name="pUserId"></param>
        public static void Create_From_Owner(Health.Back.BE.HealthInstitution pHealthInstitution, Int32 pProfesionalId, Guid pUserId)
        {
            Back.BE.HealthInstitution_Profesional wHealthInstitution_Profesional = new Back.BE.HealthInstitution_Profesional();
            Back.BE.HealtInstitute_UsersInRoles wHealtInstitute_UsersInRoles = new BE.HealtInstitute_UsersInRoles();

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                //Busco la institución padre si existe
                var parentHI = dc.HealthInstitutions.Where(p => !p.HealthInstitutionIdParent.HasValue
                    && p.HealthInstitution_Profesional.Any(prof => prof.ProfesionalId.Equals(pProfesionalId))).FirstOrDefault();
                if (parentHI != null)
                    pHealthInstitution.HealthInstitutionIdParent = parentHI.HealthInstitutionId;

                pHealthInstitution.HealthInstitutionId = Guid.NewGuid();
                pHealthInstitution.CreatedDate = System.DateTime.Now;
                dc.HealthInstitutions.AddObject(pHealthInstitution);

                wHealthInstitution_Profesional.HealthInstitutionId = pHealthInstitution.HealthInstitutionId;
                wHealthInstitution_Profesional.ProfesionalId = pProfesionalId;
                wHealthInstitution_Profesional.ActiveFlag = true;
                wHealthInstitution_Profesional.UserId = pUserId;
                wHealthInstitution_Profesional.IsLockedOut = false;
                wHealthInstitution_Profesional.IsOwner = true;
                dc.HealthInstitution_Profesional.AddObject(wHealthInstitution_Profesional);


                wHealtInstitute_UsersInRoles.UserId = pUserId;
                wHealtInstitute_UsersInRoles.HealthInstitutionId = pHealthInstitution.HealthInstitutionId;
                wHealtInstitute_UsersInRoles.RoleName = "inst_owner";

                dc.HealtInstitute_UsersInRoles.AddObject(wHealtInstitute_UsersInRoles);

                dc.SaveChanges();

            }


        }
Example #41
0
 public static void UpdatePlanVacunacion(PlanVacunacion_FullViewList planVacunacion_FullViewList, Guid lastAccessUserId)
 {
     using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
     {
         foreach (PlanVacunacion_FullViewBE pv in planVacunacion_FullViewList)
         {
             PlanVacunacion plan = dc.PlanVacunacions.Where(p => p.PatientId.Equals(pv.PatientId) && p.Codigo.Equals(pv.Codigo)).FirstOrDefault<PlanVacunacion>();
             plan.FechaColocacion = pv.FechaColocacion;
             plan.FechaPlaneada = pv.FechaPlaneada;
             plan.NombreProfesionalQueColoco = pv.NombreProfesionalQueColoco;
             plan.Lote = pv.Lote;
             plan.CodigoVacunaSustituta = pv.CodigoVacunaSustituta;
             plan.FechaPlaneada_Alterada = pv.FechaPlaneada_Alterada;
         }
         dc.SaveChanges();
     }
 }
Example #42
0
        public static void Update(PatientBE Patient)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Patient wPatient = dc.Patients.Where(p => p.PatientId.Equals(Patient.PatientId)).FirstOrDefault<Patient>();

                wPatient.Persona.Apellido = Patient.Persona.Apellido;
                wPatient.Persona.Nombre = Patient.Persona.Nombre;
                wPatient.Persona.NroDocumento = Patient.Persona.NroDocumento;
                wPatient.Persona.TipoDocumento = Patient.Persona.TipoDocumento;
                wPatient.Persona.IdEstadocivil = Patient.Persona.IdEstadocivil;
                wPatient.Persona.FechaNacimiento = Patient.Persona.FechaNacimiento;
                wPatient.Persona.Sexo = Patient.Persona.Sexo;

                wPatient.Persona.Street = Patient.Persona.Street;
                wPatient.Persona.StreetNumber = Patient.Persona.StreetNumber;
                wPatient.Persona.Floor = Patient.Persona.Floor;
                wPatient.Persona.CountryId = Patient.Persona.CountryId;
                wPatient.Persona.ProvinceId = Patient.Persona.ProvinceId;
                wPatient.Persona.CityId = Patient.Persona.CityId;
                wPatient.Persona.Neighborhood = Patient.Persona.Neighborhood;
                wPatient.Persona.mail = Patient.Persona.mail;
                wPatient.Persona.Telefono1 = Patient.Persona.Telefono1;
                wPatient.Persona.Telefono2 = Patient.Persona.Telefono2;
                wPatient.Persona.Foto = Patient.Persona.Foto;

                wPatient.LastAccessTime = System.DateTime.Now;
                wPatient.LastAccessUserId = Patient.LastAccessUserId;
                wPatient.Persona.LastAccessTime = wPatient.LastAccessTime.Value;
                wPatient.Persona.LastAccessUserId = Patient.Persona.LastAccessUserId;
                dc.SaveChanges();
            }
        }
Example #43
0
        public static void Update_FechaNAcimiento_PlanVacunacion(int idPatient, DateTime fechaActual, DateTime fechaNueva)
        {
            System.TimeSpan t = fechaNueva - fechaActual;

            using (Health.Back.BE.HealthEntities dc =
                new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                var planList = dc.PlanVacunacions.Where(p => p.PatientId.Equals(idPatient));
                foreach (PlanVacunacion plan in planList)
                {
                    plan.FechaPlaneada = plan.FechaPlaneada + t;
                }
                dc.SaveChanges();
            }
        }
Example #44
0
        public static void DisablePatientMedicaments(int patientMedicamentId, Guid guid,MedicamentStatus status)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PatientMedicament patientMedicament_db = dc.PatientMedicaments.Where(p => p.PatientMedicamentId.Equals(patientMedicamentId)).FirstOrDefault<PatientMedicament>();

                if (patientMedicament_db != null)
                {
                    patientMedicament_db.Status = (int)status;
                    patientMedicament_db.Enabled = false;
                }
                dc.SaveChanges();
            }
        }
Example #45
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pPatientMedicamentId"></param>
        public static void RemovePatientMedicaments(int pPatientMedicamentId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PatientMedicament patientMedicament_db = dc.PatientMedicaments.Where(p => p.PatientMedicamentId.Equals(pPatientMedicamentId)).FirstOrDefault<PatientMedicament>();

                dc.PatientMedicaments.DeleteObject(patientMedicament_db);
                dc.SaveChanges();
            }
        }
Example #46
0
        public static void CreatePatientAllergy(PatientAllergyBE patientAllergyBE, Guid lastAccessUserId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PatientAllergy patientAllergy_db = new PatientAllergy();
                patientAllergy_db.PatientId = patientAllergyBE.PatientId;

                patientAllergy_db.AnimalAllergy = patientAllergyBE.AnimalAllergy;
                patientAllergy_db.ChemicalAllergy = patientAllergyBE.ChemicalAllergy;
                patientAllergy_db.FoodAllergy = patientAllergyBE.FoodAllergy;
                patientAllergy_db.InsectAllergy = patientAllergyBE.InsectAllergy;
                patientAllergy_db.MedicamentsAllergy = patientAllergyBE.MedicamentsAllergy;
                patientAllergy_db.MiteAllergy = patientAllergyBE.MiteAllergy;
                patientAllergy_db.PollenAllergy = patientAllergyBE.PollenAllergy;
                patientAllergy_db.SunAllergy = patientAllergyBE.SunAllergy;

                patientAllergy_db.Observation = patientAllergyBE.Observation;
                patientAllergy_db.OtherAllergy = patientAllergyBE.OtherAllergy;


                patientAllergy_db.GeneralDetails = patientAllergyBE.GeneralDetails;
                patientAllergy_db.MedicalEventId = patientAllergyBE.MedicalEventId;
                patientAllergy_db.Enabled = true;
                patientAllergy_db.LastAccessTime = System.DateTime.Now;
                patientAllergy_db.LastAccessUserId = lastAccessUserId;

                dc.PatientAllergies.AddObject(patientAllergy_db);
                dc.SaveChanges();
            }
        }
Example #47
0
        /// <summary>
        /// Asocia un profesional a una persona existente
        /// </summary>
        /// <param name="profesionalBE"></param>
        public static void Asociar(ProfesionalBE profesionalBE)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Health.Back.BE.Profesional profesional = new Health.Back.BE.Profesional();
                profesional.IdPersona = profesionalBE.IdPersona;

                profesional.FechaAlta = System.DateTime.Now;
                profesional.Matricula = profesionalBE.Matricula;
                profesional.IdEspecialidad = profesionalBE.IdEspecialidad;
                profesional.LastAccessTime = profesional.FechaAlta;
                profesional.LastAccessUserId = profesionalBE.LastAccessUserId;

                dc.Profesionals.AddObject(profesional);
                dc.SaveChanges();
            }
        }
Example #48
0
        /// <summary>
        /// Crea un profesional y clase persona
        /// </summary>
        /// <param name="profesionalBE"></param>
        public static void Create(ProfesionalBE profesionalBE)
        {
            PersonasDAC.Create(profesionalBE.Persona);
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Health.Back.BE.Profesional p = new Health.Back.BE.Profesional();

                p.IdPersona = profesionalBE.Persona.IdPersona;

                p.FechaAlta = profesionalBE.Persona.FechaAlta;
                p.Matricula = profesionalBE.Matricula;
                p.IdEspecialidad = profesionalBE.IdEspecialidad;
                p.IdProfesion = profesionalBE.IdProfesion;
                p.LastAccessTime = p.FechaAlta;
                p.LastAccessUserId = profesionalBE.LastAccessUserId;

                dc.Profesionals.AddObject(p);
                dc.SaveChanges();

                profesionalBE.IdProfesional = p.IdProfesional;
                profesionalBE.IdPersona = p.IdPersona;
            }
        }
Example #49
0
        public static void Update_MutualPorPaciente(MutualPorPacienteList MutualPorPacienteList, int pPatientId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {

                MutualPorPaciente wMutual = null;

                foreach (MutualPorPacienteBE wMutualBE in MutualPorPacienteList)
                {
                    if (wMutualBE.EntityState == Fwk.Bases.EntityState.Added)
                    {
                        wMutual = new MutualPorPaciente();
                        wMutual.IdPaciente = pPatientId;
                        wMutual.IdMutual = wMutualBE.IdMutual;
                        wMutual.NroAfiliadoMutual = wMutualBE.NroAfiliadoMutual;
                        wMutual.IsActive = true;
                        dc.MutualPorPacientes.AddObject(wMutual);
                    }

                    if (wMutualBE.EntityState == Fwk.Bases.EntityState.Changed)
                    {
                        wMutual = dc.MutualPorPacientes.Where(p => p.IdMutual.Equals(wMutualBE.IdMutual)).FirstOrDefault();
                        wMutual.NroAfiliadoMutual = wMutualBE.NroAfiliadoMutual;
                        wMutual.IsActive = wMutualBE.IsActive;
                    }
                }
                dc.SaveChanges();
            }
        }
        /// <summary>
        /// Bloquea un Profesional IsLockedOut = true
        /// </summary>
        /// <param name="pHealthInstitutionId"></param>
        /// <param name="pProfesionalId"></param>
        /// <param name="lockout">Si True : bloquea</param>
        public static void Profesional_Lock_Unlock(Guid pHealthInstitutionId, Int32 pProfesionalId, bool lockout)
        {

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {

                var wHealthInstitution_Profesional = dc.HealthInstitution_Profesional.Where(p =>
                                   p.HealthInstitutionId.Equals(pHealthInstitutionId) &&
                                   p.Profesional.IdProfesional.Equals(pProfesionalId)).FirstOrDefault();

                wHealthInstitution_Profesional.IsLockedOut = lockout;



                dc.SaveChanges();
            }
        }
        /// <summary>
        /// Establece a un Profesiona ActiveFlag = true  y elimina toda relacion con roles
        /// </summary>
        /// <param name="pHealthInstitutionId"></param>
        /// <param name="pProfesionalId"></param>
        public static void Profesional_Remove(Guid pHealthInstitutionId, Int32 pProfesionalId)
        {

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {

                var wHealthInstitution_Profesional = dc.HealthInstitution_Profesional.Where(p =>
                                    p.HealthInstitutionId.Equals(pHealthInstitutionId) &&
                                    p.Profesional.IdProfesional.Equals(pProfesionalId)).FirstOrDefault();

                wHealthInstitution_Profesional.ActiveFlag = false;

                var roles = dc.HealtInstitute_UsersInRoles.Where(p => p.UserId.Equals(wHealthInstitution_Profesional.UserId) && p.HealthInstitutionId.Equals(pHealthInstitutionId)).FirstOrDefault();
                dc.HealtInstitute_UsersInRoles.DeleteObject(roles);


                dc.SaveChanges();
            }
        }
Example #52
0
        public static void Create_PatientAllergy_History(PatientAllergyBE patientAllergyBE, Guid lastAccessUserId)
        {
            CreatePatientAllergy(patientAllergyBE, lastAccessUserId);

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PatientAllergy atientAllergy_new = dc.PatientAllergies.Where(p => p.PatientId.Equals(patientAllergyBE.PatientId)).FirstOrDefault<PatientAllergy>();
                
                atientAllergy_new.Enabled = false;

                atientAllergy_new.LastAccessTime = System.DateTime.Now;
                atientAllergy_new.LastAccessUserId = lastAccessUserId;
                dc.SaveChanges();
            }
        }
Example #53
0
        public static void UpdatePatientAllergy(PatientAllergyBE patientAllergyBE, Guid lastAccessUserId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PatientAllergy patientAllergy_db = dc.PatientAllergies.Where(p => p.PatientId.Equals(patientAllergyBE.PatientId)).FirstOrDefault<PatientAllergy>();

                patientAllergy_db.AnimalAllergy = patientAllergyBE.AnimalAllergy;
                patientAllergy_db.ChemicalAllergy = patientAllergyBE.ChemicalAllergy;
                patientAllergy_db.FoodAllergy = patientAllergyBE.FoodAllergy;
                patientAllergy_db.InsectAllergy = patientAllergyBE.InsectAllergy;
                patientAllergy_db.MedicamentsAllergy = patientAllergyBE.MedicamentsAllergy;
                patientAllergy_db.MiteAllergy = patientAllergyBE.MiteAllergy;
                patientAllergy_db.PollenAllergy = patientAllergyBE.PollenAllergy;
                patientAllergy_db.SunAllergy = patientAllergyBE.SunAllergy;

                patientAllergy_db.Observation = patientAllergyBE.Observation;
                patientAllergy_db.OtherAllergy = patientAllergyBE.OtherAllergy;

                patientAllergy_db.GeneralDetails = patientAllergyBE.GeneralDetails;
                patientAllergy_db.Enabled = patientAllergyBE.Enabled;
                patientAllergy_db.LastAccessTime = System.DateTime.Now;
                patientAllergy_db.LastAccessUserId = lastAccessUserId;
                dc.SaveChanges();
            }
        }
Example #54
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="profesional"></param>
        public static void Update(ProfesionalBE profesional)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Health.Back.BE.Profesional wProfesional = dc.Profesionals.Where(p => p.IdProfesional.Equals(profesional.IdProfesional)).FirstOrDefault<Health.Back.BE.Profesional>();

                wProfesional.Persona.Apellido = profesional.Persona.Apellido;
                wProfesional.Persona.Nombre = profesional.Persona.Nombre;
                wProfesional.Persona.NroDocumento = profesional.Persona.NroDocumento;
                wProfesional.Persona.TipoDocumento = profesional.Persona.TipoDocumento;
                wProfesional.Persona.IdEstadocivil = profesional.Persona.IdEstadocivil;
                wProfesional.Persona.FechaNacimiento = profesional.Persona.FechaNacimiento;
                wProfesional.Persona.Sexo = profesional.Persona.Sexo;

                wProfesional.Persona.Street = profesional.Persona.Street;
                wProfesional.Persona.StreetNumber = profesional.Persona.StreetNumber;
                wProfesional.Persona.Floor = profesional.Persona.Floor;
                wProfesional.Persona.CountryId = profesional.Persona.CountryId;
                wProfesional.Persona.ProvinceId = profesional.Persona.ProvinceId;
                wProfesional.Persona.CityId = profesional.Persona.CityId;
                wProfesional.Persona.Neighborhood = profesional.Persona.Neighborhood;
                wProfesional.Persona.mail = profesional.Persona.mail;
                wProfesional.Persona.Telefono1 = profesional.Persona.Telefono1;
                wProfesional.Persona.Telefono2 = profesional.Persona.Telefono2;
                wProfesional.Persona.Foto = profesional.Persona.Foto;
                wProfesional.Matricula = profesional.Matricula;

                wProfesional.LastAccessTime = System.DateTime.Now;
                wProfesional.LastAccessUserId = profesional.LastAccessUserId;
                wProfesional.Persona.LastAccessTime = wProfesional.LastAccessTime.Value;
                wProfesional.Persona.LastAccessUserId = profesional.LastAccessUserId.Value;
                dc.SaveChanges();
            }
        }
Example #55
0
        public static void AddPatientMedicaments(PatientMedicament_ViewBE patientMedicament_View, Guid createdUserId)
        {
            
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {

                PatientMedicament patientMedicament_db = new PatientMedicament();

                patientMedicament_db.Status = patientMedicament_View.Status;
                
                patientMedicament_db.MedicalEventId = patientMedicament_View.MedicalEventId;
                patientMedicament_db.PatientId = patientMedicament_View.PatientId;
                if(patientMedicament_View.PatientMedicamentId_Parent >=0)
                    patientMedicament_db.PatientMedicamentId_Parent = patientMedicament_View.PatientMedicamentId_Parent;

                patientMedicament_db.MedicamentName = patientMedicament_View.MedicamentName;
                patientMedicament_db.MedicamentPresentation = patientMedicament_View.MedicamentPresentation;
                patientMedicament_db.Dosis = patientMedicament_View.Dosis;
                patientMedicament_db.Periodicity_hours = patientMedicament_View.Periodicity_hours;
                patientMedicament_db.CreatedDate = System.DateTime.Now;
                patientMedicament_db.CreatedUserId = createdUserId;
                patientMedicament_db.DaysCount = patientMedicament_View.DaysCount;
                patientMedicament_db.Enabled = true;
                dc.PatientMedicaments.AddObject(patientMedicament_db);
                dc.SaveChanges();
            }
            
        }
Example #56
0
        static void Create_PlanVacunacion(PatientBE PatientBE)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PlanVacunacion plan;

                foreach (Vacuna v in dc.Vacunas.ToArray())
                {
                    //{"The INSERT statement conflicted with the FOREIGN KEY constraint \"FK_PlanVacunación_Vacunas\". 
                    //The conflict occurred in database \"Health\", table \"dbo.Vacunas\", column 'IdVacuna'.
                    plan = new PlanVacunacion();
                    plan.PatientId = PatientBE.PatientId;
                    plan.Codigo = v.Codigo;
                    plan.FechaPlaneada = PatientBE.Persona.FechaNacimiento.AddDays(Convert.ToInt16(v.Cantidad));
                    //plan.ProfesionalColocadorUserID = PatientBE.LastAccessUserId;
                    dc.PlanVacunacions.AddObject(plan);
                }
                dc.SaveChanges();
            }
        }
Example #57
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="patientMedicament_View"></param>
        /// <param name="createdUserId"></param>
        public static void UpdatePatientMedicaments(PatientMedicament_ViewBE patientMedicament_View, Guid createdUserId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PatientMedicament patientMedicament_db = dc.PatientMedicaments.Where(p => p.PatientMedicamentId.Equals(patientMedicament_View.PatientMedicamentId)).FirstOrDefault<PatientMedicament>();

                if (patientMedicament_db == null) return;

                patientMedicament_db.Status = patientMedicament_View.Status;
                
                patientMedicament_db.MedicalEventId = patientMedicament_View.MedicalEventId;
                patientMedicament_db.PatientId = patientMedicament_View.PatientId;

                patientMedicament_db.PatientMedicamentId_Parent = patientMedicament_View.PatientMedicamentId_Parent;
                patientMedicament_db.MedicamentName = patientMedicament_View.MedicamentName;
                patientMedicament_db.MedicamentPresentation = patientMedicament_View.MedicamentPresentation;
                patientMedicament_db.Dosis = patientMedicament_View.Dosis;
                patientMedicament_db.Periodicity_hours = patientMedicament_View.Periodicity_hours;
                patientMedicament_db.CreatedDate = System.DateTime.Now;
                patientMedicament_db.CreatedUserId = createdUserId;
                patientMedicament_db.Enabled = patientMedicament_View.Enabled;
                patientMedicament_db.DaysCount = patientMedicament_View.DaysCount;

                dc.SaveChanges();
            }
        }
Example #58
0
        static void Update_PlanVacunacion(PlanVacunacion_FullViewList planList)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PlanVacunacion plan;
                foreach (PlanVacunacion_FullViewBE planVacunacionBE in planList)
                {
                    plan = dc.PlanVacunacions.Where(p => p.PatientId.Equals(planVacunacionBE.PatientId) && p.Codigo.Equals(planVacunacionBE.Codigo)).FirstOrDefault<PlanVacunacion>();

                    //plan.FechaPlaneada = planVacunacionBE.FechaPlaneada;
                    plan.FechaColocacion = planVacunacionBE.FechaColocacion;
                    plan.ProfesionalColocadorUserID = planVacunacionBE.ProfesionalColocadorUserID;
                    plan.NombreProfesionalQueColoco = planVacunacionBE.NombreProfesionalQueColoco;
                    plan.Lote = planVacunacionBE.NombreProfesionalQueColoco;
                    plan.FechaPlaneada_Alterada = planVacunacionBE.FechaPlaneada_Alterada;

                }
                dc.SaveChanges();
            }
        }
Example #59
0
        /// <summary>
        /// Crea Patient y persona
        /// </summary>
        /// <param name="PatientBE"></param>
        public static void Create(PatientBE PatientBE)
        {

            PersonasDAC.Create(PatientBE.Persona);

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {

                Patient p = new Patient();
                p.IdPersona = PatientBE.Persona.IdPersona;
                p.FechaAlta = PatientBE.Persona.FechaAlta;
                p.LastAccessTime = p.FechaAlta;
                p.LastAccessUserId = PatientBE.LastAccessUserId;

                dc.Patients.AddObject(p);
                dc.SaveChanges();
                PatientBE.PatientId = p.PatientId;
                PatientBE.IdPersona = p.IdPersona;
            }
            Create_PlanVacunacion(PatientBE);
        }
        /// <summary>
        /// Elimina rol a Institución
        /// Si es inst_owner o inst_admin establece .IsAdmin o.IsOwbner a falce respectivamente y posteriormente elimina el rol
        /// Si NO : l SOLO Elimina el rol
        /// </summary>
        /// <param name="pHealthInstitutionId"></param>
        /// <param name="userId"></param>
        /// <param name="rolName"></param>
        public static void Profesional_RemoveRol(Guid pHealthInstitutionId, Int32 pProfesionalId, Guid userId, string rolName)
        {
            Back.BE.HealthInstitution_Profesional wHealthInstitution_Profesional = null;
            Back.BE.HealtInstitute_UsersInRoles wHealtInstitute_UsersInRoles = null;
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {

                wHealthInstitution_Profesional = dc.HealthInstitution_Profesional.Where(p =>
                                                  p.HealthInstitutionId.Equals(pHealthInstitutionId) &&
                                                  p.Profesional.IdProfesional.Equals(pProfesionalId)).FirstOrDefault();

                //Si solo queda un unico rol el cual sera removido el usuario queda automaticamente en estado no vigente
                if (dc.HealtInstitute_UsersInRoles.Count(p => p.UserId.Equals(userId) && p.HealthInstitutionId.Equals(pHealthInstitutionId)) == 1)
                {
                    wHealthInstitution_Profesional.ActiveFlag = false;
                    wHealthInstitution_Profesional.IsOwner = false;
                    wHealthInstitution_Profesional.IsAdmin = false;
                }
                else
                {
                    if (rolName.Equals("inst_owner") || rolName.Equals("inst_admin"))
                    {
                        if (rolName.Equals("inst_owner"))
                            wHealthInstitution_Profesional.IsOwner = false;

                        if (rolName.Equals("inst_admin"))
                            wHealthInstitution_Profesional.IsAdmin = false;
                    }
                }

                //busca la entidad HealtInstitute_UsersInRoles
                wHealtInstitute_UsersInRoles = dc.HealtInstitute_UsersInRoles.Where(p =>
                      p.UserId.Equals(userId) &&
                      p.HealthInstitutionId.Equals(pHealthInstitutionId) &&
                      p.RoleName.Equals(rolName)).FirstOrDefault();

                //Elimina la entidad HealtInstitute_UsersInRoles
                if (wHealtInstitute_UsersInRoles != null)
                    dc.HealtInstitute_UsersInRoles.DeleteObject(wHealtInstitute_UsersInRoles);

                dc.SaveChanges();
            }
        }