/// <summary> /// 更新角色信息 /// </summary> /// <param name="context"></param> public void UpdateRoleInfo(HttpContext context) { HttpRequest request = context.Request; if (!string.IsNullOrWhiteSpace(request["Id"])) { try { PMSModel.RoleInfo advert = BLLRIS.GetEntityById(int.Parse(request["Id"])).retData as PMSModel.RoleInfo; if (advert != null) { if (!string.IsNullOrWhiteSpace(request["IsDelete"])) { Hashtable ht = new Hashtable(); ht.Add("Id", advert.Id); //PMSModel.JsonModel jsonModel = BLLRIS.Delete(Convert.ToInt32(advert.Id)); PMSModel.JsonModel jsonModel = BLLRMS.DelRole(ht); jsonModel.status = "yes"; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } } } catch (Exception ex) { LogHelper.Error(ex); PMSModel.JsonModel jsonModel = new PMSModel.JsonModel() { errMsg = ex.Message, retData = "", status = "no" }; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } } }
public void GetDataInfo(HttpContext context) { HttpRequest request = context.Request; try { PMSModel.JsonModel Model = new PMSModel.JsonModel(); Hashtable ht = new Hashtable(); if (!string.IsNullOrWhiteSpace(request["Id"])) { Model = BllSSS.GetEntityById(int.Parse(request["Id"])); } context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(Model) + "}"); } catch (Exception ex) { LogHelper.Error(ex); PMSModel.JsonModel jsonModel = new PMSModel.JsonModel() { errMsg = ex.Message, retData = "", status = "no" }; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } }
/// <summary> /// 修改角色信息 /// </summary> /// <param name="context"></param> public void EditRoleInfo(HttpContext context) { PMSModel.JsonModel jsonModel = new PMSModel.JsonModel(); HttpRequest request = context.Request; try { string Id = request["Id"]; string RoleName = request["RoleName"]; PMSModel.RoleInfo info = new PMSModel.RoleInfo(); info.RoleName = RoleName; if (!string.IsNullOrWhiteSpace(Id)) { info.Id = int.Parse(request["Id"]); jsonModel = BLLRIS.Update(info); } else { jsonModel = BLLRIS.Add(info); } context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } catch (Exception ex) { LogHelper.Error(ex); jsonModel = new PMSModel.JsonModel() { errMsg = ex.Message, retData = "", status = "no" }; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } }
/// <summary> /// 更新用户信息 /// </summary> /// <param name="context"></param> public void UpdateUserInfo(HttpContext context) { if (!string.IsNullOrWhiteSpace(context.Request["Id"])) { try { PMSModel.UserInfo advert = BllUIS.GetEntityById(int.Parse(context.Request["Id"])).retData as PMSModel.UserInfo; if (advert != null) { if (!string.IsNullOrWhiteSpace(context.Request["IsDelete"])) { advert.IsDelete = Convert.ToByte(context.Request["IsDelete"]); } PMSModel.JsonModel jsonModel = BllUIS.Update(advert); jsonModel.status = "yes"; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } } catch (Exception ex) { LogHelper.Error(ex); PMSModel.JsonModel jsonModel = new PMSModel.JsonModel() { errMsg = ex.Message, retData = "", status = "no" }; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } } }
/// <summary> /// 获得新闻通知公告列表 /// </summary> /// <param name="context"></param> public void GetPageList(HttpContext context) { HttpRequest request = context.Request; try { Hashtable ht = new Hashtable(); ht.Add("PageIndex", request["PageIndex"].ToString()); ht.Add("PageSize", request["PageSize"].ToString()); ht.Add("TableName", "System_Notice"); string where = string.Empty; if (!string.IsNullOrWhiteSpace(request["type"])) { where += " and [type]=" + request["type"].ToString(); } if (!string.IsNullOrWhiteSpace(request["Root"])) { where += " and ([Root]=0 or [Root]=" + request["Root"] + ")"; } if (!string.IsNullOrWhiteSpace(request["isPush"])) { where += " and isPush=" + request["isPush"]; } if (!string.IsNullOrWhiteSpace(request["MenuId"])) { where += " and MenuId=" + request["MenuId"]; } if (!string.IsNullOrWhiteSpace(request["StarDate"]) && !string.IsNullOrWhiteSpace(request["EndDate"])) { where += " and ([CreateTime]>='" + request["StarDate"].ToString() + " 00:00:00' and [CreateTime]<='" + request["EndDate"].ToString() + " 23:59:59')"; } if (!string.IsNullOrWhiteSpace(request["keyWord"])) { where += " and (Title+Contents like '%" + request["keyWord"].ToString() + "%')"; } where += " and IsDelete !=" + (int)SysStatus.除; ht.Add("Order", "Hot desc,T.SortId desc,T.CreateTime desc,T.ClickNum asc"); PMSModel.JsonModel Model = BllSNS.GetPage(ht, true, where); context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(Model) + "}"); } catch (Exception ex) { LogHelper.Error(ex); PMSModel.JsonModel jsonModel = new PMSModel.JsonModel() { errMsg = ex.Message, retData = "", status = "no" }; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } }
/// <summary> /// 更新新闻通知公告信息 /// </summary> /// <param name="context"></param> public void UpdateNotice(HttpContext context) { HttpRequest request = context.Request; if (!string.IsNullOrWhiteSpace(request["Id"])) { try { PMSModel.System_Notice sn = BllSNS.GetEntityById(int.Parse(request["Id"])).retData as PMSModel.System_Notice; if (sn != null) { if (!string.IsNullOrWhiteSpace(request["Hot"])) { sn.Hot = int.Parse(request["Hot"]); } if (!string.IsNullOrWhiteSpace(request["IsDelete"])) { sn.IsDelete = Convert.ToByte(request["IsDelete"]); } if (!string.IsNullOrWhiteSpace(request["ClickNum"])) { sn.ClickNum = sn.ClickNum + 1; } if (!string.IsNullOrWhiteSpace(request["isPush"])) { sn.isPush = int.Parse(request["isPush"]); } PMSModel.JsonModel jsonModel = BllSNS.Update(sn); jsonModel.status = "yes"; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } } catch (Exception ex) { LogHelper.Error(ex); PMSModel.JsonModel jsonModel = new PMSModel.JsonModel() { errMsg = ex.Message, retData = "", status = "no" }; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } } }
public void GetPageList(HttpContext context) { HttpRequest request = context.Request; try { Hashtable ht = new Hashtable(); var isPage = true; if (!string.IsNullOrWhiteSpace(request["PageIndex"])) { ht.Add("PageIndex", request["PageIndex"].ToString()); } if (!string.IsNullOrWhiteSpace(request["PageSize"])) { ht.Add("PageSize", request["PageSize"].ToString()); } ht.Add("TableName", "SchoolStyle"); string where = string.Empty; if (!string.IsNullOrWhiteSpace(request["MenuId"])) { where += " and MenuId=" + request["MenuId"]; } if (!string.IsNullOrWhiteSpace(request["isPage"])) { isPage = Convert.ToBoolean(request["isPage"]); } where += " and IsDelete !=" + (int)SysStatus.除; ht.Add("Order", " SortId desc,CreateTime desc "); PMSModel.JsonModel Model = BllSSS.GetPage(ht, isPage, where); context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(Model) + "}"); } catch (Exception ex) { LogHelper.Error(ex); PMSModel.JsonModel jsonModel = new PMSModel.JsonModel() { errMsg = ex.Message, retData = "", status = "no" }; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } }
/// <summary> /// 获得 /// </summa角色信息ry> /// <param name="context"></param> public void GetRoleInfo(HttpContext context) { HttpRequest request = context.Request; string Id = request["Id"]; try { if (!string.IsNullOrWhiteSpace(Id)) { PMSModel.RoleInfo ri = new PMSModel.RoleInfo(); PMSModel.JsonModel jsonModel = BLLRIS.GetEntityById(int.Parse(Id)); if (jsonModel.retData != null) { ri = jsonModel.retData as PMSModel.RoleInfo; jsonModel.retData = ri; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } } else { PMSModel.JsonModel jsonModel = new PMSModel.JsonModel() { errMsg = "null", retData = "", status = "no" }; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } } catch (Exception ex) { LogHelper.Error(ex); PMSModel.JsonModel jsonModel = new PMSModel.JsonModel() { errMsg = ex.Message, retData = "", status = "no" }; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } }
/// <summary> /// 获得角色列表 /// </summary> /// <param name="context"></param> public void GetPageList(HttpContext context) { HttpRequest request = context.Request; try { Hashtable ht = new Hashtable(); if (!string.IsNullOrWhiteSpace(request["PageIndex"])) { ht.Add("PageIndex", request["PageIndex"].ToString()); } if (!string.IsNullOrWhiteSpace(request["PageSize"])) { ht.Add("PageSize", request["PageSize"].ToString()); } var isPage = true; if (!string.IsNullOrWhiteSpace(request["isPage"])) { isPage = Convert.ToBoolean(request["isPage"]); } ht.Add("TableName", "RoleInfo"); string where = string.Empty; PMSModel.JsonModel Model = BLLRIS.GetPage(ht, isPage, where); context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(Model) + "}"); } catch (Exception ex) { LogHelper.Error(ex); PMSModel.JsonModel jsonModel = new PMSModel.JsonModel() { errMsg = ex.Message, retData = "", status = "no" }; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } }
static void Main() { //Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new Form1()); HashtableCustom ht = new HashtableCustom(); ht.Add("PageIndex", "1"); ht.Add("PageSize", "7"); ht.Add("ImgUrl", "/Common.ashx"); ht.Add("IsDelete", "0"); ht.Add("MenuIdList", "11,20,35,45"); Dictionary <string, object> diclist = new Dictionary <string, object>(); PMSModel.JsonModel jsonModel = null; try { var menuids = ht["MenuIdList"].ToString().Split(new char[] { ',' }); if (menuids.Length > 0) { foreach (var item in menuids) { var moder = BllAdvert.GetDataInfo(ht); diclist.Add(item, moder.retData); } } } catch (Exception ex) { jsonModel = new PMSModel.JsonModel() { errMsg = ex.Message, }; } }
/// <summary> /// 根据角色ID获得菜单集合 /// </summary> /// <param name="context"></param> public void GetMenuIdsForRoleId(HttpContext context) { HttpRequest request = context.Request; PMSModel.JsonModel jsonModel = new PMSModel.JsonModel(); try { Hashtable ht = new Hashtable(); ht.Add("RoleId", request["RoleId"]); jsonModel = BLLRMS.GetMenuIdsForRoleId(ht); context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } catch (Exception ex) { LogHelper.Error(ex); jsonModel = new PMSModel.JsonModel() { errMsg = ex.Message }; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } }
/// <summary> /// 登录 /// </summary> /// <param name="context"></param> public void Login(HttpContext context) { PMSModel.JsonModel jsonModel = new PMSModel.JsonModel(); try { Hashtable ht = new Hashtable(); string where = string.Empty; if (!string.IsNullOrWhiteSpace(context.Request["LoginName"]) && !string.IsNullOrWhiteSpace(context.Request["LoginPassword"])) { string pwd = EncryptHelper.Md5By32(context.Request["LoginPassword"]); ht.Add("LoginName", context.Request["LoginName"]); ht.Add("LoginPassword", pwd); jsonModel = BllUIS.GetPage(ht, false, where); context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } else { jsonModel = new PMSModel.JsonModel() { errMsg = "null", retData = "", status = "no" }; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } } catch (Exception ex) { LogHelper.Error(ex); jsonModel = new PMSModel.JsonModel() { errMsg = ex.Message, retData = "", status = "no" }; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } }
public void UpdateSchoolStyle(HttpContext context) { HttpRequest request = context.Request; if (!string.IsNullOrWhiteSpace(request["Id"])) { try { PMSModel.SchoolStyle sn = BllSSS.GetEntityById(int.Parse(request["Id"])).retData as PMSModel.SchoolStyle; if (sn != null) { if (!string.IsNullOrWhiteSpace(request["IsDelete"])) { sn.IsDelete = Convert.ToByte(request["IsDelete"]); } if (!string.IsNullOrWhiteSpace(request["ShowImgUrl"]) && "delImg" == request["ShowImgUrl"]) { sn.ImageUrl = ""; } PMSModel.JsonModel jsonModel = BllSSS.Update(sn); jsonModel.status = "yes"; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } } catch (Exception ex) { LogHelper.Error(ex); PMSModel.JsonModel jsonModel = new PMSModel.JsonModel() { errMsg = ex.Message, retData = "", status = "no" }; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } } }
/// <summary> /// 获得用户列表 /// </summary> /// <param name="context"></param> public void GetPageList(HttpContext context) { try { Hashtable ht = new Hashtable(); if (!string.IsNullOrWhiteSpace(context.Request["PageIndex"])) { ht.Add("PageIndex", context.Request["PageIndex"].ToString()); } if (!string.IsNullOrWhiteSpace(context.Request["PageSize"])) { ht.Add("PageSize", context.Request["PageSize"].ToString()); } ht.Add("TableName", "UserInfo"); string where = string.Empty; if (!string.IsNullOrWhiteSpace(context.Request["RoleId"])) { where += " and RoleId=" + context.Request["RoleId"]; } where += " and IsDelete =" + (int)PMSUtility.SysStatus.正常; PMSModel.JsonModel Model = BllUIS.GetPage(ht, true, where); context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(Model) + "}"); } catch (Exception ex) { LogHelper.Error(ex); PMSModel.JsonModel jsonModel = new PMSModel.JsonModel() { errMsg = ex.Message, retData = "", status = "no" }; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } }
public void EditSchoolStyle(HttpContext context) { PMSModel.JsonModel jsonModel = new PMSModel.JsonModel(); HttpRequest request = context.Request; try { string Title = request["Title"]; string ShowImgUrl = request["ImageUrl"]; PMSModel.SchoolStyle sn = new PMSModel.SchoolStyle(); sn.ImageUrl = ShowImgUrl; sn.Title = Title; sn.Description = HttpUtility.UrlDecode(request["Description"]); string CreativeHTML = sn.Description; sn.FileName = request["FileName"]; sn.FilePath = request["FilePath"]; if (Convert.ToBoolean(request["isImgScoll"])) { sn.SortId = string.IsNullOrWhiteSpace(request["SortId"]) ? 0 : Convert.ToInt32(request["SortId"]); } else { if (!string.IsNullOrWhiteSpace(request["SortId"])) { sn.SortId = Convert.ToInt32(request["SortId"]); } } if (CreativeHTML.ToUpper().IndexOf("SRC") > -1) { string[] imageArry = new HtmlImgRegex().GetHtmlImageUrlList(CreativeHTML); string imgstr = ""; for (int i = 0; i < imageArry.Length; i++) { imgstr += imageArry[i] + ","; } if (imgstr.Length > 0) { sn.ImageUrl = imgstr.Substring(0, imgstr.Length - 1); } } else { sn.ImageUrl = ""; } if (!string.IsNullOrWhiteSpace(request["Id"])) { int Id = int.Parse(request["Id"]); sn.Id = Id; jsonModel = BllSSS.Update(sn); } else { DateTime CreateTime = DateTime.Now; if (!string.IsNullOrWhiteSpace(request["Creator"])) { sn.Creator = request["Creator"]; } int IsDelete = Convert.ToInt16(SysStatus.正常); sn.MenuId = int.Parse(request["MenuId"]); sn.CreateTime = CreateTime; sn.IsDelete = Convert.ToByte(IsDelete); jsonModel = BllSSS.Add(sn); } jsonModel.status = "ok"; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } catch (Exception ex) { LogHelper.Error(ex); jsonModel = new PMSModel.JsonModel() { errMsg = ex.Message, retData = "", status = "no" }; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } }
/// <summary> /// 修改新闻通知公告信息 /// </summary> /// <param name="context"></param> public void EditNotice(HttpContext context) { HttpRequest request = context.Request; PMSModel.JsonModel jsonModel = new PMSModel.JsonModel(); try { string Title = request["Title"]; string Contents = HttpUtility.UrlDecode(request["Contents"]); int Hot = int.Parse(request["Hot"]); int SortId = request["SortId"] == "" ? 0 : int.Parse(request["SortId"]); int ClickNum = request["ClickNum"] == "" ? 0 : int.Parse(request["ClickNum"]); int isPush = request["isPush"] == "" ? 0 : int.Parse(request["isPush"]); string ShowImgUrl = request["ShowImgUrl"]; string FileName = request["FileName"]; string FilePath = request["FilePath"]; PMSModel.System_Notice sn = new PMSModel.System_Notice(); sn.ClickNum = ClickNum; sn.Contents = Contents; sn.Hot = Hot; sn.SortId = SortId; sn.Title = Title; sn.FileName = FileName; sn.FilePath = FilePath; sn.isPush = isPush; sn.CreateTime = string.IsNullOrWhiteSpace(request["CreateTime"]) ? DateTime.Now : Convert.ToDateTime(request["CreateTime"]); if (Contents.ToUpper().IndexOf("SRC") > -1) { string[] imageArry = new HtmlImgRegex().GetHtmlImageUrlList(Contents); string imgstr = ""; for (int i = 0; i < imageArry.Length; i++) { imgstr += imageArry[i] + ","; } if (imgstr.Length > 0) { sn.ShowImgUrl = imgstr.Substring(0, imgstr.Length - 1); } } else { sn.ShowImgUrl = ""; } if (!string.IsNullOrWhiteSpace(request["Id"])) { int Id = int.Parse(request["Id"]); sn.Id = Id; jsonModel = BllSNS.Update(sn); } else { //DateTime CreateTime = DateTime.Now; string Creator = request["Creator"]; int IsDelete = Convert.ToInt16(SysStatus.正常); //sn.CreateTime = CreateTime; sn.Creator = Creator; sn.IsDelete = Convert.ToByte(IsDelete); sn.MenuId = string.IsNullOrWhiteSpace(request["MenuId"]) ? -1 : Convert.ToInt32(request["MenuId"]); jsonModel = BllSNS.Add(sn); } jsonModel.status = "ok"; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } catch (Exception ex) { LogHelper.Error(ex); jsonModel = new PMSModel.JsonModel() { errMsg = ex.Message, retData = "", status = "no" }; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } }
/// <summary> /// 修改用户信息 /// </summary> /// <param name="context"></param> public void EditUserInfo(HttpContext context) { PMSModel.JsonModel jsonModel = new PMSModel.JsonModel(); try { string Id = context.Request["Id"]; string LoginName = context.Request["LoginName"]; string LoginPassword_New = context.Request["LoginPassword_New"]; string LoginPassword_Old = context.Request["LoginPassword_Old"]; string LoginPassword = context.Request["LoginPassword"]; string RoleId = context.Request["RoleId"]; PMSModel.UserInfo info = new PMSModel.UserInfo(); if (!string.IsNullOrWhiteSpace(LoginPassword)) { info.LoginPassword = EncryptHelper.Md5By32(LoginPassword); } info.RoleId = Convert.ToInt32(RoleId); if (!string.IsNullOrWhiteSpace(Id)) { List <PMSModel.UserInfo> ui = BllUIS.GetEntityListByField("Id", Id).retData as List <PMSModel.UserInfo>; if (!string.IsNullOrEmpty(LoginPassword_Old) && ui.Count > 0) { if (EncryptHelper.Md5By32(LoginPassword_Old) == ui[0].LoginPassword) { info.Id = int.Parse(context.Request["Id"]); jsonModel = BllUIS.Update(info); } else { jsonModel = new PMSModel.JsonModel() { errMsg = "novaled", retData = "", status = "no" }; } } } else { List <PMSModel.UserInfo> ui = BllUIS.GetEntityListByField("LoginName", LoginName).retData as List <PMSModel.UserInfo>; if (ui != null && ui.Count > 0) { jsonModel = new PMSModel.JsonModel() { errMsg = "exist", retData = "", status = "no" }; } else { info.LoginName = LoginName; info.CreateTime = DateTime.Now; info.IsDelete = (int)PMSUtility.SysStatus.正常; jsonModel = BllUIS.Add(info); } } context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } catch (Exception ex) { LogHelper.Error(ex); jsonModel = new PMSModel.JsonModel() { errMsg = ex.Message, retData = "", status = "no" }; context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}"); } }