Esempio n. 1
0
 public FormController(ICacheService cacheService, IDynamicService service, IFormService formService, IFormContext formContext, IEntityContext entityContext)
 {
     _cacheService  = cacheService;
     _service       = service;
     _formService   = formService;
     _formContext   = formContext;
     _entityContext = entityContext;
 }
Esempio n. 2
0
 public TransactionsController(ILog log,
                               IDynamicService dynamicService,
                               IBuildRepository buildRepository)
 {
     _log             = log;
     _dynamicService  = dynamicService;
     _buildRepository = buildRepository;
 }
Esempio n. 3
0
 public FormController(UserManager <GearUser> userManager, RoleManager <GearRole> roleManager, ICacheService cacheService, ApplicationDbContext applicationDbContext, EntitiesDbContext context, INotify <GearRole> notify, IDynamicService service, IFormService formService, IFormContext formContext, IEntityContext entityContext) : base(userManager, roleManager, applicationDbContext, context, notify)
 {
     _cacheService  = cacheService;
     _service       = service;
     FormService    = formService;
     _formContext   = formContext;
     _entityContext = entityContext;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="dataService"></param>
 /// <param name="context"></param>
 /// <param name="hub"></param>
 /// <param name="logger"></param>
 /// <param name="emailSender"></param>
 /// <param name="userManager"></param>
 public NotifyWithDynamicEntities(IDynamicService dataService, TContext context, ICommunicationHub hub, ILogger <NotifyWithDynamicEntities <TContext, TRole, TUser> > logger, IEmailSender emailSender, IUserManager <GearUser> userManager)
 {
     _dataService = dataService;
     _context     = context;
     _hub         = hub;
     _logger      = logger;
     _emailSender = emailSender;
     _userManager = userManager;
 }
 public ServiceBrokerService(IServiceRepository serviceRepository, IDynamicService dynamicService,
                             ICachedService cachedService, IStaticService staticService, ITaskScheduler taskScheduler, ICache cache)
 {
     _serviceRepository = serviceRepository;
     _dynamicService    = dynamicService;
     _cachedService     = cachedService;
     _taskScheduler     = taskScheduler;
     _cache             = cache;
     _staticService     = staticService;
 }
 public BalancesController(ILog log,
                           IDynamicService dynamicService,
                           IBalanceRepository balanceRepository,
                           IBalancePositiveRepository balancePositiveRepository)
 {
     _log                       = log;
     _dynamicService            = dynamicService;
     _balanceRepository         = balanceRepository;
     _balancePositiveRepository = balancePositiveRepository;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="dynamicService"></param>
 public DataInjectorController(IDynamicService dynamicService)
 {
     _dynamicService       = dynamicService;
     _jsonSerializeOptions = new JsonSerializerSettings
     {
         DateFormatString  = GearSettings.Date.DateFormat,
         ContractResolver  = new CamelCasePropertyNamesContractResolver(),
         NullValueHandling = NullValueHandling.Ignore
     };
 }
Esempio n. 8
0
 public string this[int i, DateTime d, IDynamicService s, string t, object o, double f, byte b]
 {
     get
     {
         throw new ServiceNotAvailableException(typeof(IChoucrouteService));
     }
     set
     {
         throw new ServiceNotAvailableException(typeof(IChoucrouteService));
     }
 }
Esempio n. 9
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="appContext"></param>
 /// <param name="service"></param>
 /// <param name="pageRender"></param>
 /// <param name="formContext"></param>
 /// <param name="pagesContext"></param>
 public PageRenderController(ApplicationDbContext appContext,
                             IDynamicService service,
                             IPageRender pageRender,
                             IFormContext formContext, IDynamicPagesContext pagesContext)
 {
     _appContext   = appContext;
     _service      = service;
     _formContext  = formContext;
     _pagesContext = pagesContext;
     _pageRender   = pageRender;
 }
Esempio n. 10
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="appContext"></param>
 /// <param name="service"></param>
 /// <param name="pageRender"></param>
 /// <param name="formContext"></param>
 /// <param name="pagesContext"></param>
 /// <param name="viewModelService"></param>
 public PageRenderController(GearIdentityDbContext appContext,
                             IDynamicService service,
                             IPageRender pageRender,
                             IFormContext formContext, IDynamicPagesContext pagesContext, IViewModelService viewModelService)
 {
     _appContext       = appContext;
     _service          = service;
     _formContext      = formContext;
     _pagesContext     = pagesContext;
     _viewModelService = viewModelService;
     _pageRender       = pageRender;
 }
Esempio n. 11
0
        public InlineEditController(IDynamicPagesContext pagesContext, IDynamicService service, UserManager <GearUser> userManager)
        {
            _pagesContext = pagesContext;
            _service      = service;
            _userManager  = userManager;

            _jsonSerializerSettings = new JsonSerializerSettings
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
                ContractResolver      = new CamelCasePropertyNamesContractResolver()
            };
        }
Esempio n. 12
0
 public string this[int i, DateTime d, IDynamicService s, string t, object o, double f, byte b]
 {
     get
     {
         RegisterCall(MethodInfo.GetCurrentMethod());
         return(i.ToString() + d.Ticks.ToString() + t + o.ToString() + f.ToString() + b.ToString());
     }
     set
     {
         RegisterCall(MethodInfo.GetCurrentMethod());
     }
 }
 public string this[int i, DateTime d, IDynamicService s, string t, object ob, double f, byte b]
 {
     get
     {
         LogMethodEntry          e;
         ServiceLogMethodOptions o = GetLoggerForRunningCall(7, out e);
         if ((o & ServiceLogMethodOptions.LogParameters) != 0)
         {
             e._parameters = new object[] { i, d, s, t, ob, f, b }
         }
         ;
         try
         {
             return(StandardHandleLogReturn(o, e, _impl[i, d, s, t, ob, f, b]));
         }
         catch (Exception ex)
         {
             if ((o & ServiceLogMethodOptions.LogError) != 0)
             {
                 OnCallException(7, ex, e);
             }
             throw;
         }
     }
     set
     {
         LogMethodEntry          e;
         ServiceLogMethodOptions o = GetLoggerForRunningCall(8, out e);
         if ((o & ServiceLogMethodOptions.LogParameters) != 0)
         {
             e._parameters = new object[] { i, d, s, t, o, f, b }
         }
         ;
         try
         {
             _impl[i, d, s, t, o, f, b] = value;
             if ((o & ServiceLogMethodOptions.Leave) != 0)
             {
                 LogEndCall(e);
             }
         }
         catch (Exception ex)
         {
             if ((o & ServiceLogMethodOptions.LogError) != 0)
             {
                 OnCallException(8, ex, e);
             }
             throw;
         }
     }
 }
 public WalletsController(IDynamicService dynamicService)
 {
     _dynamicService = dynamicService;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="dynamicService"></param>
 public DataInjectorController(IDynamicService dynamicService)
 {
     _dynamicService = dynamicService;
 }
Esempio n. 16
0
        public static ObjectId DeepCreate(DynamicRecord parentRecord, DynamicRecord record, SchemaView view, ObjectId tenantId, ObjectId loggedUser, string roleCode, IDynamicService <DynamicRecord> dynamicService, ISchemaService schemaService, bool allowUpdate = false)
        {
            var complexRecords = record.Values().Where(v => view.Schema.Attributes.ContainsKey(v.Key) && (view.Schema.Attributes[v.Key].IsComplex || view.Schema.Attributes[v.Key].IsSubCatalog));

            complexRecords.ToList().ForEach(r =>
            {
                var subcatalogView = schemaService.GetView(view.Schema.Attributes[r.Key].DataType, ViewCategory.Create, tenantId, roleCode);  //this should go to cache all of the time, it would be expensive not to.

                // When manually creating an invoice, we need to check if Count > 0, otherwise FindExisting throws an exception
                if (r.Value is Dictionary <string, object> && ((Dictionary <string, object>)r.Value).Count > 0)
                {
                    var subRecord     = new DynamicRecord().Initialize <DynamicRecord>((Dictionary <string, object>)r.Value, null, ViewCategory.Create);
                    bool isValidInput = true;
                    subRecord._id     = FindExisting(subRecord, subcatalogView, tenantId, loggedUser, dynamicService, out isValidInput);
                    if (subcatalogView != null && subcatalogView.Schema.AllowQuickCreate && subRecord._id == ObjectId.Empty && isValidInput)
                    {
                        var fieldId     = DeepCreate(parentRecord ?? record, subRecord, subcatalogView, tenantId, loggedUser, roleCode, dynamicService, schemaService);
                        var field       = ((Dictionary <string, object>)r.Value);
                        var arrayOfKeys = field.Keys.ToArray();
                        foreach (var k in arrayOfKeys)
                        {
                            if (subRecord.ContainsKey(k))
                            {
                                field[k] = subRecord[k];
                            }
                        }
                    }
                    else if (subRecord._id != ObjectId.Empty)
                    {
                        ((Dictionary <string, object>)r.Value)["_id"] = subRecord._id;
                    }
                }
                else if (subcatalogView?.Schema != null && subcatalogView.Schema.AllowQuickCreate && r.Value is List <Dictionary <string, object> > && ((List <Dictionary <string, object> >)r.Value).Count > 0)
                {
                    ((List <Dictionary <string, object> >)r.Value).ForEach(v =>
                    {
                        var subRecord   = new DynamicRecord().Initialize <DynamicRecord>(v, subcatalogView, ViewCategory.Create);
                        var fieldId     = DeepCreate(parentRecord ?? record, subRecord, subcatalogView, tenantId, loggedUser, roleCode, dynamicService, schemaService, true);
                        var field       = v;
                        var arrayOfKeys = field.Keys.ToArray();
                        foreach (var k in arrayOfKeys)
                        {
                            if (subRecord.ContainsKey(k))
                            {
                                field[k] = subRecord[k];
                            }
                        }
                    });
                }
            });

            if (record._id != ObjectId.Empty && allowUpdate)
            {
                record.ParentRecord = parentRecord;
                dynamicService.Update(record, view.Schema.CollectionName, view.Schema.Name, tenantId, loggedUser, roleCode);
                return(record._id);
            }
            else
            {
                var isValidInput = false;
                record._id = FindExisting(record, view, tenantId, loggedUser, dynamicService, out isValidInput);
                if (record._id == ObjectId.Empty)
                {
                    record.ParentRecord = parentRecord;
                    return(dynamicService.Add(record, view.Schema.Name, tenantId, loggedUser, roleCode));
                }
                else if (allowUpdate)
                {
                    record.ParentRecord = parentRecord;
                    dynamicService.Update(record, view.Schema.CollectionName, view.Schema.Name, tenantId, loggedUser, roleCode);
                    return(record._id);
                }
                else
                {
                    return(ObjectId.Empty);
                }
            }
        }
Esempio n. 17
0
 public static ObjectId DeepCreate(DynamicRecord record, SchemaView view, ObjectId tenantId, ObjectId loggedUser, string roleCode, IDynamicService <DynamicRecord> dynamicService, ISchemaService schemaService, bool allowUpdate = false)
 {
     return(DeepCreate(null, record, view, tenantId, loggedUser, roleCode, dynamicService, schemaService, allowUpdate));
 }
Esempio n. 18
0
        public static Dictionary <string, object> SetComplexValue(object value, ColumnSchema attribute, ObjectId tenantId, ObjectId userId,
                                                                  string roleCode, IDynamicRepository dynamicRepository, IDynamicService <DynamicRecord> dynamicService, ISchemaService schemaService)
        {
            var complexAttributeView   = schemaService.GetView(attribute.DataType, ViewCategory.Create, tenantId, roleCode); //TODO: gutierfe.  I think it should be .Catalog.
            var complexAttributeSchema = complexAttributeView.Schemas[attribute.DataType];
            var isValid = true;
            //Create complex field value
            var fieldValue = new Dictionary <string, object>()
            {
                { complexAttributeSchema.UniqueIndex.Count() == 1 ? complexAttributeSchema.UniqueIndex.First() : attribute.ComplexFieldName, value }
            };                                                                                                                                                                                            //assumming it has only one unique index, otherwise, use complex value field
            var dynamicRecordValue = new DynamicRecord().Initialize <DynamicRecord>(fieldValue as Dictionary <string, object>, null, ViewCategory.Catalog);

            ThrowExceptionIfViewIsNull(complexAttributeView);
            var id = ControllerHelper.FindExisting(dynamicRecordValue, complexAttributeView, tenantId, userId, dynamicService, out isValid);

            if (id != ObjectId.Empty)
            {
                dynamicRecordValue = dynamicRepository.Get <DynamicRecord>(attribute.DataType, id, tenantId);
            }
            return(dynamicRecordValue.Values());
        }
Esempio n. 19
0
 public NotificationTypeController(IDynamicService service)
 {
     _service = service;
 }
Esempio n. 20
0
        public static ObjectId FindExisting(DynamicRecord record, SchemaView view, ObjectId tenantId, ObjectId loggedUser, IDynamicService <DynamicRecord> dynamicService, out bool isValidInput)
        {
            isValidInput = true;
            //check if the current record exists... only check for quick create ones
            if ((record._id == null || record._id == ObjectId.Empty) && view != null && view.Schema.UniqueIndex != null)
            {
                var filter = view.Schema.UniqueIndex.ToDictionary(v => v, v =>
                                                                  v.Contains("$") ?
                                                                  //v.Split('$')[0] = View  (View$Name)
                                                                  //v.Split('$')[1] = Name
                                                                  (record[v.Split('$')[0]] as IDictionary <string, object>)[v.Split('$')[1]].ToString() :
                                                                  record[v]?.ToString()
                                                                  );

                // If all filters are empty that's because we're receiving an object without a unique index,
                // which can't be compared
                if (filter.All(x => string.IsNullOrEmpty(x.Value)))
                {
                    // We received something without a valid uniqueIndex
                    isValidInput = false;
                }
                else
                {
                    var existingRecords = dynamicService.GetAll(view, tenantId, loggedUser, RecordLevelSecurityEnum.NoRestriction).ToList();
                    var existingRecord  = existingRecords.Where(e => e.Contains(filter)).ToList();

                    if (existingRecord != null && existingRecord.Count() > 0)
                    {
                        return(existingRecord.First()._id);
                    }
                }
            }
            return(ObjectId.Empty);
        }
Esempio n. 21
0
 public AddressesController(IDynamicService dynamicService)
 {
     _dynamicService = dynamicService;
 }
Esempio n. 22
0
 public SignController(IDynamicService dynamicService)
 {
     _dynamicService = dynamicService;
 }