Пример #1
0
        /// <summary>
        /// Get activity 
        /// </summary>
        /// <param name="activityId"></param>
        /// <returns></returns>
        public void GetActivity(string activityId, ActivityServiceDelegate activityCallback)
        {

            _log.Debug("Enter - GetActivity()");
            if (activityId == null || activityId.Trim().Equals("") || activityCallback == null)
                return;
            var backgroundService = new ToaBackgroundServiceUtil();
            /*backgroundService.RunAsync(() =>
                { */
                    try
                    {
                        var activityModel = new WorkOrderModel();
                        var getActivityParam = new get_activity_parameters();
                        getActivityParam.activity_id = activityId;
                        getActivityParam.user = ToaUserUtil.GetActivityUser();
                        activity_response response = _activityClient.get_activity(getActivityParam);

                        // initialize  toa result and activity model object
                        var toaRequestResult = new ToaRequestResult();
                        toaRequestResult.DataModels.Add(activityModel);

                        activityCallback.Invoke(toaRequestResult);
                        
                    }
                    catch(Exception exception)
                    {
                        // Todo: logg exception
                    }
                     
                /*});*/
            _log.Debug("Exit - GetActivity()");
        }
Пример #2
0
        /// <summary>
        /// Get activity
        /// </summary>
        /// <param name="activityId"></param>
        /// <returns></returns>
        public void GetActivity(string activityId, ActivityServiceDelegate activityCallback)
        {
            _log.Debug("Enter - GetActivity()");
            if (activityId == null || activityId.Trim().Equals("") || activityCallback == null)
            {
                return;
            }
            var backgroundService = new ToaBackgroundServiceUtil();

            /*backgroundService.RunAsync(() =>
             *  { */
            try
            {
                var activityModel    = new WorkOrderModel();
                var getActivityParam = new get_activity_parameters();
                getActivityParam.activity_id = activityId;
                getActivityParam.user        = ToaUserUtil.GetActivityUser();
                activity_response response = _activityClient.get_activity(getActivityParam);

                // initialize  toa result and activity model object
                var toaRequestResult = new ToaRequestResult();
                toaRequestResult.DataModels.Add(activityModel);

                activityCallback.Invoke(toaRequestResult);
            }
            catch (Exception exception)
            {
                // Todo: logg exception
            }

            /*});*/
            _log.Debug("Exit - GetActivity()");
        }