private void CheckPermissionToPerformOperation(ProductionOrderTransportSheet template, User user, Permission permission)
 {
     if (!IsPermissionToPerformOperation(template, user, permission))
     {
         throw new Exception(String.Format("Недостаточно прав для выполнения операции «{0}».", permission.GetDisplayName()));
     }
 }
        private bool IsPermissionToPerformOperation(ProductionOrderTransportSheet 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);
        }
示例#3
0
        public void GetCurrencyAndCurrencyRate(ProductionOrderTransportSheet transportSheet, out Currency currency, out CurrencyRate currencyRate)
        {
            switch (transportSheet.CurrencyDeterminationType)
            {
            case ProductionOrderCurrencyDeterminationType.ProductionOrderCurrency:
                currency     = transportSheet.ProductionOrder.Currency;
                currencyRate = transportSheet.ProductionOrder.CurrencyRate;
                break;

            case ProductionOrderCurrencyDeterminationType.BaseCurrency:
                currency     = GetCurrentBaseCurrency();
                currencyRate = null;
                break;

            case ProductionOrderCurrencyDeterminationType.SelectCurrency:
                currency     = transportSheet.Currency;
                currencyRate = transportSheet.CurrencyRate;
                break;

            default:
                throw new Exception("Неизвестный тип поля «Способ выбора валюты».");
            }
            ;
        }
示例#4
0
 public void Delete(ProductionOrderTransportSheet entity)
 {
     CurrentSession.SaveOrUpdate(entity);
 }