private void Down(HttpContext context) { string json = ""; //1.获取参数 string itemid = context.Request["itemid"].ToString(); string dictid = context.Request["dictid"].ToString(); int sort = int.Parse(context.Request["sort"].ToString()); //2.初始化实体 MODEL.System.TBL_DICTITEM dictitem = new MODEL.System.TBL_DICTITEM(); dictitem.itemid = itemid; dictitem.xh = sort; //3.组装T_SQL语句 string sql1 = " update tbl_dictitem set sort=" + sort + " where dictid='" + dictid + "' and sort=" + (sort + 1); string sql = "update tbl_dictitem set sort=" + (sort + 1) + " where dictid='" + dictid + "' and itemid='" + itemid + "'"; if (itemBLL.UpdateXh(sql1)) { if (itemBLL.UpdateXh(sql)) { json = "{IsSuccess:true,Message:'移动成功'}"; } } else { json = "{IsSuccess:false,Message:'移动失败'}"; } json = JsonConvert.SerializeObject(json); context.Response.ContentType = "application/json"; context.Response.Write(json); context.ApplicationInstance.CompleteRequest(); }
private void EditItem(HttpContext context) { string json = ""; //1.获取参数 MODEL.System.TBL_DICTITEM item = new MODEL.System.TBL_DICTITEM(); item.dictid = context.Request["dictid"].ToString(); item.itemid = context.Request["itemid"].ToString(); item.itemname = context.Request["name"].ToString(); item.sort = int.Parse(context.Request["sort"].ToString()); try { if (itemBLL.Update(item)) { json = "{IsSuccess:true,Message:'编辑成功'}"; } else { json = "{IsSuccess:false,Message:'编辑失败'}"; } } catch (Exception) { throw; } json = JsonConvert.SerializeObject(json); context.Response.ContentType = "application/json"; context.Response.Write(json); context.ApplicationInstance.CompleteRequest(); }