/// <summary>
        /// Create XML for approval sent by supervisor.
        /// </summary>
        /// <param name="personNumber">PersonNumber who sent time off request.</param>
        /// <param name="reqId">RequestId for which approval needs to be done.</param>
        /// <param name="command">Command String.</param>
        /// <param name="querySpan">Query Span.</param>
        /// <param name="comment">Selected comment.</param>
        /// <param name="note">Note entered while approving request.</param>
        /// <returns>Approval request.</returns>
        public string CreateApprovalRequest(string personNumber, string reqId, string command, string querySpan, string comment, string note)
        {
            var status = command == Constants.ApproveTimeoff ? Constants.Approved.ToUpper() : Constants.Refused.ToUpper();

            RequestManagement.Request rq = new RequestManagement.Request()
            {
                Action      = ApiConstants.UpdateStatus,
                RequestMgmt = new RequestManagement.RequestMgmt()
                {
                    Employees = new RequestManagement.Employee()
                    {
                        PersonIdentity = new RequestManagement.PersonIdentity()
                        {
                            PersonNumber = personNumber
                        }
                    },
                    QueryDateSpan        = querySpan,
                    RequestStatusChanges = new RequestManagement.RequestStatusChanges {
                        RequestStatusChange = new System.Collections.Generic.List <RequestManagement.RequestStatusChange>()
                    },
                },
            };

            List <Comment> cmt = null;

            if (!string.IsNullOrEmpty(note))
            {
                cmt = new List <Comment>
                {
                    new Comment {
                        CommentText = comment, Notes = new Notes {
                            Note = new Note {
                                Text = note
                            }
                        }
                    },
                };
            }

            rq.RequestMgmt.RequestStatusChanges.RequestStatusChange.Add(new RequestManagement.RequestStatusChange {
                RequestId = reqId, ToStatusName = status, Comments = new Comments {
                    Comment = cmt
                }
            });

            return(rq.XmlSerialize());
        }
Beispiel #2
0
        public string CreateSwapShiftSubmitRequest(string personNumber, string reqId, string querySpan, string comment)
        {
            var status = Constants.Offered.ToUpper();

            RequestManagement.Request rq = new RequestManagement.Request()
            {
                Action      = ApiConstants.UpdateStatus,
                RequestMgmt = new RequestManagement.RequestMgmt()
                {
                    Employees = new RequestManagement.Employee()
                    {
                        PersonIdentity = new RequestManagement.PersonIdentity()
                        {
                            PersonNumber = personNumber
                        }
                    },
                    QueryDateSpan        = querySpan,
                    RequestStatusChanges = new RequestManagement.RequestStatusChanges {
                        RequestStatusChange = new System.Collections.Generic.List <RequestManagement.RequestStatusChange>()
                    }
                }
            };

            List <Comment> cmt = null;

            if (!string.IsNullOrEmpty(comment))
            {
                cmt = new List <Comment>
                {
                    new Comment {
                        CommentText = "Other reason", Notes = new Notes {
                            Note = new Note {
                                Text = comment
                            }
                        }
                    }
                };
            }

            rq.RequestMgmt.RequestStatusChanges.RequestStatusChange.Add(new RequestManagement.RequestStatusChange {
                RequestId = reqId, ToStatusName = status, Comments = new Comments {
                    Comment = cmt
                }
            });

            return(rq.XmlSerialize());
        }