private bool RegisterTimeClockOperation(TimeClockType registerTimeType, string method)
        {
            ReadOnlyCollection <object> containerArray = null;
            string workerId = ApplicationSettings.Terminal.TerminalOperator.OperatorId;
            string terminal = Convert.ToString(ApplicationSettings.Terminal.TerminalId);


            if (registerTimeType == TimeClockType.BreakFlowStart)
            {
                containerArray = PosApplication.Instance.TransactionServices.Invoke(
                    method, workerId, terminal, this.JobId);
            }
            else
            {
                containerArray = PosApplication.Instance.TransactionServices.Invoke(
                    method, workerId, terminal);
            }

            bool result = Convert.ToBoolean(containerArray[ResultIndex]);

            //if result is false then container array will have error message in [ErrorMessageIndex]=2
            //else container array will have last activity in [LastActivityIndex]=3
            if (!result)
            {
                this.LastActivity = containerArray[ErrorMessageIndex].ToString();
            }
            else
            {
                this.LastActivity = containerArray[LastActivityIndex].ToString();
            }

            return(result);
        }
Example #2
0
        private void TimeClockAccess(int message, TimeClockType operation)
        {
            bool result = viewModel.RegisterTimeClock(operation);

            ShowMessage(message, result);
            Close();
        }
Example #3
0
 private void OnConvertTimeClockStateClockOutToBool(object sender, ConvertEventArgs e)
 {
     if (e.DesiredType == typeof(bool))
     {
         TimeClockType status = (TimeClockType)e.Value;
         e.Value = !(status == TimeClockType.BreakFlowStart || status == TimeClockType.ClockOut);
     }
 }
Example #4
0
        private static TimeClockType ConvertToTimeClockType(int intValue)
        {
            TimeClockType enumValue = TimeClockType.None;

            if (Enum.IsDefined(typeof(TimeClockType), enumValue))
            {
                enumValue = (TimeClockType)(intValue);
            }

            return(enumValue);
        }
        private void GetActivity(string activity, TimeClockType timeClockType)
        {
            SqlConnection connection = ApplicationSettings.Database.LocalConnection;

            try
            {
                using (SqlCommand command = new SqlCommand())
                {
                    if (timeClockType == TimeClockType.BreakFlowStart)
                    {//this is to get activity message from db (DailyBrks/LunchBrk)
                        GetActivityMessage(command);
                        command.Parameters.AddWithValue("@JOBID", this.JobId);
                    }
                    else
                    {//this is to get JobId
                        GetQuery(command);
                        command.Parameters.AddWithValue("@ACTIVITY", activity);
                    }
                    command.Connection = connection;
                    command.Parameters.AddWithValue("@DATAAREAID", ApplicationSettings.Database.DATAAREAID);
                    if (connection.State != ConnectionState.Open)
                    {
                        connection.Open();
                    }
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            if (timeClockType == TimeClockType.BreakFlowStart)
                            {
                                this.BreakActivity = Convert.ToString(reader["ACTIVITY"]);
                            }
                            else
                            {
                                this.JobId = Convert.ToString(reader["JOBID"]);
                            }
                        }
                    }
                }
            }
            finally
            {
                if (connection.State == ConnectionState.Open)
                {
                    connection.Close();
                }
            }
        }
        /// <summary>
        /// Gets or sets the clockin\clockout
        /// </summary>
        /// <param name="registerTimeType">Time clock type.</param>
        /// <returns>Returns true if successful, false otherwise</returns>
        public bool RegisterTimeClock(TimeClockType registerTimeType)
        {
            string method = null;

            switch (registerTimeType)
            {
            case TimeClockType.ClockIn:
                method = "clockIn";
                break;

            case TimeClockType.ClockOut:
                method = "clockOut";
                break;
            }

            return(RegisterTimeClockOperation(registerTimeType, method));
        }
Example #7
0
        private static string TranslateTimeClockState(TimeClockType state)
        {
            string translatedText = null;

            switch (state)
            {
            case TimeClockType.ClockIn:
                translatedText = ApplicationLocalizer.Language.Translate(ClockInTextResourceId);
                break;

            case TimeClockType.ClockOut:
                translatedText = ApplicationLocalizer.Language.Translate(ClockOutTextResourceId);
                break;

            case TimeClockType.BreakFlowStart:
                translatedText = ApplicationLocalizer.Language.Translate(BreakForLunchTextResourceId);
                break;

            default:
                break;
            }

            return(translatedText ?? string.Empty);
        }