Esempio n. 1
0
        public ActionResult ViewLeaveHistory(bool OnlyReportedToMe, string FromDate, string ToDate, bool IsLeaveOnly, Int64?paramUserId, string RequestMenuUser)
        {
            DateTime?startDateFormatted = null;
            DateTime?endDateFormatted   = null;

            if (FromDate != "")
            {
                try
                {
                    startDateFormatted = DateTime.Parse(FromDate, new CultureInfo("en-GB", true));
                    endDateFormatted   = DateTime.Parse(ToDate, new CultureInfo("en-GB", true));
                }
                catch (Exception)
                {
                    throw;
                }
            }
            if (FromDate == "" || ToDate == "")
            {
                startDateFormatted = System.DateTime.Now.Date;
                endDateFormatted   = System.DateTime.Now.Date;
            }
            ManageTeamLeavesQueryModel qryMdl = new ManageTeamLeavesQueryModel
            {
                OnlyReportedToMe = OnlyReportedToMe,
                FromDate         = startDateFormatted,
                ToDate           = endDateFormatted,
                RequestMenuUser  = RequestMenuUser,
                IsLeaveOnly      = IsLeaveOnly,
                SearchUserID     = paramUserId
            };
            IList <TeamLeaves> LeaveRequests = null;

            qryMdl.LeadId = UserId;
            using (var client = new LeaveClient())
            {
                LeaveRequests = client.GetTeamLeaveHistory(qryMdl);
            }
            return(PartialView("TeamHistoryDetailPartial", LeaveRequests));
        }