개정판 b6abb7b8
issue #0000
- excel userlist db->information userlist로 변경
- id2 project db 조회 함수 추가-global
- basecontroller 에 id2 project db 조회 함수 적용
Change-Id: I560b546852173c40e4fc351a799842327f10447f
ID2.Manager/ID2.Manager.Common/Globals.cs | ||
---|---|---|
7 | 7 |
using System.IO; |
8 | 8 |
using System.Security.Cryptography; |
9 | 9 |
using System.Text.RegularExpressions; |
10 |
using System.Configuration; |
|
11 |
using System.Xml.Linq; |
|
12 |
using System.Xml.XPath; |
|
10 | 13 |
|
11 | 14 |
namespace ID2.Manager.Common |
12 | 15 |
{ |
... | ... | |
74 | 77 |
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "ID2Manager"); |
75 | 78 |
} |
76 | 79 |
} |
80 |
|
|
81 |
public static string GetProjectDBConnstr() |
|
82 |
{ |
|
83 |
string prjDBPath = string.Empty; |
|
84 |
|
|
85 |
try |
|
86 |
{ |
|
87 |
var userConfigPath = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath; |
|
88 |
if (File.Exists(userConfigPath)) |
|
89 |
{ |
|
90 |
XDocument xdoc = XDocument.Load(userConfigPath); |
|
91 |
XElement id2xElement = xdoc.XPathSelectElements("//setting[@name=\"ID2SQLiteInfo\"]").FirstOrDefault(); |
|
92 |
if (id2xElement != null) |
|
93 |
{ |
|
94 |
if (!string.IsNullOrEmpty(id2xElement.Value)) |
|
95 |
{ |
|
96 |
if (File.Exists(id2xElement.Value)) |
|
97 |
{ |
|
98 |
prjDBPath = String.Format(ConfigurationManager.AppSettings["ID2SQLite"], id2xElement.Value); |
|
99 |
return prjDBPath; |
|
100 |
} |
|
101 |
} |
|
102 |
} |
|
103 |
} |
|
104 |
|
|
105 |
var appConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ConfigurationManager.AppSettings["ID2SQLiteInfo"]); |
|
106 |
if (File.Exists(appConfigPath)) |
|
107 |
{ |
|
108 |
prjDBPath = String.Format(ConfigurationManager.AppSettings["ID2SQLite"], appConfigPath); |
|
109 |
return prjDBPath; |
|
110 |
} |
|
111 |
} |
|
112 |
catch (Exception ex) |
|
113 |
{ |
|
114 |
throw ex; |
|
115 |
} |
|
116 |
|
|
117 |
return prjDBPath; |
|
118 |
} |
|
119 |
|
|
120 |
public static bool IsProjectDBConnstr() |
|
121 |
{ |
|
122 |
bool isDBPath = false; |
|
123 |
|
|
124 |
try |
|
125 |
{ |
|
126 |
isDBPath = !string.IsNullOrEmpty(GetProjectDBConnstr()); |
|
127 |
} |
|
128 |
catch (Exception ex) |
|
129 |
{ |
|
130 |
throw ex; |
|
131 |
} |
|
132 |
//catch |
|
133 |
//{ |
|
134 |
// Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
|
135 |
//} |
|
136 |
|
|
137 |
return isDBPath; |
|
138 |
} |
|
77 | 139 |
} |
78 | 140 |
} |
내보내기 Unified diff