public override void Delete(BaseEntity entity) { Person u = entity as Person; GroupUserDB gudb = new GroupUserDB(); GroupUserList gul = new GroupUserList(); gul = gudb.SelectByPerson(u); foreach (GroupUser g in gul) { gudb.Delete(g); } CommentsDB cdb = new CommentsDB(); CommentsList lc = cdb.CommentsByPerson(u); foreach (Comments c in lc) { cdb.Delete(c); } MsgsDB mdb = new MsgsDB(); MsgsList ml = new MsgsList(); ml = mdb.MsgsBySender(u); foreach (Msgs m in ml) { mdb.Delete(m); } base.Delete(entity); }
public static GroupUser SelectByID(int id) { if (lgroupu == null) { GroupUserDB db = new GroupUserDB(); lgroupu = db.SelectAll(); } GroupUser groupu = lgroupu.Find(c => c.ID == id); return(groupu); }