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) + "}"); } } }
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) + "}"); } }