public static string Del(string ID, string formid) { FORM_BUILDER_FORM frmstaBll = new FORM_BUILDER_FORM(); string tableName = frmstaBll.GetModel(decimal.Parse(formid)).FORMTABLE; string Sqlstr = string.Format("delete from {0} where CONTROLID={1}", tableName, ID); try { int rows = DbHelperOra.ExecuteSql(Sqlstr); if (rows > 0) { return("删除成功!"); } else { return("删除失败!"); } } catch (Exception ex) { return(ex.Message); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string type = context.Request.QueryString["type"]; string Data = context.Request.Form["data"]; string layoutid = context.Request.QueryString["layoutid"]; FORM_BUILDER_FORM frmBll = new FORM_BUILDER_FORM(); GYLYEQ.Model.FORM_BUILDER_FORM frmModel = new GYLYEQ.Model.FORM_BUILDER_FORM(); FORM_BUILDER_CONTROL cntrBll = new FORM_BUILDER_CONTROL(); GYLYEQ.Model.FORM_BUILDER_CONTROL cntrModel = new GYLYEQ.Model.FORM_BUILDER_CONTROL(); switch (type) { case "savelayout": string formName = context.Request.QueryString["formName"]; savelayout(Data, formName); //创建自定义表单模板数据及动态表 break; case "savepostdata": savepostdata(Data, layoutid); //插入自定义表单用户数据 break; case "showData": string pageindex = context.Request.QueryString["page"]; string pagesize = context.Request.QueryString["limit"]; string wheres = context.Request.Params["wheres"]; GetJsonData(pageindex, pagesize, wheres, layoutid); break; case "save": var mRequest = HttpContext.Current.Request.Form["data"]; string formTitle = HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request.QueryString["formTitle"]); string columns = HttpContext.Current.Request.QueryString["columns"]; string tabName = string.Format("FORM_BUILDER_{0}", DateTime.Now.ToString("yyyyMMddHHmmss")); List <formControl> clist = JsonConvert.DeserializeObject <List <formControl> >(mRequest); frmModel.FORMID = DbHelperOra.GetMaxID("FORMID", "FORM_BUILDER_FORM"); frmModel.FORMNAME = formTitle; frmModel.FORMCREATETIME = DateTime.Now; frmModel.FORMCOLUMNS = int.Parse(columns); frmModel.FORMREMARK = formTitle; frmModel.FORMTABLE = tabName; frmBll.Add(frmModel); foreach (formControl item in clist) { cntrModel.CONTROLID = DbHelperOra.GetMaxID("CONTROLID", "FORM_BUILDER_CONTROL"); cntrModel.CONTROLNAME = item.name; cntrModel.CONTROLSORT = item.sort.ToString(); cntrModel.CONTROLREQUIRE = item.required; cntrModel.CONTROLREMARK = item.remark; cntrModel.CONTROLHTML = item.html; cntrModel.FORMID = frmModel.FORMID; cntrModel.CONTROLFIELD = item.field; cntrBll.Add(cntrModel); } //创建对应的业务表 CreateTable(clist, tabName); break; case "savedata": var data = HttpContext.Current.Request.Form["data"]; List <dataModel> llist = JsonConvert.DeserializeObject <List <dataModel> >(data); string formID = HttpContext.Current.Request.QueryString["formID"]; string inserTableName = frmBll.GetModel(decimal.Parse(formID)).FORMTABLE; insertData(inserTableName, llist); //进行数据插入 break; case "upload": UpLoadFile(context); break; default: break; } context.Response.Write(result); }