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 gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { if (e.Column == colNroAfiliadoMutual || e.Column == colIsActive) { MutualPorPacienteBE wMutualPorPacienteBE = ((MutualPorPacienteBE)gridView1.GetRow(gridView1.FocusedRowHandle)); //Si es recientemente agregada no modificar el estado if (wMutualPorPacienteBE.EntityState == Fwk.Bases.EntityState.Added) { return; } wMutualPorPacienteBE.EntityState = Fwk.Bases.EntityState.Changed; } }
/// <summary> /// Mutual /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { 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(); }
private void gridView1_MouseDown(object sender, MouseEventArgs e) { _HitInfo1 = gridView1.CalcHitInfo(new Point(e.X, e.Y)); selectedMutualPorPacienteBE = ((MutualPorPacienteBE)gridView1.GetRow(_HitInfo1.RowHandle)); }
/// <summary> /// Mutual /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { 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(); }