예제 #1
0
        public ActionResult NoOfLateReportRpt()
        {
            DaywiseLeaveQueryModel mdl = new DaywiseLeaveQueryModel();

            ViewBag.RequestLevelPerson = "Admin";
            mdl.OnlyReportedToMe       = true;
            mdl.DonotShowRejected      = true;
            return(View("NoOfLateReportRpt", mdl));
        }
예제 #2
0
        public ActionResult TeamDaywiseLeaves()
        {
            DaywiseLeaveQueryModel mdl = new DaywiseLeaveQueryModel();

            ViewBag.RequestLevelPerson = "Team";
            mdl.OnlyReportedToMe       = true;
            mdl.DonotShowRejected      = true;
            return(View("DaywiseLeaveDateRangeView", mdl));
        }
예제 #3
0
        public ActionResult ExportToExcel(DaywiseLeaveQueryModel data, string RequestLevelPerson)
        {
            IList <DaywiseLeaveDtlModel> LeaveRequests = null;
            string   startDate          = data.DateRange.Substring(0, 10);
            string   endDate            = data.DateRange.Substring(12);
            DateTime?startDateFormatted = null;
            DateTime?endDateFormatted   = null;

            if (startDate != "")
            {
                try
                {
                    startDateFormatted = DateTime.Parse(startDate, new CultureInfo("en-GB", true));
                    endDateFormatted   = DateTime.Parse(endDate, new CultureInfo("en-GB", true));
                }
                catch (Exception)
                {
                    throw;
                }
            }
            using (var client = new LeaveClient())
            {
                LeaveRequests = client.GetDaywiseLeaveDtl(startDateFormatted, endDateFormatted, data.IsLeaveOnly, UserId, data.OnlyReportedToMe, data.SearchUserID, RequestLevelPerson, data.DonotShowRejected);
            }
            List <DaywiseLeaveDtlModel> excelData = new List <DaywiseLeaveDtlModel>();

            excelData = LeaveRequests.ToList();
            if (excelData.Count > 0)
            {
                string[] columns     = { "Emp Id", "Name", "Request Type", "Leave Balance", "Request Date", "Part Of Day", "Duration", "Status", "Reason", "Approver Comments" };
                byte[]   filecontent = ExcelExportHelper.ExportExcel(excelData, "", false, columns);
                return(File(filecontent, ExcelExportHelper.ExcelContentType, "DaywiseReport_" + System.DateTime.Now + ".xlsx"));
            }
            else
            {
                ViewBag.RequestLevelPerson = RequestLevelPerson;
                data.ErrorMsg = "Excel file is not generated as no data returned.";
                return(View("DaywiseLeaveDateRangeView", data));
            }
        }