Skip to content

Commit 2c61082

Browse files
author
starlying
committed
plugins
1 parent 9f3de26 commit 2c61082

File tree

17 files changed

+336
-390
lines changed

17 files changed

+336
-390
lines changed

source/BaiRong.Core/WebConfigUtils.cs

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Reflection;
32
using System.Web;
43
using System.Xml;
54
using BaiRong.Core.Data;
@@ -39,7 +38,7 @@ public static AdoHelper Helper
3938

4039
static WebConfigUtils()
4140
{
42-
var physicalApplicationPath = string.Empty;
41+
string physicalApplicationPath;
4342
var applicationPath = string.Empty;
4443
if (HttpContext.Current != null)
4544
{
@@ -196,5 +195,45 @@ public static void UpdateWebConfig(bool isProtectData, bool isMySql, string conn
196195
ConnectionString = connectionString;
197196
_helper = null;
198197
}
198+
199+
public static string GetConnectionStringByName(string name)
200+
{
201+
var connectionString = string.Empty;
202+
try
203+
{
204+
var doc = new XmlDocument();
205+
206+
var configFile = PathUtils.Combine(PhysicalApplicationPath, "web.config");
207+
208+
doc.Load(configFile);
209+
210+
var appSettings = doc.SelectSingleNode("configuration/appSettings");
211+
if (appSettings != null)
212+
{
213+
foreach (XmlNode setting in appSettings)
214+
{
215+
if (setting.Name != "add") continue;
216+
217+
var attrKey = setting.Attributes?["key"];
218+
if (attrKey == null) continue;
219+
220+
if (!StringUtils.EqualsIgnoreCase(attrKey.Value, name)) continue;
221+
222+
var attrValue = setting.Attributes["value"];
223+
if (attrValue != null)
224+
{
225+
connectionString = attrValue.Value;
226+
}
227+
break;
228+
}
229+
}
230+
}
231+
catch
232+
{
233+
// ignored
234+
}
235+
236+
return connectionString;
237+
}
199238
}
200239
}

source/SiteServer.BackgroundPages/Cms/ModalInputContentTaxis.cs

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ namespace SiteServer.BackgroundPages.Cms
99
{
1010
public class ModalInputContentTaxis : BasePageCms
1111
{
12-
protected RadioButtonList TaxisType;
13-
protected TextBox TaxisNum;
12+
protected RadioButtonList RblTaxisType;
13+
protected TextBox TbTaxisNum;
1414

1515
private int _inputId;
1616
private string _returnUrl;
17-
private List<int> _contentIdArrayList;
17+
private List<int> _contentIdList;
1818

1919
public static string GetOpenWindowString(int publishmentSystemId, int inputId, string returnUrl)
2020
{
@@ -33,45 +33,37 @@ public void Page_Load(object sender, EventArgs e)
3333
PageUtils.CheckRequestParameter("PublishmentSystemID", "ReturnUrl");
3434
_inputId = Body.GetQueryInt("InputID");
3535
_returnUrl = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl"));
36-
_contentIdArrayList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection"));
36+
_contentIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection"));
3737

3838
if (!IsPostBack)
3939
{
40-
TaxisType.Items.Add(new ListItem("上升", "Up"));
41-
TaxisType.Items.Add(new ListItem("下降", "Down"));
42-
ControlUtils.SelectListItems(TaxisType, "Up");
43-
44-
40+
RblTaxisType.Items.Add(new ListItem("上升", "Up"));
41+
RblTaxisType.Items.Add(new ListItem("下降", "Down"));
42+
ControlUtils.SelectListItems(RblTaxisType, "Up");
4543
}
4644
}
4745

4846
public override void Submit_OnClick(object sender, EventArgs e)
4947
{
50-
var isUp = (TaxisType.SelectedValue == "Up");
51-
var taxisNum = int.Parse(TaxisNum.Text);
48+
var isUp = RblTaxisType.SelectedValue == "Up";
49+
var taxisNum = TranslateUtils.ToInt(TbTaxisNum.Text);
5250

5351
if (isUp == false)
5452
{
55-
_contentIdArrayList.Reverse();
53+
_contentIdList.Reverse();
5654
}
5755

58-
foreach (int contentID in _contentIdArrayList)
56+
foreach (var contentId in _contentIdList)
5957
{
60-
for (var i = 1; i <= taxisNum; i++)
58+
for (var i = 0; i < taxisNum; i++)
6159
{
6260
if (isUp)
6361
{
64-
if (DataProvider.InputContentDao.UpdateTaxisToUp(_inputId, contentID))
65-
{
66-
break;
67-
}
62+
DataProvider.InputContentDao.UpdateTaxisToUp(_inputId, contentId);
6863
}
6964
else
7065
{
71-
if (DataProvider.InputContentDao.UpdateTaxisToDown(_inputId, contentID))
72-
{
73-
break;
74-
}
66+
DataProvider.InputContentDao.UpdateTaxisToDown(_inputId, contentId);
7567
}
7668
}
7769
}

0 commit comments

Comments
 (0)