Exemplo n.º 1
0
        public ActionResult ExportYearSummaryToExcel(YearwiseLeaveSummaryQueryModel data, string RequestLevelPerson)
        {
            IList <EmployeeWiseLeaveSummaryModel> LeaveRequests = null;

            using (var client = new LeaveClient())
            {
                LeaveRequests = client.GetEmployeeWiseLeaveSumary(UserId, data.Year, RequestLevelPerson, data.SearchUserID, data.OnlyReportedToMe);
            }
            List <EmployeeWiseLeaveSummaryModel> excelData = new List <EmployeeWiseLeaveSummaryModel>();

            excelData = LeaveRequests.ToList();
            if (excelData.Count > 0)
            {
                string[] columns     = { "Emp Id", "Name", "Request Type", "Total Leaves", "Used Leaves", "Pending Approval", "Balance Leaves" };
                byte[]   filecontent = ExcelExportHelper.ExportExcelYearSummary(excelData, "", false, columns);
                return(File(filecontent, ExcelExportHelper.ExcelContentType, "LeaveBalanceReport_" + System.DateTime.Now + ".xlsx"));
            }
            else
            {
                using (var Client = new LeaveClient())
                {
                    var result = Client.GetYearsFromLeaveBalance();
                    ViewBag.YearsInLeaveBal = result;
                }
                ViewBag.RequestLevelPerson = RequestLevelPerson;
                data.ErrorMsg = "Excel file is not generated as no data returned.";
                return(View("ViewEmployeeWiseLeaveSummary", data));
            }
        }
Exemplo n.º 2
0
        public ActionResult LoadYearwiseLeaveSummary(int Year, string reqUsr, Int64?paramUserId, bool OnlyReportedToMe)
        {
            IList <EmployeeWiseLeaveSummaryModel> LeaveRequests = null;

            using (var client = new LeaveClient())
            {
                LeaveRequests = client.GetEmployeeWiseLeaveSumary(UserId, Year, reqUsr, paramUserId, OnlyReportedToMe);
            }
            return(PartialView("YearwiseSummaryPartial", LeaveRequests));
        }