Esempio n. 1
0
        public void SyncActivityQueryUsingoAuth()
        {
            QueryService <SyncActivity> entityQuery = new QueryService <SyncActivity>(qboContextoAuth);
            SyncActivity        existing            = Helper.FindOrAdd <SyncActivity>(qboContextoAuth, new SyncActivity());
            List <SyncActivity> entities            = entityQuery.ExecuteIdsQuery("Select * from Customer where Id='" + existing.Id + "'").ToList();

            Assert.IsTrue(entities.Count() > 0);
        }
Esempio n. 2
0
        public void SyncActivityQueryUsingoAuth()
        {
            QueryService <SyncActivity> entityQuery = new QueryService <SyncActivity>(qboContextoAuth);
            SyncActivity        existing            = Helper.FindOrAdd <SyncActivity>(qboContextoAuth, new SyncActivity());
            List <SyncActivity> entities            = entityQuery.Where(c => c.Id == existing.Id).ToList();

            Assert.IsTrue(entities.Count() > 0);
        }
Esempio n. 3
0
        public void SyncActivityVoidAsyncTestsUsingoAuth()
        {
            //Creating the SyncActivity for Adding
            SyncActivity entity = QBOHelper.CreateSyncActivity(qboContextoAuth);
            //Adding the SyncActivity
            SyncActivity added = Helper.Add <SyncActivity>(qboContextoAuth, entity);

            Helper.VoidAsync <SyncActivity>(qboContextoAuth, added);
        }
Esempio n. 4
0
        public void SyncActivityAddAsyncTestsUsingoAuth()
        {
            //Creating the SyncActivity for Add
            SyncActivity entity = QBOHelper.CreateSyncActivity(qboContextoAuth);

            SyncActivity added = Helper.AddAsync <SyncActivity>(qboContextoAuth, entity);

            QBOHelper.VerifySyncActivity(entity, added);
        }
Esempio n. 5
0
        public void SyncActivityFindbyIdTestUsingoAuth()
        {
            //Creating the SyncActivity for Adding
            SyncActivity syncActivity = QBOHelper.CreateSyncActivity(qboContextoAuth);
            //Adding the SyncActivity
            SyncActivity added = Helper.Add <SyncActivity>(qboContextoAuth, syncActivity);
            SyncActivity found = Helper.FindById <SyncActivity>(qboContextoAuth, added);

            QBOHelper.VerifySyncActivity(found, added);
        }
Esempio n. 6
0
        public void SyncActivityAddTestUsingoAuth()
        {
            //Creating the SyncActivity for Add
            SyncActivity syncActivity = QBOHelper.CreateSyncActivity(qboContextoAuth);
            //Adding the SyncActivity
            SyncActivity added = Helper.Add <SyncActivity>(qboContextoAuth, syncActivity);

            //Verify the added SyncActivity
            QBOHelper.VerifySyncActivity(syncActivity, added);
        }
        public IDisposable GetTaskFrame(SyncActivity activity)
        {
            PublicFolderActivityPerformanceTracker publicFolderActivityPerformanceTracker;

            if (!this.performanceTrackers.TryGetValue(activity, out publicFolderActivityPerformanceTracker))
            {
                publicFolderActivityPerformanceTracker = new PublicFolderActivityPerformanceTracker(activity, this.FolderOperationCounter, this.SyncStateCounter, this.MRSProxyLatencyInfo, this.transientRetryDelayTracker);
                this.performanceTrackers[activity]     = publicFolderActivityPerformanceTracker;
            }
            return(new PublicFolderPerformanceLogger.TaskFrame(activity, publicFolderActivityPerformanceTracker));
        }
 public PublicFolderActivityPerformanceTracker(SyncActivity trackedActivity, FolderOperationCounter folderOperationCounter, SyncStateCounter syncStateCounter, LatencyInfo mrsProxyLatencyInfo, PerformanceDataProvider transientRetryDelayTracker)
 {
     ArgumentValidator.ThrowIfNull("folderOperationCounter", folderOperationCounter);
     ArgumentValidator.ThrowIfNull("syncStateCounter", syncStateCounter);
     ArgumentValidator.ThrowIfNull("mrsProxyLatencyInfo", mrsProxyLatencyInfo);
     ArgumentValidator.ThrowIfNull("transientRetryDelayTracker", transientRetryDelayTracker);
     this.folderOperationCounter     = folderOperationCounter;
     this.syncStateCounter           = syncStateCounter;
     this.transientRetryDelayTracker = transientRetryDelayTracker;
     this.trackedActivity            = trackedActivity;
     this.mrsProxyLatencyInfo        = mrsProxyLatencyInfo;
 }
            public TaskFrame(SyncActivity activity, PublicFolderActivityPerformanceTracker performanceTracker)
            {
                IActivityScope currentActivityScope = ActivityContext.GetCurrentActivityScope();

                if (currentActivityScope != null)
                {
                    this.previousActionDescription = currentActivityScope.Action;
                    currentActivityScope.Action    = activity.ToString();
                }
                this.performanceTracker = performanceTracker;
                this.performanceTracker.Start();
            }
Esempio n. 10
0
        public void SyncActivityUpdateTestUsingoAuth()
        {
            //Creating the SyncActivity for Adding
            SyncActivity syncActivity = QBOHelper.CreateSyncActivity(qboContextoAuth);
            //Adding the SyncActivity
            SyncActivity added = Helper.Add <SyncActivity>(qboContextoAuth, syncActivity);
            //Change the data of added entity
            SyncActivity changed = QBOHelper.UpdateSyncActivity(qboContextoAuth, added);
            //Update the returned entity data
            SyncActivity updated = Helper.Update <SyncActivity>(qboContextoAuth, changed);//Verify the updated SyncActivity

            QBOHelper.VerifySyncActivity(changed, updated);
        }
Esempio n. 11
0
        public void SyncActivityUpdatedAsyncTestsUsingoAuth()
        {
            //Creating the SyncActivity for Adding
            SyncActivity entity = QBOHelper.CreateSyncActivity(qboContextoAuth);
            //Adding the SyncActivity
            SyncActivity added = Helper.Add <SyncActivity>(qboContextoAuth, entity);

            //Update the SyncActivity
            SyncActivity updated = QBOHelper.UpdateSyncActivity(qboContextoAuth, added);
            //Call the service
            SyncActivity updatedReturned = Helper.UpdateAsync <SyncActivity>(qboContextoAuth, updated);

            //Verify updated SyncActivity
            QBOHelper.VerifySyncActivity(updated, updatedReturned);
        }
Esempio n. 12
0
        public void SyncActivityVoidTestUsingoAuth()
        {
            //Creating the entity for Adding
            SyncActivity entity = QBOHelper.CreateSyncActivity(qboContextoAuth);
            //Adding the entity
            SyncActivity added = Helper.Add <SyncActivity>(qboContextoAuth, entity);

            //Void the returned entity
            try
            {
                SyncActivity voided = Helper.Void <SyncActivity>(qboContextoAuth, added);
                Assert.AreEqual(EntityStatusEnum.Voided, voided.status);
            }
            catch (IdsException ex)
            {
                Assert.Fail();
            }
        }
Esempio n. 13
0
        public void SyncActivityDeleteTestUsingoAuth()
        {
            //Creating the SyncActivity for Adding
            SyncActivity syncActivity = QBOHelper.CreateSyncActivity(qboContextoAuth);
            //Adding the SyncActivity
            SyncActivity added = Helper.Add <SyncActivity>(qboContextoAuth, syncActivity);

            //Delete the returned entity
            try
            {
                SyncActivity deleted = Helper.Delete <SyncActivity>(qboContextoAuth, added);
                Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status);
            }
            catch (IdsException ex)
            {
                Assert.Fail();
            }
        }
Esempio n. 14
0
        public void SyncActivityBatchUsingoAuth()
        {
            Dictionary <OperationEnum, object> batchEntries = new Dictionary <OperationEnum, object>();

            SyncActivity existing = Helper.FindOrAdd(qboContextoAuth, new SyncActivity());

            batchEntries.Add(OperationEnum.create, QBOHelper.CreateSyncActivity(qboContextoAuth));

            batchEntries.Add(OperationEnum.update, QBOHelper.UpdateSyncActivity(qboContextoAuth, existing));

            batchEntries.Add(OperationEnum.query, "select * from SyncActivity");

            batchEntries.Add(OperationEnum.delete, existing);

            ReadOnlyCollection <IntuitBatchResponse> batchResponses = Helper.BatchTest <SyncActivity>(qboContextoAuth, batchEntries);

            int position = 0;

            foreach (IntuitBatchResponse resp in batchResponses)
            {
                if (resp.ResponseType == ResponseType.Exception)
                {
                    Assert.Fail(resp.Exception.ToString());
                }

                if (resp.ResponseType == ResponseType.Entity)
                {
                    Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as SyncActivity).Id));
                }
                else if (resp.ResponseType == ResponseType.Query)
                {
                    Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0);
                }
                else if (resp.ResponseType == ResponseType.CdcQuery)
                {
                    Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0);
                }

                position++;
            }
        }
Esempio n. 15
0
        private void LongAction(object state)
        {
            object[]      array    = state as object[];
            SessionHelper h        = (SessionHelper)array[0];
            int           activity = Convert.ToInt32(array[1]);



            _emp = new EmployeeService(new EmployeeRepository(), h);
            LoanTrackingService    _lt = new LoanTrackingService(new LoanTrackingRepository(), h);
            LeaveManagementService _lm = new LeaveManagementService(h, new LeaveManagementRepository());
            TimeAttendanceService  _ta = new TimeAttendanceService(h, new TimeAttendanceRepository());
            AssetManagementService _am = new AssetManagementService(new AssetManagementRepository(), h);

            _system = new SystemService(new SystemRepository(), h);
            _help   = new HelpFunctionService(new HelpFunctionRepository(), h);


            try
            {
                SyncActivity SA = new SyncActivity();
                SA.startDate = startingDate.SelectedDate;
                SA.endDate   = endingDate.SelectedDate;

                PostRequest <SyncActivity> req = new PostRequest <SyncActivity>();
                req.entity = SA;
                PostResponse <SyncActivity> resp = new PostResponse <SyncActivity>();

                switch (activity)
                {
                case 1:
                    resp = _ta.ChildAddOrUpdate <SyncActivity>(req);
                    break;

                case 2:
                    resp = _lm.ChildAddOrUpdate <SyncActivity>(req);
                    break;

                case 3:
                    resp = _lm.ChildAddOrUpdate <SyncActivity>(req);
                    break;

                case 4:
                    resp = _lt.ChildAddOrUpdate <SyncActivity>(req);
                    break;

                case 5:
                    resp = _emp.ChildAddOrUpdate <SyncActivity>(req);
                    break;

                case 6:
                    resp = _am.ChildAddOrUpdate <SyncActivity>(req);
                    break;
                }


                if (!resp.Success)
                {
                    HttpRuntime.Cache.Insert("ErrorMsgSync", resp.Error);
                    HttpRuntime.Cache.Insert("LogIdMsgSync", resp.LogId);
                }



                HttpRuntime.Cache.Insert("syncAC_RecordId", resp.recordId);
            }

            catch (Exception exp)
            {
                HttpRuntime.Cache.Insert("ExceptionMsgSync", exp.Message);
            }
        }