private void GetListByPower(HttpContext context, string btn) { if (btn != "show") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } try { BLL.sys_Bulletin bll = new BLL.sys_Bulletin(); //int recordNum = RequestHelper.GetInt("recordNum",0); Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); string strWhere = ""; DataTable dt = bll.GetListByPower(strWhere, 0, loginUserModel.DepId).Tables[0]; string rowsStr = Utils.ToJson(dt); StringBuilder jsonStr = new StringBuilder(); jsonStr.Append("{\"status\":\"1\",\"msg\":\"数据获取成功!\",\"info\":"); jsonStr.Append("{\"total\":" + dt.Rows.Count + ",\"rows\":"); jsonStr.Append(rowsStr); jsonStr.Append("}}"); context.Response.Write(jsonStr); } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }
private void GetHomePage(HttpContext context) { try { string loginSalt = RequestHelper.GetQueryString("LoginSalt"); Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); if (loginUserModel == null || loginUserModel.Salt != loginSalt) { context.Response.Write("{\"status\":\"0.1\",\"msg\":\"对不起,登录超时,请重新登录!\"}"); return; } string vt = new BLL.System.sys_Config().loadConfig().webversiontime; BLL.System.sys_Mail_Send mailBll = new BLL.System.sys_Mail_Send(); int receiveNoRead = mailBll.GetReceiveNoRead(loginUserModel.ID); BLL.sys_Bulletin bll = new BLL.sys_Bulletin(); int recordNumBulletin = RequestHelper.GetInt("recordNumBulletin", 0); string strWhere = ""; DataTable bulletinDT = bll.GetListByPower(strWhere, recordNumBulletin, loginUserModel.DepId).Tables[0]; string bulletinInfo = Utils.ToJson(bulletinDT); BLL.System.sys_Menu menuBll = new BLL.System.sys_Menu(); DataTable todoDT = menuBll.GetTodoList(loginUserModel.ID).Tables[0]; string todoInfo = Utils.ToJson(todoDT); DataTable nodoDT = menuBll.GetNodoList(loginUserModel.ID).Tables[0]; string nodoInfo = Utils.ToJson(nodoDT); StringBuilder jsonStr = new StringBuilder(); jsonStr.Append("{\"status\":\"1\",\"msg\":\"数据获取成功!\",\"vt\":\"" + vt + "\""); jsonStr.Append(",\"receiveNoRead\":" + receiveNoRead); jsonStr.Append(",\"bulletinInfo\":" + bulletinInfo); jsonStr.Append(",\"todoInfo\":" + todoInfo); jsonStr.Append(",\"nodoInfo\":" + nodoInfo); jsonStr.Append("}"); context.Response.Write(jsonStr); } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"" + e.Message + "\"}"); } }