public void DataBindList() { B_Model bll1 = new B_Model(); int ModelID = DataConverter.CLng(this.ViewState["ModelID"].ToString()); M_ModelInfo modeli = bll1.GetModelById(ModelID); this.LModelName.Text = modeli.ModelName; this.TxtTemplate.Text = modeli.ContentModule; this.RepSystemModel.DataSource = bll.GetSysUserField(); this.RepSystemModel.DataBind(); this.RepModelField.DataSource = bll.GetModelFieldList(ModelID); this.RepModelField.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(base.Request.QueryString["ItemID"])) { int ItemID = DataConverter.CLng(base.Request.QueryString["ItemID"]); B_Content bcontent = new B_Content(); B_Model bmode = new B_Model(); B_Node bnode = new B_Node(); M_CommonData ItemInfo = bcontent.GetCommonData(ItemID); if(ItemInfo.IsNull) Response.Write("[产生错误的可能原因:您访问的内容信息不存在!]"); M_ModelInfo modelinfo = bmode.GetModelById(ItemInfo.ModelID); string TempNode = bnode.GetModelTemplate(ItemInfo.NodeID, ItemInfo.ModelID); string TempContent = ItemInfo.Template; string TemplateDir = modelinfo.ContentModule; if (!string.IsNullOrEmpty(TempContent)) TemplateDir = TempContent; else { if (!string.IsNullOrEmpty(TempNode)) TemplateDir = TempNode; } if (string.IsNullOrEmpty(TemplateDir)) { Response.Write("[产生错误的可能原因:该内容所属模型未指定模板!]"); } else { TemplateDir = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + TemplateDir; TemplateDir = TemplateDir.Replace("/", @"\"); string ContentHtml = this.bll.CreateHtml(FileSystemObject.ReadFile(TemplateDir), 0, ItemID); Response.Write(ContentHtml); } } else { Response.Write("[产生错误的可能原因:您访问的内容信息不存在!]"); } }
/// <summary> /// 创建模型和数据表,并增加字段 /// </summary> public int CreateModelInfo(M_Pub pub, M_ModelInfo modelinfo = null) { B_Model mll = new B_Model(); if (modelinfo == null) { modelinfo = new M_ModelInfo(); } modelinfo.TableName = pub.PubTableName; modelinfo.ModelType = 7; modelinfo.MultiFlag = false; //--------------------------------- string sqlStr = ""; string propert1 = ""; //bool isext = DBHelper.Table_IsExist(pub.PubTableName); switch (pub.PubType) { case 0: //评论 modelinfo.ModelName = "评论" + pub.PubName + "的模型"; //modelinfo.Description = ""; //modelinfo.ItemName = "评论"; //modelinfo.ItemUnit = "条"; //modelinfo.ItemIcon = "GuestBook.gif"; modelinfo.ContentModule = "/互动模板/默认评论" + pub.PubName + "模板.html"; sqlStr = "CREATE TABLE [dbo].[" + pub.PubTableName + "] ( [ID] [int] IDENTITY (1, 1) NOT NULL, [Pubupid] [int] NULL , [PubUserName] [nvarchar] (255) NULL , [PubUserID] [int] NULL , [PubContentid] [int] NULL ,[PubInputer] [nvarchar] (255) NULL ,[Parentid] [int] NULL DEFAULT (0), [PubIP] [nvarchar] (255) NULL , [Pubnum] [int] NULL DEFAULT (0) , [Pubstart] [int] NULL DEFAULT (0) , [PubTitle] [nvarchar] (255) NULL ,[PubContent] [ntext] NULL , [PubAddTime] [datetime] NULL DEFAULT (getdate()),[Optimal] [int] NULL DEFAULT (0),[cookflag] [nvarchar] (500) NULL) ALTER TABLE [" + pub.PubTableName + "] WITH NOCHECK ADD CONSTRAINT [PK_" + pub.PubTableName + "] PRIMARY KEY NONCLUSTERED ( [ID] )"; mll.AddModel(modelinfo, sqlStr); propert1 = @"sp_addextendedproperty N'MS_Description', N'评论ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'ID'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'互动ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubupid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'回复用户名', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubUserName'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'回复用户ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubUserID'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'内容ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubContentid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'所属ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Parentid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'IP地址', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubIP'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'参与人数', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubnum'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'是否审核', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubstart'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'评论标题', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubTitle'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'评论回复', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubContent'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'评论时间', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubAddTime'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'设置评论最佳回复', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Optimal'"; Execute(propert1); break; case 1: //投票 modelinfo.ModelName = "投票" + pub.PubName + "的模型"; modelinfo.ContentModule = "/互动模板/默认投票" + pub.PubName + "模板.html"; modelinfo.ModelType = 7; modelinfo.MultiFlag = false; sqlStr = "CREATE TABLE [dbo].[" + pub.PubTableName + "] ( [ID] [int] IDENTITY (1, 1) NOT NULL , [Pubupid] [int] NULL , [PubUserName] [nvarchar] (255) NULL , [PubUserID] [int] NULL , [PubContentid] [int] NULL ,[PubInputer] [nvarchar] (255) NULL ,[Parentid] [int] NULL DEFAULT (0), [PubIP] [nvarchar] (255) NULL , [Pubnum] [int] NULL DEFAULT (0) , [Pubstart] [int] NULL DEFAULT (0) , [PubTitle] [nvarchar] (255) NULL , [PubContent] [ntext] NULL , [PubAddTime] [datetime] NULL DEFAULT (getdate()),[Optimal] [int] NULL DEFAULT (0),[cookflag] [nvarchar] (500) NULL ) ALTER TABLE [" + pub.PubTableName + "] WITH NOCHECK ADD CONSTRAINT [PK_" + pub.PubTableName + "] PRIMARY KEY NONCLUSTERED ( [ID] )"; mll.AddModel(modelinfo, sqlStr); propert1 = @"sp_addextendedproperty N'MS_Description', N'投票ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'ID'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'互动ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubupid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'回复用户名', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubUserName'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'回复用户ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubUserID'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'内容ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubContentid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'所属ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Parentid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'IP地址', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubIP'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'参与人数', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubnum'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'是否审核', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubstart'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'投票标题', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubTitle'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'投票回复', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubContent'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'投票时间', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubAddTime'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'设置投票最佳回复', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Optimal'"; Execute(propert1); break; case 2: //活动 modelinfo.ModelName = "活动" + pub.PubName + "的模型"; modelinfo.ContentModule = "/互动模板/默认活动" + pub.PubName + "模板.html"; sqlStr = "CREATE TABLE [dbo].[" + pub.PubTableName + "] ( [ID] [int] IDENTITY (1, 1) NOT NULL , [Pubupid] [int] NULL , [PubUserName] [nvarchar] (255) NULL , [PubUserID] [int] NULL , [PubContentid] [int] NULL , [PubInputer] [nvarchar] (255) NULL ,[Parentid] [int] NULL DEFAULT (0),[PubIP] [nvarchar] (255) NULL , [Pubnum] [int] NULL DEFAULT (0) , [Pubstart] [int] NULL DEFAULT (0) , [PubTitle] [nvarchar] (255) NULL , [PubContent] [ntext] NULL , [PubAddTime] [datetime] NULL DEFAULT (getdate()),[Optimal] [int] NULL DEFAULT (0),[cookflag] [nvarchar] (500) NULL) ALTER TABLE [" + pub.PubTableName + "] WITH NOCHECK ADD CONSTRAINT [PK_" + pub.PubTableName + "] PRIMARY KEY NONCLUSTERED ( [ID] )"; mll.AddModel(modelinfo, sqlStr); propert1 = @"sp_addextendedproperty N'MS_Description', N'活动ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'ID'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'互动ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubupid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'回复用户名', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubUserName'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'回复用户ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubUserID'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'内容ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubContentid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'所属ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Parentid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'IP地址', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubIP'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'参与人数', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubnum'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'是否审核', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubstart'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'活动标题', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubTitle'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'活动回复', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubContent'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'发动时间', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubAddTime'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'设置活动最佳回复', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Optimal'"; Execute(propert1); break; case 3: //留言 modelinfo.ModelName = "留言" + pub.PubName + "的模型"; modelinfo.ContentModule = "/互动模板/默认留言" + pub.PubName + "模板.html"; sqlStr = "CREATE TABLE [dbo].[" + pub.PubTableName + "] ( [ID] [int] IDENTITY (1, 1) NOT NULL , [Pubupid] [int] NULL , [PubUserName] [nvarchar] (255) NULL , [PubUserID] [int] NULL , [PubContentid] [int] NULL , [PubInputer] [nvarchar] (255) NULL ,[Parentid] [int] NULL DEFAULT (0),[PubIP] [nvarchar] (255) NULL , [Pubnum] [int] NULL DEFAULT (0) , [Pubstart] [int] NULL DEFAULT (0) , [PubTitle] [nvarchar] (255) NULL ,[PubContent] [ntext] NULL , [PubAddTime] [datetime] NULL DEFAULT (getdate()),[Optimal] [int] NULL DEFAULT (0),[cookflag] [nvarchar] (500) NULL) ALTER TABLE [" + pub.PubTableName + "] WITH NOCHECK ADD CONSTRAINT [PK_" + pub.PubTableName + "] PRIMARY KEY NONCLUSTERED ( [ID] )"; mll.AddModel(modelinfo, sqlStr); propert1 = @"sp_addextendedproperty N'MS_Description', N'留言ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'ID'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'互动ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubupid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'回复用户名', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubUserName'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'回复用户ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubUserID'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'内容ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubContentid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'所属ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Parentid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'IP地址', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubIP'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'参与人数', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubnum'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'是否审核', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubstart'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'留言标题', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubTitle'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'留言回复', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubContent'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'留言时间', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubAddTime'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'设置留言最佳回复', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Optimal'"; Execute(propert1); break; case 4: //问券 modelinfo.ModelName = "问券" + pub.PubName + "的模型"; modelinfo.ContentModule = "/互动模板/默认问券" + pub.PubName + "模板.html"; sqlStr = "CREATE TABLE [dbo].[" + pub.PubTableName + "] ( [ID] [int] IDENTITY (1, 1) NOT NULL , [Pubupid] [int] NULL , [PubUserName] [nvarchar] (255) NULL , [PubUserID] [int] NULL , [PubContentid] [int] NULL ,[PubInputer] [nvarchar] (255) NULL ,[Parentid] [int] NULL DEFAULT (0), [PubIP] [nvarchar] (255) NULL , [Pubnum] [int] NULL DEFAULT (0) , [Pubstart] [int] NULL DEFAULT (0) , [PubTitle] [nvarchar] (255) NULL , [PubContent] [ntext] NULL , [PubAddTime] [datetime] NULL DEFAULT (getdate()),[Optimal] [int] NULL DEFAULT (0),[cookflag] [nvarchar] (500) NULL) ALTER TABLE [" + pub.PubTableName + "] WITH NOCHECK ADD CONSTRAINT [PK_" + pub.PubTableName + "] PRIMARY KEY NONCLUSTERED ( [ID] )"; mll.AddModel(modelinfo, sqlStr); propert1 = @"sp_addextendedproperty N'MS_Description', N'问券ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'ID'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'互动ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubupid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'回复用户名', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubUserName'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'回复用户ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubUserID'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'内容ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubContentid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'所属ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Parentid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'IP地址', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubIP'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'参与人数', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubnum'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'是否审核', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubstart'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'问券标题', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubTitle'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'问券回复', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubContent'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'问券时间', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubAddTime'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'设置问券最佳回复', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Optimal'"; Execute(propert1); break; case 5: //统计 modelinfo.ModelName = "统计" + pub.PubName + "的模型"; modelinfo.ContentModule = "/互动模板/默认统计" + pub.PubName + "模板.html"; sqlStr = "CREATE TABLE [dbo].[" + pub.PubTableName + "] ( [ID] [int] IDENTITY (1, 1) NOT NULL , [Pubupid] [int] NULL , [PubUserName] [nvarchar] (255) NULL , [PubUserID] [int] NULL , [PubContentid] [int] NULL , [PubInputer] [nvarchar] (255) NULL ,[Parentid] [int] NULL DEFAULT (0), [PubIP] [nvarchar] (255) NULL , [Pubnum] [int] NULL DEFAULT (0) , [Pubstart] [int] NULL DEFAULT (0) , [PubTitle] [nvarchar] (255) NULL , [PubContent] [ntext] NULL , [PubAddTime] [datetime] NULL DEFAULT (getdate()),[Optimal] [int] NULL DEFAULT (0),[cookflag] [nvarchar] (500) NULL) ALTER TABLE [" + pub.PubTableName + "] WITH NOCHECK ADD CONSTRAINT [PK_" + pub.PubTableName + "] PRIMARY KEY NONCLUSTERED ( [ID] )"; mll.AddModel(modelinfo, sqlStr); propert1 = @"sp_addextendedproperty N'MS_Description', N'统计ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'ID'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'互动ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubupid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'参与用户名', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubUserName'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'参与用户ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubUserID'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'内容ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubContentid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'所属ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Parentid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'IP地址', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubIP'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'参与人数', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubnum'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'是否审核', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubstart'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'统计标题', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubTitle'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'统计备注', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubContent'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'添加时间', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubAddTime'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'设置统计最佳回复', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Optimal'"; Execute(propert1); break; case 6: //竞标 modelinfo.ModelName = "竞标" + pub.PubName + "的模型"; modelinfo.ContentModule = "/互动模板/默认竞标" + pub.PubName + "模板.html"; sqlStr = "CREATE TABLE [dbo].[" + pub.PubTableName + "] ( [ID] [int] IDENTITY (1, 1) NOT NULL , [Pubupid] [int] NULL , [PubUserName] [nvarchar] (255) NULL , [PubUserID] [int] NULL , [PubContentid] [int] NULL ,[PubInputer] [nvarchar] (255) NULL ,[Parentid] [int] NULL DEFAULT (0), [PubIP] [nvarchar] (255) NULL , [Pubnum] [int] NULL DEFAULT (0) , [Pubstart] [int] NULL DEFAULT (0) , [PubTitle] [nvarchar] (255) NULL , [PubContent] [ntext] NULL , [PubAddTime] [datetime] NULL DEFAULT (getdate()),[Optimal] [int] NULL DEFAULT (0),[cookflag] [nvarchar] (500) NULL ) ALTER TABLE [" + pub.PubTableName + "] WITH NOCHECK ADD CONSTRAINT [PK_" + pub.PubTableName + "] PRIMARY KEY NONCLUSTERED ( [ID] )"; mll.AddModel(modelinfo, sqlStr); propert1 = @"sp_addextendedproperty N'MS_Description', N'竞标ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'ID'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'互动ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubupid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'回复用户名', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubUserName'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'回复用户ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubUserID'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'内容ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubContentid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'所属ID', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Parentid'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'IP地址', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubIP'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'参与人数', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubnum'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'是否审核', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Pubstart'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'竞标标题', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubTitle'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'竞标回复', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubContent'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'竞标时间', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'PubAddTime'"; Execute(propert1); propert1 = @"sp_addextendedproperty N'MS_Description', N'设置竞标最佳回复', N'user', N'dbo', N'table', N'" + pub.PubTableName + "', N'column', N'Optimal'"; Execute(propert1); break; case 7: //评星 modelinfo.ModelName = "评星" + pub.PubName + "的模型"; modelinfo.ContentModule = "/互动模板/评星" + pub.PubName + "模板.html"; sqlStr = "CREATE TABLE [dbo].[" + pub.PubTableName + "] ( [ID] [int] IDENTITY (1, 1) NOT NULL , [Pubupid] [int] NULL , [PubUserName] [nvarchar] (255) NULL , [PubUserID] [int] NULL , [PubContentid] [int] NULL ,[PubInputer] [nvarchar] (255) NULL ,[Parentid] [int] NULL DEFAULT (0), [PubIP] [nvarchar] (255) NULL , [Pubnum] [int] NULL DEFAULT (0) , [Pubstart] [int] NULL DEFAULT (0) , [PubTitle] [nvarchar] (255) NULL , [PubContent] [ntext] NULL , [PubAddTime] [datetime] NULL DEFAULT (getdate()),[Optimal] [int] NULL DEFAULT (0),[Type] [int] NULL DEFAULT (1),[cookflag] [nvarchar] (500) NULL ) ALTER TABLE [" + pub.PubTableName + "] WITH NOCHECK ADD CONSTRAINT [PK_" + pub.PubTableName + "] PRIMARY KEY NONCLUSTERED ( [ID] )"; mll.AddModel(modelinfo, sqlStr); break; case 8: //互动表单 sqlStr = "CREATE TABLE [dbo].[" + pub.PubTableName + "] ([ID] [int] IDENTITY (1, 1) NOT NULL , [Pubupid] [int] NULL , [PubUserName] [nvarchar] (255) NULL , [PubUserID] [int] NULL , [PubContentid] [int] NULL ,[PubInputer] [nvarchar] (255) NULL ,[Parentid] [int] NULL DEFAULT (0), [PubIP] [nvarchar] (255) NULL , [Pubnum] [int] NULL DEFAULT (0) , [Pubstart] [int] NULL DEFAULT (0) , [PubTitle] [nvarchar] (255) NULL , [PubContent] [ntext] NULL , [PubAddTime] [datetime] NULL DEFAULT (getdate()),[Optimal] [int] NULL DEFAULT (0),[cookflag] [nvarchar] (500) NULL ) ALTER TABLE [" + pub.PubTableName + "] WITH NOCHECK ADD CONSTRAINT [PK_" + pub.PubTableName + "] PRIMARY KEY NONCLUSTERED ( [ID] )"; Execute(sqlStr); break; default: mll.AddModel(modelinfo, ""); break; } return(modelinfo.ModelID); }
protected void Repeater1_ItemCommand(object sender, RepeaterCommandEventArgs e) { if (e.CommandName == "UpMove") { int Id = DataConverter.CLng(e.CommandArgument); M_ModelField Fieldinfo = this.bll.GetModelByID(Id); if (Fieldinfo.OrderID != this.bll.GetMinOrder(Fieldinfo.ModelID)) { M_ModelField FieldPre = this.bll.GetPreField(Fieldinfo.ModelID, Fieldinfo.OrderID); int CurrOrder = Fieldinfo.OrderID; Fieldinfo.OrderID = FieldPre.OrderID; FieldPre.OrderID = CurrOrder; this.bll.UpdateOrder(Fieldinfo); this.bll.UpdateOrder(FieldPre); } } if (e.CommandName == "DownMove") { int Id = DataConverter.CLng(e.CommandArgument); M_ModelField Fieldinfo = this.bll.GetModelByID(Id); if (Fieldinfo.OrderID != this.bll.GetMaxOrder(Fieldinfo.ModelID)) { M_ModelField FieldPre = this.bll.GetNextField(Fieldinfo.ModelID, Fieldinfo.OrderID); int CurrOrder = Fieldinfo.OrderID; Fieldinfo.OrderID = FieldPre.OrderID; FieldPre.OrderID = CurrOrder; this.bll.UpdateOrder(Fieldinfo); this.bll.UpdateOrder(FieldPre); } } if (e.CommandName == "Delete") { int Id = DataConverter.CLng(e.CommandArgument); int ModelID; ModelID = DataConverter.CLng(this.ViewState["ModelID"].ToString()); B_Model bll1 = new B_Model(); string tablename = bll1.GetModelById(ModelID).TableName; M_ModelField fieldinfo = this.bll.GetModelByID(Id); if (fieldinfo.FieldType == "PicType" || fieldinfo.FieldType == "FileType") { string[] Setting = fieldinfo.Content.Split(new char[] { ',' }); bool chk = DataConverter.CBool(Setting[0].Split(new char[] { '=' })[1]); string fieldname = Setting[1].Split(new char[] { '=' })[1]; if (chk && fieldname != "") { this.bll.DelSubField(tablename, fieldname); } } this.bll.Del(Id, tablename); } DataBindList(); }
protected void SetTemplate(object sender, EventArgs e) { B_Model bll1 = new B_Model(); int ModelID = DataConverter.CLng(this.ViewState["ModelID"].ToString()); bll1.UpdateTemplate(this.TxtTemplate.Text, ModelID); }