protected override bool Grabar_Registro() { try { BindingList<CMatrix_group> lstGrid = gcGroupMatrix.DataSource as BindingList<CMatrix_group>; //eliminar todo List<CMatrix_group> lstMg = new CMatrix_groupFactory().GetAll(); foreach (CMatrix_group item in lstMg) { item.Status = false; new CMatrix_groupFactory().Update(item); } //grabar desde el grid foreach (CMatrix_group item in lstGrid) { item.Status = true; if (!new CMatrix_groupFactory().Update(item)) new CMatrix_groupFactory().Insert(item); } return true; } catch (Exception ex) { MessageBox.Show("Error al guardar: " + ex.Message); return false; } }
protected override bool Grabar_Registro() { try { BindingList <CMatrix_group> lstGrid = gcGroupMatrix.DataSource as BindingList <CMatrix_group>; //eliminar todo List <CMatrix_group> lstMg = new CMatrix_groupFactory().GetAll(); foreach (CMatrix_group item in lstMg) { item.Status = false; new CMatrix_groupFactory().Update(item); } //grabar desde el grid foreach (CMatrix_group item in lstGrid) { item.Status = true; if (!new CMatrix_groupFactory().Update(item)) { new CMatrix_groupFactory().Insert(item); } } return(true); } catch (Exception ex) { MessageBox.Show("Error al guardar: " + ex.Message); return(false); } }