private void CheckPermissionToPerformOperation(ProductionOrderBatchLifeCycleTemplate template, User user, Permission permission) { if (!IsPermissionToPerformOperation(template, user, permission)) { throw new Exception(String.Format("Недостаточно прав для выполнения операции «{0}».", permission.GetDisplayName())); } }
public bool IsPossibilityToDelete(ProductionOrderBatchLifeCycleTemplate template, User user) { try { CheckPossibilityToDelete(template, user); return(true); } catch { return(false); } }
public short Save(ProductionOrderBatchLifeCycleTemplate productionOrderBatchLifeCycleTemplate) { // Проверяем, нет ли этапов с повторяющимися названиями foreach (var stage in productionOrderBatchLifeCycleTemplate.Stages) { foreach (var anotherStage in productionOrderBatchLifeCycleTemplate.Stages) { ValidationUtils.Assert(stage.Name != anotherStage.Name || stage == anotherStage, "Названия этапов не должны повторяться."); } } productionOrderBatchLifeCycleTemplateRepository.Save(productionOrderBatchLifeCycleTemplate); return(productionOrderBatchLifeCycleTemplate.Id); }
private bool IsPermissionToPerformOperation(ProductionOrderBatchLifeCycleTemplate template, User user, Permission permission) { bool result = false; switch (user.GetPermissionDistributionType(permission)) { case PermissionDistributionType.None: result = false; break; case PermissionDistributionType.All: result = true; break; } return(result); }
public void Delete(ProductionOrderBatchLifeCycleTemplate productionOrderBatchLifeCycleTemplate) { productionOrderBatchLifeCycleTemplateRepository.Delete(productionOrderBatchLifeCycleTemplate); }
public void CheckPossibilityToDelete(ProductionOrderBatchLifeCycleTemplate template, User user) { // права CheckPermissionToPerformOperation(template, user, Permission.ProductionOrderBatchLifeCycleTemplate_Delete); }
/// <summary> /// Удаление /// </summary> /// <param name="entity">Сущность</param> public void Delete(ProductionOrderBatchLifeCycleTemplate entity) { CurrentSession.Delete(entity); }
/// <summary> /// Сохранение /// </summary> /// <param name="entity">Сущность</param> public void Save(ProductionOrderBatchLifeCycleTemplate entity) { CurrentSession.SaveOrUpdate(entity); }