Beispiel #1
0
 // PermissionSyncToServer()
 public int PermissionSyncToServer(string permissionID, PERMISSION_STATE targetStateCode, LoginObjectEntity actionUser, out PERMISSION_STATE finalStateCode)
 {
     return _permissionManager.SyncPermissionToServer(permissionID, time, targetStateCode, actionUser, out finalStateCode);
 }
Beispiel #2
0
 // PermissionGetFromServer()
 // - Find permission need to be downloaded
 public LinkedList<PermissionEntity> PermissionGetFromServer(LoginObjectEntity loginEnity, DateTime lastUpdatedTime, out DateTime newUpdateTime)
 {
     // Get PermissionType of a specific user
     list = _permissionManager.GetPermissionTypesOfUser(loginEnity.UserCode);
     foreach (PermissionType tempType in list)
     {
         // Find all permissions need to be sent to client
         permissionList = _permissionManager.GetPermissions(loginEnity, tempType, MBSDateConverter.ConvertTimeToString(lastUpdatedTime), out downloadUpdateTime);
         // Insert all permissions into resultList sorted by PermissionCreateTime
         // Trunk resultList by maxNewDownloadNumber
     }
 }
Beispiel #3
0
        // SyncPermissionToServer()
        public int SyncPermissionToServer(string permissionID, DateTime actionTime, PERMISSION_STATE targetStateCode, LoginObjectEntity actionUser, out PERMISSION_STATE finalStateCode)
        {
            // Get permission from DB
            PermissionEntity entity = _permissionEntityDAO.Get(permissionID);

            // Get STATUS_CODE from T_PERMISSION_STATUS, which
            // - PermissionTypeID = permission.PermissionTypeID
            // - PermissionStatusCode = targetStateCode
            GetFormCodeFromPermissionStatus(entity, targetStateCode, out targetFormCode);

            // If the permission has been updated by ERP server, update finalStateCode as ERP server
            if (entity.ToStatusCode.Trim() != string.Empty)
            {
                finalStateCode = (PERMISSION_STATE)entity.PermissionState;
                return 1;
            }

            // Process one permission (communicate with ERP)
            // Below is the fake code in test
            IFormDataAccessor tempDataAccessor = GetFormDataAccessor(entity.FormCode);
            tempDataAccessor.SyncPermissionToServer(entity, ref actionTime, targetFormCode, ref actionUserCode, out finalFormCode, out actionSystemCode)

            // Update permission
            entity.FormUpdateTime = MBSDateConverter.ConvertTimeToString(actionTime);
            entity.PermissionUpdateTime = MBSDateConverter.ConvertTimeToString(actionTime);
            entity.FormStatusCode = finalFormCode;
            entity.ToStatusCode = finalFormCode;
            entity.PermissionState = (decimal)finalStateCode;

            // Update process result into DB
            _permissionEntityDAO.Update(entity, wrapper.Transaction);

            // Scan ERP if it has more permission waiting for process
            // TODO: confirmed with Long
            // Usually, after one permission is confirmed by ERP, we need query
            // ERP DB again to get the new permission.
            // Now, we generate it automatically.
            UpdateNextPermission(entity, wrapper.Transaction);
        }
Beispiel #4
0
 // PermissionSyncFromServer()
 //
 public IList<PermissionEntity> PermissionSyncFromServer(LoginObjectEntity loginEnity, DateTime lastUpdatedTime, out DateTime newUpdateTime)
 {
     // Get PermissionType of a specific user
     list = _permissionManager.GetPermissionTypesOfUser(loginEnity.UserCode);
     foreach (PermissionType tempType in list)
     {
         // Find all permissions updated by server after lastUpdatedTime
         permissionList = _permissionManager.SyncPermissions(loginEnity, tempType, MBSDateConverter.ConvertTimeToString(lastUpdatedTime), out downloadUpdateTime);
         resultList.AddRange(permissionList);
     }
 }
Beispiel #5
0
        // GetPermissions()
        // -
        public IList<PermissionEntity> GetPermissions(LoginObjectEntity loginEnity, PermissionType permissionType, String startTime, out string endTime)
        {
            // Get IPermissionManager according to PersonSelectCode
            IPermissionManager temp = GetPermissionManager(permissionType.PersonSelectCode);
            {
                IPermissionManager temp = PermissionManagerFactory.GetPermissionManager(code);
                _dic.Add(code, temp);
            }

            // get PermissionEntity list
            resultList = temp.GetPermissions(loginEnity.UserCode, permissionType, startTime, out endTime);
            // get PermissionForm
            tempDAO = GetFormDataAccessor(permissionEntity.FormCode);

            return resultList;
        }