private object[] UpdateMaster(ETablaGen entity) { IDOUpdate objDO = new MGDOMnt.TablaGen(); if(entity.EntityState == EntityState.Unchanged) return null; object[] objRet = null; switch(entity.EntityState) { case EntityState.Added: objRet = objDO.Insert(entity); break; case EntityState.Modified: if(entity.StAnulado == ConstFlagEstado.DESACTIVADO) objDO.Update(entity); else objDO.Delete(entity); break; case EntityState.Deleted: objDO.Delete(entity); break; } return objRet; }
private void DeleteDetail(IList<ETablaGen> col, bool filterModified) { if(col == null) return; IDOUpdate objDO = new MGDOMnt.TablaGen(); IEnumerable<ETablaGen> colSel = null; if(filterModified) { var deleteItems = from itm in col where itm.EntityState == EntityState.Deleted select itm; colSel = (IEnumerable<ETablaGen>) deleteItems; } else { var deleteItems = from itm in col select itm; colSel = (IEnumerable<ETablaGen>) deleteItems; } foreach(ETablaGen objE in colSel) objDO.Delete(objE); }
private void DeleteMaster(ETablaGen entity) { IDOUpdate objDO = new MGDOMnt.TablaGen(); if(entity.EntityState == EntityState.Unchanged) return; objDO.Delete(entity); }