public ActionResult RekapSettingBU() { using (var db = new BENEFITContext()) { return PartialView(db.vwRekapBuListInfoSettings.ToList()); } }
public int buCount(string KDKC) { using (var db = new BENEFITContext()) { int _buCount = db.vwBuListInfoBenefits.Where(a=>a.KDKC== KDKC).Count(); return _buCount; } }
public int buCount(string KDKC) { using (var db = new BENEFITContext()) { int _buCount = db.vwInfoSettingBUs.Where(a => a.KDKC == KDKC).Count(); return _buCount; } }
public JsonResult BuList(string KDKC, int jtStartIndex = 0, int jtPageSize = 0, string jtSorting = null) { try { int _buCount = buCount(KDKC); using (var db = new BENEFITContext()) { var bus = db.vwInfoSettingBUs.Where(a => a.KDKC == KDKC).OrderBy(a => a.PKSNM).Skip(jtStartIndex).Take(jtPageSize).ToList(); return Json(new { Result = "OK", Records = bus, TotalRecordCount = _buCount }); } //List<person> persons = _personRepository.GetPersons(jtStartIndex, jtPageSize, jtSorting); } catch (Exception ex) { return Json(new { Result = "ERROR", Message = ex.Message }); } }
public JsonResult vwInfoBenefit(string NOMOR) { //var _NOMOR = NOMOR.Replace("'", ""); try { using (var db = new BENEFITContext()) { List<vwInfoBenefit> bus = db.vwInfoBenefits.Where(a => a.POLIS == NOMOR).OrderBy(a => a.NMPROD).ThenBy(a => a.NMKLSRWT).ToList(); return Json(new { Result = "OK", Records = bus }); } //List<person> persons = _personRepository.GetPersons(jtStartIndex, jtPageSize, jtSorting); } catch (Exception ex) { return Json(new { Result = "ERROR", Message = ex.Message }); } }
public bool Export() { using (ExcelPackage pck = new ExcelPackage()) { using (var db = new BENEFITContext()) { var filename = "InfoBenefitBU"; var contacts = db.vwInfoBenefits.Select(a => new { NMKC = a.NMKC, NOMOR = a.POLIS, PKSKD = a.PKSKD, PKSTGLML = a.PKSTGLML, PKSTGLAKH = a.PKSTGLAKH, PKSNM = a.PKSNM }).Distinct(); if (contacts.Count() != 0) { var grid = new System.Web.UI.WebControls.GridView(); System.Data.DataTable dt = new System.Data.DataTable(); grid.DataSource = contacts.ToList(); grid.DataBind(); if (grid.HeaderRow != null) { for (int i = 0; i < grid.HeaderRow.Cells.Count; i++) { dt.Columns.Add(grid.HeaderRow.Cells[i].Text); } } // add each of the data rows to the table foreach (GridViewRow row in grid.Rows) { DataRow dr; dr = dt.NewRow(); for (int i = 0; i < row.Cells.Count; i++) { dr[i] = row.Cells[i].Text;//.Replace(" ", ""); } dt.Rows.Add(dr); } //Create the worksheet ExcelWorksheet ws = pck.Workbook.Worksheets.Add("Report"); //Load the datatable into the sheet, starting from cell A1. Print the column names on row 1 ws.Cells["A1"].LoadFromDataTable(dt, true); //Write it back to the client Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("content-disposition", "attachment; filename=" + filename); Response.BinaryWrite(pck.GetAsByteArray()); return true; } else { return false; } } } }