Exemplo n.º 1
0
        public static string GetStringValue(this ActivityEnum value)
        {
            switch (value)
            {
            case ActivityEnum.NULL:
                return(" ");

            case ActivityEnum.Very_Low:
                return("Very Low");

            case ActivityEnum.Low:
                return("Low");

            case ActivityEnum.High:
                return("High");

            case ActivityEnum.Very_High:
                return("Very High");

            case ActivityEnum.Intense:
                return("Intense");

            default:
                return(" ");
            }
        }
Exemplo n.º 2
0
        public bool AddQuizzCommentActivity(ActivityEnum type, int quizzId, int quizzCommentId, bool callSaveChanges = true)
        {
            try
            {
                var activity = new Activity
                {
                    PostedDate     = DateTime.UtcNow,
                    ActivityType   = type,
                    OwnerId        = _currentUser.Id,
                    QuizzId        = quizzId,
                    QuizzCommentId = quizzCommentId,
                    TestLogId      = 1,
                    QuestionId     = 1,
                };

                _uow.Activities.Add(activity);
                if (callSaveChanges)
                {
                    _uow.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                _svcContainer.LoggingSvc.Log(ex);
                return(false);
            }
        }
Exemplo n.º 3
0
 public LogDO Constructor(
     uint? table,
     uint? cpr,
     ActivityEnum? activity
 )
 {
     LogDO target = new LogDO(table, cpr, activity);
     return target;
     // TODO: add assertions to method LogDOTest.Constructor(Nullable`1<UInt32>, Nullable`1<UInt32>, Nullable`1<ActivityEnum>)
 }
Exemplo n.º 4
0
 public void ShowActivity(ActivityEnum activity)
 {
     if (ActivityEnum.Allowed.Equals(activity))
     {
         ToggleLightsTask(GreenLight, 200);
     }
     else
     {
         ToggleLightsTask(RedLight, 200);
     }
 }
Exemplo n.º 5
0
 public void ShowActivity(ActivityEnum activity)
 {
     if (ActivityEnum.Allowed.Equals(activity))
     {
         GreenTurnOn();
     }
     else
     {
         RedTurnOn();
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Updates the log with activity registered for the current voter
 /// </summary>
 /// <param name="ae">The activity to be logged</param>
 private void UpdateLog(ActivityEnum ae)
 {
     try
     {
         //Create the log DAO with setup information, activity and current voter.
         var ldo  = new LogDO(setupInfo.TableNo, currentVoter.PrimaryKey, ae);
         var ldao = new LogDAO(DigitalVoterList.GetInstanceFromServer(setupInfo.Ip));
         ldao.Create(ldo);
     }
     catch (Exception)
     {
         ConnectionError();
     }
 }
Exemplo n.º 7
0
        private double CalculateTotalCalories(ActivityEnum activity, double bmr)
        {
            switch (activity)
            {
            case ActivityEnum.Sedentary:
                return(bmr * 1.53);

            case ActivityEnum.Moderate:
                return(bmr * 1.76);

            case ActivityEnum.Vigorous:
                return(bmr * 2.25);

            default:
                throw new Exception("Argument exception!");
            }
        }
Exemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GetIndustrySystemsCostIndice" /> class.
 /// </summary>
 /// <param name="Activity">activity string (required).</param>
 /// <param name="CostIndex">cost_index number (required).</param>
 public GetIndustrySystemsCostIndice(ActivityEnum Activity = default(ActivityEnum), float?CostIndex = default(float?))
 {
     // to ensure "Activity" is required (not null)
     if (Activity == null)
     {
         throw new InvalidDataException("Activity is a required property for GetIndustrySystemsCostIndice and cannot be null");
     }
     else
     {
         this.Activity = Activity;
     }
     // to ensure "CostIndex" is required (not null)
     if (CostIndex == null)
     {
         throw new InvalidDataException("CostIndex is a required property for GetIndustrySystemsCostIndice and cannot be null");
     }
     else
     {
         this.CostIndex = CostIndex;
     }
 }
Exemplo n.º 9
0
        /// <summary>
        /// log information of event
        /// </summary>
        /// <param name="userName">user name for the one who did the event</param>
        /// <param name="activity">activity enum describe what the event do</param>
        /// <param name="pageName">page name that the event occurred in</param>
        /// <param name="objectName">object name that the event occurred on</param>
        public void LogInfoEvent(string userName, ActivityEnum activity, string pageName, string objectName)
        {
            string msg = "";

            switch (activity)
            {
            case ActivityEnum.Add:
                msg = "has added new";
                break;

            case ActivityEnum.Update:
                msg = "has updated";
                break;

            case ActivityEnum.Delete:
                msg = "has deleted";
                break;

            case ActivityEnum.Approve:
                msg = "has approved";
                break;

            case ActivityEnum.Reject:
                msg = "has rejected";
                break;

            case ActivityEnum.Submitted:
                msg = "has submitted";
                break;

            default: break;
            }
            string objectMsg = "";

            if (!string.IsNullOrEmpty(objectName))
            {
                objectMsg = $"with name '{objectName}'";
            }
            _logger.LogInformation($"User '{userName}'  {msg} {pageName} {objectMsg}");
        }
Exemplo n.º 10
0
 public ActivityEventArgs(ActivityEnum activity, CurrentConn currentConnection)
 {
     Activity          = activity;
     CurrentConnection = currentConnection;
 }
 /// <summary>
 /// Returns a value indicating whether the specified user has been granted the given activity
 /// </summary>
 /// <param name="userId">The user to check for.</param>
 /// <param name="activity">The <see cref="IActivityId"/> to check for.</param>
 /// <returns><b>true</b> if the specified user has been granted the given activity otherwise, <b>false</b>.</returns>
 public bool IsAuthorized(string userId, ActivityEnum activity)
 {
     // Of course you are authorized
     return(true);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 public LogDO(uint? table, uint? cpr, ActivityEnum? activity)
 {
     this.Table = table;
     this.Cpr = cpr;
     this.Activity = activity;
 }
Exemplo n.º 13
0
 /// <summary>
 /// Updates the log with activity registered for the current voter
 /// </summary>
 /// <param name="ae">The activity to be logged</param>
 private void UpdateLog(ActivityEnum ae)
 {
     try
     {
         //Create the log DAO with setup information, activity and current voter.
         var ldo = new LogDO(setupInfo.TableNo, currentVoter.PrimaryKey, ae);
         var ldao = new LogDAO(DigitalVoterList.GetInstanceFromServer(setupInfo.Ip));
         ldao.Create(ldo);
     }
     catch (Exception)
     {
         ConnectionError();
     }
 }