public string SaveList(string model, string panel, string list, string condition, string pagesize, int index, string enable) { string colsJson = HttpContext.Current.Server.UrlDecode(list); string conditionJson = HttpContext.Current.Server.UrlDecode(condition); ModelInfo modelInfo = ModelHelper.GetModelInfo(model); try { if (modelInfo.Layout.Panels[panel] == null && panel == "multi") { AddMutiPanel(modelInfo, model); modelInfo = ModelHelper.GetModelInfo(model); } ColumnInfoCollection cols = JavaScriptConvert.DeserializeObject <ColumnInfoCollection>(colsJson); We7ControlCollection conditionCtr = JavaScriptConvert.DeserializeObject <We7ControlCollection>(conditionJson); ModelUIHandler.DealSystemColumn(cols, modelInfo); GetGroupByIndex(index, modelInfo.Layout.Panels[panel].ListInfo.Groups).Columns = cols; GetGroupByIndex(index, modelInfo.Layout.Panels[panel].ListInfo.Groups).Enable = bool.Parse(enable); modelInfo.Layout.Panels[panel].Context.PageSize = Convert.ToInt32(pagesize); modelInfo.Layout.Panels[panel].ConditionInfo.Controls = conditionCtr; ModelHelper.SaveModelInfo(modelInfo, model); //生成数据表 DataBaseHelperFactory.Create().CreateTable(modelInfo); } catch (Exception ex) { //TODO:: resolve exception return(ex.Message); } return("保存完毕"); }
public string SaveList(string model, string panel, string list, string condition, string pagesize, int index, string enable) { string colsJson = HttpContext.Current.Server.UrlDecode(list); string conditionJson = HttpContext.Current.Server.UrlDecode(condition); ModelInfo modelInfo = ModelHelper.GetModelInfo(model); try { if (modelInfo.Layout.Panels[panel] == null && panel == "multi") { AddMutiPanel(modelInfo, model); modelInfo = ModelHelper.GetModelInfo(model); } ColumnInfoCollection cols = JsonConvert.DeserializeObject <ColumnInfoCollection>(colsJson); We7ControlCollection conditionCtr = JsonConvert.DeserializeObject <We7ControlCollection>(conditionJson); ModelUIHandler.DealSystemColumn(cols, modelInfo); /* begin * ndoe:此段代码的作用是查找编辑配置 * 有param["model"]的项(此param作用于关联控件) * 列表查询读取此段param信息可以得到关联表信息。 * ps:如果您试图维护此代码,或者有更好的办法。请谨慎为之。 * author:丁乐 * date:2011/12/19 */ if (modelInfo.Layout.Panels["edit"] != null && modelInfo.Layout.Panels["edit"].EditInfo != null && modelInfo.Layout.Panels["edit"].EditInfo.Controls != null && modelInfo.Layout.Panels["edit"].EditInfo.Controls.Count > 0) { foreach (var item in modelInfo.Layout.Panels["edit"].EditInfo.Controls) { if (item.Params != null && item.Params.Count > 0 && !string.IsNullOrEmpty(item.Params["model"])) { if (cols[item.Name] != null && cols[item.Name].Params != null) { cols[item.Name].Params.Add(new Param("model", item.Params["model"])); cols[item.Name].Params.Add(new Param("textfield", item.Params["textfield"])); cols[item.Name].Params.Add(new Param("valuefield", item.Params["valuefield"])); } else if (cols[item.Name] != null && cols[item.Name].Params == null) { cols[item.Name].Params = new ParamCollection { new Param("model", item.Params["model"]), new Param("textfield", item.Params["textfield"]), new Param("valuefield", item.Params["valuefield"]) }; } } } } /*end*/ GetGroupByIndex(index, modelInfo.Layout.Panels[panel].ListInfo.Groups).Columns = cols; GetGroupByIndex(index, modelInfo.Layout.Panels[panel].ListInfo.Groups).Enable = bool.Parse(enable); modelInfo.Layout.Panels[panel].Context.PageSize = Convert.ToInt32(pagesize); modelInfo.Layout.Panels[panel].ConditionInfo.Controls = conditionCtr; ModelHelper.SaveModelInfo(modelInfo, model); //生成数据表 DataBaseHelperFactory.Create().CreateTable(modelInfo); } catch (Exception ex) { //TODO:: resolve exception return(ex.Message); } return("保存完毕"); }