59 lines
1.8 KiB
C#
59 lines
1.8 KiB
C#
|
|
using AUTS.Domain.Application;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
|
|||
|
|
namespace AUTS.DBUtility
|
|||
|
|
{
|
|||
|
|
public partial class DbConfigsInfo
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
private static string onUserOperationSessionName = "UserOperationSessionName";//用户当前选择库
|
|||
|
|
|
|||
|
|
private static List<DBCofinStrModel> cacheSysDBCofinStrList
|
|||
|
|
{
|
|||
|
|
// get选择器获取Lazyk懒加载数据
|
|||
|
|
get { return AUTS.Services.Cache.CacheHelp.GetDBCofinStrList(); }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#region 获取用户当前选择库数据库连接串
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取用户当前选择库信息
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="userID">用户ID</param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public static DBCofinStrModel GerOnUserDBCofinStr()
|
|||
|
|
{
|
|||
|
|
//var dbList = CacheHelp.GetSysDBList();
|
|||
|
|
|
|||
|
|
var onCustomer = System.Web.HttpContext.Current.Session[onUserOperationSessionName];
|
|||
|
|
if (onCustomer != null)
|
|||
|
|
{
|
|||
|
|
return cacheSysDBCofinStrList.SingleOrDefault(x => x.ID == (int)onCustomer);
|
|||
|
|
}
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 获取用户当前选择数据库连接串
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取用户当前选择数据库连接串
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public static string GerOnUserCofin()
|
|||
|
|
{
|
|||
|
|
var connectionString = "";
|
|||
|
|
connectionString = GerOnUserDBCofinStr().CofinStr;
|
|||
|
|
if (!String.IsNullOrEmpty(connectionString))
|
|||
|
|
{
|
|||
|
|
return connectionString;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return System.Configuration.ConfigurationManager.ConnectionStrings["Uts_Manage"].ConnectionString;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|