public bool DeleteLinkGroup(int systemId, string companyId, string groupId) { try { var expression = ExtLinq.True <Ld_Extend_LinkGroup>(); expression = expression.And(m => m.SystemID == systemId && m.CompanyID == companyId && m.GroupID == groupId); if (!IsExists(expression)) { throw new Exception("分组ID无效!"); } var expressionLink = ExtLinq.True <Ld_Extend_Link>(); expressionLink = expressionLink.And(m => m.SystemID == systemId && m.CompanyID == companyId && m.GroupID == groupId); var dbContext = new DAL.BaseDAL(LdCmsDbEntitiesContext); var isUse = dbContext.IsExists(expressionLink); if (isUse) { throw new Exception("分组ID已被使用,不能操作删除!"); } return(Delete(expression)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public bool DeleteNoticeCategory(int systemId, string companyId, string categoryId) { try { var expression = ExtLinq.True <Ld_Info_NoticeCategory>(); expression = expression.And(m => m.SystemID == systemId && m.CompanyID == companyId && m.CategoryID == categoryId); if (!IsExists(expression)) { throw new Exception("类别ID无效!"); } var expressionNotice = ExtLinq.True <Ld_Info_Notice>(); expressionNotice = expressionNotice.And(m => m.SystemID == systemId && m.CompanyID == companyId && m.ClassID == categoryId); var dbContext = new DAL.BaseDAL(LdCmsDbEntitiesContext); var isUse = dbContext.IsExists(expressionNotice); if (isUse) { throw new Exception("类别ID已被使用,不能操作删除!"); } return(Delete(expression)); } catch (Exception ex) { throw new Exception(ex.Message); } }