Ejemplo n.º 1
0
        public bool SaveToServerWithPermissions()
        {
            List <UserPermission> permissionsToSave   = new List <UserPermission>();
            List <UserPermission> permissionsToDelete = new List <UserPermission>();

            foreach (User u in _entities.Values)
            {
                u.UserPermissionCache.ToList().ForEach(p => permissionsToSave.Add(p));
                u.UserPermissionCache.DeletedEntities.ForEach(p => permissionsToDelete.Add(p));
            }
            if (ServiceResultHandler.HandleServiceResult(GlobalDataCache.Instance.Service.SaveUserWithPermissions(
                                                             _entities.Values.ToArray(),
                                                             _deletedEntities.Values.ToArray(),
                                                             permissionsToSave.ToArray(),
                                                             permissionsToDelete.ToArray(),
                                                             GlobalDataCache.Instance.CurrentUser)))
            {
                return(true);
            }
            foreach (User u in _entities.Values)
            {
                u.UserPermissionCache.ClearAddedEntities();
                u.UserPermissionCache.ClearDeletedEntities();
            }
            _addedEntities.Clear();
            _deletedEntities.Clear();
            return(false);
        }
        public bool RefreshFromServer()
        {
            ServiceFunctionResultOfListOfGlobalVariable result = GlobalDataCache.Instance.Service.GetAllGlobalVariable(false, GlobalDataCache.Instance.CurrentUser);

            if (ServiceResultHandler.HandleServiceResult(result))
            {
                return(true);
            }
            _globalVariables.Clear();
            result.Contents.OrderBy(p => p.VariableName).ToList().ForEach(p => _globalVariables.Add(p.VariableName, p));
            return(false);
        }
Ejemplo n.º 3
0
        public override bool RefreshFromServer()
        {
            ServiceFunctionResultOfListOfUser result = GlobalDataCache.Instance.Service.GetAllUser(false, GlobalDataCache.Instance.CurrentUser);

            if (ServiceResultHandler.HandleServiceResult(result))
            {
                return(true);
            }
            Clear();
            result.Contents.OrderBy(p => p.UserName).ToList().ForEach(p => _entities.Add(p.UserId, p));
            return(false);
        }
        public bool SaveToServer()
        {
            ServiceProcedureResult result = GlobalDataCache.Instance.Service.SaveGlobalVariable(
                _globalVariables.Values.ToArray(),
                GlobalDataCache.Instance.CurrentUser,
                false);

            if (ServiceResultHandler.HandleServiceResult(result))
            {
                return(true);
            }
            return(false);
        }
        public bool RefreshFromServerWithCustomerInfo()
        {
            ServiceFunctionResultOfListOfDeviceConfig result = GlobalDataCache.Instance.Service.GetAllDeviceConfigWithCustomerInfo(
                GlobalDataCache.Instance.CurrentUser);

            if (ServiceResultHandler.HandleServiceResult(result))
            {
                return(true);
            }
            Clear();
            result.Contents.OrderBy(p => p.CustomerCompanyName).ToList().ForEach(p => _entities.Add(p.DeviceConfigId, p));
            return(false);
        }
Ejemplo n.º 6
0
        public override bool RefreshFromServer()
        {
            ServiceFunctionResultOfListOfAplexControlMapping result = GlobalDataCache.Instance.Service.GetAllAplexControlMapping(
                false,
                GlobalDataCache.Instance.CurrentUser);

            if (ServiceResultHandler.HandleServiceResult(result))
            {
                return(true);
            }
            Clear();
            result.Contents.ToList().ForEach(p => _entities.Add(p.StateControlMappingId, p));
            return(false);
        }
        public override bool RefreshFromServer()
        {
            ServiceFunctionResultOfListOfDevicePendingApproval result = GlobalDataCache.Instance.Service.GetAllDevicePendingApproval(
                false,
                GlobalDataCache.Instance.CurrentUser);

            if (ServiceResultHandler.HandleServiceResult(result))
            {
                return(true);
            }
            Clear();
            result.Contents.OrderBy(p => p.LatestAttemptDate).ToList().ForEach(p => _entities.Add(p.DevicePendingApprovalId, p));
            return(false);
        }
        public bool RefreshFromServerForUser(User targetUser)
        {
            ServiceFunctionResultOfListOfUserPermission result = GlobalDataCache.Instance.Service.GetUserPermissionsForUser(
                targetUser,
                GlobalDataCache.Instance.CurrentUser);

            if (ServiceResultHandler.HandleServiceResult(result))
            {
                return(true);
            }
            Clear();
            result.Contents.OrderBy(p => p.PermissionName).ToList().ForEach(p => _entities.Add(p.UserPermissionId, p));
            return(false);
        }
        public bool RefreshFromServer(Guid aplexDataTableId)
        {
            ServiceFunctionResultOfListOfAplexDataColumn result = GlobalDataCache.Instance.Service.GetAplexDataColumnByField(
                EntityReader <AplexDataColumn> .GetPropertyName(p => p.AplexDataTableId, false),
                aplexDataTableId,
                false,
                GlobalDataCache.Instance.CurrentUser);

            if (ServiceResultHandler.HandleServiceResult(result))
            {
                return(true);
            }
            Clear();
            result.Contents.ToList().ForEach(p => _entities.Add(p.AplexDataColumnId, p));
            return(false);
        }
Ejemplo n.º 10
0
        public override bool RefreshFromServer()
        {
            ServiceFunctionResultOfListOfEmailAction result = GlobalDataCache.Instance.Service.GetAllEmailAction(
                false,
                GlobalDataCache.Instance.CurrentUser);

            if (ServiceResultHandler.HandleServiceResult(result))
            {
                return(true);
            }
            Clear();
            foreach (EmailAction e in result.Contents.OrderBy(p => p.DateCreated))
            {
                _entities.Add(e.EmailActionId, e);
            }
            return(false);
        }
Ejemplo n.º 11
0
        public override bool RefreshFromServer()
        {
            ServiceFunctionResultOfListOfServerError result = GlobalDataCache.Instance.Service.GetAllServerError(
                false,
                GlobalDataCache.Instance.CurrentUser);

            if (ServiceResultHandler.HandleServiceResult(result))
            {
                return(true);
            }
            Clear();
            foreach (ServerError e in result.Contents.OrderBy(p => p.DateCreated))
            {
                e.ServerErrorCacheId = Guid.NewGuid();
                _entities.Add(e.ServerErrorCacheId, e);
            }
            return(false);
        }
Ejemplo n.º 12
0
 public override bool SaveToServer()
 {
     if (ServiceResultHandler.HandleServiceResult(GlobalDataCache.Instance.Service.SaveEmailAction(
                                                      _entities.Values.ToArray(),
                                                      GlobalDataCache.Instance.CurrentUser,
                                                      false)))
     {
         return(true);
     }
     _addedEntities.Clear();
     if (ServiceResultHandler.HandleServiceResult(GlobalDataCache.Instance.Service.DeleteEmailAction(
                                                      _deletedEntities.Values.ToArray(),
                                                      GlobalDataCache.Instance.CurrentUser)))
     {
         return(true);
     }
     _deletedEntities.Clear();
     return(false);
 }
Ejemplo n.º 13
0
        public bool RefreshFromServerByFilters(DateTime startDate, DateTime endDate)
        {
            ServiceFunctionResultOfListOfServerAction result = GlobalDataCache.Instance.Service.GetServerActionByFilters(
                startDate,
                endDate,
                GlobalDataCache.Instance.CurrentUser);

            if (ServiceResultHandler.HandleServiceResult(result))
            {
                return(true);
            }
            Clear();
            foreach (ServerAction a in result.Contents.OrderBy(p => p.DateCreated))
            {
                a.ServerActionCacheId = Guid.NewGuid();
                _entities.Add(a.ServerActionCacheId, a);
            }
            return(false);
        }
Ejemplo n.º 14
0
        public bool RefreshFromServerByFilters(
            DateTime startDate,
            DateTime endDate)
        {
            ServiceFunctionResultOfListOfEmailAction result = GlobalDataCache.Instance.Service.GetEmailActionByFilters(
                startDate,
                endDate,
                GlobalDataCache.Instance.CurrentUser);

            if (ServiceResultHandler.HandleServiceResult(result))
            {
                return(true);
            }
            Clear();
            foreach (EmailAction e in result.Contents.OrderBy(p => p.DateCreated))
            {
                _entities.Add(e.EmailActionId, e);
            }
            return(false);
        }
        public bool RefreshFromServerByFilters(
            string deviceId,
            string applicationName,
            DateTime startDate,
            DateTime endDate)
        {
            ServiceFunctionResultOfListOfDeviceConfigAction result = GlobalDataCache.Instance.Service.GetDeviceConfigActionByFilters(
                deviceId,
                applicationName,
                startDate,
                endDate,
                GlobalDataCache.Instance.CurrentUser);

            if (ServiceResultHandler.HandleServiceResult(result))
            {
                return(true);
            }
            Clear();
            result.Contents.OrderBy(p => p.DateCreated).ToList().ForEach(p => _entities.Add(p.DeviceConfigActionId, p));
            return(false);
        }
Ejemplo n.º 16
0
        public bool RefreshFromServer(Guid aplexId, bool refreshScreenFields)
        {
            ServiceFunctionResultOfListOfAplexScreen result = GlobalDataCache.Instance.Service.GetAplexScreenByField(
                EntityReader <AplexScreen> .GetPropertyName(p => p.AplexId, false),
                aplexId,
                false,
                GlobalDataCache.Instance.CurrentUser);

            if (ServiceResultHandler.HandleServiceResult(result))
            {
                return(true);
            }
            Clear();
            result.Contents.ToList().ForEach(p => _entities.Add(p.AplexScreenId, p));
            if (refreshScreenFields)
            {
                foreach (AplexScreen s in this)
                {
                    s.AplexScreenFieldCache.RefreshFromServer(s.AplexScreenId);
                }
            }
            return(false);
        }