Пример #1
0
        public ListLeavesResponse ListLeavesByEmployee(int maximumRows       = 10, int startRowIndex = 1,
                                                       string sortExpression = null, string employee = null, LeaveCategories?category = null,
                                                       LeaveStatuses?status  = null)
        {
            int totalRowCount = 0;
            var response      = new ListLeavesResponse();

            try
            {
                LeaveComponent bc = new LeaveComponent();
                response.Leaves = bc.ListLeavesByEmployee(maximumRows, startRowIndex, sortExpression,
                                                          employee, category, status, out totalRowCount);
                response.TotalRowCount = totalRowCount;
            }
            catch (Exception ex)
            {
                // Repack to Http error.
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422, // Unprocessable Entity
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }

            return(response);
        }
Пример #2
0
        /// <summary>
        /// Calls the ListLeavesByEmployee business method of the LeaveComponent.
        /// </summary>
        /// <param name="maximumRows"> A maximumRows value.</param>
        /// <param name="startRowIndex"> A startRowIndex value.</param>
        /// <param name="sortExpression"> A sortExpression value.</param>
        /// <param name="employee"> A employee value.</param>
        /// <param name="category"> A category value.</param>
        /// <param name="status"> A status value.</param>
        /// <param name="int"> A int value.</param>
        /// <returns>Returns a List<Leave> object.</returns>
        public List <Leave> ListLeavesByEmployee(int maximumRows, int startRowIndex,
                                                 string sortExpression, string employee, LeaveCategories?category,
                                                 LeaveStatuses?status, out int totalRowCount)
        {
            LeaveComponent bc = new LeaveComponent();

            return(bc.ListLeavesByEmployee(maximumRows, startRowIndex, sortExpression,
                                           employee, category, status, out totalRowCount));
        }
Пример #3
0
        protected override void Execute(CodeActivityContext context)
        {
            // Argument initialization (if any).
            Leave leave = context.GetValue(this.Leave);

            // Instantiate business components.
            LeaveComponent leaveComponent = new LeaveComponent();

            // Call business component methods.
            leave = leaveComponent.Approve(leave);

            // Set value to Out arguments (if any).
            context.SetValue(this.Leave, leave);
        }
Пример #4
0
        //[Route("{action}/{maximumRows}/{startRowIndex}sortExpression={sortExpression}&employee={employee}&category={category=}&status={status=}")]
        public ListLeavesResponse ListLeavesByEmployee(int maximumRows, int startRowIndex,
                                                       string sortExpression, string employee, LeaveCategories?category,
                                                       LeaveStatuses?status)
        {
            int totalRowCount = 0;
            var response      = new ListLeavesResponse();

            LeaveComponent bc = new LeaveComponent();

            response.Leaves = bc.ListLeavesByEmployee(maximumRows, startRowIndex, sortExpression,
                                                      employee, category, status, out totalRowCount);
            response.TotalRowCount = totalRowCount;

            return(response);
        }
Пример #5
0
        public Leave GetLeaveById(long leaveID)
        {
            Leave result = null;

            try
            {
                LeaveComponent bc = new LeaveComponent();
                result = bc.GetLeaveById(leaveID);
            }
            catch (Exception ex)
            {
                // Repack to Http error.
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422, // Unprocessable Entity
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }

            return(result);
        }
Пример #6
0
        /// <summary>
        /// Calls the GetLeaveById business method of the LeaveComponent.
        /// </summary>
        /// <param name="leaveID"> A leaveID value.</param>
        /// <returns>Returns a Leave object.</returns>
        public Leave GetLeaveById(long leaveID)
        {
            LeaveComponent bc = new LeaveComponent();

            return(bc.GetLeaveById(leaveID));
        }
Пример #7
0
        /// <summary>
        /// Calls the ListLogsByLeave business method of the LeaveComponent.
        /// </summary>
        /// <param name="leaveID"> A leaveID value.</param>
        /// <returns>Returns a List<LeaveStatusLog> object.</returns>
        public List <LeaveStatusLog> ListLogsByLeave(long leaveID)
        {
            LeaveComponent bc = new LeaveComponent();

            return(bc.ListLogsByLeave(leaveID));
        }