/// <summary> /// 获取单行数据 /// </summary> public void GetDataView(HttpContext context, int option) { var ChoiceValue = context.Request["ChoiceValue"]; BLL.B_Table TableBll = new BLL.B_Table(option); context.Response.Write(TableBll.GetDataView(ChoiceValue)); context.Response.End(); }
/// <summary> /// 查询 /// </summary> /// <param name="context"></param> public void GetDataList(HttpContext context, int option) { BLL.B_Table TableBll = new BLL.B_Table(option); int PageIndex = Convert.ToInt32(context.Request["page"]); int PageSize = Convert.ToInt32(context.Request["limit"]); int PageStart = Convert.ToInt32(context.Request["start"]); string Order = context.Request["order"]; var WhereValues = context.Request["where"]; context.Response.Write(TableBll.GetDataListJson(PageStart, PageIndex, PageSize, WhereValues, Order)); context.Response.End(); }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(Request["ItemID"])) { //输入错误 } ItemID = Convert.ToInt32(Request["ItemID"]); TableBll = new BLL.B_Table(ItemID); TableModel = TableBll.GetTableModel(); TableFielModelList = TableBll.GetTableFieldModel(); if (!IsPostBack) { BindData(); } }
/// <summary> /// 删除 /// </summary> /// <param name="context"></param> public void BntDeleteItemID(HttpContext context, int option) { var choicevalue = context.Request["choicevalue"]; BLL.B_Table TableBll = new BLL.B_Table(option); if (TableBll.DeleteTableData(choicevalue)) { context.Response.Write("{\"code\":1,\"msg\":\"删除成功!\"}"); } else { context.Response.Write("{\"code\":500,\"msg\":\"删除失败!\"}"); } context.Response.End(); }
/// <summary> /// 修改 /// </summary> /// <param name="context"></param> /// <param name="option"></param> public void UpdateData(HttpContext context, int option) { var ChoiceValue = context.Request["ChoiceValue"]; var FromValues = context.Server.UrlDecode(context.Request.QueryString["FromValues"]); BLL.B_Table TableBll = new BLL.B_Table(option); if (TableBll.UpdateTableData(FromValues, ChoiceValue)) { context.Response.Write("{\"code\":1,\"msg\":\"保存成功!\"}"); } else { context.Response.Write("{\"code\":500,\"msg\":\"保存失败!\"}"); } context.Response.End(); }
/// <summary> /// 新增 /// </summary> /// <param name="context"></param> /// <param name="option"></param> public void InsertData(HttpContext context, int option) { var FromValues = context.Server.UrlDecode(context.Request.QueryString["FromValues"]); BLL.B_Table TableBll = new BLL.B_Table(option); var NewID = TableBll.InsertTableData(FromValues); if (!string.IsNullOrWhiteSpace(NewID)) { context.Response.Write("{\"code\":1,\"msg\":\"保存成功!\",\"newitemid\":\"" + NewID + "\"}"); } else { context.Response.Write("{\"code\":500,\"msg\":\"保存失败!\"}"); } context.Response.End(); }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(Request["ItemID"])) { //输入错误 } ItemID = Convert.ToInt32(Request["ItemID"]); TableBll = new BLL.B_Table(ItemID); TableModel = TableBll.GetTableModel(); TableFielModelList = TableBll.GetTableFieldModel(); if (!IsPostBack) { string GetType = Request.Form["gettype"]; if (GetType != null) { if (GetType == "SetData") { var PageData = Request.Form["values"]; var TableInfo = Request.Form["tableInfo"]; DataTable TableInfoDt = BLL.JsonHelper.DeserializeJsonToObject <DataTable>(TableInfo); DataTable TableFileInfoDt = BLL.JsonHelper.DeserializeJsonToObject <DataTable>(PageData); if (TableBll.UpdateTableModel(TableInfoDt) && TableBll.UpdateTableFieldModel(TableFileInfoDt)) { TableBll.SavePageHtml(); Response.Write("True"); } else { Response.Write("False"); } Response.End(); } else if (GetType == "SetTableData") { var SetTableInfo = Request.Form["settableinfo"]; DataTable SetTableInfodt = BLL.JsonHelper.DeserializeJsonToObject <DataTable>(SetTableInfo); if (TableBll.UpdateTableModel(SetTableInfodt)) { //更新TableFieldInfo信息 TableBll.ToUpdateTableFieldModel(); Response.Write("True"); } else { Response.Write("False"); } Response.End(); } else if (GetType == "SetOrder") { Response.Write(TableBll.SetOrder()); Response.End(); } else if (GetType == "SetFragmentCode") { var SetTableInfo = Request.Form["settableinfo"]; DataTable SetTableInfodt = BLL.JsonHelper.DeserializeJsonToObject <DataTable>(SetTableInfo); if (SetTableInfodt != null && SetTableInfodt.Rows.Count > 0) { for (int i = 0; i < SetTableInfodt.Rows.Count; i++) { var KeyName = SetTableInfodt.Rows[i][0].ToString(); var KeyValue = SetTableInfodt.Rows[i][1].ToString(); TableBll.UpdateFragmentCodeModel(KeyName, KeyValue); TableBll.SavePageHtml(); } } TableBll.SavePageHtml(); Response.Write("True"); Response.End(); } } } }