Example #1
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 #2
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();
            }
        }