private IEnumerable <CustomReportFilterViewModel> GetFilters(CustomReportView_ViewModel model, CustomReportBaseDataViewModel it)
        {
            Regex rg = new Regex(@"\(.*?\)");

            model.ValuesListString = rg.Replace(model.ValuesListString, "").Replace(" GMT+", ".").Replace(" GMT ", ".");
            model.ValuesList       = model.ValuesListString.Split(';').ToList();
            model.IdsList          = model.IdsListString.Split(';').Select(x => long.Parse(x)).ToList();
            var filters     = model.IdsList.Zip(model.ValuesList, (i, v) => new { Id = i, Value = v }).Where(x => !String.IsNullOrEmpty(x.Value)).ToList();
            var initFilters = it.GetAllAvailableFilters(Db);
            var res         = from f in filters
                              join i in initFilters
                              on f.Id equals i.Id
                              select new CustomReportFilterViewModel()
            {
                Id = i.Id,

                Field     = i.Field,
                Operation = i.Operation,

                ValueString = f.Value,
                Value       = SystemTypeHelper.GetObjectByString(f.Value, i.Field.DataType, i.Multi)
            };

            return(res.Where(x => !String.IsNullOrEmpty(x.ValueString)));
        }
예제 #2
0
 public TypeKeyUInt64ValuePairGenerator(ModuleDefinition module, SystemValueTypeHelper valueTypeHelper, SystemRuntimeCompilerServicesIsReadOnlyAttributeHelper readOnlyAttributeHelper, SystemTypeHelper typeHelper)
 {
     this.module                  = module;
     this.valueTypeHelper         = valueTypeHelper;
     this.readOnlyAttributeHelper = readOnlyAttributeHelper;
     this.typeHelper              = typeHelper;
 }
        public static List <CustomReportFilterDTO> GetUsedFiltersForReport(IUnitOfWork db, long reportId)
        {
            var query = from filter in db.CustomReportFilters.GetAllAsDto()

                        join predefinedField in db.CustomReportPredefinedFields.GetAllAsDto()
                        on filter.CustomReportPredefinedFieldId equals predefinedField.Id
                        where filter.CustomReportId == reportId
                        select new
            {
                Id = filter.Id,
                PredefinedField = predefinedField,
                Filter          = filter,
                //Field = field
            };

            var res = query.ToList().Select(x => new CustomReportFilterDTO()
            {
                Id = x.Filter.Id,
                CustomReportPredefinedField = x.PredefinedField,
                //AvailableOperations = GetOperations(x.PredefinedField.DataType),
                Operation   = x.Filter.Operation,
                ValueObject = SystemTypeHelper.GetObjectByString(x.Filter.Value, x.PredefinedField.DataType),
                //OperationString = EnumHelper<FilterOperation>.GetEnumDescription(x.Filter.Operation.ToString())
            });

            return(res.ToList());
        }
예제 #4
0
 public FixedTypeKeyGenerator(string name, ModuleDefinition module, TValueGenerator pairGenerator, SystemObjectHelper systemObjectHelper, SystemTypeHelper typeHelper, ModuleImporter importer, SystemArrayHelper arrayHelper, double loadFactor, Action <ILProcessor, TInfo> loadValueFromInfoAction, Func <TInfo, TypeReference> ldTokenTypeReferenceFunc, Instruction[] loadDefaultReturnValue)
 {
     this.name                     = name;
     this.module                   = module;
     this.pairGenerator            = pairGenerator;
     this.loadValueFromInfoAction  = loadValueFromInfoAction;
     this.ldTokenTypeReferenceFunc = ldTokenTypeReferenceFunc;
     this.systemObjectHelper       = systemObjectHelper;
     this.typeHelper               = typeHelper;
     this.importer                 = importer;
     this.arrayHelper              = arrayHelper;
     this.loadFactor               = loadFactor;
     this.loadDefaultReturnValue   = loadDefaultReturnValue;
 }
예제 #5
0
        private object GetValueObject(string val, string dataType, bool multi = false)
        {
            int days = 0;

            if (multi)
            {
                return(String.IsNullOrEmpty(val) ? new List <int>() : val.Split(',').Select(x => int.Parse(x)).ToList());
            }
            if (dataType == "datetime" && int.TryParse(val, out days))
            {
                return(DateTime.Now.AddDays(days).Date);
            }
            return(SystemTypeHelper.GetObjectByString(val, dataType));
        }
예제 #6
0
 public FixedTypeKeyInterfaceMessagePackFormatterValueHashtableGenerator(ModuleDefinition module, TypeKeyInterfaceMessagePackFormatterValuePairGenerator pairGenerator, SystemObjectHelper systemObjectHelper, SystemTypeHelper typeHelper, ModuleImporter importer, SystemArrayHelper arrayHelper, double loadFactor)
 {
     this.importer   = importer;
     this.typeHelper = typeHelper;
     customFormatterConstructorImporter = new CustomFormatterConstructorImporter(module.TypeSystem.Void, importer);
     generator = new FixedTypeKeyGenerator <FormatterTableItemInfo, TypeKeyInterfaceMessagePackFormatterValuePairGenerator>(
         TypeName,
         module,
         pairGenerator,
         systemObjectHelper,
         typeHelper,
         importer,
         arrayHelper,
         loadFactor,
         LoadAppropriateValueFromFormatterInfo,
         info => info.SerializeTypeReference,
         new[] { Instruction.Create(OpCodes.Ldnull), });
 }
예제 #7
0
 public FixedTypeKeyUInt64ValueHashtableGenerator(ModuleDefinition module, TypeKeyUInt64ValuePairGenerator pairGenerator, SystemObjectHelper systemObjectHelper, SystemTypeHelper typeHelper, ModuleImporter importer, SystemArrayHelper arrayHelper, double loadFactor)
 {
     generator = new FixedTypeKeyGenerator <UnionSerializationInfo, TypeKeyUInt64ValuePairGenerator>(
         TypeName,
         module,
         pairGenerator,
         systemObjectHelper,
         typeHelper,
         importer,
         arrayHelper,
         loadFactor,
         (processor, unionInfo) =>
     {
         var(instruction0, instruction1) = InstructionUtility.LdcU8(unionInfo.Value);
         processor.Append(instruction0);
         if (!(instruction1 is null))
         {
             processor.Append(instruction1);
         }
     },
예제 #8
0
 public FixedTypeKeyInt32ValueHashtableGenerator(ModuleDefinition module, TypeKeyInt32ValuePairGenerator pairGenerator, SystemObjectHelper systemObjectHelper, SystemTypeHelper typeHelper, ModuleImporter importer, SystemArrayHelper arrayHelper, double loadFactor)
 {
     generator = new FixedTypeKeyGenerator <UnionSerializationInfo, TypeKeyInt32ValuePairGenerator>(
         TypeName,
         module,
         pairGenerator,
         systemObjectHelper,
         typeHelper,
         importer,
         arrayHelper,
         loadFactor,
         (processor, unionInfo) =>
     {
         processor.Append(InstructionUtility.LdcI4(unionInfo.Index));
     },
         unionInfo => unionInfo.Type,
         new[] { Instruction.Create(OpCodes.Ldc_I4_M1), });
 }