/// <summary>
 /// Save the object to dictionary
 /// </summary>
 /// <param name="controller"></param>
 /// <param name="syncObjects"></param>
 /// <returns></returns>
 internal Syncdto Save(object controller, Syncdto syncObjects)
 {
     syncController = controller as Controller;
     Random random = new Random();
     syncObjects.Id = random.Next(1,100);
     syncRepo.Add(syncObjects.Id, syncObjects);
     syncController.TempData["Sync"] = syncRepo;
     syncController.TempData.Keep();
     return syncObjects;
 }
Exemple #2
0
        /// <summary>
        /// Save the object to dictionary
        /// </summary>
        /// <param name="controller"></param>
        /// <param name="syncObjects"></param>
        /// <returns></returns>
        internal Syncdto Save(object controller, Syncdto syncObjects)
        {
            syncController = controller as Controller;
            Random random = new Random();

            syncObjects.Id = random.Next(1, 100);
            syncRepo.Add(syncObjects.Id, syncObjects);
            syncController.TempData["Sync"] = syncRepo;
            syncController.TempData.Keep();
            return(syncObjects);
        }
Exemple #3
0
        /// <summary>
        /// Sequence :
        /// -->Get Token
        /// -->Get data to be pushed to QBO
        /// -->Call the service
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns>RedirectToAction</returns>
        public ActionResult ServiceItem(Int64 id)
        {
            OAuthorizationdto oAuthDetails = new OAuthService(new OAuthorizationdto()).GetAccessToken(this);

            syncService            = new SyncService(oAuthDetails);
            syncObjects            = id > 0 ? syncService.GetSyncObjects(this, id) : new Syncdto();
            syncObjects.OauthToken = oAuthDetails;
            syncObjects.CompanyId  = oAuthDetails.Realmid;

            if (!syncService.IsServiceItemSync(syncObjects, syncService).IsServiceItemSync)
            {
                syncObjects = syncService.GetDatafromDBItem(syncObjects);
                if (syncObjects.ItemList.Count > 0)
                {
                    syncObjects = syncService.SyncServiceItems(this, syncObjects);
                }
            }
            return(RedirectToAction("Sync", "Home", new { id = syncObjects.Id, isConnected = oAuthDetails.IsConnected }));
        }
        public ActionResult Load(Int64 id)
        {
            Syncdto syncDetails = id > 0 ? new SyncRepository().Get(this, id) : new Syncdto();

            timeActivity.oAuthTokens  = syncDetails.OauthToken;
            timeActivity.Syncdto      = syncDetails;
            timeActivity.EmployeeList = syncDetails.EmployeeList;
            timeActivity.CustomerList = syncDetails.CustomerList;
            timeActivity.ItemList     = syncDetails.ItemList;
            timeActivityService       = new TimeActivityService(timeActivity);
            timeActivity           = timeActivityService.LoaddropdownList(timeActivity);
            timeActivity.CompanyId = timeActivity.oAuthTokens.Realmid;
            timeActivityRepository = new TimeActivityRepository();
            timeActivityRepository.Save(this, timeActivity);
            multiplemodels = new Multiplemodels();
            multiplemodels.TimeActivityModel = timeActivity;
            multiplemodels.SyncObjectsModel  = syncDetails;
            multiplemodels.IsConnected       = syncDetails.OauthToken.IsConnected;
            multiplemodels.IsReadytoInvoice  = true;
            return(View("TimeActivity", multiplemodels));
        }