void CheckMutualChanges() { foreach (MutualPorPacienteBE aux in this.MutualListAux) { MutualPorPacienteBE mutual = MutualList.Where(p => p.IdMutual.Equals(aux.IdMutual)).FirstOrDefault <MutualPorPacienteBE>(); if (mutual != null) { //Si cambio halgo if (mutual.IsActive != aux.IsActive || mutual.NroAfiliadoMutual != aux.NroAfiliadoMutual) { mutual.EntityState = Fwk.Bases.EntityState.Changed; mutual.IsActive = aux.IsActive; mutual.NroAfiliadoMutual = aux.NroAfiliadoMutual; } } else { if (aux.IsActive) { aux.EntityState = Fwk.Bases.EntityState.Added; MutualList.Add(aux); } } } //Elimino de la lista las mutuales no modificadas MutualList.RemoveAll(p => p.EntityState.Equals(Fwk.Bases.EntityState.Unchanged)); }
private void gridView2_DoubleClick(object sender, EventArgs e) { if (selectedMutual == null) { return; } if (MutualListAux.Exists(p => p.IdMutual.Equals(selectedMutual.IdMutual))) { return; } MutualPorPacienteBE mutual = new MutualPorPacienteBE(); mutual.EntityState = Fwk.Bases.EntityState.Added; mutual.IdMutual = selectedMutual.IdMutual; mutual.IsActive = true; mutual.NombreMutual = selectedMutual.Nombre; MutualListAux.Add(mutual); gridControl_MutualXPatient.RefreshDataSource(); }