Exemplo n.º 1
0
 /// <summary>
 /// 参数设置
 /// </summary>
 public string Parameter()
 {
     StringBuilder sr = new StringBuilder();
     SettingData setData = new SettingData(conn);
     //取得默认值
     if (SiteFun.IsPost)
     {
         SettingParameterItem postVal = new SettingParameterItem();
         postVal.WatermarkSeat = SiteFun.ToInt(SiteFun.Post("ws"));
         postVal.WatermarkPath = SiteFun.Post("wmPath");
         postVal.ArticleNum = SiteFun.ToInt(SiteFun.Post("artNum"));
         postVal.CommentNum = SiteFun.ToInt(SiteFun.Post("cmtNum"));
         postVal.AppendFineArticleNum = SiteFun.ToInt(SiteFun.Post("appFAN"));
         postVal.AppendRandomArticleNum = SiteFun.ToInt(SiteFun.Post("appRAN"));
         postVal.AppendHotArticleNum = SiteFun.ToInt(SiteFun.Post("appHAN"));
         postVal.AppendHotTagNum = SiteFun.ToInt(SiteFun.Post("appHTN"));
         postVal.AppendNewCommentNum = SiteFun.ToInt(SiteFun.Post("appNCN"));
         postVal.RssNum = SiteFun.ToInt(SiteFun.Post("rssNum"));
         postVal.RssMode = SiteFun.ToInt(SiteFun.Post("rssMode"));
         postVal.Key = SiteFun.Post("key");
         setData.UpdateSettingParameter(postVal);
         sr.Append(AdminUI.SuccessBox(SiteDat.GetLan("MsgUpdateDat")));
         ClearCache();
     }
     SettingItem old = setData.GetSetting();
     sr.Append(HtmlUI.FormStart());
     sr.Append(AdminUI.AdminBoxStart(true));
     sr.Append(HtmlUI.TableStart("onCenter"));
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("RssNum")) + HtmlUI.CreateTd(HtmlUI.Input("rssNum", 5, null, old.Parameter.RssNum)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("RssMode")) + HtmlUI.CreateTd(HtmlUI.RadioInput(SiteDat.GetLan("ShowExplain"), "rssMode", 0, old.Parameter.RssMode == 0) + HtmlUI.RadioInput(SiteDat.GetLan("ShowContent"), "rssMode", 1, old.Parameter.RssMode == 1)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TableFinal());
     sr.Append(AdminUI.AdminBoxFinal());
     sr.Append(AdminUI.AdminBoxStart(true));
     sr.Append(HtmlUI.TableStart("onCenter"));
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("ArtNum")) + HtmlUI.CreateTd(HtmlUI.Input("artNum", 5, null, old.Parameter.ArticleNum)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("CmtNum")) + HtmlUI.CreateTd(HtmlUI.Input("cmtNum", 5, null, old.Parameter.CommentNum)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TableFinal());
     sr.Append(AdminUI.AdminBoxFinal());
     sr.Append(AdminUI.AdminBoxStart(true));
     sr.Append(HtmlUI.TableStart("onCenter"));
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("TopArtNum")) + HtmlUI.CreateTd(HtmlUI.Input("appFAN", 5, null, old.Parameter.AppendFineArticleNum)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("RandomArtNum")) + HtmlUI.CreateTd(HtmlUI.Input("appRAN", 5, null, old.Parameter.AppendRandomArticleNum)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("HotArtNum")) + HtmlUI.CreateTd(HtmlUI.Input("appHAN", 5, null, old.Parameter.AppendHotArticleNum)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("HotTagNum")) + HtmlUI.CreateTd(HtmlUI.Input("appHTN", 5, null, old.Parameter.AppendHotTagNum)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("NewCmtNum")) + HtmlUI.CreateTd(HtmlUI.Input("appNCN", 5, null, old.Parameter.AppendNewCommentNum)));
     sr.Append(HtmlUI.CreateTh() + HtmlUI.CreateTd());
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TableFinal());
     sr.Append(AdminUI.AdminBoxFinal());
     //水印设置
     sr.Append(AdminUI.AdminBoxStart(true));
     sr.Append(HtmlUI.TableStart("onCenter"));
     sr.Append(HtmlUI.TrStart());
     ArrayList values = new ArrayList();
     for (int wmI = 0; wmI <= 9; wmI++)
     {
         values.Add(wmI);
     }
     ArrayList caps = new ArrayList();
     caps.Add(SiteDat.GetLan("Close"));
     caps.Add(SiteDat.GetLan("PTopLeft"));
     caps.Add(SiteDat.GetLan("PTopCen"));
     caps.Add(SiteDat.GetLan("PTopRight"));
     caps.Add(SiteDat.GetLan("PMdlLeft"));
     caps.Add(SiteDat.GetLan("PMdlCen"));
     caps.Add(SiteDat.GetLan("PMdlRight"));
     caps.Add(SiteDat.GetLan("PBtmLeft"));
     caps.Add(SiteDat.GetLan("PBtmCen"));
     caps.Add(SiteDat.GetLan("PBtmRight"));
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("WmPosition")));
     sr.Append(HtmlUI.CreateTd(HtmlUI.Input("wmPath", 50, null, SiteFun.HtmlEncode(old.Parameter.WatermarkPath)) + HtmlUI.CreateSelect("ws", values, caps, old.Parameter.WatermarkSeat)));
     sr.Append(HtmlUI.TrFinal());
     if (File.Exists(Path.Combine(SiteCfg.Router, old.Parameter.WatermarkPath)))
     {
         sr.Append(HtmlUI.CreateTh());
         sr.Append(HtmlUI.CreateTd(HtmlUI.Image(SiteCfg.Path + old.Parameter.WatermarkPath, old.Parameter.WatermarkPath)));
         sr.Append(HtmlUI.TrFinal());
     }
     sr.Append(HtmlUI.TableFinal());
     sr.Append(AdminUI.AdminBoxFinal());
     //水印
     sr.Append(AdminUI.AdminBoxStart(true));
     sr.Append(HtmlUI.TableStart("onCenter"));
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("BusinessKey")) + HtmlUI.CreateTd(HtmlUI.Input("key", 15, null, SiteFun.HtmlEncode(old.Parameter.Key))));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh() + HtmlUI.CreateTd(HtmlUI.SubmitButton() + HtmlUI.ResetButton()));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TableFinal());
     sr.Append(AdminUI.AdminBoxFinal());
     sr.Append(HtmlUI.FormFinal());
     return sr.ToString();
 }
Exemplo n.º 2
0
 /// <summary>
 /// 更新参数
 /// </summary>
 /// <param name="value">参数</param>
 public void UpdateSettingParameter(SettingParameterItem value)
 {
     _DbParameter[] pars ={
                             new _DbParameter().Set("@WatermarkSeat", DbType.Int32, value.WatermarkSeat),
                             new _DbParameter().Set("@ArticleNum", DbType.Int32, value.ArticleNum),
                             new _DbParameter().Set("@CommentNum", DbType.Int32, value.CommentNum),
                             new _DbParameter().Set("@AppendFineArticleNum", DbType.Int32, value.AppendFineArticleNum),
                             new _DbParameter().Set("@AppendRandomArticleNum", DbType.Int32, value.AppendRandomArticleNum),
                             new _DbParameter().Set("@AppendHotArticleNum", DbType.Int32, value.AppendHotArticleNum),
                             new _DbParameter().Set("@AppendHotTagNum", DbType.Int32, value.AppendHotTagNum),
                             new _DbParameter().Set("@AppendNewCommentNum", DbType.Int32, value.AppendNewCommentNum),
                             new _DbParameter().Set("@RssNum", DbType.Int32, value.RssNum),
                             new _DbParameter().Set("@RssMode", DbType.Int32, value.RssMode),
                             new _DbParameter().Set("@WMPath", DbType.String, value.WatermarkPath),
                             new _DbParameter().Set("@Key", DbType.String, value.Key)
                         };
     conn.ExecuteNonQuery("UPDATE [Setting] SET [WatermarkSeat] = @WatermarkSeat, [ParArticleNum] = @ArticleNum, [ParCommentNum] = @CommentNum, [ParAppendFineArticleNum] = @AppendFineArticleNum, [ParAppendRandomArticleNum] = @AppendRandomArticleNum, [ParAppendHotArticleNum] = @AppendHotArticleNum, [ParAppendHotTagNum] = @AppendHotTagNum, [ParAppendNewCommentNum] = @AppendNewCommentNum, [RssNum] = @RssNum, [RssMode] = @RssMode, [WatermarkPath] = @WMPath, [Key] = @Key", pars);
 }