// Method to Generate the report public ActionResult Report(string id) { LocalReport lr = new LocalReport(); string path = Path.Combine(Server.MapPath("~/Report"), "FinancialYearLeaveReport.rdlc"); if (System.IO.File.Exists(path)) { lr.ReportPath = path; } else { return(View("Index")); } List <Employees_Take_Leaves> cm = new List <Employees_Take_Leaves>(); using (LeaveManagementDBEntities db = new LeaveManagementDBEntities()) { cm = db.Employees_Take_Leaves.ToList(); } ReportDataSource rd = new ReportDataSource("MyDataSet", cm); lr.DataSources.Add(rd); string reportType = id; string mimeType; string encoding; string fileNameExtension; string deviceInfo = "<DeviceInfo>" + " <OutputFormat>" + id + "</OutputFormat>" + " <PageWidth>8.5in</PageWidth>" + " <PageHeight>11in</PageHeight>" + " <MarginTop>0.5in</MarginTop>" + " <MarginLeft>1in</MarginLeft>" + " <MarginRight>1in</MarginRight>" + " <MarginBottom>0.5in</MarginBottom>" + "</DeviceInfo>"; Warning[] warnings; string[] streams; byte[] renderedBytes; renderedBytes = lr.Render( reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings); return(File(renderedBytes, mimeType)); }
public JsonResult GetInstitutesList(string blockName) { LeaveManagementDBEntities db = new LeaveManagementDBEntities(); if (blockName != null) { var getBlocks = db.Employees.Where(s => s.name == blockName).ToList(); } return(Json(new { success = false })); }
public JsonResult GetEmployeeDetails(string code) { LeaveManagementDBEntities db = new LeaveManagementDBEntities(); if (code != null) { var getRow = db.Employees.SingleOrDefault(s => s.code == code); if (getRow == null) { return(null); } var post = db.Posts.FirstOrDefault(s => s.id == getRow.post_id).name; var gender = getRow.gender; var postingPlace = db.Posting_Place.FirstOrDefault(s => s.id == getRow.posting_place_id).name; var typeOfInstitute = db.Type_Of_Institute.FirstOrDefault(s => s.id == getRow.type_of_institute_id).name; var blockHq = db.Block_HQ.FirstOrDefault(s => s.id == getRow.block_id).name; return(Json(new { success = true, post = post, posting_place = postingPlace, gender = gender, type_of_institute = typeOfInstitute, block_hq = blockHq })); } return(Json(new { success = false })); }