public ActionResult ShowPub() { GID = DataConverter.CLng(Request["ID"]); PubID = DataConverter.CLng(Request["pid"]); string menu = Request["menu"] ?? ""; string Optimal = Request["Optimal"] ?? ""; M_Pub pubMod = pubBll.GetSelect(PubID); if (pubMod != null) { switch (menu) { case "setinfo": { if (Optimal.Equals("0")) { pubBll.UpdatePubModelByOptimal(pubMod.PubTableName, GID); pubBll.UpdatePubModelById(pubMod.PubTableName, PubID); } else if (Optimal.Equals("1")) { pubBll.UpdatePubModelOptimal(pubMod.PubTableName, PubID); } } break; case "setdb": { if (Optimal.Equals("0")) { pubBll.Getdb(pubMod.PubTableName, GID); } else if (Optimal.Equals("2")) { pubBll.UpdatePubModelOptimal(pubMod.PubTableName, GID); } } break; case "setnodb": { if (Optimal.Equals("0")) { pubBll.Getnodb(pubMod.PubTableName, DataConverter.CLng(Request.QueryString["GID"])); } else if (Optimal.Equals("-1")) { pubBll.UpdatePubModelOptimal(pubMod.PubTableName, DataConverter.CLng(Request.QueryString["GID"])); } } break; } } M_CommonData comMod = conBll.GetCommonData(GID); int ModelID = comMod.ModelID; bool IsLoginUser = comMod.Inputer.Equals(mu.UserName); //列表数据 //PageSetting setting = IsLoginUser ? pubBll.SelPage(CPage, PSize, 0, GID, "", pubMod.PubTableName) : pubBll.SelPage(CPage, PSize, 0, GID, mu.UserName, pubMod.PubTableName); PageSetting setting = null; //详情数据 DataRow DataDr = conBll.GetContentByItems(comMod.TableName, comMod.GeneralID).Rows[0]; //要显示的数据 DataTable FieldDt = mfBll.GetModelFieldList(ModelID); //要显示的字段列表 DataTable newDt = new DataTable(); newDt.Columns.Add("Title"); newDt.Columns.Add("Content"); DataRow dr1 = newDt.NewRow(); dr1["Title"] = "ID"; dr1["Content"] = DataDr["GeneralID"]; newDt.Rows.Add(dr1); DataRow dr2 = newDt.NewRow(); dr2["Title"] = "标题"; dr2["Content"] = DataDr["Title"]; newDt.Rows.Add(dr2); foreach (DataRow dr in FieldDt.Rows) { DataRow row = newDt.NewRow(); row["Title"] = dr["FieldAlias"]; row["Content"] = DataDr[dr["FieldName"].ToString()]; newDt.Rows.Add(row); } ViewBag.Details = newDt; ViewBag.IsLoginUser = IsLoginUser; PubTable = pubMod.PubTableName; return(View(setting)); }