public ActionResult GetDataList() { var msg = ""; sSql = "SELECT p.cmpcode, profoid [User ID], profname [User Name], profstatus [Status], divname [Business Unit] FROM QL_mstprof p INNER JOIN QL_mstdivision div ON div.divcode=p.cmpcode WHERE 1=1 and p.deleteflag = ''"; if (!ClassFunction.isSpecialAccess(this.ControllerContext.RouteData.Values["controller"].ToString(), (List <RoleSpecial>)Session["SpecialAccess"])) { sSql += " AND createuser='******'"; } sSql += " ORDER BY profoid, profstatus"; if (msg == "") { DataTable tbl = new ClassConnection().GetDataTable(sSql, "QL_mstprof"); if (tbl.Rows.Count > 0) { List <string> colname = new List <string>(); List <Dictionary <string, object> > rows = new List <Dictionary <string, object> >(); Dictionary <string, object> row; foreach (DataRow dr in tbl.Rows) { row = new Dictionary <string, object>(); foreach (DataColumn col in tbl.Columns) { var item = dr[col].ToString(); if (col.ColumnName == "User ID") { item = "<a class='text-primary' href='" + Url.Action("Form/" + dr["User ID"].ToString() + "/" + dr["cmpcode"].ToString(), "Profile") + "'>" + item + "</a>"; } row.Add(col.ColumnName, item); if (!colname.Contains(col.ColumnName)) { colname.Add(col.ColumnName); } } rows.Add(row); } JsonResult js = Json(new { msg, colname, rows }, JsonRequestBehavior.AllowGet); js.MaxJsonLength = Int32.MaxValue; return(js); } else { msg = "Data Not Found"; } } return(Json(new { msg }, JsonRequestBehavior.AllowGet)); }
public ActionResult GetDataList() { var msg = ""; sSql = "SELECT ID, ID [NO], TITLE [TITLE], SUBTITLE [SUBTITLE], CONTEN [CONTENT] FROM Promo"; //if (!ClassFunction.isSpecialAccess(this.ControllerContext.RouteData.Values["controller"].ToString(), (List<RoleSpecial>)Session["SpecialAccess"])) // sSql += " AND createuser='******'"; //sSql += " ORDER BY ID "; if (msg == "") { DataTable tbl = new ClassConnection().GetDataTable(sSql, "Promo"); if (tbl.Rows.Count > 0) { List <string> colname = new List <string>(); List <Dictionary <string, object> > rows = new List <Dictionary <string, object> >(); Dictionary <string, object> row; foreach (DataRow dr in tbl.Rows) { row = new Dictionary <string, object>(); foreach (DataColumn col in tbl.Columns) { var item = dr[col].ToString(); if (col.ColumnName == "NO") { item = "<a class='text-primary' href='" + Url.Action("Form/" + dr["ID"].ToString(), "Promo") + "'>" + item + "</a>"; } row.Add(col.ColumnName, item); if (!colname.Contains(col.ColumnName)) { colname.Add(col.ColumnName); } } rows.Add(row); } JsonResult js = Json(new { msg, colname, rows }, JsonRequestBehavior.AllowGet); js.MaxJsonLength = Int32.MaxValue; return(js); } else { msg = "Data Not Found"; } } return(Json(new { msg }, JsonRequestBehavior.AllowGet)); }
public ActionResult GetDataList() { var msg = ""; sSql = "SELECT ID, ID [NO], TITLE [TITLE], SUBTITLE [SUBTITLE], EMAIL [EMAIL], WORK_HOUR [WORK HOUR], INSTAGRAM [INSTAGRAM], FACEBOOK [FACEBOOK], YOUTUBE [YOUTUBE], WEBSITE [WEBSITE], TOKOPEDIA [TOKOPEDIA], DEKORUMA [DEKORUMA] FROM HighlightStore"; if (msg == "") { DataTable tbl = new ClassConnection().GetDataTable(sSql, "HighlightStore"); if (tbl.Rows.Count > 0) { List <string> colname = new List <string>(); List <Dictionary <string, object> > rows = new List <Dictionary <string, object> >(); Dictionary <string, object> row; foreach (DataRow dr in tbl.Rows) { row = new Dictionary <string, object>(); foreach (DataColumn col in tbl.Columns) { var item = dr[col].ToString(); if (col.ColumnName == "NO") { item = "<a class='text-primary' href='" + Url.Action("Form/" + dr["ID"].ToString(), "HighlightStore") + "'>" + item + "</a>"; } row.Add(col.ColumnName, item); if (!colname.Contains(col.ColumnName)) { colname.Add(col.ColumnName); } } rows.Add(row); } JsonResult js = Json(new { msg, colname, rows }, JsonRequestBehavior.AllowGet); js.MaxJsonLength = Int32.MaxValue; return(js); } else { msg = "Data Not Found"; } } return(Json(new { msg }, JsonRequestBehavior.AllowGet)); }
public ActionResult GetDataList() { var msg = ""; sSql = "SELECT ID, ID [NO], TITLE [TITLE], SUBTITLE [SUBTITLE] FROM Katalogues"; if (msg == "") { DataTable tbl = new ClassConnection().GetDataTable(sSql, "Katalogues"); if (tbl.Rows.Count > 0) { List <string> colname = new List <string>(); List <Dictionary <string, object> > rows = new List <Dictionary <string, object> >(); Dictionary <string, object> row; foreach (DataRow dr in tbl.Rows) { row = new Dictionary <string, object>(); foreach (DataColumn col in tbl.Columns) { var item = dr[col].ToString(); if (col.ColumnName == "NO") { item = "<a class='text-primary' href='" + Url.Action("Form/" + dr["ID"].ToString(), "Katalogues") + "'>" + item + "</a>"; } row.Add(col.ColumnName, item); if (!colname.Contains(col.ColumnName)) { colname.Add(col.ColumnName); } } rows.Add(row); } JsonResult js = Json(new { msg, colname, rows }, JsonRequestBehavior.AllowGet); js.MaxJsonLength = Int32.MaxValue; return(js); } else { msg = "Data Not Found"; } } return(Json(new { msg }, JsonRequestBehavior.AllowGet)); }
public ActionResult GetNotifPRNonPO() { var result = ""; JsonResult js = null; List <string> tblcols = new List <string>(); List <Dictionary <string, object> > tblrows = new List <Dictionary <string, object> >(); try { List <RoleDetail> dtrole = (List <RoleDetail>)Session["Role"]; List <RoleDetail> dtrolesel = dtrole.Where(r => r.formaddress.ToUpper() == "PRREPORT" && r.formmenu.ToUpper().StartsWith("REPORTSTATUS/")).ToList(); if (dtrolesel.Count > 0) { ReportModels.FullFormType formtype; var totaldata = 1; var UserID = Session["UserID"].ToString(); sSql = "SELECT * FROM ("; foreach (var item in dtrolesel) { formtype = new ReportModels.FullFormType(item.formmenu.ToUpper().Replace("REPORTSTATUS/", "")); sSql += "SELECT ('ReportStatus/" + formtype.formtype + "/' + pr.cmpcode + '?proid=' + CAST(pr.pr" + formtype.reftype + "mstoid AS VARCHAR(10))) [Go], ISNULL((SELECT divname FROM QL_mstdivision di WHERE di.cmpcode=pr.cmpcode), '') [Business Unit], pr" + formtype.reftype + "no [PR No.], CONVERT(VARCHAR(10), pr" + formtype.reftype + "date, 101) [PR Date], ISNULL((SELECT deptname FROM QL_mstdept de WHERE de.cmpcode=pr.cmpcode AND de.deptoid=pr.deptoid), '') [Department], pr" + formtype.reftype + "mstnote [Note], ISNULL((SELECT COUNT(pr" + formtype.reftype + "dtloid) FROM QL_pr" + formtype.reftype + "dtl pd WHERE pr.cmpcode=pd.cmpcode AND pr.pr" + formtype.reftype + "mstoid=pd.pr" + formtype.reftype + "mstoid AND pr" + formtype.reftype + "dtlstatus<>'COMPLETE'), 0) [num_Outstanding] FROM QL_pr" + formtype.reftype + "mst pr WHERE pr.pr" + formtype.reftype + "mststatus='Approved' AND "; if (Session["CompnyCode"].ToString() != CompnyCode) { sSql += "pr.cmpcode IN ('" + Session["CompnyCode"].ToString() + "')"; } else { sSql += "pr.cmpcode LIKE '%'"; } if (totaldata < dtrolesel.Count) { sSql += " UNION ALL "; totaldata++; } } sSql += ") tblPRNonPO ORDER BY [Business Unit], [PR No.]"; DataTable tbl = new ClassConnection().GetDataTable(sSql, "tblPRNonPO"); if (tbl.Rows.Count > 0) { Dictionary <string, object> row; foreach (DataRow dr in tbl.Rows) { row = new Dictionary <string, object>(); foreach (DataColumn col in tbl.Columns) { var item = dr[col].ToString(); if (col.ColumnName == "Go") { var tmp = item.Split('?'); if (tmp.Length > 1) { item = "<a href='" + Url.Action(tmp[0], "PRReport") + "?" + tmp[1] + "'>Go</a>"; } else { item = "<a href='" + Url.Action(item, "PRReport") + "'>Go</a>"; } } row.Add(col.ColumnName, item); if (!tblcols.Contains(col.ColumnName)) { tblcols.Add(col.ColumnName); } } tblrows.Add(row); } } else { result = "Data Not Found."; } } else { result = "No Notif"; } } catch (Exception e) { result = e.ToString(); } js = Json(new { result, tblcols, tblrows }, JsonRequestBehavior.AllowGet); js.MaxJsonLength = Int32.MaxValue; return(js); }