//提交 protected void Submit_B_Click(object sender, EventArgs e) { M_Pub pubMod = new M_Pub(); bool addtrue = true; #region 验证模块 if (Mid < 1) { DataTable tempinfo = pubBll.SelByName(PubName.Text); if (tempinfo.Rows.Count > 0) { addtrue = false; function.WriteErrMsg("已存在此互动模块!请更换模块名称再试!!"); } DataTable PubInputLoadStrtable = pubBll.SelBy("", "PubInputLoadStr.Text", Mid.ToString()); if (PubInputLoadStrtable.Rows.Count > 0) { addtrue = false; function.WriteErrMsg("已经存在此提交标签!"); } DataTable PubLoadstrtable = pubBll.SelBy(PubLoadstr.Text, "", Mid.ToString()); if (PubLoadstrtable.Rows.Count > 0) { addtrue = false; function.WriteErrMsg("已经存在此互动标签!"); } } #endregion if (addtrue) { if (Mid > 0) { pubMod = pubBll.SelReturnModel(Mid); if (Menu.Equals("copy")) { pubMod.Pubid = 0; } } pubMod.PubAddnum = 0; pubMod.PubCreateTime = DateTime.Now; pubMod.PubBindPub = 0; pubMod.PubClass = DataConverter.CLng(this.PubClass.SelectedValue); pubMod.PubCode = PubCode.Checked ? 1 : 0; //界面处理显示结束时间,如果是最大则不显示 if (!string.IsNullOrEmpty(this.PubEndTime.Text)) { pubMod.PubEndTime = DataConverter.CDate(this.PubEndTime.Text.Replace("/", "-")); } else { pubMod.PubEndTime = DateTime.MaxValue; } pubMod.PubInputLoadStr = PubInputLoadStr.Text; pubMod.PubType = DataConverter.CLng(this.PubType.SelectedValue); pubMod.PubNodeID = ""; pubMod.PubTemplateID = ""; pubMod.PubIsDel = 0; pubMod.PubIsTrue = PubIsTrue.Checked ? 1 : 0; pubMod.PubLoadstr = PubLoadstr.Text; pubMod.PubLogin = PubLogin.Checked ? 1 : 0; pubMod.PubLoginUrl = PubLoginUrl.Text; pubMod.PubTableName = "ZL_Pub_" + PubTableName.Text; pubMod.PubName = PubName.Text; pubMod.PubOpenComment = PubOpenComment.Checked ? 1 : 0; pubMod.PubShowType = DataConverter.CLng(this.PubShowType.SelectedValue); //pubMod.PubTimeSlot = CookieNum_Rad.SelectedValue.Equals("0") ? 0 : DataConverter.CLng(CookieNum_T.Text); pubMod.Pubkeep = DataConverter.CLng(this.Pubkeep.Text); pubMod.PubInputTM = ""; pubMod.PubTemplate = ""; pubMod.Puberrmsg = Puberrmsg.Text; pubMod.PubFlag = pubflag.Checked ? 1 : 0; string perm = ""; if (CheckBox1.Checked) { perm += "Look"; } if (CheckBox2.Checked) { perm += ",Edit"; } if (CheckBox3.Checked) { perm += ",Del"; } if (CheckBox4.Checked) { perm += ",Sen"; } pubMod.PubPermissions = perm; pubMod.PubGourl = PubGourl.Text; pubMod.Public = RaPublic.Checked ? 1 : 0; //设置限制用户提交数量 if (this.PubOneOrMore.SelectedValue == "2") { pubMod.PubOneOrMore = DataConverter.CLng(this.PubOneOrMorenum.Text); } else { pubMod.PubOneOrMore = DataConverter.CLng(this.PubOneOrMore.SelectedValue); } //设置限制IP提交数量 if (this.PubIPOneOrMore.SelectedValue == "2") { pubMod.PubIPOneOrMore = DataConverter.CLng(this.PubIPOneOrMorenum.Text); } else { pubMod.PubIPOneOrMore = DataConverter.CLng(this.PubIPOneOrMore.SelectedValue); } pubMod.Interval = DataConverter.CLng(Interval_T.Text); string strPath = ""; string strPathname = ""; string PubInputTMurl = ""; string Tempinputstr = @""; //模型ID if (pubMod.Pubid == 0) { pubMod.PubModelID = pubBll.CreateModelInfo(pubMod);//建立数据表与模型Field,Model int Pubinsertid = pubBll.GetInsert(pubMod); #region 创建互动模板 string PubTemplateurl = ""; string Tmpstr = ""; M_Label lab = new M_Label(); B_Label blab = new B_Label(); lab.LabelAddUser = badmin.GetAdminLogin().AdminId; string getstr = ""; switch (pubMod.PubClass) { //0-内容 1-商城 2-黄页 3-店铺 4-会员 case 0: getstr = "ID"; break; case 1: getstr = "ID"; break; case 2: getstr = "Pageid"; break; case 3: getstr = "id"; break; case 4: getstr = "Userid"; break; case 5: getstr = "Nodeid"; break; case 6: getstr = ""; break; default: getstr = "ID"; break; } string pubcontdid = "-1"; if (pubMod.PubClass != 6) { pubcontdid = "{$GetRequest(" + getstr + ")$}"; } //创建标签 switch (pubMod.PubType) { case 0: //评论 //创建源标签 lab.LableName = pubMod.PubName + "调用标签"; lab.LabelCate = "互动标签"; lab.LableType = 4; lab.LabelTable = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid"; lab.LabelField = "" + pubMod.PubTableName + ".*,ZL_Pub.*"; lab.LabelWhere = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1"; lab.Param = ""; lab.LabelOrder = "" + pubMod.PubTableName + ".ID DESC"; lab.LabelCount = "10"; lab.Content = "{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n评论说明:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n评论时间:{Field=\"PubAddTime\"/}<br />{/Repeate}<br />\n{ZL.Page/}"; lab.Desc = pubMod.PubTableName + "分页标签"; lab.LabelNodeID = 0; blab.AddLabelXML(lab); Tmpstr = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + PubInputLoadStr.Text + "/}"; strPath = "默认评论" + pubMod.PubName + "模板.html"; strPathname = "默认评论" + pubMod.PubName + "模板.html"; strPath = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath; strPath = strPath.Replace("/", @"\"); FileSystemObject.WriteFile(strPath, Tmpstr); break; case 1: //投票 //创建标签 lab.LableName = pubMod.PubName + "调用标签"; lab.LabelCate = "互动标签"; lab.LableType = 4; lab.LabelTable = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid"; lab.LabelField = "" + pubMod.PubTableName + ".*,ZL_Pub.*"; lab.LabelWhere = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1"; lab.Param = ""; lab.LabelOrder = "" + pubMod.PubTableName + ".ID DESC"; lab.LabelCount = "10"; lab.Content = "{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n投票说明:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n投票时间:{Field=\"PubAddTime\"/}<br />{/Repeate}<br />\n{ZL.Page/}"; lab.Desc = pubMod.PubTableName + "分页标签"; lab.LabelNodeID = 0; blab.AddLabelXML(lab); Tmpstr = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + PubInputLoadStr.Text + "/}"; strPath = "默认投票" + pubMod.PubName + "模板.html"; strPathname = "默认投票" + pubMod.PubName + "模板.html"; strPath = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath; break; case 2: //活动 lab.LableName = pubMod.PubName + "调用标签"; lab.LabelCate = "互动标签"; lab.LableType = 4; lab.LabelTable = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid"; lab.LabelField = "" + pubMod.PubTableName + ".*,ZL_Pub.*"; lab.LabelWhere = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1"; lab.Param = ""; lab.LabelOrder = "" + pubMod.PubTableName + ".ID DESC"; lab.LabelCount = "10"; lab.Content = "<a href=PubAction.aspx?menu=hd&act=add&Pubid=" + Pubinsertid.ToString() + ">发起活动</a>\n{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n活动内容:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n提交时间:{Field=\"PubAddTime\"/}\n{/Repeate}<br />\n{ZL.Page/}"; lab.Desc = pubMod.PubTableName + "分页标签"; lab.LabelNodeID = 0; blab.AddLabelXML(lab); Tmpstr = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + PubInputLoadStr.Text + "/}"; strPath = "默认活动" + pubMod.PubName + "模板.html"; strPathname = "默认活动" + pubMod.PubName + "模板.html"; strPath = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath; break; case 3: //留言 lab.LableName = pubMod.PubName + "调用标签"; lab.LabelCate = "互动标签"; lab.LableType = 4; lab.LabelTable = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid"; lab.LabelField = "" + pubMod.PubTableName + ".*,ZL_Pub.*"; lab.LabelWhere = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1"; lab.Param = ""; lab.LabelOrder = "" + pubMod.PubTableName + ".ID DESC"; lab.LabelCount = "10"; lab.Content = "{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n留言内容:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n提交时间:{Field=\"PubAddTime\"/}\n{/Repeate}<br />\n{ZL.Page/}"; lab.Desc = pubMod.PubTableName + "分页标签"; lab.LabelNodeID = 0; blab.AddLabelXML(lab); Tmpstr = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + PubInputLoadStr.Text + "/}"; strPath = "默认留言" + pubMod.PubName + "模板.html"; strPathname = "默认留言" + pubMod.PubName + "模板.html"; strPath = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath; break; case 4: //问券 lab.LableName = pubMod.PubName + "调用标签"; lab.LabelCate = "互动标签"; lab.LableType = 4; lab.LabelTable = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid"; lab.LabelField = "" + pubMod.PubTableName + ".*,ZL_Pub.*"; lab.LabelWhere = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1"; lab.Param = ""; lab.LabelOrder = "" + pubMod.PubTableName + ".ID DESC"; lab.LabelCount = "10"; lab.Content = "{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n问券内容:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n提交时间:{Field=\"PubAddTime\"/}\n{/Repeate}<br />\n{ZL.Page/}<br />"; lab.Desc = pubMod.PubTableName + "分页标签"; lab.LabelNodeID = 0; blab.AddLabelXML(lab); Tmpstr = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + PubInputLoadStr.Text + "/}"; strPath = "默认问券" + pubMod.PubName + "模板.html"; strPathname = "默认问券" + pubMod.PubName + "模板.html"; strPath = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath; break; case 5: //统计 lab.LableName = pubMod.PubName + "调用标签"; lab.LabelCate = "互动标签"; lab.LableType = 2; lab.LabelTable = pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid"; lab.LabelField = pubMod.PubTableName + ".*,ZL_Pub.*"; lab.LabelWhere = pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " and Parentid=0 And " + pubMod.PubTableName + ".Pubstart=1"; lab.Param = ""; lab.LabelOrder = pubMod.PubTableName + ".ID DESC"; lab.LabelCount = "10"; lab.Content = "点击数:{Field=\"Pubnum\"/}"; lab.Desc = pubMod.PubTableName + "动态标签"; lab.LabelNodeID = 0; blab.AddLabelXML(lab); Tmpstr = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + PubInputLoadStr.Text + "/}"; strPath = "默认统计" + pubMod.PubName + "模板.html"; strPathname = "默认统计" + pubMod.PubName + "模板.html"; strPath = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath; break; case 6: //竞标 //创建标签 lab.LableName = pubMod.PubName + "调用标签"; lab.LabelCate = "互动标签"; lab.LableType = 4; lab.LabelTable = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid"; lab.LabelField = "" + pubMod.PubTableName + ".*,ZL_Pub.*"; lab.LabelWhere = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1"; lab.Param = ""; lab.LabelOrder = "" + pubMod.PubTableName + ".ID DESC"; lab.LabelCount = "10"; lab.Content = "{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n竞标说明:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n竞标时间:{Field=\"PubAddTime\"/}<br />{/Repeate}<br />\n{ZL.Page/}"; lab.Desc = pubMod.PubTableName + "分页标签"; lab.LabelNodeID = 0; blab.AddLabelXML(lab); Tmpstr = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + PubInputLoadStr.Text + "/}"; strPath = "默认竞标" + pubMod.PubName + "模板.html"; strPathname = "默认竞标" + pubMod.PubName + "模板.html"; strPath = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath; break; case 7: lab.LableName = pubMod.PubName + "调用标签"; lab.LabelCate = "互动标签"; lab.LableType = 1; lab.LabelTable = ""; lab.LabelField = ""; lab.LabelWhere = ""; lab.Param = ""; lab.LabelOrder = ""; lab.LabelCount = "10"; if (string.IsNullOrEmpty(starOPT.Text.Trim())) { function.WriteErrMsg("选项不能为空!!"); } string[] starOP = starOPT.Text.Trim().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); lab.Content = GetContent(starOP, Pubinsertid); lab.Desc = pubMod.PubTableName + "分页标签"; lab.LabelNodeID = 0; blab.AddLabelXML(lab); Tmpstr = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + PubInputLoadStr.Text + "/}"; strPath = "评星" + pubMod.PubName + "模板.html"; strPathname = "评星" + pubMod.PubName + "模板.html"; strPath = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath; break; case 8: break; default: function.WriteErrMsg("类型错误,该类型不存在!!!"); break; } strPath = strPath.Replace("/", @"\"); if (!string.IsNullOrEmpty(strPath)) { FileSystemObject.WriteFile(strPath, Tmpstr); } PubTemplateurl = "/互动模板/" + strPathname; #endregion #region 创建互动提交模板 switch (pubMod.PubType) { case 0: //评论 Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction.aspx""> <input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" /> <input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" /> <input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" /> <div class=""form-group""> <label for=""PubTitle"">评论标题:</label> <input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" />{PubCode/} </div> <div class=""form-group""> <label for=""PubContent"">评论内容:</label> <textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea> </div> <div class=""form-group text-center""> <button type=""submit"" class=""btn btn-default"">提交</button> <button type=""reset"" class=""btn btn-default"">重置</button> </div> </form>"; Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString()); strPath = "默认评论" + pubMod.PubName + "提交模板.html"; strPathname = "默认评论" + pubMod.PubName + "提交模板.html"; strPath = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath; break; case 1: //投票 Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction.aspx""> <input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" /> <input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" /> <input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" /> <div class=""form-group""> <label for=""PubTitle"">投票标题:</label> <input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" /> {PubCode/} </div> <div class=""form-group""> <label for=""PubContent"">投票内容:</label> <textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea> </div> <div class=""form-group text-center""> <button type=""submit"" class=""btn btn-default"">提交</button> <button type=""reset"" class=""btn btn-default"">重置</button> </div> </form>"; Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString()); strPath = "默认投票" + pubMod.PubName + "提交模板.html"; strPathname = "默认投票" + pubMod.PubName + "提交模板.html"; strPath = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath; break; case 2: //活动 Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction.aspx""> <input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" /> <input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" /> <input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" /> <div class=""form-group""> <label for=""PubTitle"">活动标题:</label> <input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" /> {PubCode/} </div> <div class=""form-group""> <label for=""PubContent"">活动内容:</label> <textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea> </div> <div class=""form-group text-center""> <button type=""submit"" class=""btn btn-default"">提交</button> <button type=""reset"" class=""btn btn-default"">重置</button> </div> </form>"; Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString()); strPath = "默认活动" + pubMod.PubName + "提交模板.html"; strPathname = "默认活动" + pubMod.PubName + "提交模板.html"; strPath = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath; break; case 3: //留言 Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction.aspx""> <input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" /> <input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" /> <input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" /> <div class=""form-group""> <label for=""PubTitle"">留言标题:</label> <input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" /> {PubCode/} </div> <div class=""form-group""> <label for=""PubContent"">留言内容:</label> <textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea> </div> <div class=""form-group text-center""> <button type=""submit"" class=""btn btn-default"">提交</button> <button type=""reset"" class=""btn btn-default"">重置</button> </div> </form>"; Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString()); strPath = "默认留言" + pubMod.PubName + "提交模板.html"; strPathname = "默认留言" + pubMod.PubName + "提交模板.html"; strPath = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath; break; case 4: //问券 Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction.aspx""> <input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" /> <input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" /> <input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" /> <div class=""form-group""> <label for=""PubTitle"">问券标题:</label> <input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" /> {PubCode/} </div> <div class=""form-group""> <label for=""PubContent"">问券内容:</label> <textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea> </div> <div class=""form-group text-center""> <button type=""submit"" class=""btn btn-default"">提交</button> <button type=""reset"" class=""btn btn-default"">重置</button> </div> </form>"; Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString()); strPath = "默认问券" + pubMod.PubName + "提交模板.html"; strPathname = "默认问券" + pubMod.PubName + "提交模板.html"; strPath = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath; break; case 5: //统计 Tempinputstr = @"<a href=/PubAction.aspx?pubid=" + Pubinsertid + "&PubContentid={PubContentid/}>通过链接提交</a>"; strPath = "默认统计" + pubMod.PubName + "提交模板.html"; strPathname = "默认统计" + pubMod.PubName + "提交模板.html"; strPath = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath; break; case 6: //竞标 Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction.aspx""> <input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" /> <input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" /> <input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" /> <div class=""form-group""> <label for=""PubTitle"">竞标标题:</label> <input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" /> {PubCode/} </div> <div class=""form-group""> <label for=""PubContent"">竞标内容:</label> <textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea> </div> <div class=""form-group text-center""> <button type=""submit"" class=""btn btn-default"">提交</button> <button type=""reset"" class=""btn btn-default"">重置</button> </div> </form>"; Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString()); strPath = "默认竞标" + pubMod.PubName + "提交模板.html"; strPathname = "默认竞标" + pubMod.PubName + "提交模板.html"; strPath = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath; break; case 7: //评星 if (string.IsNullOrEmpty(starOPT.Text.Trim())) { function.WriteErrMsg("选项不能为空!!"); } string[] starOP = starOPT.Text.Trim().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); Tempinputstr = GetContent(starOP, Pubinsertid); //存值方式Content中 //name:value,name:value然后用先获取contentID下的记录,然后再统计用lamda统计得分 strPath = "评星" + pubMod.PubName + "提交模板.html"; strPathname = "评星" + pubMod.PubName + "提交模板.html"; strPath = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath; break; default: break; } if (pubflag.Checked)//开启cookie验证 { Tempinputstr += @" if (!localStorage[""cookflag""]) { localStorage[""cookflag""] = GetRanPass(12); } if (!getCookie(""cookflag"")) { setCookie(""cookflag"", localStorage[""cookflag""]); }"; } strPath = strPath.Replace("/", @"\"); FileSystemObject.WriteFile(strPath, Tempinputstr); PubInputTMurl = "/互动模板/" + strPathname; #endregion pubMod = pubBll.GetSelect(Pubinsertid); pubMod.PubInputTM = PubInputTMurl;//提交窗口模板 pubMod.PubTemplate = PubTemplateurl; pubMod.Public = RaPublic.Checked ? 1 : 0; pubBll.GetUpdate(pubMod); function.WriteSuccessMsg("添加成功", pubMod.PubType == 8 ? "FormMangae.aspx" : "pubmanage.aspx"); } else { pubMod.PubTableName = ModelList_DP.SelectedValue; pubMod.PubInputTM = PubInputTM_hid.Value; pubMod.PubTemplate = PubTemplate_hid.Value; pubMod.Pubinfo = Pubinfo.Text; pubBll.GetUpdate(pubMod); function.WriteSuccessMsg("更新成功", pubMod.PubType == 8 ? "FormMangae.aspx" : "pubmanage.aspx"); } } }
public IActionResult PubAdd_Submit() { M_Pub pubMod = new M_Pub(); if (Mid > 0) { pubMod = pubBll.SelReturnModel(Mid); } pubMod.PubName = GetParam("PubName"); bool addtrue = true; #region 验证模块 if (Mid < 1) { pubMod.PubLoadstr = GetParam("PubLoadstr"); pubMod.PubInputLoadStr = GetParam("PubInputLoadStr"); pubMod.PubTableName = B_Pub.PREFIX + GetParam("PubTableName"); DataTable tempinfo = pubBll.SelByName(pubMod.PubName); if (tempinfo.Rows.Count > 0) { addtrue = false; return(WriteErr("已存在此互动模块!请更换模块名称再试!!", "javascript:history.back(-2);")); } DataTable PubInputLoadStrtable = pubBll.SelBy("", "PubInputLoadStr.Text", Mid.ToString()); if (PubInputLoadStrtable.Rows.Count > 0) { addtrue = false; return(WriteErr("已经存在此提交标签!")); } DataTable PubLoadstrtable = pubBll.SelBy(pubMod.PubLoadstr, "", Mid.ToString()); if (PubLoadstrtable.Rows.Count > 0) { addtrue = false; return(WriteErr("已经存在此互动标签!")); } } #endregion if (addtrue) { pubMod.PubClass = DataConverter.CLng(GetParam("PubClass")); pubMod.PubCode = DataConvert.CLng(GetParam("PubCode")); //界面处理显示结束时间,如果是最大则不显示 if (!string.IsNullOrEmpty(GetParam("PubEndTime"))) { pubMod.PubEndTime = DataConverter.CDate(GetParam("PubEndTime").Replace("/", "-")); } else { pubMod.PubEndTime = DateTime.MaxValue; } pubMod.PubType = DataConverter.CLng(GetParam("PubType")); pubMod.PubIsTrue = DataConvert.CLng(GetParam("PubIsTrue")); pubMod.PubLogin = DataConvert.CLng(GetParam("PubLogin")); //pubMod.PubLoginUrl = PubLoginUrl.Text; pubMod.PubOpenComment = DataConvert.CLng(GetParam("PubOpenComment")); pubMod.PubShowType = DataConverter.CLng(GetParam("PubShowType")); pubMod.Pubkeep = DataConverter.CLng(GetParam("Pubkeep")); pubMod.Puberrmsg = Request.Form["Puberrmsg"]; pubMod.PubPermissions = GetParam("PubPermissions"); pubMod.PubGourl = GetParam("PubGourl"); pubMod.Public = DataConvert.CLng(GetParam("RaPublic")); pubMod.VerifyMode = Request.Form["verify_chk"]; pubMod.PubIPOneOrMore = DataConverter.CLng(GetParam("PubIPOneOrMore")); pubMod.Interval = DataConverter.CLng(GetParam("Interval_T")); pubMod.Pubinfo = GetParam("Pubinfo"); string PubInputTMurl = ""; string Tempinputstr = @""; //模型ID if (pubMod.Pubid == 0) { string saveDir = function.VToP(SiteConfig.SiteOption.TemplateDir + "/互动模板/"); string saveName = ""; pubMod.PubModelID = pubBll.CreateModelInfo(pubMod);//建立数据表与模型Field,Model int Pubinsertid = pubBll.GetInsert(pubMod); #region 创建互动引用模板 string PubTemplateurl = ""; //模板路径 string Tmpstr = ""; //引用标签 M_Label lab = new M_Label(); B_Label blab = new B_Label(); lab.LabelAddUser = adminMod.AdminId; string pubcontdid = "@ID"; lab.Param = "ID,0,2,"; //创建标签 switch (pubMod.PubType) { case 0: //评论 //创建源标签 lab.LabelName = pubMod.PubName + "调用标签"; lab.LabelCate = "互动标签"; lab.LabelType = 4; lab.LabelTable = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid"; lab.LabelField = "" + pubMod.PubTableName + ".*,ZL_Pub.*"; lab.LabelWhere = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1"; lab.LabelOrder = "" + pubMod.PubTableName + ".ID DESC"; lab.LabelCount = "10"; lab.Content = "{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n评论说明:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n评论时间:{Field=\"PubAddTime\"/}<br />{/Repeate}<br />\n{ZL.Page/}"; lab.Desc = pubMod.PubTableName + "分页标签"; lab.LabelNodeID = 0; blab.AddLabelXML(lab); Tmpstr = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + pubMod.PubInputLoadStr + "/}"; saveName = "默认评论" + pubMod.PubName + "模板.html"; break; case 1: //投票 //创建标签 lab.LabelName = pubMod.PubName + "调用标签"; lab.LabelCate = "互动标签"; lab.LabelType = 4; lab.LabelTable = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid"; lab.LabelField = "" + pubMod.PubTableName + ".*,ZL_Pub.*"; lab.LabelWhere = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1"; lab.LabelOrder = "" + pubMod.PubTableName + ".ID DESC"; lab.LabelCount = "10"; lab.Content = "{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n投票说明:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n投票时间:{Field=\"PubAddTime\"/}<br />{/Repeate}<br />\n{ZL.Page/}"; lab.Desc = pubMod.PubTableName + "分页标签"; lab.LabelNodeID = 0; blab.AddLabelXML(lab); Tmpstr = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + pubMod.PubInputLoadStr + "/}"; saveName = "默认投票" + pubMod.PubName + "模板.html"; break; case 2: //活动 lab.LabelName = pubMod.PubName + "调用标签"; lab.LabelCate = "互动标签"; lab.LabelType = 4; lab.LabelTable = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid"; lab.LabelField = "" + pubMod.PubTableName + ".*,ZL_Pub.*"; lab.LabelWhere = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1"; lab.LabelOrder = "" + pubMod.PubTableName + ".ID DESC"; lab.LabelCount = "10"; lab.Content = "<a href=PubAction?menu=hd&act=add&Pubid=" + Pubinsertid.ToString() + ">发起活动</a>\n{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n活动内容:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n提交时间:{Field=\"PubAddTime\"/}\n{/Repeate}<br />\n{ZL.Page/}"; lab.Desc = pubMod.PubTableName + "分页标签"; lab.LabelNodeID = 0; blab.AddLabelXML(lab); Tmpstr = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + pubMod.PubInputLoadStr + "/}"; saveName = "默认活动" + pubMod.PubName + "模板.html"; break; case 3: //留言 lab.LabelName = pubMod.PubName + "调用标签"; lab.LabelCate = "互动标签"; lab.LabelType = 4; lab.LabelTable = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid"; lab.LabelField = "" + pubMod.PubTableName + ".*,ZL_Pub.*"; lab.LabelWhere = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1"; lab.LabelOrder = "" + pubMod.PubTableName + ".ID DESC"; lab.LabelCount = "10"; lab.Content = "{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n留言内容:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n提交时间:{Field=\"PubAddTime\"/}\n{/Repeate}<br />\n{ZL.Page/}"; lab.Desc = pubMod.PubTableName + "分页标签"; lab.LabelNodeID = 0; blab.AddLabelXML(lab); Tmpstr = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + pubMod.PubInputLoadStr + "/}"; saveName = "默认留言" + pubMod.PubName + "模板.html"; break; case 4: //问券 lab.LabelName = pubMod.PubName + "调用标签"; lab.LabelCate = "互动标签"; lab.LabelType = 4; lab.LabelTable = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid"; lab.LabelField = "" + pubMod.PubTableName + ".*,ZL_Pub.*"; lab.LabelWhere = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1"; lab.LabelOrder = "" + pubMod.PubTableName + ".ID DESC"; lab.LabelCount = "10"; lab.Content = "{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n问券内容:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n提交时间:{Field=\"PubAddTime\"/}\n{/Repeate}<br />\n{ZL.Page/}<br />"; lab.Desc = pubMod.PubTableName + "分页标签"; lab.LabelNodeID = 0; blab.AddLabelXML(lab); Tmpstr = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + pubMod.PubInputLoadStr + "/}"; saveName = "默认问券" + pubMod.PubName + "模板.html"; break; case 5: //统计 lab.LabelName = pubMod.PubName + "调用标签"; lab.LabelCate = "互动标签"; lab.LabelType = 2; lab.LabelTable = pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid"; lab.LabelField = pubMod.PubTableName + ".*,ZL_Pub.*"; lab.LabelWhere = pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " and Parentid=0 And " + pubMod.PubTableName + ".Pubstart=1"; lab.LabelOrder = pubMod.PubTableName + ".ID DESC"; lab.LabelCount = "10"; lab.Content = "点击数:{Field=\"Pubnum\"/}"; lab.Desc = pubMod.PubTableName + "动态标签"; lab.LabelNodeID = 0; blab.AddLabelXML(lab); Tmpstr = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + pubMod.PubInputLoadStr + "/}"; saveName = "默认统计" + pubMod.PubName + "模板.html"; break; case 6: //竞标 case 7: case 8: break; default: return(WriteErr("类型错误,该类型不存在!!!")); break; } if (!string.IsNullOrEmpty(saveName)) { FileSystemObject.WriteFile(saveDir + saveName, Tmpstr); } PubTemplateurl = "/互动模板/" + saveName; #endregion #region 创建互动提交模板 switch (pubMod.PubType) { case 0: //评论 Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction""> <input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" /> <input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" /> <input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" /> <div class=""form-group""> <label for=""PubTitle"">评论标题:</label> <input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" />{PubCode/} </div> <div class=""form-group""> <label for=""PubContent"">评论内容:</label> <textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea> </div> <div class=""form-group text-center""> <button type=""submit"" class=""btn btn-default"">提交</button> <button type=""reset"" class=""btn btn-default"">重置</button> </div> </form>"; Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString()); saveName = "默认评论" + pubMod.PubName + "提交模板.html"; break; case 1: //投票 Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction""> <input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" /> <input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" /> <input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" /> <div class=""form-group""> <label for=""PubTitle"">投票标题:</label> <input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" /> {PubCode/} </div> <div class=""form-group""> <label for=""PubContent"">投票内容:</label> <textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea> </div> <div class=""form-group text-center""> <button type=""submit"" class=""btn btn-default"">提交</button> <button type=""reset"" class=""btn btn-default"">重置</button> </div> </form>"; Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString()); saveName = "默认投票" + pubMod.PubName + "提交模板.html"; break; case 2: //活动 Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction""> <input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" /> <input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" /> <input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" /> <div class=""form-group""> <label for=""PubTitle"">活动标题:</label> <input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" /> {PubCode/} </div> <div class=""form-group""> <label for=""PubContent"">活动内容:</label> <textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea> </div> <div class=""form-group text-center""> <button type=""submit"" class=""btn btn-default"">提交</button> <button type=""reset"" class=""btn btn-default"">重置</button> </div> </form>"; Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString()); saveName = "默认活动" + pubMod.PubName + "提交模板.html"; break; case 3: //留言 Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction""> <input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" /> <input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" /> <input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" /> <div class=""form-group""> <label for=""PubTitle"">留言标题:</label> <input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" /> {PubCode/} </div> <div class=""form-group""> <label for=""PubContent"">留言内容:</label> <textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea> </div> <div class=""form-group text-center""> <button type=""submit"" class=""btn btn-default"">提交</button> <button type=""reset"" class=""btn btn-default"">重置</button> </div> </form>"; Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString()); saveName = "默认留言" + pubMod.PubName + "提交模板.html"; break; case 4: //问券 Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction""> <input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" /> <input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" /> <input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" /> <div class=""form-group""> <label for=""PubTitle"">问券标题:</label> <input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" /> {PubCode/} </div> <div class=""form-group""> <label for=""PubContent"">问券内容:</label> <textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea> </div> <div class=""form-group text-center""> <button type=""submit"" class=""btn btn-default"">提交</button> <button type=""reset"" class=""btn btn-default"">重置</button> </div> </form>"; Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString()); saveName = "默认问券" + pubMod.PubName + "提交模板.html"; break; case 5: //统计 case 6: //竞标 default: break; } if (!string.IsNullOrEmpty(saveName)) { FileSystemObject.WriteFile(saveDir + saveName, Tempinputstr); } PubInputTMurl = "/互动模板/" + saveName; #endregion pubMod = pubBll.GetSelect(Pubinsertid); pubMod.PubInputTM = PubInputTMurl;//提交窗口模板 pubMod.PubTemplate = PubTemplateurl; pubBll.GetUpdate(pubMod); } else { pubMod.PubInputTM = GetParam("PubInputTM_hid"); pubMod.PubTemplate = GetParam("PubTemplate_hid"); pubBll.GetUpdate(pubMod); } } return(WriteOK("操作成功", pubMod.PubType == 8 ? "FormManage" : "PubManage")); }