void ReleaseDesignerOutlets() { if (ContentLabel != null) { ContentLabel.Dispose(); ContentLabel = null; } if (MainImageView != null) { MainImageView.Dispose(); MainImageView = null; } if (TimeLabel != null) { TimeLabel.Dispose(); TimeLabel = null; } if (TitleLabel != null) { TitleLabel.Dispose(); TitleLabel = null; } if (ContentConstraint != null) { ContentConstraint.Dispose(); ContentConstraint = null; } }
public static void Delete(ContentConstraint constraint) { if (constraint == null) { throw new ArgumentNullException(nameof(constraint)); } if (constraint.IsNew) { throw new ArgumentException("Метод вызван для несуществующего в БД ContentConstraint"); } using (var scope = new QPConnectionScope()) { try { if (QPContext.DatabaseType == DatabaseType.SqlServer) { ChangeContentIndexesTriggerState(scope.DbConnection, false); } var dal = MapperFacade.ContentConstraintMapper.GetDalObject(constraint); Common.DropComplexIndex(scope.DbConnection, dal); DefaultRepository.Delete <ContentConstraintDAL>(constraint.Id); } finally { if (QPContext.DatabaseType == DatabaseType.SqlServer) { ChangeContentIndexesTriggerState(scope.DbConnection, true); } } } }
public static ContentConstraint HttpContent(this ConstraintExpression expression, ContentConstraint content = null) { var constraint = new ContentConstraint(content); expression.Append(constraint); return(constraint); }
void ReleaseDesignerOutlets() { if (ContentConstraint != null) { ContentConstraint.Dispose(); ContentConstraint = null; } if (RepositoryDescription != null) { RepositoryDescription.Dispose(); RepositoryDescription = null; } if (RepositoryImage != null) { RepositoryImage.Dispose(); RepositoryImage = null; } if (RepositoryName != null) { RepositoryName.Dispose(); RepositoryName = null; } if (RepositoryOwner != null) { RepositoryOwner.Dispose(); RepositoryOwner = null; } }
private static void SaveConstraint(ContentConstraint constraint, Field newItem) { if (constraint != null) { BindFieldToContstraint(newItem, constraint); ContentConstraintRepository.Save(constraint); } }
private static void BindFieldToContstraint(Field item, ContentConstraint constraint) { constraint.ContentId = item.ContentId; foreach (var r in constraint.Rules) { if (r.FieldId == 0) { r.FieldId = item.Id; } } }
internal static ContentConstraint GetConstraintByFieldId(int id) { ContentConstraint result = null; var constraintId = QPContext.EFContext.ContentConstraintRuleSet.Where(s => s.FieldId == (decimal)id).Select(s => s.ConstraintId).SingleOrDefault(); if (constraintId > 0) { result = MapperFacade.ContentConstraintMapper.GetBizObject(QPContext.EFContext.ContentConstraintSet.Include("Rules").SingleOrDefault(s => s.Id == constraintId)); } return(result); }
public static void Delete(ContentConstraint constraint) { if (constraint == null) { throw new ArgumentNullException(nameof(constraint)); } if (constraint.IsNew) { throw new ArgumentException("Метод вызван для несуществующего в БД ContentConstraint"); } DefaultRepository.Delete <ContentConstraintDAL>(constraint.Id); }
private static void UpdateConstraint(ContentConstraint constraint, Field newItem) { if (constraint != null) { BindFieldToContstraint(newItem, constraint); if (constraint.IsNew) { ContentConstraintRepository.Save(constraint); } else { ContentConstraintRepository.Update(constraint); } } }
internal static ContentConstraint Save(ContentConstraint constraint) { if (constraint == null) { throw new ArgumentNullException(nameof(constraint)); } if (!constraint.IsNew) { throw new ArgumentException("Метод вызван для существующего в БД ContentConstraint"); } // Сохраняем ограничение только если есть правила if (constraint.Rules != null && constraint.Rules.Any()) { var ccDal = MapperFacade.ContentConstraintMapper.GetDalObject(constraint); using (var scope = new QPConnectionScope()) { ccDal = DefaultRepository.SimpleSave(ccDal); foreach (var rule in ccDal.Rules) { rule.Constraint = ccDal; rule.ConstraintId = ccDal.Id; DefaultRepository.SimpleSave(rule); } if (constraint.IsComplex) { Common.CreateComplexIndex(QPContext.EFContext, scope.DbConnection, ccDal); } } var newContraint = MapperFacade.ContentConstraintMapper.GetBizObject(ccDal); return(newContraint); } return(constraint); }
internal static ContentConstraint Update(ContentConstraint constraint) { if (constraint == null) { throw new ArgumentNullException(nameof(constraint)); } if (constraint.IsNew) { throw new ArgumentException("Метод вызван для несуществующего в БД ContentConstraint"); } // если нет правил, то удалить ограничение if (constraint.Rules == null || constraint.Rules.Count == 0) { Delete(constraint); return(null); } var ccDal = QPContext.EFContext.ContentConstraintSet.Single(d => d.Id == constraint.Id); ccDal.Rules.Load(); IEnumerable <ContentConstraintRuleDAL> ruleDalList = ccDal.Rules.ToArray(); // удалить все правила которые уже есть DefaultRepository.SimpleDelete(ruleDalList); // создать новые записи для правил foreach (var rule in constraint.Rules) { rule.ConstraintId = constraint.Id; } var newDalList = MapperFacade.ContentConstraintRuleMapper.GetDalList(constraint.Rules.ToList()); DefaultRepository.SimpleSave(newDalList.AsEnumerable()); return(MapperFacade.ContentConstraintMapper.GetBizObject(ccDal)); }
void ReleaseDesignerOutlets() { if (ContentConstraint != null) { ContentConstraint.Dispose(); ContentConstraint = null; } if (ActionImage != null) { ActionImage.Dispose(); ActionImage = null; } if (Body != null) { Body.Dispose(); Body = null; } if (Header != null) { Header.Dispose(); Header = null; } if (Image != null) { Image.Dispose(); Image = null; } if (Time != null) { Time.Dispose(); Time = null; } }
internal static ContentConstraint Save(ContentConstraint constraint) { if (constraint == null) { throw new ArgumentNullException(nameof(constraint)); } if (!constraint.IsNew) { throw new ArgumentException("Метод вызван для существующего в БД ContentConstraint"); } // Сохраняем ограничение только если есть правила if (constraint.Rules != null && constraint.Rules.Count > 0) { var ccDal = MapperFacade.ContentConstraintMapper.GetDalObject(constraint); ccDal = DefaultRepository.SimpleSave(ccDal); var newContraint = MapperFacade.ContentConstraintMapper.GetBizObject(ccDal); return(newContraint); } return(constraint); }
public static MessageConstraint HttpRequest(UriConstraint.QueryAndPath uri = null, IConstraint method = null, ContentConstraint content = null) { return(new MessageConstraint(uri, method, content)); }
public static MessageConstraint HttpRequest(this ConstraintExpression expression, UriConstraint.QueryAndPath uri = null, IConstraint method = null, ContentConstraint content = null) { var constraint = new MessageConstraint(uri, method, content); expression.Append(constraint); return(constraint); }
void ReleaseDesignerOutlets() { if (CaptionLabel != null) { CaptionLabel.Dispose(); CaptionLabel = null; } if (ContentLabel != null) { ContentLabel.Dispose(); ContentLabel = null; } if (FollowersImageVIew != null) { FollowersImageVIew.Dispose(); FollowersImageVIew = null; } if (FollowersLabel != null) { FollowersLabel.Dispose(); FollowersLabel = null; } if (ForksImageView != null) { ForksImageView.Dispose(); ForksImageView = null; } if (ForksLabel != null) { ForksLabel.Dispose(); ForksLabel = null; } if (OwnerImageView != null) { OwnerImageView.Dispose(); OwnerImageView = null; } if (UserImageView != null) { UserImageView.Dispose(); UserImageView = null; } if (UserLabel != null) { UserLabel.Dispose(); UserLabel = null; } if (ContentConstraint != null) { ContentConstraint.Dispose(); ContentConstraint = null; } }
internal static ContentConstraint Update(ContentConstraint constraint) { if (constraint == null) { throw new ArgumentNullException(nameof(constraint)); } if (constraint.IsNew) { throw new ArgumentException("Метод вызван для несуществующего в БД ContentConstraint"); } // если нет правил, то удалить ограничение if (constraint.Rules == null || !constraint.Rules.Any()) { Delete(constraint); return(null); } using (var scope = new QPConnectionScope()) { try { if (QPContext.DatabaseType == DatabaseType.SqlServer) { ChangeContentIndexesTriggerState(scope.DbConnection, false); } var context = QPContext.EFContext; var oldConstraintDal = context.ContentConstraintSet.Include(n => n.Rules) .Single(d => d.Id == constraint.Id); Common.DropComplexIndex(scope.DbConnection, oldConstraintDal); // удалить все правила которые уже есть DefaultRepository.SimpleDeleteBulk(oldConstraintDal.Rules.ToArray(), context); // создать новые записи для правил foreach (var rule in constraint.Rules) { rule.ConstraintId = constraint.Id; } var newDalList = MapperFacade.ContentConstraintRuleMapper.GetDalList(constraint.Rules.ToList()); var list = DefaultRepository.SimpleSaveBulk(newDalList.AsEnumerable()).ToList(); constraint.Rules = MapperFacade.ContentConstraintRuleMapper.GetBizList(list).ToArray(); if (constraint.IsComplex) { var dal = MapperFacade.ContentConstraintMapper.GetDalObject(constraint); Common.CreateComplexIndex(QPContext.EFContext, scope.DbConnection, dal); } } finally { if (QPContext.DatabaseType == DatabaseType.SqlServer) { ChangeContentIndexesTriggerState(scope.DbConnection, true); } } } return(constraint); }