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)); } }
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)); } }
public ActionResult ExportTimeSheetToExcel(TimeSheetQueryModel TimeSheetQueryModelObj, string RequestLevelPerson) { string errorMessage = string.Empty; string startDate = TimeSheetQueryModelObj.DateRange.Substring(0, 10); string endDate = TimeSheetQueryModelObj.DateRange.Substring(12); //TimeSheetQueryModelObj.FromDate = startDate; if (startDate != "") { try { TimeSheetQueryModelObj.FromDate = DateTime.Parse(startDate, new CultureInfo("en-GB", true)); TimeSheetQueryModelObj.ToDate = DateTime.Parse(endDate, new CultureInfo("en-GB", true)); } catch (Exception) { throw; } } List <TimeSheetModel> timeSheetModelList = GetEmployeeTimeSheet(TimeSheetQueryModelObj, out errorMessage, RequestLevelPerson); List <TimeSheetModel> excelData = timeSheetModelList.ToList(); if (excelData.Count > 0) { List <string> columns = new List <string>() { "Date", "Shift", "In Time", "Out Time", "Working Hours", "Status", "Requests", "Day", "Late In", "Early Out", "Name", "Reporting Manager" }; string fileName = string.Format("Timesheet_{0}{1}", DateTime.Now.ToString("ddMMyyyyHHmmss"), ".xlsx"); //if (RequestLevelPerson == "My") //{ // EmployeeProfile profile = (EmployeeProfile)Session["Profile"]; // fileName = string.Format("{0}{1}{2}{3}", profile.FirstName, profile.LastName, DateTime.Now.ToString("ddMMyyyyHHmmss"), ".xlsx"); //} //else //{ //fileName = string.Format("TimeSheet_{0}{1}", DateTime.Now.ToString("ddMMyyyyHHmmss"), ".xlsx"); //} byte[] filecontent = ExcelExportHelper.ExportTimesheetExcel(excelData, "", true, columns.ToArray()); return(File(filecontent, ExcelExportHelper.ExcelContentType, fileName)); } else { using (var Client = new LeaveClient()) { var result = Client.GetYearsFromLeaveBalance(); ViewBag.YearsInLeaveBal = result; } ViewBag.RequestLevelPerson = RequestLevelPerson; EmployeeAttendanceQueryModel data = new EmployeeAttendanceQueryModel { ErrorMsg = "Excel file is not generated as no data returned." }; return(View("~/Views/Attendance/TimeSheet.cshtml", data)); } }
public ActionResult AdminOverTimePermissions() { PermissionQueryModel mdl = new PermissionQueryModel(); using (var Client = new LeaveClient()) { var result = Client.GetYearsFromLeaveBalance(); ViewBag.YearsInLeaveBal = result; } ViewBag.RequestLevelPerson = "Admin"; mdl.OnlyReportedToMe = true; return(View("OverTimePermissions", mdl)); }
public ActionResult AdminYearWiseLeaveSumary() { using (var Client = new LeaveClient()) { var result = Client.GetYearsFromLeaveBalance(); ViewBag.YearsInLeaveBal = result; } ViewBag.RequestLevelPerson = "Admin"; YearwiseLeaveSummaryQueryModel qryMdl = new YearwiseLeaveSummaryQueryModel { OnlyReportedToMe = true }; return(View("ViewEmployeeWiseLeaveSummary", qryMdl)); }
public ActionResult TeamMonthWiseLeaves() { using (var Client = new LeaveClient()) { var result = Client.GetYearsFromLeaveBalance(); ViewBag.YearsInLeaveBal = result; } ViewBag.RequestLevelPerson = "Team"; YearwiseLeaveSummaryQueryModel qryMdl = new YearwiseLeaveSummaryQueryModel { OnlyReportedToMe = true }; return(View("MonthwiseLeaveCount", qryMdl)); }