Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
starlying committed Aug 19, 2019
1 parent 949405f commit 39bfff8
Show file tree
Hide file tree
Showing 30 changed files with 541 additions and 118 deletions.
20 changes: 14 additions & 6 deletions SiteServer.BackgroundPages/PageInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ public class PageInstaller : BasePage
public TextBox TbSqlUserName;
public TextBox TbSqlPassword;
public HtmlInputHidden HihSqlHiddenPassword;
public PlaceHolder PhSqlOracleDatabase;
public TextBox TbSqlOracleDatabase;
public PlaceHolder PhOracleDatabase;
public DropDownList DdlOraclePrivilege;
public DropDownList DdlIsOracleSid;
public TextBox TbOracleDatabase;
public PlaceHolder PhSql2;
public DropDownList DdlSqlDatabaseName;

Expand Down Expand Up @@ -78,6 +80,12 @@ public void Page_Load(object sender, EventArgs e)
SetSetp(1);

DatabaseTypeUtils.AddListItems(DdlSqlDatabaseType);
DdlOraclePrivilege.Items.Add(new ListItem(EOraclePrivilegeUtils.GetValue(EOraclePrivilege.Normal), EOraclePrivilegeUtils.GetValue(EOraclePrivilege.Normal)));
DdlOraclePrivilege.Items.Add(new ListItem(EOraclePrivilegeUtils.GetValue(EOraclePrivilege.SYSDBA), EOraclePrivilegeUtils.GetValue(EOraclePrivilege.SYSDBA)));
DdlOraclePrivilege.Items.Add(new ListItem(EOraclePrivilegeUtils.GetValue(EOraclePrivilege.SYSOPER), EOraclePrivilegeUtils.GetValue(EOraclePrivilege.SYSOPER)));

EBooleanUtils.AddListItems(DdlIsOracleSid, "SID", "Service name");
ControlUtils.SelectSingleItemIgnoreCase(DdlIsOracleSid, true.ToString());

EBooleanUtils.AddListItems(DdlIsDefaultPort, "默认数据库端口", "自定义数据库端口");
ControlUtils.SelectSingleItemIgnoreCase(DdlIsDefaultPort, true.ToString());
Expand All @@ -93,7 +101,7 @@ public void Page_Load(object sender, EventArgs e)
public void DdlSqlDatabaseType_SelectedIndexChanged(object sender, EventArgs e)
{
var databaseType = DatabaseTypeUtils.GetEnumType(DdlSqlDatabaseType.SelectedValue);
PhSqlOracleDatabase.Visible = databaseType == DatabaseType.Oracle;
PhOracleDatabase.Visible = databaseType == DatabaseType.Oracle;
}

public void DdlIsDefaultPort_SelectedIndexChanged(object sender, EventArgs e)
Expand Down Expand Up @@ -191,7 +199,7 @@ public void BtnStep3_Click(object sender, EventArgs e)
isConnectValid = false;
errorMessage = "数据库用户必须填写。";
}
else if (databaseType == DatabaseType.Oracle && string.IsNullOrEmpty(TbSqlOracleDatabase.Text))
else if (databaseType == DatabaseType.Oracle && string.IsNullOrEmpty(TbOracleDatabase.Text))
{
isConnectValid = false;
errorMessage = "数据库名称必须填写。";
Expand Down Expand Up @@ -314,9 +322,9 @@ private string GetConnectionString(bool isDatabaseName)
var databaseName = string.Empty;
if (isDatabaseName)
{
databaseName = databaseType == DatabaseType.Oracle ? TbSqlOracleDatabase.Text : DdlSqlDatabaseName.SelectedValue;
databaseName = databaseType == DatabaseType.Oracle ? TbOracleDatabase.Text : DdlSqlDatabaseName.SelectedValue;
}
return WebConfigUtils.GetConnectionString(databaseType, TbSqlServer.Text, TranslateUtils.ToBool(DdlIsDefaultPort.SelectedValue), TranslateUtils.ToInt(TbSqlPort.Text), TbSqlUserName.Text, HihSqlHiddenPassword.Value, databaseName);
return WebConfigUtils.GetConnectionString(databaseType, TbSqlServer.Text, TranslateUtils.ToBool(DdlIsDefaultPort.SelectedValue), TranslateUtils.ToInt(TbSqlPort.Text), TbSqlUserName.Text, HihSqlHiddenPassword.Value, databaseName, TranslateUtils.ToBool(DdlIsOracleSid.SelectedValue), DdlOraclePrivilege.SelectedValue);
}

private bool CheckLoginValid(out string errorMessage)
Expand Down
4 changes: 2 additions & 2 deletions SiteServer.BackgroundPages/SiteServer.BackgroundPages.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
<Reference Include="Npgsql, Version=4.0.7.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7, processorArchitecture=MSIL">
<HintPath>..\packages\Npgsql.4.0.7\lib\net451\Npgsql.dll</HintPath>
</Reference>
<Reference Include="Oracle.ManagedDataAccess, Version=4.122.18.3, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL">
<HintPath>..\packages\Oracle.ManagedDataAccess.18.6.0\lib\net40\Oracle.ManagedDataAccess.dll</HintPath>
<Reference Include="Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL">
<HintPath>..\packages\Oracle.ManagedDataAccess.19.3.1\lib\net40\Oracle.ManagedDataAccess.dll</HintPath>
</Reference>
<Reference Include="QueryBuilder, Version=1.1.7.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SqlKata.1.1.7\lib\net45\QueryBuilder.dll</HintPath>
Expand Down
6 changes: 3 additions & 3 deletions SiteServer.BackgroundPages/app.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.18.3, Culture=neutral, PublicKeyToken=89b483f429c47342" />
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</configSections>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
Expand All @@ -16,15 +16,15 @@
<dependentAssembly>
<publisherPolicy apply="no" />
<assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
<bindingRedirect oldVersion="4.122.0.0 - 4.65535.65535.65535" newVersion="4.122.18.3" />
<bindingRedirect oldVersion="0.0.0.0-4.122.19.1" newVersion="4.122.19.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /></startup>
<system.data>
<DbProviderFactories>
<remove invariant="Oracle.ManagedDataAccess.Client" />
<add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.18.3, Culture=neutral, PublicKeyToken=89b483f429c47342" />
<add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>
<oracle.manageddataaccess.client>
Expand Down
2 changes: 1 addition & 1 deletion SiteServer.BackgroundPages/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<package id="MySql.Data" version="8.0.16" targetFramework="net452" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net452" />
<package id="Npgsql" version="4.0.7" targetFramework="net452" />
<package id="Oracle.ManagedDataAccess" version="18.6.0" targetFramework="net452" />
<package id="Oracle.ManagedDataAccess" version="19.3.1" targetFramework="net452" />
<package id="SiteServer.Plugin" version="2.3.13" targetFramework="net452" />
<package id="SqlKata" version="1.1.7" targetFramework="net452" />
<package id="System.Buffers" version="4.4.0" targetFramework="net452" />
Expand Down
12 changes: 12 additions & 0 deletions SiteServer.CMS/Provider/DatabaseDao.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,19 @@ public List<string> GetDatabaseNameList(DatabaseType databaseType, string connec
else if (databaseType == DatabaseType.Oracle)
{
var connection = new OracleConnection(connectionStringWithoutDatabaseName);
//var command = new OracleCommand("select name from v$database", connection);

connection.Open();

//var rdr = command.ExecuteReader();

//while (rdr.Read())
//{
// var dbName = rdr.GetString(0);
// if (dbName == null) continue;
// list.Add(dbName);
//}

connection.Close();
}

Expand Down
4 changes: 2 additions & 2 deletions SiteServer.CMS/SiteServer.CMS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
<Reference Include="NuGet.Versioning, Version=4.5.0.4, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\NuGet.Versioning.4.5.0\lib\net45\NuGet.Versioning.dll</HintPath>
</Reference>
<Reference Include="Oracle.ManagedDataAccess, Version=4.122.18.3, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL">
<HintPath>..\packages\Oracle.ManagedDataAccess.18.6.0\lib\net40\Oracle.ManagedDataAccess.dll</HintPath>
<Reference Include="Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL">
<HintPath>..\packages\Oracle.ManagedDataAccess.19.3.1\lib\net40\Oracle.ManagedDataAccess.dll</HintPath>
</Reference>
<Reference Include="QueryBuilder, Version=1.1.7.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SqlKata.1.1.7\lib\net45\QueryBuilder.dll</HintPath>
Expand Down
8 changes: 4 additions & 4 deletions SiteServer.CMS/StlParser/StlElement/StlDynamic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public static string ParseDynamicContent(DynamicInfo dynamicInfo, string templat
var pageHtml = pageContentsElementParser.Parse(totalNum, currentPageIndex, pageCount, false);
contentBuilder.Replace(stlPageContentsElementReplaceString, pageHtml);

StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, currentPageIndex, pageCount, totalNum, true, dynamicInfo.AjaxDivId);
StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, currentPageIndex, pageCount, totalNum, false, dynamicInfo.AjaxDivId);

break;
}
Expand All @@ -181,7 +181,7 @@ public static string ParseDynamicContent(DynamicInfo dynamicInfo, string templat
var pageHtml = pageChannelsElementParser.Parse(currentPageIndex, pageCount);
contentBuilder.Replace(stlPageChannelsElementReplaceString, pageHtml);

StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, currentPageIndex, pageCount, totalNum, true, dynamicInfo.AjaxDivId);
StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, currentPageIndex, pageCount, totalNum, false, dynamicInfo.AjaxDivId);

break;
}
Expand All @@ -205,7 +205,7 @@ public static string ParseDynamicContent(DynamicInfo dynamicInfo, string templat
var pageHtml = pageSqlContentsElementParser.Parse(totalNum, currentPageIndex, pageCount, false);
contentBuilder.Replace(stlPageSqlContentsElementReplaceString, pageHtml);

StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, currentPageIndex, pageCount, totalNum, true, dynamicInfo.AjaxDivId);
StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, currentPageIndex, pageCount, totalNum, false, dynamicInfo.AjaxDivId);

break;
}
Expand All @@ -222,7 +222,7 @@ public static string ParseDynamicContent(DynamicInfo dynamicInfo, string templat
{
if (currentPageIndex == pageIndex)
{
StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, currentPageIndex, pageCount, totalNum, true, pageContentsAjaxDivId);
StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, currentPageIndex, pageCount, totalNum, false, pageContentsAjaxDivId);

break;
}
Expand Down
6 changes: 3 additions & 3 deletions SiteServer.CMS/app.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.18.3, Culture=neutral, PublicKeyToken=89b483f429c47342" />
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</configSections>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
Expand All @@ -16,15 +16,15 @@
<dependentAssembly>
<publisherPolicy apply="no" />
<assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
<bindingRedirect oldVersion="4.122.0.0 - 4.65535.65535.65535" newVersion="4.122.18.3" />
<bindingRedirect oldVersion="0.0.0.0-4.122.19.1" newVersion="4.122.19.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /></startup>
<system.data>
<DbProviderFactories>
<remove invariant="Oracle.ManagedDataAccess.Client" />
<add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.18.3, Culture=neutral, PublicKeyToken=89b483f429c47342" />
<add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>
<oracle.manageddataaccess.client>
Expand Down
2 changes: 1 addition & 1 deletion SiteServer.CMS/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<package id="NuGet.Packaging" version="4.5.0" targetFramework="net461" />
<package id="NuGet.Packaging.Core" version="4.5.0" targetFramework="net461" />
<package id="NuGet.Versioning" version="4.5.0" targetFramework="net461" />
<package id="Oracle.ManagedDataAccess" version="18.6.0" targetFramework="net452" />
<package id="Oracle.ManagedDataAccess" version="19.3.1" targetFramework="net452" />
<package id="SiteServer.Plugin" version="2.3.13" targetFramework="net452" />
<package id="SqlKata" version="1.1.7" targetFramework="net452" />
<package id="System.Buffers" version="4.4.0" targetFramework="net452" />
Expand Down
4 changes: 2 additions & 2 deletions SiteServer.Cli/SiteServer.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
<Reference Include="Npgsql, Version=4.0.7.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7, processorArchitecture=MSIL">
<HintPath>..\packages\Npgsql.4.0.7\lib\net451\Npgsql.dll</HintPath>
</Reference>
<Reference Include="Oracle.ManagedDataAccess, Version=4.122.18.3, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL">
<HintPath>..\packages\Oracle.ManagedDataAccess.18.6.0\lib\net40\Oracle.ManagedDataAccess.dll</HintPath>
<Reference Include="Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL">
<HintPath>..\packages\Oracle.ManagedDataAccess.19.3.1\lib\net40\Oracle.ManagedDataAccess.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=3.0.6.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\packages\Quartz.3.0.6\lib\net452\Quartz.dll</HintPath>
Expand Down
33 changes: 17 additions & 16 deletions SiteServer.Cli/app.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.18.3, Culture=neutral, PublicKeyToken=89b483f429c47342" />
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</configSections>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
Expand All @@ -20,21 +20,22 @@
<dependentAssembly>
<publisherPolicy apply="no" />
<assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
<bindingRedirect oldVersion="4.122.0.0 - 4.65535.65535.65535" newVersion="4.122.18.3" />
<bindingRedirect oldVersion="0.0.0.0-4.122.19.1" newVersion="4.122.19.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.data>
<DbProviderFactories>
<remove invariant="Oracle.ManagedDataAccess.Client" />
<add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.18.3, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>
<oracle.manageddataaccess.client>
<version number="*">
<dataSources>
<dataSource alias="SampleDataSource" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL))) " />
</dataSources>
</version>
</oracle.manageddataaccess.client>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /></startup>
<system.data>
<DbProviderFactories>
<remove invariant="Oracle.ManagedDataAccess.Client" />
<add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>
<oracle.manageddataaccess.client>
<version number="*">
<dataSources>
<dataSource alias="SampleDataSource" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL))) " />
</dataSources>
</version>
</oracle.manageddataaccess.client>
</configuration>
2 changes: 1 addition & 1 deletion SiteServer.Cli/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<package id="NDesk.Options" version="0.2.1" targetFramework="net452" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net452" />
<package id="Npgsql" version="4.0.7" targetFramework="net452" />
<package id="Oracle.ManagedDataAccess" version="18.6.0" targetFramework="net452" />
<package id="Oracle.ManagedDataAccess" version="19.3.1" targetFramework="net452" />
<package id="Quartz" version="3.0.6" targetFramework="net452" />
<package id="SiteServer.Plugin" version="2.3.13" targetFramework="net452" />
<package id="SqlKata" version="1.1.7" targetFramework="net452" />
Expand Down
66 changes: 66 additions & 0 deletions SiteServer.Utils/Enumerations/EOraclePrivilege.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using System;

namespace SiteServer.Utils.Enumerations
{
public enum EOraclePrivilege
{
Normal,
SYSDBA,
SYSOPER
}

public class EOraclePrivilegeUtils
{
public static string GetValue(EOraclePrivilege type)
{
if (type == EOraclePrivilege.Normal)
{
return "Normal";
}
if (type == EOraclePrivilege.SYSDBA)
{
return "SYSDBA";
}
if (type == EOraclePrivilege.SYSOPER)
{
return "SYSOPER";
}
throw new Exception();
}

public static EOraclePrivilege GetEnumType(string typeStr)
{
var retval = EOraclePrivilege.Normal;

if (Equals(EOraclePrivilege.Normal, typeStr))
{
retval = EOraclePrivilege.Normal;
}
else if (Equals(EOraclePrivilege.SYSDBA, typeStr))
{
retval = EOraclePrivilege.SYSDBA;
}
else if (Equals(EOraclePrivilege.SYSOPER, typeStr))
{
retval = EOraclePrivilege.SYSOPER;
}

return retval;
}

public static bool Equals(EOraclePrivilege type, string typeStr)
{
if (string.IsNullOrEmpty(typeStr)) return false;
if (string.Equals(GetValue(type).ToLower(), typeStr.ToLower()))
{
return true;
}
return false;
}

public static bool Equals(string typeStr, EOraclePrivilege type)
{
return Equals(type, typeStr);
}
}
}
Loading

0 comments on commit 39bfff8

Please sign in to comment.