예제 #1
0
 /// <summary>
 /// Метод  обработки условии к доступу данных
 /// </summary>
 private static void DataAccessCondition <TSource, TDestionation>(
     IMappingExpression <TSource, TDestionation> mapping)
     where TSource : IStatUnitM
     where TDestionation : IStatisticalUnit
 =>
 mapping.ForAllMembers(v => v.Condition((src, dst) =>
 {
     var name = DataAccessAttributesHelper.GetName(dst.GetType(), v.DestinationMember.Name);
     return(DataAccessAttributesProvider.Find(name) == null ||
            (src.DataAccess?.HasWritePermission(name) ?? false));
 }));
예제 #2
0
        /// <summary>
        /// Convert method to string collection
        /// </summary>
        /// <param name="validate">Flag of validity</param>
        /// <returns></returns>
        public IEnumerable <string> ToStringCollection(bool validate = true)
        {
            var attributes = LegalUnit.Concat(LocalUnit)
                             .Concat(EnterpriseUnit)
                             .Concat(EnterpriseGroup)
                             .Where(v => v.Allowed)
                             .Select(v => v.Name);

            if (validate)
            {
                attributes = attributes.Where(v => DataAccessAttributesProvider.Find(v) != null);
            }
            return(attributes);
        }