示例#1
0
        public ActionResult ExportMonthCountToExcel(YearwiseLeaveSummaryQueryModel data, string RequestLevelPerson)
        {
            IList <MonthwiseLeavesCountModel> LeaveRequests = null;

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

            excelData = LeaveRequests.ToList();
            if (excelData.Count > 0)
            {
                string[] columns     = { "EmpId", "Name", "CL1", "PL1", "DL1", "LWP1", "CO1", "CL2", "PL2", "DL2", "LWP2", "CO2", "CL3", "PL3", "DL3", "LWP3", "CO3", "CL4", "PL4", "DL4", "LWP4", "CO4", "CL5", "PL5", "DL5", "LWP5", "CO5", "CL6", "PL6", "DL6", "LWP6", "CO6", "CL7", "PL7", "DL7", "LWP7", "CO7", "CL8", "PL8", "DL8", "LWP8", "CO8", "CL9", "PL9", "DL9", "LWP9", "CO9", "CL10", "PL10", "DL10", "LWP10", "CO10", "CL11", "PL11", "DL11", "LWP11", "CO11", "CL12", "PL12", "DL12", "LWP12", "CO12" };
                byte[]   filecontent = ExcelExportHelper.ExportExcelMonthSummary(excelData, data.Year, "", false, columns);
                return(File(filecontent, ExcelExportHelper.ExcelContentType, "MonthwiseReport_" + 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("MonthwiseLeaveCount", data));
            }
        }
示例#2
0
        public ActionResult LoadMonthWiseLeaveCount(int Year, string reqUsr, Int64?paramUserId, bool OnlyReportedToMe)
        {
            IList <MonthwiseLeavesCountModel> LeaveRequests = null;

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