개정판 3d842083
issue #000: 매뉴얼 수정, 다른 DB에 저장 (mssql, sqlite) 추가, Reset 기능 추가
Change-Id: Id97268f82311e87a4c815da5f04be1b972abf9b6
DTI_PID/ID2PSN/DB.cs | ||
---|---|---|
1148 | 1148 |
param.Value = Value; |
1149 | 1149 |
cmd.Parameters.Add(param); |
1150 | 1150 |
} |
1151 | ||
1151 |
|
|
1152 | 1152 |
public static bool SavePSNData(PSN item) |
1153 | 1153 |
{ |
1154 | 1154 |
ID2Info id2Info = ID2Info.GetInstance(); |
... | ... | |
1912 | 1912 | |
1913 | 1913 |
return dt; |
1914 | 1914 |
} |
1915 | ||
1916 |
//Anohter DB |
|
1917 |
public static bool ConnTestAndCreateAnotherTable() |
|
1918 |
{ |
|
1919 |
bool result = false; |
|
1920 |
AnotherID2Info id2Info = AnotherID2Info.GetInstance(); |
|
1921 | ||
1922 |
using (IAbstractDatabase connection = id2Info.CreateConnection()) |
|
1923 |
{ |
|
1924 |
try |
|
1925 |
{ |
|
1926 |
var names = connection.GetTableNames(); |
|
1927 |
var matched = names.FirstOrDefault(param => param == PSN_HEADER_SETTING); |
|
1928 |
Dictionary<string, string> dicColCheck = new Dictionary<string, string>(); |
|
1929 |
dicColCheck.Add("GROUP_ID", "TEXT"); |
|
1930 |
dicColCheck.Add("DESCRIPTION", "TEXT"); |
|
1931 |
dicColCheck.Add("INDEX", "INTEGER"); |
|
1932 |
dicColCheck.Add("NAME", "TEXT"); |
|
1933 | ||
1934 |
if (matched == null) |
|
1935 |
{ |
|
1936 |
var query = $"CREATE TABLE {PSN_HEADER_SETTING} (GROUP_ID TEXT, DESCRIPTION TEXT, [INDEX] INTEGER, NAME TEXT)"; |
|
1937 |
using (var cmd = connection.GetSqlStringCommand(query)) |
|
1938 |
{ |
|
1939 |
cmd.ExecuteNonQuery(); |
|
1940 |
} |
|
1941 |
} |
|
1942 |
else |
|
1943 |
{ |
|
1944 |
AddColumn(PSN_HEADER_SETTING, dicColCheck); |
|
1945 |
} |
|
1946 | ||
1947 |
matched = names.FirstOrDefault(param => param == PSN_VENTDRAIN_SETTING); |
|
1948 |
dicColCheck.Clear(); |
|
1949 |
dicColCheck.Add("GROUP_ID", "TEXT"); |
|
1950 |
dicColCheck.Add("DESCRIPTION", "TEXT"); |
|
1951 |
dicColCheck.Add("INDEX", "INTEGER"); |
|
1952 |
dicColCheck.Add("NAME", "TEXT"); |
|
1953 |
if (matched == null) |
|
1954 |
{ |
|
1955 |
var query = $"CREATE TABLE {PSN_VENTDRAIN_SETTING} (GROUP_ID TEXT, DESCRIPTION TEXT, [INDEX] INTEGER, NAME TEXT)"; |
|
1956 |
using (var cmd = connection.GetSqlStringCommand(query)) |
|
1957 |
{ |
|
1958 |
cmd.ExecuteNonQuery(); |
|
1959 |
} |
|
1960 |
} |
|
1961 |
else |
|
1962 |
{ |
|
1963 |
AddColumn(PSN_VENTDRAIN_SETTING, dicColCheck); |
|
1964 |
} |
|
1965 | ||
1966 |
matched = names.FirstOrDefault(param => param == PSN_TOPOLOGY_RULE); |
|
1967 |
dicColCheck.Clear(); |
|
1968 |
dicColCheck.Add("UID", "TEXT"); |
|
1969 |
if (matched == null) |
|
1970 |
{ |
|
1971 |
var query = $"CREATE TABLE {PSN_TOPOLOGY_RULE} (UID TEXT)"; |
|
1972 |
using (var cmd = connection.GetSqlStringCommand(query)) |
|
1973 |
{ |
|
1974 |
cmd.ExecuteNonQuery(); |
|
1975 |
} |
|
1976 | ||
1977 |
DataTable topologyRule = new DataTable(); |
|
1978 |
topologyRule.Columns.Add("NAME", typeof(string)); |
|
1979 | ||
1980 |
topologyRule.Rows.Add("FluidCode"); |
|
1981 |
topologyRule.Rows.Add("-"); |
|
1982 |
topologyRule.Rows.Add("PipingMaterialsClass"); |
|
1983 |
topologyRule.Rows.Add("-"); |
|
1984 |
topologyRule.Rows.Add("Tag Seq No"); |
|
1985 | ||
1986 |
SaveTopologyRule(topologyRule); |
|
1987 |
} |
|
1988 |
//else |
|
1989 |
//{ |
|
1990 |
// AddColumn(PSN_TOPOLOGY_RULE, dicColCheck); |
|
1991 |
//} |
|
1992 | ||
1993 |
matched = names.FirstOrDefault(param => param == PSN_PIPESYSTEMNETWORK); |
|
1994 |
dicColCheck.Clear(); |
|
1995 |
dicColCheck.Add("OID", "NVARCHAR(255)"); |
|
1996 |
dicColCheck.Add("Type", "NVARCHAR(255)"); |
|
1997 |
dicColCheck.Add("OrderNumber", "NVARCHAR(255)"); |
|
1998 |
dicColCheck.Add("Pipeline_OID", "NVARCHAR(255)"); |
|
1999 |
dicColCheck.Add("From_Data", "NVARCHAR(255)"); |
|
2000 |
dicColCheck.Add("To_Data", "NVARCHAR(255)"); |
|
2001 |
dicColCheck.Add("TopologySet_OID_Key", "NVARCHAR(125)"); |
|
2002 |
dicColCheck.Add("PSNRevisionNumber", "NVARCHAR(255)"); |
|
2003 |
dicColCheck.Add("IsValid", "INT"); |
|
2004 |
dicColCheck.Add("Status", "NVARCHAR(255)"); |
|
2005 |
dicColCheck.Add("PBS", "NVARCHAR(255)"); |
|
2006 |
dicColCheck.Add("Drawings", "NVARCHAR(255)"); |
|
2007 |
dicColCheck.Add("IncludingVirtualData", "NVARCHAR(10)"); |
|
2008 |
dicColCheck.Add("PSNAccuracy", "REAL"); |
|
2009 | ||
2010 |
if (matched == null) |
|
2011 |
{ |
|
2012 |
var query = $"CREATE TABLE {PSN_PIPESYSTEMNETWORK} (OID NVARCHAR(255), Type NVARCHAR(255), OrderNumber NVARCHAR(255), Pipeline_OID NVARCHAR(255), From_Data NVARCHAR(255), " + |
|
2013 |
"To_Data NVARCHAR(255), TopologySet_OID_Key NVARCHAR(125), PSNRevisionNumber NVARCHAR(255), IsValid INTEGER, Status NVARCHAR(255), PBS NVARCHAR(255), Drawings NVARCHAR(255), " + |
|
2014 |
"IncludingVirtualData NVARCHAR(10), PSNAccuracy REAL)"; |
|
2015 |
using (var cmd = connection.GetSqlStringCommand(query)) |
|
2016 |
{ |
|
2017 |
cmd.ExecuteNonQuery(); |
|
2018 |
} |
|
2019 |
} |
|
2020 |
else |
|
2021 |
{ |
|
2022 |
AddColumn(PSN_PIPESYSTEMNETWORK, dicColCheck); |
|
2023 |
} |
|
2024 | ||
2025 |
matched = names.FirstOrDefault(param => param == PSN_EQUIPMENT); |
|
2026 |
dicColCheck.Clear(); |
|
2027 |
dicColCheck.Add("OID", "NVARCHAR(255)"); |
|
2028 |
dicColCheck.Add("ItemTag", "NVARCHAR(255)"); |
|
2029 |
dicColCheck.Add("Xcoords", "REAL"); |
|
2030 |
dicColCheck.Add("Ycoords", "REAL"); |
|
2031 |
if (matched == null) |
|
2032 |
{ |
|
2033 |
var query = $"CREATE TABLE {PSN_EQUIPMENT} (OID NVARCHAR(255), ItemTag NVARCHAR(255), Xcoords REAL, Ycoords REAL)"; |
|
2034 |
using (var cmd = connection.GetSqlStringCommand(query)) |
|
2035 |
{ |
|
2036 |
cmd.ExecuteNonQuery(); |
|
2037 |
} |
|
2038 |
} |
|
2039 |
else |
|
2040 |
{ |
|
2041 |
AddColumn(PSN_EQUIPMENT, dicColCheck); |
|
2042 |
} |
|
2043 | ||
2044 |
dicColCheck.Clear(); |
|
2045 |
dicColCheck.Add("OID", "NVARCHAR(255)"); |
|
2046 |
dicColCheck.Add("ItemTag", "NVARCHAR(255)"); |
|
2047 |
dicColCheck.Add("Xcoords", "REAL"); |
|
2048 |
dicColCheck.Add("Ycoords", "REAL"); |
|
2049 |
dicColCheck.Add("Equipment_OID", "NVARCHAR(255)"); |
|
2050 |
dicColCheck.Add("Fluid", "NVARCHAR(255)"); |
|
2051 |
dicColCheck.Add("NPD", "NVARCHAR(255)"); |
|
2052 |
dicColCheck.Add("PMC", "NVARCHAR(255)"); |
|
2053 |
dicColCheck.Add("Rotation", "REAL"); |
|
2054 |
dicColCheck.Add("FlowDirection", "NVARCHAR(255)"); |
|
2055 | ||
2056 |
matched = names.FirstOrDefault(param => param == PSN_NOZZLE); |
|
2057 |
if (matched == null) |
|
2058 |
{ |
|
2059 |
var query = $"CREATE TABLE {PSN_NOZZLE} (OID NVARCHAR(255), ItemTag NVARCHAR(255), Xcoords REAL, Ycoords REAL, Equipment_OID NVARCHAR(255), " + |
|
2060 |
"Fluid NVARCHAR(255), NPD NVARCHAR(255), PMC NVARCHAR(255), Rotation REAL, FlowDirection NVARCHAR(255))"; |
|
2061 |
using (var cmd = connection.GetSqlStringCommand(query)) |
|
2062 |
{ |
|
2063 |
cmd.ExecuteNonQuery(); |
|
2064 |
} |
|
2065 |
} |
|
2066 |
else |
|
2067 |
{ |
|
2068 |
AddColumn(PSN_NOZZLE, dicColCheck); |
|
2069 |
} |
|
2070 | ||
2071 |
matched = names.FirstOrDefault(param => param == PSN_FLUIDCODE); |
|
2072 |
dicColCheck.Clear(); |
|
2073 |
dicColCheck.Add("UID", "NVARCHAR(50)"); |
|
2074 |
dicColCheck.Add("Code", "NVARCHAR(255)"); |
|
2075 |
dicColCheck.Add("Description", "NVARCHAR(255)"); |
|
2076 |
dicColCheck.Add("Condition", "NVARCHAR(255)"); |
|
2077 |
dicColCheck.Add("Remarks", "NVARCHAR(255)"); |
|
2078 |
dicColCheck.Add("GroundLevel", "NVARCHAR(20)"); |
|
2079 |
if (matched == null) |
|
2080 |
{ |
|
2081 |
var query = $"CREATE TABLE {PSN_FLUIDCODE} (UID NVARCHAR(50), Code NVARCHAR(255), Description NVARCHAR(255), Condition NVARCHAR(255), Remarks NVARCHAR(255), GroundLevel NVARCHAR(20))"; |
|
2082 |
using (var cmd = connection.GetSqlStringCommand(query)) |
|
2083 |
{ |
|
2084 |
cmd.ExecuteNonQuery(); |
|
2085 |
} |
|
2086 |
} |
|
2087 |
else |
|
2088 |
{ |
|
2089 |
AddColumn(PSN_FLUIDCODE, dicColCheck); |
|
2090 |
} |
|
2091 | ||
2092 |
matched = names.FirstOrDefault(param => param == PSN_PIPINGMATLCLASS); |
|
2093 |
dicColCheck.Clear(); |
|
2094 |
dicColCheck.Add("UID", "NVARCHAR(50)"); |
|
2095 |
dicColCheck.Add("Priority", "INTEGER"); |
|
2096 |
dicColCheck.Add("Code", "NVARCHAR(255)"); |
|
2097 |
dicColCheck.Add("Description", "NVARCHAR(255)"); |
|
2098 |
dicColCheck.Add("Condition", "NVARCHAR(255)"); |
|
2099 |
dicColCheck.Add("Remarks", "NVARCHAR(255)"); |
|
2100 |
dicColCheck.Add("GroundLevel", "NVARCHAR(20)"); |
|
2101 |
if (matched == null) |
|
2102 |
{ |
|
2103 |
var query = $"CREATE TABLE {PSN_PIPINGMATLCLASS} (UID NVARCHAR(50), Priority INTEGER, Code NVARCHAR(255), Description NVARCHAR(255), Condition NVARCHAR(255), Remarks NVARCHAR(255), GroundLevel NVARCHAR(20))"; |
|
2104 |
using (var cmd = connection.GetSqlStringCommand(query)) |
|
2105 |
{ |
|
2106 |
cmd.ExecuteNonQuery(); |
|
2107 |
} |
|
2108 |
} |
|
2109 |
else |
|
2110 |
{ |
|
2111 |
AddColumn(PSN_PIPINGMATLCLASS, dicColCheck); |
|
2112 |
} |
|
2113 | ||
2114 |
matched = names.FirstOrDefault(param => param == PSN_SEQUENCEDATA); |
|
2115 |
dicColCheck.Clear(); |
|
2116 |
dicColCheck.Add("OID", "NVARCHAR(255)"); |
|
2117 |
dicColCheck.Add("SERIALNUMBER", "NVARCHAR(255)"); |
|
2118 |
dicColCheck.Add("PathItem_OID", "NVARCHAR(255)"); |
|
2119 |
dicColCheck.Add("TopologySet_OID_Key", "NVARCHAR(255)"); |
|
2120 |
if (matched == null) |
|
2121 |
{ |
|
2122 |
var query = $"CREATE TABLE {PSN_SEQUENCEDATA} (OID NVARCHAR(255), SERIALNUMBER NVARCHAR(255), PathItem_OID NVARCHAR(255), TopologySet_OID_Key NVARCHAR(255))"; |
|
2123 |
using (var cmd = connection.GetSqlStringCommand(query)) |
|
2124 |
{ |
|
2125 |
cmd.ExecuteNonQuery(); |
|
2126 |
} |
|
2127 |
} |
|
2128 |
else |
|
2129 |
{ |
|
2130 |
AddColumn(PSN_SEQUENCEDATA, dicColCheck); |
|
2131 |
} |
|
2132 | ||
2133 |
matched = names.FirstOrDefault(param => param == PSN_PATHITEMS); |
|
2134 |
dicColCheck.Clear(); |
|
2135 |
dicColCheck.Add("OID", "NVARCHAR(255)"); |
|
2136 |
dicColCheck.Add("SequenceData_OID", "NVARCHAR(255)"); |
|
2137 |
dicColCheck.Add("TopologySet_OID", "NVARCHAR(255)"); |
|
2138 |
dicColCheck.Add("BranchTopologySet_OID", "NVARCHAR(255)"); |
|
2139 |
dicColCheck.Add("PipeLine_OID", "NVARCHAR(255)"); |
|
2140 |
dicColCheck.Add("ItemName", "NVARCHAR(255)"); |
|
2141 |
dicColCheck.Add("ItemTag", "NVARCHAR(255)"); |
|
2142 |
dicColCheck.Add("DESCRIPTION", "NVARCHAR(255)"); |
|
2143 |
dicColCheck.Add("CLASS", "NVARCHAR(255)"); |
|
2144 |
dicColCheck.Add("SUBCLASS", "NVARCHAR(255)"); |
|
2145 |
dicColCheck.Add("TYPE", "NVARCHAR(255)"); |
|
2146 |
dicColCheck.Add("PIDNAME", "NVARCHAR(255)"); |
|
2147 |
dicColCheck.Add("Equipment_OID", "NVARCHAR(255)"); |
|
2148 |
dicColCheck.Add("NPD", "NVARCHAR(255)"); |
|
2149 |
dicColCheck.Add("PipeSystemNetwork_OID", "NVARCHAR(255)"); |
|
2150 |
dicColCheck.Add("PipeRun_OID", "NVARCHAR(255)"); |
|
2151 |
dicColCheck.Add("ViewPipeSystemNetwork_OID", "NVARCHAR(255)"); |
|
2152 |
if (matched == null) |
|
2153 |
{ |
|
2154 |
var query = $"CREATE TABLE {PSN_PATHITEMS} (OID NVARCHAR(255), SequenceData_OID NVARCHAR(255), " + |
|
2155 |
"TopologySet_OID NVARCHAR(255), BranchTopologySet_OID NVARCHAR(255), PipeLine_OID NVARCHAR(255), ItemName NVARCHAR(255), ItemTag NVARCHAR(255), DESCRIPTION NVARCHAR(255), " + |
|
2156 |
"CLASS NVARCHAR(255), SUBCLASS NVARCHAR(255), TYPE NVARCHAR(255), PIDNAME NVARCHAR(255), Equipment_OID NVARCHAR(255), NPD NVARCHAR(255), PipeSystemNetwork_OID NVARCHAR(255), PipeRun_OID NVARCHAR(255), " + |
|
2157 |
"ViewPipeSystemNetwork_OID NVARCHAR(255))"; |
|
2158 |
using (var cmd = connection.GetSqlStringCommand(query)) |
|
2159 |
{ |
|
2160 |
cmd.ExecuteNonQuery(); |
|
2161 |
} |
|
2162 |
} |
|
2163 |
else |
|
2164 |
{ |
|
2165 |
AddColumn(PSN_PATHITEMS, dicColCheck); |
|
2166 |
} |
|
2167 | ||
2168 |
matched = names.FirstOrDefault(param => param == PSN_VIEW); |
|
2169 |
dicColCheck.Clear(); |
|
2170 |
dicColCheck.Add("OID", "TEXT"); |
|
2171 |
if (matched == null) |
|
2172 |
{ |
|
2173 |
var query = $"CREATE TABLE {PSN_VIEW} (OID TEXT)"; |
|
2174 |
using (var cmd = connection.GetSqlStringCommand(query)) |
|
2175 |
{ |
|
2176 |
cmd.ExecuteNonQuery(); |
|
2177 |
} |
|
2178 |
} |
|
2179 | ||
2180 |
matched = names.FirstOrDefault(param => param == PSN_TOPOLOGYSET); |
|
2181 |
dicColCheck.Clear(); |
|
2182 |
dicColCheck.Add("OID", "NVARCHAR(255)"); |
|
2183 |
dicColCheck.Add("Type", "NVARCHAR(255)"); |
|
2184 |
dicColCheck.Add("SubType", "NVARCHAR(255)"); |
|
2185 |
dicColCheck.Add("HeadItemTag", "NVARCHAR(255)"); |
|
2186 |
dicColCheck.Add("TailItemTag", "NVARCHAR(255)"); |
|
2187 |
dicColCheck.Add("HeadItemSPID", "NVARCHAR(255)"); |
|
2188 |
dicColCheck.Add("TailItemSPID", "NVARCHAR(255)"); |
|
2189 | ||
2190 |
if (matched == null) |
|
2191 |
{ |
|
2192 |
var query = $"CREATE TABLE { PSN_TOPOLOGYSET} (OID NVARCHAR(255), Type NVARCHAR(255), SubType NVARCHAR(255), HeadItemTag NVARCHAR(255), TailItemTag NVARCHAR(255), HeadItemSPID NVARCHAR(255), TailItemSPID NVARCHAR(255))"; |
|
2193 |
using (var cmd = connection.GetSqlStringCommand(query)) |
|
2194 |
{ |
|
2195 |
cmd.ExecuteNonQuery(); |
|
2196 |
} |
|
2197 |
} |
|
2198 |
else |
|
2199 |
{ |
|
2200 |
AddColumn(PSN_TOPOLOGYSET, dicColCheck); |
|
2201 |
} |
|
2202 | ||
2203 |
matched = names.FirstOrDefault(param => param == PSN_TRANSFORMKEYWORD_SETTING); |
|
2204 |
dicColCheck.Clear(); |
|
2205 |
dicColCheck.Add("[INDEX]", "INTEGER"); |
|
2206 |
dicColCheck.Add("[NAME]", "TEXT"); |
|
2207 |
dicColCheck.Add("[KEYWORD]", "TEXT"); |
|
2208 |
if (matched == null) |
|
2209 |
{ |
|
2210 |
var query = $"CREATE TABLE {PSN_TRANSFORMKEYWORD_SETTING} ([INDEX] INTEGER, [NAME] TEXT, [KEYWORD] TEXT)"; |
|
2211 |
using (var cmd = connection.GetSqlStringCommand(query)) |
|
2212 |
{ |
|
2213 |
cmd.ExecuteNonQuery(); |
|
2214 |
} |
|
2215 |
} |
|
2216 |
else |
|
2217 |
{ |
|
2218 |
AddColumn(PSN_TRANSFORMKEYWORD_SETTING, dicColCheck); |
|
2219 |
} |
|
2220 | ||
2221 |
matched = names.FirstOrDefault(param => param == PSN_PIPELINE); |
|
2222 |
dicColCheck.Clear(); |
|
2223 |
dicColCheck.Add("OID", "NVARCHAR(255)"); |
|
2224 |
dicColCheck.Add("PipeSystem_OID", "NVARCHAR(255)"); |
|
2225 |
dicColCheck.Add("FLUID", "NVARCHAR(255)"); |
|
2226 |
dicColCheck.Add("PMC", "NVARCHAR(255)"); |
|
2227 |
dicColCheck.Add("SEQNUMBER", "NVARCHAR(255)"); |
|
2228 |
dicColCheck.Add("INSULATION", "NVARCHAR(255)"); |
|
2229 |
dicColCheck.Add("FROM_DATA", "NVARCHAR(255)"); |
|
2230 |
dicColCheck.Add("TO_DATA", "NVARCHAR(255)"); |
|
2231 |
dicColCheck.Add("Unit", "NVARCHAR(100)"); |
|
2232 |
if (matched == null) |
|
2233 |
{ |
|
2234 |
var query = $"CREATE TABLE {PSN_PIPELINE} (OID NVARCHAR(255), PipeSystem_OID NVARCHAR(255), FLUID NVARCHAR(255), PMC NVARCHAR(255), SEQNUMBER NVARCHAR(255), INSULATION NVARCHAR(255), " + |
|
2235 |
$"FROM_DATA NVARCHAR(255), TO_DATA NVARCHAR(255), Unit NVARCHAR(100))"; |
|
2236 |
using (var cmd = connection.GetSqlStringCommand(query)) |
|
2237 |
{ |
|
2238 |
cmd.ExecuteNonQuery(); |
|
2239 |
} |
|
2240 |
} |
|
2241 |
else |
|
2242 |
{ |
|
2243 |
AddColumn(PSN_PIPELINE, dicColCheck); |
|
2244 |
} |
|
2245 | ||
2246 |
matched = names.FirstOrDefault(param => param == PSN_INSULATIONPURPOSE); |
|
2247 |
dicColCheck.Clear(); |
|
2248 |
dicColCheck.Add("UID", "NVARCHAR(50)"); |
|
2249 |
dicColCheck.Add("Code", "NVARCHAR(255)"); |
|
2250 |
dicColCheck.Add("Description", "NVARCHAR(255)"); |
|
2251 |
dicColCheck.Add("Remarks", "NVARCHAR(255)"); |
|
2252 |
if (matched == null) |
|
2253 |
{ |
|
2254 |
var query = $"CREATE TABLE {PSN_INSULATIONPURPOSE} (UID NVARCHAR(50), Code NVARCHAR(255), Description NVARCHAR(255), Remarks NVARCHAR(255))"; |
|
2255 |
using (var cmd = connection.GetSqlStringCommand(query)) |
|
2256 |
{ |
|
2257 |
cmd.ExecuteNonQuery(); |
|
2258 |
} |
|
2259 |
} |
|
2260 |
else |
|
2261 |
{ |
|
2262 |
AddColumn(PSN_INSULATIONPURPOSE, dicColCheck); |
|
2263 |
} |
|
2264 | ||
2265 |
void AddColumn(string TableName, Dictionary<string, string> dicCol) |
|
2266 |
{ |
|
2267 |
var colnames = connection.GetColumnNames(TableName); |
|
2268 |
bool check = false; |
|
2269 |
if (colnames != null) |
|
2270 |
{ |
|
2271 |
foreach (KeyValuePair<string, string> col in dicCol) |
|
2272 |
{ |
|
2273 |
check = false; |
|
2274 |
foreach (string c in colnames) |
|
2275 |
{ |
|
2276 |
if (col.Key.Contains(c)) |
|
2277 |
{ |
|
2278 |
check = true; |
|
2279 |
break; |
|
2280 |
} |
|
2281 |
} |
|
2282 | ||
2283 |
if (!check) //없으면 추가 |
|
2284 |
{ |
|
2285 |
string i = string.Empty; |
|
2286 |
if (col.Value.ToString().ToUpper().Contains("INT") || col.Value.ToString().ToUpper().Contains("REAL")) |
|
2287 |
i = "DEFAULT 0"; |
|
2288 | ||
2289 |
var query = $"ALTER TABLE " + TableName + " ADD [" + col.Key + "] " + col.Value + " " + i + ";"; |
|
2290 |
using (var cmd = connection.GetSqlStringCommand(query)) |
|
2291 |
{ |
|
2292 |
cmd.ExecuteNonQuery(); |
|
2293 |
} |
|
2294 |
} |
|
2295 |
} |
|
2296 |
} |
|
2297 |
} |
|
2298 | ||
2299 |
result = true; |
|
2300 |
} |
|
2301 |
catch (Exception ex) |
|
2302 |
{ |
|
2303 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
2304 |
} |
|
2305 |
} |
|
2306 | ||
2307 |
return result; |
|
2308 |
} |
|
2309 | ||
2310 |
public static bool SaveAnotherPSNData(PSN item, List<HeaderInfo> headerInfos, List<VentDrainInfo> ventDrainInfos, |
|
2311 |
List<KeywordItem> keywordItems, DataTable dtTopologyRule, DataTable dtFluidCode, DataTable dtPMC, DataTable dtInsulation) |
|
2312 |
{ |
|
2313 |
AnotherID2Info id2Info = AnotherID2Info.GetInstance(); |
|
2314 | ||
2315 |
bool result = true; |
|
2316 |
using (IAbstractDatabase connection = id2Info.CreateConnection()) |
|
2317 |
{ |
|
2318 |
try |
|
2319 |
{ |
|
2320 |
using (var txn = connection.BeginTransaction()) |
|
2321 |
{ |
|
2322 |
try |
|
2323 |
{ |
|
2324 |
// Path Items |
|
2325 |
var query = $"DELETE FROM {PSN_PATHITEMS}"; |
|
2326 |
connection.ExecuteNonQuery(connection.GetSqlStringCommand(query), txn); |
|
2327 |
for (int i = 0; i < item.PathItems.Rows.Count; i++) |
|
2328 |
{ |
|
2329 |
DataRow row = item.PathItems.Rows[i]; |
|
2330 |
query = $"INSERT INTO {PSN_PATHITEMS} " + |
|
2331 |
$"(OID, SequenceData_OID, TopologySet_OID, BranchTopologySet_OID, PipeLine_OID, ItemName, ItemTag, DESCRIPTION, CLASS, SUBCLASS, TYPE, " + |
|
2332 |
$"PIDNAME, Equipment_OID, NPD, PipeSystemNetwork_OID, PipeRun_OID, ViewPipeSystemNetwork_OID) VALUES " + |
|
2333 |
$"(@OID, @SequenceData_OID, @TopologySet_OID, @BranchTopologySet_OID, @PipeLine_OID, @ITEMNAME, @ITEMTAG, @DESCRIPTION, @Class, @SubClass, @TYPE, @PIDNAME, @Equipment_OID, @NPD, @PipeSystemNetwork_OID,@PipeRun_OID, @ViewPipeSystemNetwork_OID)"; |
|
2334 |
var cmd = connection.GetSqlStringCommand(query); |
|
2335 |
AddWithValue(cmd, "@OID", string.IsNullOrEmpty(row["OID"].ToString()) ? "" : row["OID"].ToString()); |
|
2336 |
AddWithValue(cmd, "@SequenceData_OID", string.IsNullOrEmpty(row["SequenceData_OID"].ToString()) ? "" : row["SequenceData_OID"].ToString()); |
|
2337 |
AddWithValue(cmd, "@TopologySet_OID", string.IsNullOrEmpty(row["TopologySet_OID"].ToString()) ? "" : row["TopologySet_OID"].ToString()); |
|
2338 |
AddWithValue(cmd, "@BranchTopologySet_OID", string.IsNullOrEmpty(row["BranchTopologySet_OID"].ToString()) ? "" : row["BranchTopologySet_OID"].ToString()); |
|
2339 |
AddWithValue(cmd, "@PipeLine_OID", string.IsNullOrEmpty(row["PipeLine_OID"].ToString()) ? "" : row["PipeLine_OID"].ToString()); |
|
2340 |
AddWithValue(cmd, "@ITEMNAME", string.IsNullOrEmpty(row["ITEMNAME"].ToString()) ? "" : row["ITEMNAME"].ToString()); |
|
2341 |
AddWithValue(cmd, "@ITEMTAG", string.IsNullOrEmpty(row["ITEMTAG"].ToString()) ? "" : row["ITEMTAG"].ToString()); |
|
2342 |
AddWithValue(cmd, "@DESCRIPTION", string.IsNullOrEmpty(row["DESCRIPTION"].ToString()) ? "" : row["DESCRIPTION"].ToString()); |
|
2343 |
AddWithValue(cmd, "@Class", string.IsNullOrEmpty(row["Class"].ToString()) ? "" : row["Class"].ToString()); |
|
2344 |
AddWithValue(cmd, "@SubClass", string.IsNullOrEmpty(row["SubClass"].ToString()) ? "" : row["SubClass"].ToString()); |
|
2345 |
AddWithValue(cmd, "@TYPE", string.IsNullOrEmpty(row["TYPE"].ToString()) ? "" : row["TYPE"].ToString()); |
|
2346 |
AddWithValue(cmd, "@PIDNAME", string.IsNullOrEmpty(row["PIDNAME"].ToString()) ? "" : row["PIDNAME"].ToString()); |
|
2347 |
AddWithValue(cmd, "@Equipment_OID", string.IsNullOrEmpty(row["Equipment_OID"].ToString()) ? "" : row["Equipment_OID"].ToString()); |
|
2348 |
AddWithValue(cmd, "@NPD", string.IsNullOrEmpty(row["NPD"].ToString()) ? "" : row["NPD"].ToString()); |
|
2349 |
AddWithValue(cmd, "@PipeSystemNetwork_OID", string.IsNullOrEmpty(row["PipeSystemNetwork_OID"].ToString()) ? "" : row["PipeSystemNetwork_OID"].ToString()); |
|
2350 |
AddWithValue(cmd, "@ViewPipeSystemNetwork_OID", string.IsNullOrEmpty(row["ViewPipeSystemNetwork_OID"].ToString()) ? "" : row["ViewPipeSystemNetwork_OID"].ToString()); |
|
2351 |
AddWithValue(cmd, "@PipeRun_OID", string.IsNullOrEmpty(row["PipeRun_OID"].ToString()) ? "" : row["PipeRun_OID"].ToString()); |
|
2352 |
connection.ExecuteNonQuery(cmd, txn); |
|
2353 |
} |
|
2354 | ||
2355 |
// Sequence |
|
2356 |
query = $"DELETE FROM {PSN_SEQUENCEDATA}"; |
|
2357 |
connection.ExecuteNonQuery(connection.GetSqlStringCommand(query), txn); |
|
2358 |
foreach (DataRow row in item.SequenceData.Rows) |
|
2359 |
{ |
|
2360 |
query = $"INSERT INTO {PSN_SEQUENCEDATA} (OID, SERIALNUMBER, PathItem_OID, TopologySet_OID_Key) VALUES (@OID, @SERIALNUMBER, @PathItem_OID, @TopologySet_OID_Key)"; |
|
2361 |
var cmd = connection.GetSqlStringCommand(query); |
|
2362 |
AddWithValue(cmd, "@OID", string.IsNullOrEmpty(row["OID"].ToString()) ? "" : row["OID"].ToString()); |
|
2363 |
AddWithValue(cmd, "@SERIALNUMBER", string.IsNullOrEmpty(row["SERIALNUMBER"].ToString()) ? "" : row["SERIALNUMBER"].ToString()); |
|
2364 |
AddWithValue(cmd, "@PathItem_OID", string.IsNullOrEmpty(row["PathItem_OID"].ToString()) ? "" : row["PathItem_OID"].ToString()); |
|
2365 |
AddWithValue(cmd, "@TopologySet_OID_Key", string.IsNullOrEmpty(row["TopologySet_OID_Key"].ToString()) ? "" : row["TopologySet_OID_Key"].ToString()); |
|
2366 |
connection.ExecuteNonQuery(cmd, txn); |
|
2367 |
} |
|
2368 | ||
2369 |
// Nozzle |
|
2370 |
query = $"DELETE FROM {PSN_NOZZLE}"; |
|
2371 |
connection.ExecuteNonQuery(connection.GetSqlStringCommand(query), txn); |
|
2372 |
foreach (DataRow row in item.Nozzle.Rows) |
|
2373 |
{ |
|
2374 |
query = $"INSERT INTO {PSN_NOZZLE} (OID, ItemTag, Xcoords, Ycoords, Equipment_OID, Fluid, NPD, PMC, Rotation, FlowDirection) VALUES (@OID, @ITEMTAG, @XCOORDS, @YCOORDS, @Equipment_OID, @FLUID, @NPD, @PMC, @ROTATION, @FlowDirection)"; |
|
2375 |
var cmd = connection.GetSqlStringCommand(query); |
|
2376 |
AddWithValue(cmd, "@OID", string.IsNullOrEmpty(row["OID"].ToString()) ? "" : row["OID"].ToString()); |
|
2377 |
AddWithValue(cmd, "@ITEMTAG", string.IsNullOrEmpty(row["ITEMTAG"].ToString()) ? "" : row["ITEMTAG"].ToString()); |
|
2378 | ||
2379 |
if (string.IsNullOrEmpty(row["XCOORDS"].ToString())) |
|
2380 |
AddWithValue(cmd, "@XCOORDS", DBNull.Value); |
|
2381 |
else |
|
2382 |
AddWithValue(cmd, "@XCOORDS", row["XCOORDS"].ToString()); |
|
2383 | ||
2384 |
if (string.IsNullOrEmpty(row["YCOORDS"].ToString())) |
|
2385 |
AddWithValue(cmd, "@YCOORDS", DBNull.Value); |
|
2386 |
else |
|
2387 |
AddWithValue(cmd, "@YCOORDS", row["YCOORDS"].ToString()); |
|
2388 | ||
2389 |
AddWithValue(cmd, "@Equipment_OID", string.IsNullOrEmpty(row["Equipment_OID"].ToString()) ? "" : row["Equipment_OID"].ToString()); |
|
2390 |
AddWithValue(cmd, "@FLUID", string.IsNullOrEmpty(row["FLUID"].ToString()) ? "" : row["FLUID"].ToString()); |
|
2391 |
AddWithValue(cmd, "@NPD", string.IsNullOrEmpty(row["NPD"].ToString()) ? "" : row["NPD"].ToString()); |
|
2392 |
AddWithValue(cmd, "@PMC", string.IsNullOrEmpty(row["PMC"].ToString()) ? "" : row["PMC"].ToString()); |
|
2393 | ||
2394 |
if (string.IsNullOrEmpty(row["ROTATION"].ToString())) |
|
2395 |
AddWithValue(cmd, "@ROTATION", DBNull.Value); |
|
2396 |
else |
|
2397 |
AddWithValue(cmd, "@ROTATION", row["ROTATION"].ToString()); |
|
2398 | ||
2399 |
AddWithValue(cmd, "@FlowDirection", string.IsNullOrEmpty(row["FlowDirection"].ToString()) ? "" : row["FlowDirection"].ToString()); |
|
2400 |
connection.ExecuteNonQuery(cmd, txn); |
|
2401 |
} |
|
2402 | ||
2403 |
//Equipment |
|
2404 |
query = $"DELETE FROM {PSN_EQUIPMENT}"; |
|
2405 |
connection.ExecuteNonQuery(connection.GetSqlStringCommand(query), txn); |
|
2406 |
foreach (DataRow row in item.Equipment.Rows) |
|
2407 |
{ |
|
2408 |
query = $"INSERT INTO {PSN_EQUIPMENT} (OID, ItemTag, Xcoords, Ycoords) VALUES (@OID, @ITEMTAG, @XCOORDS, @YCOORDS)"; |
|
2409 |
var cmd = connection.GetSqlStringCommand(query); |
|
2410 |
AddWithValue(cmd, "@OID", string.IsNullOrEmpty(row["OID"].ToString()) ? "" : row["OID"].ToString()); |
|
2411 |
AddWithValue(cmd, "@ITEMTAG", string.IsNullOrEmpty(row["ITEMTAG"].ToString()) ? "" : row["ITEMTAG"].ToString()); |
|
2412 | ||
2413 |
if (string.IsNullOrEmpty(row["XCOORDS"].ToString())) |
|
2414 |
AddWithValue(cmd, "@XCOORDS", DBNull.Value); |
|
2415 |
else |
|
2416 |
AddWithValue(cmd, "@XCOORDS", row["XCOORDS"].ToString()); |
|
2417 | ||
2418 |
if (string.IsNullOrEmpty(row["YCOORDS"].ToString())) |
|
2419 |
AddWithValue(cmd, "@YCOORDS", DBNull.Value); |
|
2420 |
else |
|
2421 |
AddWithValue(cmd, "@YCOORDS", row["YCOORDS"].ToString()); |
|
2422 | ||
2423 |
connection.ExecuteNonQuery(cmd, txn); |
|
2424 |
} |
|
2425 | ||
2426 |
// TopologySet |
|
2427 |
query = $"DELETE FROM {PSN_TOPOLOGYSET}"; |
|
2428 |
connection.ExecuteNonQuery(connection.GetSqlStringCommand(query), txn); |
|
2429 |
foreach (DataRow row in item.TopologySet.Rows) |
|
2430 |
{ |
|
2431 |
query = $"INSERT INTO {PSN_TOPOLOGYSET} (OID, Type, SubType, HeadItemTag, TailItemTag, HeadItemSPID, TailItemSPID) VALUES (@OID, @Type, @SubType, @HeadItemTag, @TailItemTag, @HeadItemSPID, @TailItemSPID)"; |
|
2432 |
var cmd = connection.GetSqlStringCommand(query); |
|
2433 |
AddWithValue(cmd, "@OID", string.IsNullOrEmpty(row["OID"].ToString()) ? "" : row["OID"].ToString()); |
|
2434 |
AddWithValue(cmd, "@Type", string.IsNullOrEmpty(row["Type"].ToString()) ? "" : row["Type"].ToString()); |
|
2435 |
AddWithValue(cmd, "@SubType", string.IsNullOrEmpty(row["SubType"].ToString()) ? "" : row["SubType"].ToString()); |
|
2436 |
AddWithValue(cmd, "@HeadItemTag", string.IsNullOrEmpty(row["HeadItemTag"].ToString()) ? "" : row["HeadItemTag"].ToString()); |
|
2437 |
AddWithValue(cmd, "@TailItemTag", string.IsNullOrEmpty(row["TailItemTag"].ToString()) ? "" : row["TailItemTag"].ToString()); |
|
2438 |
AddWithValue(cmd, "@HeadItemSPID", string.IsNullOrEmpty(row["HeadItemSPID"].ToString()) ? "" : row["HeadItemSPID"].ToString()); |
|
2439 |
AddWithValue(cmd, "@TailItemSPID", string.IsNullOrEmpty(row["TailItemSPID"].ToString()) ? "" : row["TailItemSPID"].ToString()); |
|
2440 |
connection.ExecuteNonQuery(cmd, txn); |
|
2441 |
} |
|
2442 | ||
2443 |
// PSN |
|
2444 |
query = $"DELETE FROM {PSN_PIPESYSTEMNETWORK} WHERE PSNRevisionNumber = '{string.Format("V{0:D4}", item.Revision)}'"; |
|
2445 |
connection.ExecuteNonQuery(connection.GetSqlStringCommand(query), txn); |
|
2446 |
foreach (DataRow row in item.PipeSystemNetwork.Rows) |
|
2447 |
{ |
|
2448 |
query = $"INSERT INTO {PSN_PIPESYSTEMNETWORK} " + |
|
2449 |
$"(OID, Type, OrderNumber, Pipeline_OID, FROM_DATA, TO_DATA, TopologySet_OID_Key, PSNRevisionNumber, PBS, Drawings, IsValid, Status, IncludingVirtualData, PSNAccuracy) VALUES " + |
|
2450 |
$"(@OID, @Type, @OrderNumber, @Pipeline_OID, @FROM_DATA, @TO_DATA, @TopologySet_OID_Key, @PSNRevisionNumber, @PBS, @Drawings, @IsValid, @Status, @IncludingVirtualData, @PSNAccuracy)"; |
|
2451 |
var cmd = connection.GetSqlStringCommand(query); |
|
2452 |
AddWithValue(cmd, "@OID", string.IsNullOrEmpty(row["OID"].ToString()) ? "" : row["OID"].ToString()); |
|
2453 |
AddWithValue(cmd, "@Type", string.IsNullOrEmpty(row["Type"].ToString()) ? "" : row["Type"].ToString()); |
|
2454 |
AddWithValue(cmd, "@OrderNumber", string.IsNullOrEmpty(row["OrderNumber"].ToString()) ? "" : row["OrderNumber"].ToString()); |
|
2455 |
AddWithValue(cmd, "@Pipeline_OID", string.IsNullOrEmpty(row["Pipeline_OID"].ToString()) ? "" : row["Pipeline_OID"].ToString()); |
|
2456 |
AddWithValue(cmd, "@FROM_DATA", string.IsNullOrEmpty(row["FROM_DATA"].ToString()) ? "" : row["FROM_DATA"].ToString()); |
|
2457 |
AddWithValue(cmd, "@TO_DATA", string.IsNullOrEmpty(row["TO_DATA"].ToString()) ? "" : row["TO_DATA"].ToString()); |
|
2458 |
AddWithValue(cmd, "@TopologySet_OID_Key", string.IsNullOrEmpty(row["TopologySet_OID_Key"].ToString()) ? "" : row["TopologySet_OID_Key"].ToString()); |
|
2459 |
AddWithValue(cmd, "@PSNRevisionNumber", string.IsNullOrEmpty(row["PSNRevisionNumber"].ToString()) ? "" : row["PSNRevisionNumber"].ToString()); |
|
2460 | ||
2461 |
int IsValid = 0; |
|
2462 |
if (row["IsValid"].ToString() == string.Empty || row["IsValid"].ToString() == "OK") |
|
2463 |
IsValid = 0; |
|
2464 |
else if (row["IsValid"].ToString() == "InValid") |
|
2465 |
IsValid = 1; |
|
2466 |
else if (row["IsValid"].ToString() == "Error") |
|
2467 |
IsValid = -1; |
|
2468 | ||
2469 |
AddWithValue(cmd, "@IsValid", IsValid); |
|
2470 |
AddWithValue(cmd, "@Status", string.IsNullOrEmpty(row["Status"].ToString()) ? "" : row["Status"].ToString()); |
|
2471 | ||
2472 |
AddWithValue(cmd, "@PBS", string.IsNullOrEmpty(row["PBS"].ToString()) ? "" : row["PBS"].ToString()); |
|
2473 |
AddWithValue(cmd, "@Drawings", string.IsNullOrEmpty(row["Drawings"].ToString()) ? "" : row["Drawings"].ToString()); |
|
2474 | ||
2475 |
AddWithValue(cmd, "@IncludingVirtualData", string.IsNullOrEmpty(row["IncludingVirtualData"].ToString()) ? "" : row["IncludingVirtualData"].ToString()); |
|
2476 |
if (string.IsNullOrEmpty(row["PSNAccuracy"].ToString())) |
|
2477 |
AddWithValue(cmd, "@PSNAccuracy", DBNull.Value); |
|
2478 |
else |
|
2479 |
AddWithValue(cmd, "@PSNAccuracy", row["PSNAccuracy"].ToString()); |
|
2480 | ||
2481 |
connection.ExecuteNonQuery(cmd, txn); |
|
2482 |
} |
|
2483 | ||
2484 |
//Pipeline |
|
2485 |
query = $"DELETE FROM {PSN_PIPELINE}"; |
|
2486 |
connection.ExecuteNonQuery(connection.GetSqlStringCommand(query), txn); |
|
2487 |
foreach (DataRow row in item.PipeLine.Rows) |
|
2488 |
{ |
|
2489 |
query = $"INSERT INTO {PSN_PIPELINE} (OID, PipeSystem_OID, FLUID, PMC, SEQNUMBER, INSULATION, FROM_DATA, TO_DATA, Unit) VALUES (@OID, @PipeSystem_OID, @FLUID, @PMC, @SEQNUMBER, @INSULATION, @FROM_DATA, @TO_DATA, @Unit)"; |
|
2490 |
var cmd = connection.GetSqlStringCommand(query); |
|
2491 |
AddWithValue(cmd, "@OID", row["OID"].ToString()); |
|
2492 |
AddWithValue(cmd, "@PipeSystem_OID", row["PipeSystem_OID"].ToString()); |
|
2493 |
AddWithValue(cmd, "@FLUID", row["FLUID"].ToString()); |
|
2494 |
AddWithValue(cmd, "@PMC", row["PMC"].ToString()); |
|
2495 |
AddWithValue(cmd, "@SEQNUMBER", row["SEQNUMBER"].ToString()); |
|
2496 |
AddWithValue(cmd, "@INSULATION", row["INSULATION"].ToString()); |
|
2497 |
AddWithValue(cmd, "@FROM_DATA", row["FROM_DATA"].ToString()); |
|
2498 |
AddWithValue(cmd, "@TO_DATA", row["TO_DATA"].ToString()); |
|
2499 |
AddWithValue(cmd, "@Unit", row["Unit"].ToString()); |
|
2500 |
connection.ExecuteNonQuery(cmd, txn); |
|
2501 |
} |
|
2502 | ||
2503 |
//Header Setting |
|
2504 |
query = $"DELETE FROM {PSN_HEADER_SETTING}"; |
|
2505 |
connection.ExecuteNonQuery(connection.GetSqlStringCommand(query), txn); |
|
2506 | ||
2507 |
foreach (HeaderInfo headerInfo in headerInfos) |
|
2508 |
{ |
|
2509 |
foreach (HeaderItem itemheader in headerInfo.HeaderItems) |
|
2510 |
{ |
|
2511 |
query = $"INSERT INTO {PSN_HEADER_SETTING} (GROUP_ID, DESCRIPTION, [INDEX], NAME) VALUES (@GROUP_ID, @DESCRIPTION, @INDEX, @NAME)"; |
|
2512 |
var cmd = connection.GetSqlStringCommand(query); |
|
2513 |
AddWithValue(cmd, "@GROUP_ID", headerInfo.UID); |
|
2514 |
AddWithValue(cmd, "@DESCRIPTION", headerInfo.Description); |
|
2515 |
AddWithValue(cmd, "@INDEX", itemheader.Index); |
|
2516 |
AddWithValue(cmd, "@NAME", itemheader.Name); |
|
2517 |
connection.ExecuteNonQuery(cmd, txn); |
|
2518 |
} |
|
2519 |
} |
|
2520 | ||
2521 |
//Vent/Drain Setting |
|
2522 |
query = $"DELETE FROM {PSN_VENTDRAIN_SETTING}"; |
|
2523 |
connection.ExecuteNonQuery(connection.GetSqlStringCommand(query), txn); |
|
2524 | ||
2525 |
foreach (VentDrainInfo ventDrainInfo in ventDrainInfos) |
|
2526 |
{ |
|
2527 |
foreach (VentDrainItem itemventdrain in ventDrainInfo.VentDrainItems) |
|
2528 |
{ |
|
2529 |
query = $"INSERT INTO {PSN_VENTDRAIN_SETTING} (GROUP_ID, DESCRIPTION, [INDEX], NAME) VALUES (@GROUP_ID, @DESCRIPTION, @INDEX, @NAME)"; |
|
2530 |
var cmd = connection.GetSqlStringCommand(query); |
|
2531 |
AddWithValue(cmd, "@GROUP_ID", ventDrainInfo.UID); |
|
2532 |
AddWithValue(cmd, "@DESCRIPTION", ventDrainInfo.Description); |
|
2533 |
AddWithValue(cmd, "@INDEX", itemventdrain.Index); |
|
2534 |
AddWithValue(cmd, "@NAME", itemventdrain.Name); |
|
2535 |
connection.ExecuteNonQuery(cmd, txn); |
|
2536 |
} |
|
2537 |
} |
|
2538 | ||
2539 |
//Keyword Setting |
|
2540 |
query = $"DELETE FROM {PSN_TRANSFORMKEYWORD_SETTING}"; |
|
2541 |
connection.ExecuteNonQuery(connection.GetSqlStringCommand(query), txn); |
|
2542 | ||
2543 |
foreach (KeywordItem itemKeyword in keywordItems) |
|
2544 |
{ |
|
2545 |
query = $"INSERT INTO {PSN_TRANSFORMKEYWORD_SETTING} ([INDEX], NAME, KEYWORD) VALUES (@INDEX, @NAME, @KEYWORD)"; |
|
2546 |
var cmd = connection.GetSqlStringCommand(query); |
|
2547 |
AddWithValue(cmd, "@INDEX", itemKeyword.Index); |
|
2548 |
AddWithValue(cmd, "@NAME", itemKeyword.Name); |
|
2549 |
AddWithValue(cmd, "@KEYWORD", itemKeyword.Keyword); |
|
2550 |
connection.ExecuteNonQuery(cmd, txn); |
|
2551 |
} |
|
2552 | ||
2553 |
//FulidCode |
|
2554 |
query = $"DELETE FROM {PSN_FLUIDCODE}"; |
|
2555 |
connection.ExecuteNonQuery(connection.GetSqlStringCommand(query), txn); |
|
2556 | ||
2557 |
foreach (DataRow row in dtFluidCode.Rows) |
|
2558 |
{ |
|
2559 |
query = $"INSERT INTO {PSN_FLUIDCODE} (UID, Code, Description, Condition, Remarks, GroundLevel) VALUES (@UID, @Code, @Description, @Condition, @Remarks, @GroundLevel)"; |
|
2560 |
var cmd = connection.GetSqlStringCommand(query); |
|
2561 |
cmd.Parameters.Clear(); |
|
2562 | ||
2563 |
{ |
|
2564 |
var param = cmd.CreateParameter(); |
|
2565 |
param.ParameterName = "@UID"; |
|
2566 |
param.Value = row["UID"].ToString(); |
|
2567 |
cmd.Parameters.Add(param); |
|
2568 |
} |
|
2569 | ||
2570 |
{ |
|
2571 |
var param = cmd.CreateParameter(); |
|
2572 |
param.ParameterName = "@Code"; |
|
2573 |
param.Value = row["Code"].ToString(); |
|
2574 |
cmd.Parameters.Add(param); |
|
2575 |
} |
|
2576 | ||
2577 |
{ |
|
2578 |
var param = cmd.CreateParameter(); |
|
2579 |
param.ParameterName = "@Description"; |
|
2580 |
param.Value = row["Description"].ToString(); |
|
2581 |
cmd.Parameters.Add(param); |
|
2582 |
} |
|
2583 | ||
2584 |
{ |
|
2585 |
var param = cmd.CreateParameter(); |
|
2586 |
param.ParameterName = "@Condition"; |
|
2587 |
param.Value = row["Condition"].ToString(); |
|
2588 |
cmd.Parameters.Add(param); |
|
2589 |
} |
|
2590 | ||
2591 |
{ |
|
2592 |
var param = cmd.CreateParameter(); |
|
2593 |
param.ParameterName = "@Remarks"; |
|
2594 |
param.Value = row["Remarks"].ToString(); |
|
2595 |
cmd.Parameters.Add(param); |
|
2596 |
} |
|
2597 | ||
2598 |
{ |
|
2599 |
var param = cmd.CreateParameter(); |
|
2600 |
param.ParameterName = "@GroundLevel"; |
|
2601 |
param.Value = row["GroundLevel"].ToString(); |
|
2602 |
cmd.Parameters.Add(param); |
|
2603 |
} |
|
2604 | ||
2605 |
connection.ExecuteNonQuery(cmd, txn); |
|
2606 |
} |
|
2607 | ||
2608 |
//PMC |
|
2609 |
query = $"DELETE FROM {PSN_PIPINGMATLCLASS}"; |
|
2610 |
connection.ExecuteNonQuery(connection.GetSqlStringCommand(query), txn); |
|
2611 | ||
2612 |
foreach (DataRow row in dtPMC.Rows) |
|
2613 |
{ |
|
2614 |
query = $"INSERT INTO {PSN_PIPINGMATLCLASS} ( UID, Priority, Code, Description, Condition, Remarks, GroundLevel) VALUES (@UID, @Priority, @Code, @Description, @Condition, @Remarks, @GroundLevel)"; |
|
2615 |
var cmd = connection.GetSqlStringCommand(query); |
|
2616 |
cmd.Parameters.Clear(); |
|
2617 | ||
2618 |
{ |
|
2619 |
var param = cmd.CreateParameter(); |
|
2620 |
param.ParameterName = "@UID"; |
|
2621 |
param.Value = row["UID"].ToString(); |
|
2622 |
cmd.Parameters.Add(param); |
|
2623 |
} |
|
2624 | ||
2625 |
{ |
|
2626 |
var param = cmd.CreateParameter(); |
|
2627 |
param.ParameterName = "@Priority"; |
|
2628 |
param.Value = row["Priority"].ToString(); |
|
2629 |
cmd.Parameters.Add(param); |
|
2630 |
} |
|
2631 | ||
2632 |
{ |
|
2633 |
var param = cmd.CreateParameter(); |
|
2634 |
param.ParameterName = "@Code"; |
|
2635 |
param.Value = row["Code"].ToString(); |
|
2636 |
cmd.Parameters.Add(param); |
|
2637 |
} |
|
2638 | ||
2639 |
{ |
|
2640 |
var param = cmd.CreateParameter(); |
|
2641 |
param.ParameterName = "@Description"; |
|
2642 |
param.Value = row["Description"].ToString(); |
|
2643 |
cmd.Parameters.Add(param); |
|
2644 |
} |
|
2645 | ||
2646 |
{ |
|
2647 |
var param = cmd.CreateParameter(); |
|
2648 |
param.ParameterName = "@Condition"; |
|
2649 |
param.Value = row["Condition"].ToString(); |
|
2650 |
cmd.Parameters.Add(param); |
|
2651 |
} |
|
2652 | ||
2653 |
{ |
|
2654 |
var param = cmd.CreateParameter(); |
|
2655 |
param.ParameterName = "@Remarks"; |
|
2656 |
param.Value = row["Remarks"].ToString(); |
|
2657 |
cmd.Parameters.Add(param); |
|
2658 |
} |
|
2659 | ||
2660 |
{ |
|
2661 |
var param = cmd.CreateParameter(); |
|
2662 |
param.ParameterName = "@GroundLevel"; |
|
2663 |
param.Value = row["GroundLevel"].ToString(); |
|
2664 |
cmd.Parameters.Add(param); |
|
2665 |
} |
|
2666 | ||
2667 |
connection.ExecuteNonQuery(cmd, txn); |
|
2668 |
} |
|
2669 | ||
2670 |
//Insulation |
|
2671 |
query = $"DELETE FROM {PSN_INSULATIONPURPOSE}"; |
|
2672 |
connection.ExecuteNonQuery(connection.GetSqlStringCommand(query), txn); |
|
2673 | ||
2674 |
foreach (DataRow row in dtInsulation.Rows) |
|
2675 |
{ |
|
2676 |
query = $"INSERT INTO {PSN_INSULATIONPURPOSE} (UID, Code, Description, Remarks) VALUES (@UID, @Code, @Description, @Remarks)"; |
|
2677 |
var cmd = connection.GetSqlStringCommand(query); |
|
2678 |
cmd.Parameters.Clear(); |
|
2679 | ||
2680 |
{ |
|
2681 |
var param = cmd.CreateParameter(); |
|
2682 |
param.ParameterName = "@UID"; |
|
2683 |
param.Value = row["UID"].ToString(); |
|
2684 |
cmd.Parameters.Add(param); |
|
2685 |
} |
|
2686 | ||
2687 |
{ |
|
2688 |
var param = cmd.CreateParameter(); |
|
2689 |
param.ParameterName = "@Code"; |
|
2690 |
param.Value = row["Code"].ToString(); |
|
2691 |
cmd.Parameters.Add(param); |
|
2692 |
} |
|
2693 | ||
2694 |
{ |
|
2695 |
var param = cmd.CreateParameter(); |
|
2696 |
param.ParameterName = "@Description"; |
|
2697 |
param.Value = row["Description"].ToString(); |
|
2698 |
cmd.Parameters.Add(param); |
|
2699 |
} |
|
2700 | ||
2701 |
{ |
|
2702 |
var param = cmd.CreateParameter(); |
|
2703 |
param.ParameterName = "@Remarks"; |
|
2704 |
param.Value = row["Remarks"].ToString(); |
|
2705 |
cmd.Parameters.Add(param); |
|
2706 |
} |
|
2707 | ||
2708 |
connection.ExecuteNonQuery(cmd, txn); |
|
2709 |
} |
|
2710 | ||
2711 |
//Topology Rule |
|
2712 |
query = $"DELETE FROM {PSN_TOPOLOGY_RULE}"; |
|
2713 |
var cmdtopology = connection.GetSqlStringCommand(query); |
|
2714 |
//connection.ExecuteNonQuery(connection.GetSqlStringCommand(query), txn); |
|
2715 |
connection.ExecuteNonQuery(cmdtopology, txn); |
|
2716 | ||
2717 |
foreach (DataRow row in dtTopologyRule.Rows) |
|
2718 |
{ |
|
2719 |
query = $"INSERT INTO {PSN_TOPOLOGY_RULE} (UID) VALUES (@UID)"; |
|
2720 |
cmdtopology = connection.GetSqlStringCommand(query); |
|
2721 |
AddWithValue(cmdtopology, "@UID", row["UID"].ToString()); |
|
2722 |
connection.ExecuteNonQuery(cmdtopology, txn); |
|
2723 |
} |
|
2724 | ||
2725 |
txn.Commit(); |
|
2726 |
} |
|
2727 |
catch (Exception ex) |
|
2728 |
{ |
|
2729 |
txn.Rollback(); |
|
2730 |
result = false; |
|
2731 |
} |
|
2732 |
} |
|
2733 |
} |
|
2734 |
catch (Exception ex) |
|
2735 |
{ |
|
2736 |
System.Windows.Forms.MessageBox.Show(ex.Message); |
|
2737 |
result = false; |
|
2738 |
} |
|
2739 |
} |
|
2740 | ||
2741 |
return result; |
|
2742 |
} |
|
1915 | 2743 |
} |
1916 | 2744 |
} |
DTI_PID/ID2PSN/Form/DBSettingForm.Designer.cs | ||
---|---|---|
1 |
namespace ID2PSN |
|
2 |
{ |
|
3 |
partial class DBSettingForm |
|
4 |
{ |
|
5 |
/// <summary> |
|
6 |
/// Required designer variable. |
|
7 |
/// </summary> |
|
8 |
private System.ComponentModel.IContainer components = null; |
|
9 | ||
10 |
/// <summary> |
|
11 |
/// Clean up any resources being used. |
|
12 |
/// </summary> |
|
13 |
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> |
|
14 |
protected override void Dispose(bool disposing) |
|
15 |
{ |
|
16 |
if (disposing && (components != null)) |
|
17 |
{ |
|
18 |
components.Dispose(); |
|
19 |
} |
|
20 |
base.Dispose(disposing); |
|
21 |
} |
|
22 | ||
23 |
#region Windows Form Designer generated code |
|
24 | ||
25 |
/// <summary> |
|
26 |
/// Required method for Designer support - do not modify |
|
27 |
/// the contents of this method with the code editor. |
|
28 |
/// </summary> |
|
29 |
private void InitializeComponent() |
|
30 |
{ |
|
31 |
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DBSettingForm)); |
|
32 |
this.splashScreenManager1 = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::ID2PSN.WaitForm), true, true); |
|
33 |
this.ribbonControl = new DevExpress.XtraBars.Ribbon.RibbonControl(); |
|
34 |
this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl(); |
|
35 |
this.btnClose = new DevExpress.XtraEditors.SimpleButton(); |
|
36 |
this.btnSave = new DevExpress.XtraEditors.SimpleButton(); |
|
37 |
this.rgDbSetting = new DevExpress.XtraEditors.RadioGroup(); |
|
38 |
this.txHost = new DevExpress.XtraEditors.TextEdit(); |
|
39 |
this.txDBName = new DevExpress.XtraEditors.TextEdit(); |
|
40 |
this.txUser = new DevExpress.XtraEditors.TextEdit(); |
|
41 |
this.txPassword = new DevExpress.XtraEditors.TextEdit(); |
|
42 |
this.btnFolder = new DevExpress.XtraEditors.SimpleButton(); |
|
43 |
this.txID2Filepath = new DevExpress.XtraEditors.TextEdit(); |
|
44 |
this.Root = new DevExpress.XtraLayout.LayoutControlGroup(); |
|
45 |
this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem(); |
|
46 |
this.layoutControlItem5 = new DevExpress.XtraLayout.LayoutControlItem(); |
|
47 |
this.emptySpaceItem2 = new DevExpress.XtraLayout.EmptySpaceItem(); |
|
48 |
this.layoutControlGroup1 = new DevExpress.XtraLayout.LayoutControlGroup(); |
|
49 |
this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); |
|
50 |
this.group2 = new DevExpress.XtraLayout.LayoutControlGroup(); |
|
51 |
this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem(); |
|
52 |
this.lcID2FilePath = new DevExpress.XtraLayout.LayoutControlItem(); |
|
53 |
this.group1 = new DevExpress.XtraLayout.LayoutControlGroup(); |
|
54 |
this.lcPassword = new DevExpress.XtraLayout.LayoutControlItem(); |
|
55 |
this.lcHost = new DevExpress.XtraLayout.LayoutControlItem(); |
|
56 |
this.lcDBName = new DevExpress.XtraLayout.LayoutControlItem(); |
|
57 |
this.lcUser = new DevExpress.XtraLayout.LayoutControlItem(); |
|
58 |
this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem(); |
|
59 |
((System.ComponentModel.ISupportInitialize)(this.ribbonControl)).BeginInit(); |
|
60 |
((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit(); |
|
61 |
this.layoutControl1.SuspendLayout(); |
|
62 |
((System.ComponentModel.ISupportInitialize)(this.rgDbSetting.Properties)).BeginInit(); |
|
63 |
((System.ComponentModel.ISupportInitialize)(this.txHost.Properties)).BeginInit(); |
|
64 |
((System.ComponentModel.ISupportInitialize)(this.txDBName.Properties)).BeginInit(); |
|
65 |
((System.ComponentModel.ISupportInitialize)(this.txUser.Properties)).BeginInit(); |
|
66 |
((System.ComponentModel.ISupportInitialize)(this.txPassword.Properties)).BeginInit(); |
|
67 |
((System.ComponentModel.ISupportInitialize)(this.txID2Filepath.Properties)).BeginInit(); |
|
68 |
((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit(); |
|
69 |
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).BeginInit(); |
|
70 |
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).BeginInit(); |
|
71 |
((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).BeginInit(); |
|
72 |
((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).BeginInit(); |
|
73 |
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit(); |
|
74 |
((System.ComponentModel.ISupportInitialize)(this.group2)).BeginInit(); |
|
75 |
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit(); |
|
76 |
((System.ComponentModel.ISupportInitialize)(this.lcID2FilePath)).BeginInit(); |
|
77 |
((System.ComponentModel.ISupportInitialize)(this.group1)).BeginInit(); |
|
78 |
((System.ComponentModel.ISupportInitialize)(this.lcPassword)).BeginInit(); |
|
79 |
((System.ComponentModel.ISupportInitialize)(this.lcHost)).BeginInit(); |
|
80 |
((System.ComponentModel.ISupportInitialize)(this.lcDBName)).BeginInit(); |
|
81 |
((System.ComponentModel.ISupportInitialize)(this.lcUser)).BeginInit(); |
|
82 |
((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit(); |
|
83 |
this.SuspendLayout(); |
|
84 |
// |
|
85 |
// splashScreenManager1 |
|
86 |
// |
|
87 |
this.splashScreenManager1.ClosingDelay = 500; |
|
88 |
// |
|
89 |
// ribbonControl |
|
90 |
// |
|
91 |
this.ribbonControl.ExpandCollapseItem.Id = 0; |
|
92 |
this.ribbonControl.Items.AddRange(new DevExpress.XtraBars.BarItem[] { |
|
93 |
this.ribbonControl.ExpandCollapseItem, |
|
94 |
this.ribbonControl.SearchEditItem}); |
|
95 |
this.ribbonControl.Location = new System.Drawing.Point(0, 0); |
|
96 |
this.ribbonControl.MaxItemId = 1; |
|
97 |
this.ribbonControl.Name = "ribbonControl"; |
|
98 |
this.ribbonControl.ShowApplicationButton = DevExpress.Utils.DefaultBoolean.False; |
|
99 |
this.ribbonControl.ShowDisplayOptionsMenuButton = DevExpress.Utils.DefaultBoolean.False; |
|
100 |
this.ribbonControl.ShowPageHeadersMode = DevExpress.XtraBars.Ribbon.ShowPageHeadersMode.ShowOnMultiplePages; |
|
101 |
this.ribbonControl.ShowToolbarCustomizeItem = false; |
|
102 |
this.ribbonControl.Size = new System.Drawing.Size(378, 32); |
|
103 |
this.ribbonControl.Toolbar.ShowCustomizeItem = false; |
|
104 |
// |
|
105 |
// layoutControl1 |
|
106 |
// |
|
107 |
this.layoutControl1.Controls.Add(this.btnClose); |
|
108 |
this.layoutControl1.Controls.Add(this.btnSave); |
|
109 |
this.layoutControl1.Controls.Add(this.rgDbSetting); |
|
110 |
this.layoutControl1.Controls.Add(this.txHost); |
|
111 |
this.layoutControl1.Controls.Add(this.txDBName); |
|
112 |
this.layoutControl1.Controls.Add(this.txUser); |
|
113 |
this.layoutControl1.Controls.Add(this.txPassword); |
|
114 |
this.layoutControl1.Controls.Add(this.btnFolder); |
|
115 |
this.layoutControl1.Controls.Add(this.txID2Filepath); |
|
116 |
this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill; |
|
117 |
this.layoutControl1.Location = new System.Drawing.Point(0, 32); |
|
118 |
this.layoutControl1.Name = "layoutControl1"; |
|
119 |
this.layoutControl1.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = new System.Drawing.Rectangle(963, 307, 650, 400); |
|
120 |
this.layoutControl1.Root = this.Root; |
|
121 |
this.layoutControl1.Size = new System.Drawing.Size(378, 266); |
|
122 |
this.layoutControl1.TabIndex = 1; |
|
123 |
this.layoutControl1.Text = "layoutControl1"; |
|
124 |
// |
|
125 |
// btnClose |
|
126 |
// |
|
127 |
this.btnClose.ImageOptions.Image = ((System.Drawing.Image)(resources.GetObject("btnClose.ImageOptions.Image"))); |
|
128 |
this.btnClose.Location = new System.Drawing.Point(296, 218); |
|
129 |
this.btnClose.Name = "btnClose"; |
|
130 |
this.btnClose.Size = new System.Drawing.Size(70, 36); |
|
131 |
this.btnClose.StyleController = this.layoutControl1; |
|
132 |
this.btnClose.TabIndex = 5; |
|
133 |
this.btnClose.Text = "Close"; |
|
134 |
this.btnClose.Click += new System.EventHandler(this.btnClose_Click); |
|
135 |
// |
|
136 |
// btnSave |
|
137 |
// |
|
138 |
this.btnSave.ImageOptions.Image = ((System.Drawing.Image)(resources.GetObject("btnSave.ImageOptions.Image"))); |
|
139 |
this.btnSave.Location = new System.Drawing.Point(204, 218); |
|
140 |
this.btnSave.Name = "btnSave"; |
|
141 |
this.btnSave.Size = new System.Drawing.Size(68, 36); |
|
142 |
this.btnSave.StyleController = this.layoutControl1; |
|
143 |
this.btnSave.TabIndex = 6; |
|
144 |
this.btnSave.Text = "Save"; |
|
145 |
this.btnSave.Click += new System.EventHandler(this.btnSave_Click); |
|
146 |
// |
|
147 |
// rgDbSetting |
|
148 |
// |
|
149 |
this.rgDbSetting.Location = new System.Drawing.Point(24, 43); |
|
150 |
this.rgDbSetting.MenuManager = this.ribbonControl; |
|
151 |
this.rgDbSetting.Name = "rgDbSetting"; |
|
152 |
this.rgDbSetting.Properties.Columns = 2; |
|
153 |
this.rgDbSetting.Properties.Items.AddRange(new DevExpress.XtraEditors.Controls.RadioGroupItem[] { |
|
154 |
new DevExpress.XtraEditors.Controls.RadioGroupItem("SQLite", "SQLite", true, "SQLite"), |
|
155 |
new DevExpress.XtraEditors.Controls.RadioGroupItem("MSSQL", "MSSQL", true, "MSSQL")}); |
|
156 |
this.rgDbSetting.Size = new System.Drawing.Size(330, 37); |
|
157 |
this.rgDbSetting.StyleController = this.layoutControl1; |
|
158 |
this.rgDbSetting.TabIndex = 7; |
|
159 |
this.rgDbSetting.SelectedIndexChanged += new System.EventHandler(this.rgDbSetting_SelectedIndexChanged); |
|
160 |
// |
|
161 |
// txHost |
|
162 |
// |
|
163 |
this.txHost.Location = new System.Drawing.Point(89, 84); |
|
164 |
this.txHost.MenuManager = this.ribbonControl; |
|
165 |
this.txHost.Name = "txHost"; |
|
166 |
this.txHost.Size = new System.Drawing.Size(265, 20); |
|
167 |
this.txHost.StyleController = this.layoutControl1; |
|
168 |
this.txHost.TabIndex = 8; |
|
169 |
// |
|
170 |
// txDBName |
|
171 |
// |
|
172 |
this.txDBName.Location = new System.Drawing.Point(89, 108); |
|
173 |
this.txDBName.MenuManager = this.ribbonControl; |
|
174 |
this.txDBName.Name = "txDBName"; |
|
175 |
this.txDBName.Size = new System.Drawing.Size(265, 20); |
|
176 |
this.txDBName.StyleController = this.layoutControl1; |
|
177 |
this.txDBName.TabIndex = 9; |
|
178 |
// |
|
179 |
// txUser |
|
180 |
// |
|
181 |
this.txUser.Location = new System.Drawing.Point(89, 132); |
|
182 |
this.txUser.MenuManager = this.ribbonControl; |
|
183 |
this.txUser.Name = "txUser"; |
|
184 |
this.txUser.Size = new System.Drawing.Size(265, 20); |
|
185 |
this.txUser.StyleController = this.layoutControl1; |
|
186 |
this.txUser.TabIndex = 10; |
|
187 |
// |
|
188 |
// txPassword |
|
189 |
// |
|
190 |
this.txPassword.Location = new System.Drawing.Point(89, 156); |
|
191 |
this.txPassword.MenuManager = this.ribbonControl; |
|
192 |
this.txPassword.Name = "txPassword"; |
|
193 |
this.txPassword.Size = new System.Drawing.Size(265, 20); |
|
194 |
this.txPassword.StyleController = this.layoutControl1; |
|
195 |
this.txPassword.TabIndex = 11; |
|
196 |
// |
|
197 |
// btnFolder |
|
198 |
// |
|
199 |
this.btnFolder.Location = new System.Drawing.Point(327, 180); |
|
200 |
this.btnFolder.Name = "btnFolder"; |
|
201 |
this.btnFolder.Size = new System.Drawing.Size(27, 22); |
|
202 |
this.btnFolder.StyleController = this.layoutControl1; |
|
203 |
this.btnFolder.TabIndex = 12; |
|
204 |
this.btnFolder.Text = "..."; |
|
205 |
this.btnFolder.Click += new System.EventHandler(this.btnFolder_Click); |
|
206 |
// |
|
207 |
// txID2Filepath |
|
208 |
// |
|
209 |
this.txID2Filepath.Location = new System.Drawing.Point(89, 180); |
|
210 |
this.txID2Filepath.MenuManager = this.ribbonControl; |
|
211 |
this.txID2Filepath.Name = "txID2Filepath"; |
|
212 |
this.txID2Filepath.Size = new System.Drawing.Size(234, 20); |
|
213 |
this.txID2Filepath.StyleController = this.layoutControl1; |
|
214 |
this.txID2Filepath.TabIndex = 13; |
|
215 |
// |
|
216 |
// Root |
|
217 |
// |
|
218 |
this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; |
|
219 |
this.Root.GroupBordersVisible = false; |
|
220 |
this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { |
|
221 |
this.layoutControlItem4, |
|
222 |
this.layoutControlItem5, |
|
223 |
this.emptySpaceItem2, |
|
224 |
this.layoutControlGroup1, |
|
225 |
this.emptySpaceItem1}); |
|
226 |
this.Root.Name = "Root"; |
|
227 |
this.Root.Size = new System.Drawing.Size(378, 266); |
|
228 |
this.Root.TextVisible = false; |
|
229 |
// |
|
230 |
// layoutControlItem4 |
|
231 |
// |
|
232 |
this.layoutControlItem4.Control = this.btnSave; |
|
233 |
this.layoutControlItem4.Location = new System.Drawing.Point(192, 206); |
|
234 |
this.layoutControlItem4.MaxSize = new System.Drawing.Size(72, 40); |
|
235 |
this.layoutControlItem4.MinSize = new System.Drawing.Size(72, 40); |
|
236 |
this.layoutControlItem4.Name = "layoutControlItem4"; |
|
237 |
this.layoutControlItem4.Size = new System.Drawing.Size(72, 40); |
|
238 |
this.layoutControlItem4.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; |
|
239 |
this.layoutControlItem4.TextSize = new System.Drawing.Size(0, 0); |
|
240 |
this.layoutControlItem4.TextVisible = false; |
|
241 |
// |
|
242 |
// layoutControlItem5 |
|
243 |
// |
|
244 |
this.layoutControlItem5.Control = this.btnClose; |
|
245 |
this.layoutControlItem5.Location = new System.Drawing.Point(284, 206); |
|
246 |
this.layoutControlItem5.MaxSize = new System.Drawing.Size(74, 40); |
|
247 |
this.layoutControlItem5.MinSize = new System.Drawing.Size(74, 40); |
|
248 |
this.layoutControlItem5.Name = "layoutControlItem5"; |
|
249 |
this.layoutControlItem5.Size = new System.Drawing.Size(74, 40); |
|
250 |
this.layoutControlItem5.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; |
|
251 |
this.layoutControlItem5.TextSize = new System.Drawing.Size(0, 0); |
|
252 |
this.layoutControlItem5.TextVisible = false; |
|
253 |
// |
|
254 |
// emptySpaceItem2 |
|
255 |
// |
|
256 |
this.emptySpaceItem2.AllowHotTrack = false; |
|
257 |
this.emptySpaceItem2.Location = new System.Drawing.Point(264, 206); |
|
258 |
this.emptySpaceItem2.MaxSize = new System.Drawing.Size(20, 40); |
|
259 |
this.emptySpaceItem2.MinSize = new System.Drawing.Size(20, 40); |
|
260 |
this.emptySpaceItem2.Name = "emptySpaceItem2"; |
|
261 |
this.emptySpaceItem2.Size = new System.Drawing.Size(20, 40); |
|
262 |
this.emptySpaceItem2.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; |
|
263 |
this.emptySpaceItem2.TextSize = new System.Drawing.Size(0, 0); |
|
264 |
// |
|
265 |
// layoutControlGroup1 |
|
266 |
// |
|
267 |
this.layoutControlGroup1.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { |
|
268 |
this.layoutControlItem1, |
|
269 |
this.group2, |
|
270 |
this.group1}); |
|
271 |
this.layoutControlGroup1.Location = new System.Drawing.Point(0, 0); |
|
272 |
this.layoutControlGroup1.Name = "layoutControlGroup1"; |
|
273 |
this.layoutControlGroup1.Size = new System.Drawing.Size(358, 206); |
|
274 |
this.layoutControlGroup1.Text = "DB Setting"; |
|
275 |
// |
|
276 |
// layoutControlItem1 |
|
277 |
// |
|
278 |
this.layoutControlItem1.Control = this.rgDbSetting; |
|
279 |
this.layoutControlItem1.Location = new System.Drawing.Point(0, 0); |
|
280 |
this.layoutControlItem1.MaxSize = new System.Drawing.Size(334, 41); |
|
281 |
this.layoutControlItem1.MinSize = new System.Drawing.Size(334, 41); |
|
282 |
this.layoutControlItem1.Name = "layoutControlItem1"; |
|
283 |
this.layoutControlItem1.Size = new System.Drawing.Size(334, 41); |
|
284 |
this.layoutControlItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; |
|
285 |
this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0); |
|
286 |
this.layoutControlItem1.TextVisible = false; |
|
287 |
// |
|
288 |
// group2 |
|
289 |
// |
|
290 |
this.group2.GroupBordersVisible = false; |
|
291 |
this.group2.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { |
|
292 |
this.layoutControlItem2, |
|
293 |
this.lcID2FilePath}); |
|
294 |
this.group2.Location = new System.Drawing.Point(0, 137); |
|
295 |
this.group2.Name = "group2"; |
|
296 |
this.group2.Size = new System.Drawing.Size(334, 26); |
|
297 |
this.group2.TextVisible = false; |
|
298 |
// |
|
299 |
// layoutControlItem2 |
|
300 |
// |
|
301 |
this.layoutControlItem2.Control = this.btnFolder; |
|
302 |
this.layoutControlItem2.Location = new System.Drawing.Point(303, 0); |
|
303 |
this.layoutControlItem2.Name = "layoutControlItem2"; |
|
304 |
this.layoutControlItem2.Size = new System.Drawing.Size(31, 26); |
|
305 |
this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0); |
|
306 |
this.layoutControlItem2.TextVisible = false; |
|
307 |
// |
|
308 |
// lcID2FilePath |
|
309 |
// |
|
310 |
this.lcID2FilePath.Control = this.txID2Filepath; |
|
311 |
this.lcID2FilePath.Location = new System.Drawing.Point(0, 0); |
|
312 |
this.lcID2FilePath.Name = "lcID2FilePath"; |
|
313 |
this.lcID2FilePath.Size = new System.Drawing.Size(303, 26); |
|
314 |
this.lcID2FilePath.Text = "ID2 Project"; |
|
315 |
this.lcID2FilePath.TextSize = new System.Drawing.Size(62, 14); |
|
316 |
// |
|
317 |
// group1 |
|
318 |
// |
|
319 |
this.group1.CustomizationFormText = "layoutControlGroup1"; |
|
320 |
this.group1.GroupBordersVisible = false; |
|
321 |
this.group1.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { |
|
322 |
this.lcPassword, |
|
323 |
this.lcHost, |
|
324 |
this.lcDBName, |
|
325 |
this.lcUser}); |
|
326 |
this.group1.Location = new System.Drawing.Point(0, 41); |
|
327 |
this.group1.Name = "group1"; |
|
328 |
this.group1.Size = new System.Drawing.Size(334, 96); |
|
329 |
this.group1.Text = "layoutControlGroup1"; |
|
330 |
this.group1.TextVisible = false; |
|
331 |
// |
|
332 |
// lcPassword |
|
333 |
// |
|
334 |
this.lcPassword.Control = this.txPassword; |
|
335 |
this.lcPassword.Location = new System.Drawing.Point(0, 72); |
|
336 |
this.lcPassword.Name = "lcPassword"; |
|
337 |
this.lcPassword.Size = new System.Drawing.Size(334, 24); |
|
338 |
this.lcPassword.Text = "Password"; |
|
339 |
this.lcPassword.TextSize = new System.Drawing.Size(62, 14); |
|
340 |
// |
|
341 |
// lcHost |
|
342 |
// |
|
343 |
this.lcHost.Control = this.txHost; |
|
344 |
this.lcHost.Location = new System.Drawing.Point(0, 0); |
|
345 |
this.lcHost.Name = "lcHost"; |
|
346 |
this.lcHost.Size = new System.Drawing.Size(334, 24); |
|
347 |
this.lcHost.Text = "Host"; |
|
348 |
this.lcHost.TextLocation = DevExpress.Utils.Locations.Left; |
|
349 |
this.lcHost.TextSize = new System.Drawing.Size(62, 14); |
|
350 |
// |
|
351 |
// lcDBName |
|
352 |
// |
|
353 |
this.lcDBName.Control = this.txDBName; |
|
354 |
this.lcDBName.Location = new System.Drawing.Point(0, 24); |
|
355 |
this.lcDBName.Name = "lcDBName"; |
|
356 |
this.lcDBName.Size = new System.Drawing.Size(334, 24); |
|
357 |
this.lcDBName.Text = "DB Name"; |
|
358 |
this.lcDBName.TextSize = new System.Drawing.Size(62, 14); |
|
359 |
// |
|
360 |
// lcUser |
|
361 |
// |
|
362 |
this.lcUser.Control = this.txUser; |
|
363 |
this.lcUser.Location = new System.Drawing.Point(0, 48); |
|
364 |
this.lcUser.Name = "lcUser"; |
|
365 |
this.lcUser.Size = new System.Drawing.Size(334, 24); |
|
366 |
this.lcUser.Text = "User"; |
|
367 |
this.lcUser.TextSize = new System.Drawing.Size(62, 14); |
|
368 |
// |
|
369 |
// emptySpaceItem1 |
|
370 |
// |
|
371 |
this.emptySpaceItem1.AllowHotTrack = false; |
|
372 |
this.emptySpaceItem1.CustomizationFormText = "emptySpaceItem3"; |
|
373 |
this.emptySpaceItem1.Location = new System.Drawing.Point(0, 206); |
|
374 |
this.emptySpaceItem1.Name = "emptySpaceItem1"; |
|
375 |
this.emptySpaceItem1.Size = new System.Drawing.Size(192, 40); |
|
376 |
this.emptySpaceItem1.Text = "emptySpaceItem3"; |
|
377 |
this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0); |
|
378 |
// |
|
379 |
// DBSettingForm |
|
380 |
// |
|
381 |
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F); |
|
382 |
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
|
383 |
this.ClientSize = new System.Drawing.Size(378, 298); |
|
384 |
this.Controls.Add(this.layoutControl1); |
|
385 |
this.Controls.Add(this.ribbonControl); |
|
386 |
this.Name = "DBSettingForm"; |
|
387 |
this.Ribbon = this.ribbonControl; |
|
388 |
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; |
|
389 |
this.Text = "DB Setting"; |
|
390 |
((System.ComponentModel.ISupportInitialize)(this.ribbonControl)).EndInit(); |
|
391 |
((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit(); |
|
392 |
this.layoutControl1.ResumeLayout(false); |
|
393 |
((System.ComponentModel.ISupportInitialize)(this.rgDbSetting.Properties)).EndInit(); |
|
394 |
((System.ComponentModel.ISupportInitialize)(this.txHost.Properties)).EndInit(); |
|
395 |
((System.ComponentModel.ISupportInitialize)(this.txDBName.Properties)).EndInit(); |
|
396 |
((System.ComponentModel.ISupportInitialize)(this.txUser.Properties)).EndInit(); |
|
397 |
((System.ComponentModel.ISupportInitialize)(this.txPassword.Properties)).EndInit(); |
|
398 |
((System.ComponentModel.ISupportInitialize)(this.txID2Filepath.Properties)).EndInit(); |
|
399 |
((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit(); |
|
400 |
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).EndInit(); |
|
401 |
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).EndInit(); |
|
402 |
((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).EndInit(); |
|
403 |
((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).EndInit(); |
|
404 |
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit(); |
|
405 |
((System.ComponentModel.ISupportInitialize)(this.group2)).EndInit(); |
|
406 |
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit(); |
|
407 |
((System.ComponentModel.ISupportInitialize)(this.lcID2FilePath)).EndInit(); |
|
408 |
((System.ComponentModel.ISupportInitialize)(this.group1)).EndInit(); |
|
409 |
((System.ComponentModel.ISupportInitialize)(this.lcPassword)).EndInit(); |
|
410 |
((System.ComponentModel.ISupportInitialize)(this.lcHost)).EndInit(); |
|
411 |
((System.ComponentModel.ISupportInitialize)(this.lcDBName)).EndInit(); |
|
412 |
((System.ComponentModel.ISupportInitialize)(this.lcUser)).EndInit(); |
|
413 |
((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).EndInit(); |
|
414 |
this.ResumeLayout(false); |
|
415 |
this.PerformLayout(); |
|
416 | ||
417 |
} |
|
418 | ||
419 |
#endregion |
|
420 | ||
421 |
private DevExpress.XtraBars.Ribbon.RibbonControl ribbonControl; |
|
422 |
private DevExpress.XtraLayout.LayoutControl layoutControl1; |
|
423 |
private DevExpress.XtraLayout.LayoutControlGroup Root; |
|
424 |
private DevExpress.XtraEditors.SimpleButton btnClose; |
|
425 |
private DevExpress.XtraEditors.SimpleButton btnSave; |
|
426 |
private DevExpress.XtraLayout.LayoutControlItem layoutControlItem4; |
|
427 |
private DevExpress.XtraLayout.LayoutControlItem layoutControlItem5; |
|
428 |
private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem2; |
|
429 |
private DevExpress.XtraLayout.LayoutControlGroup layoutControlGroup1; |
|
430 |
private DevExpress.XtraEditors.RadioGroup rgDbSetting; |
|
431 |
private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1; |
|
432 |
private DevExpress.XtraEditors.TextEdit txHost; |
|
433 |
private DevExpress.XtraEditors.TextEdit txDBName; |
|
434 |
private DevExpress.XtraEditors.TextEdit txUser; |
|
435 |
private DevExpress.XtraEditors.TextEdit txPassword; |
|
436 |
private DevExpress.XtraLayout.LayoutControlItem lcHost; |
|
437 |
private DevExpress.XtraLayout.LayoutControlItem lcDBName; |
|
438 |
private DevExpress.XtraLayout.LayoutControlItem lcUser; |
|
439 |
private DevExpress.XtraLayout.LayoutControlItem lcPassword; |
|
440 |
private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem1; |
|
441 |
private DevExpress.XtraEditors.SimpleButton btnFolder; |
|
442 |
private DevExpress.XtraEditors.TextEdit txID2Filepath; |
|
443 |
private DevExpress.XtraLayout.LayoutControlItem lcID2FilePath; |
|
444 |
private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2; |
|
445 |
private DevExpress.XtraLayout.LayoutControlGroup group2; |
|
446 |
private DevExpress.XtraLayout.LayoutControlGroup group1; |
|
447 |
private DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager1; |
|
448 |
} |
|
449 |
} |
DTI_PID/ID2PSN/Form/DBSettingForm.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.ComponentModel; |
|
4 |
using System.Data; |
|
5 |
using System.Drawing; |
|
6 |
using System.IO; |
|
7 |
using System.Linq; |
|
8 |
using System.Text; |
|
9 |
using System.Threading.Tasks; |
|
10 |
using System.Windows.Forms; |
|
11 | ||
12 |
namespace ID2PSN |
|
13 |
{ |
|
14 |
public partial class DBSettingForm : DevExpress.XtraBars.Ribbon.RibbonForm |
|
15 |
{ |
|
16 |
ID2Info ID2Info = ID2Info.GetInstance(); |
|
17 |
AnotherID2Info AnotherID2Info = AnotherID2Info.GetInstance(); |
|
18 | ||
19 |
PSN _currentPSN = null; |
|
20 | ||
21 |
public DBSettingForm(PSN currentPSN) |
|
22 |
{ |
|
23 |
InitializeComponent(); |
|
24 |
this._currentPSN = currentPSN; |
|
25 |
if(ID2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
26 |
{ |
|
27 |
//group1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; |
|
28 |
//group2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; |
|
29 |
//lcID2FilePath.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; |
|
30 | ||
31 |
//lcHost.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; |
|
32 |
//lcDBName.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; |
|
33 |
//lcUser.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; |
|
34 |
//lcPassword.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; |
|
35 |
txID2Filepath.Text = ""; |
|
36 |
txID2Filepath.ReadOnly = true; |
|
37 |
btnFolder.Enabled = false; |
|
38 |
rgDbSetting.SelectedIndex = 1; |
|
39 | ||
40 |
txHost.Text = ID2Info.ServerIP; |
|
41 |
txDBName.Text = ID2Info.Database; |
|
42 |
txUser.Text = ID2Info.DBUser; |
|
43 |
txPassword.Text = ID2Info.DBPassword; |
|
44 |
|
|
45 |
} |
|
46 |
else //SQLite |
|
47 |
{ |
|
48 |
rgDbSetting.SelectedIndex = 0; |
|
49 | ||
50 |
//lcID2FilePath.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; |
|
51 | ||
52 |
//lcHost.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; |
|
53 |
//lcDBName.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; |
|
54 |
//lcUser.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; |
|
55 |
//lcPassword.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; |
|
56 |
txHost.Text = ""; |
|
57 |
txDBName.Text = ""; |
|
58 |
txUser.Text = ""; |
|
59 |
txPassword.Text = ""; |
|
60 |
txHost.ReadOnly = true; |
|
61 |
txDBName.ReadOnly = true; |
|
62 |
txUser.ReadOnly = true; |
|
63 |
txPassword.ReadOnly = true; |
|
64 |
txID2Filepath.Text = ID2Info.DefaultPath; |
|
65 |
} |
|
66 |
} |
|
67 | ||
68 |
private void btnSave_Click(object sender, EventArgs e) |
|
69 |
{ |
|
70 |
try |
|
71 |
{ |
|
72 |
splashScreenManager1.ShowWaitForm(); |
|
73 |
splashScreenManager1.SetWaitFormCaption("Save PSN.."); |
|
74 |
splashScreenManager1.SetWaitFormDescription("Wating..."); |
|
75 | ||
76 |
if (this._currentPSN == null) |
|
77 |
{ |
|
78 |
MessageBox.Show("There is no data to save.", "ID2 " + ID2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
79 |
return; |
|
80 |
} |
|
81 |
if (rgDbSetting.SelectedIndex == 1) |
|
82 |
{ |
|
83 |
AnotherID2Info.ID2DBType = AnotherID2DB_Type.MSSQL; |
|
84 |
AnotherID2Info.ServerIP = txHost.Text; |
|
85 |
//info.Port = "3389"; |
|
86 |
AnotherID2Info.DBUser = txUser.Text; |
|
87 |
AnotherID2Info.DBPassword = txPassword.Text; |
|
88 |
AnotherID2Info.Database = txDBName.Text; |
|
89 |
AnotherID2Info.DefaultPath = txID2Filepath.Text; |
|
90 |
} |
|
91 |
else |
|
92 |
{ |
|
93 |
AnotherID2Info.ID2DBType = AnotherID2DB_Type.SQLite; |
|
94 |
var parent = txID2Filepath.Text; |
|
95 |
AnotherID2Info.DefaultPath = parent.ToString(); |
|
96 |
} |
|
97 | ||
98 |
|
|
99 | ||
100 |
CheckEquipment(); |
|
101 | ||
102 |
List<HeaderInfo> HeaderInfos = new List<HeaderInfo>(); |
|
103 |
DataTable dt = DB.SelectHeaderSetting(); |
|
104 |
foreach (DataRow row in dt.Rows) |
|
105 |
{ |
|
106 |
string groupID = row["GROUP_ID"].ToString(); |
|
107 |
string desc = row["DESCRIPTION"].ToString(); |
|
108 |
int index = Convert.ToInt32(row["INDEX"]); |
|
109 |
string name = row["NAME"].ToString(); |
|
110 | ||
111 |
HeaderInfo headerInfo = HeaderInfos.Find(x => x.UID.Equals(groupID)); |
|
112 |
if (headerInfo == null) |
|
113 |
{ |
|
114 |
headerInfo = new HeaderInfo(groupID); |
|
115 |
headerInfo.Description = desc; |
|
116 |
HeaderInfos.Add(headerInfo); |
|
117 |
} |
|
118 | ||
119 |
headerInfo.HeaderItems.Add(new HeaderItem() |
|
120 |
{ |
|
121 |
Index = index, |
|
122 |
Name = name |
|
123 |
}); |
|
124 |
} |
|
125 | ||
126 |
List<VentDrainInfo> VentDrainInfos = new List<VentDrainInfo>(); |
|
127 |
DataTable dtVentDrain = DB.SelectVentDrainSetting(); |
|
128 |
foreach (DataRow row in dtVentDrain.Rows) |
|
129 |
{ |
|
130 |
string groupID = row["GROUP_ID"].ToString(); |
|
131 |
string desc = row["DESCRIPTION"].ToString(); |
|
132 |
int index = Convert.ToInt32(row["INDEX"]); |
|
133 |
string name = row["NAME"].ToString(); |
|
134 | ||
135 |
VentDrainInfo ventDrainInfo = VentDrainInfos.Find(x => x.UID.Equals(groupID)); |
|
136 |
if (ventDrainInfo == null) |
|
137 |
{ |
|
138 |
ventDrainInfo = new VentDrainInfo(groupID); |
|
139 |
ventDrainInfo.Description = desc; |
|
140 |
VentDrainInfos.Add(ventDrainInfo); |
|
141 |
} |
|
142 | ||
143 |
ventDrainInfo.VentDrainItems.Add(new VentDrainItem() |
|
144 |
{ |
|
145 |
Index = index, |
|
146 |
Name = name |
|
147 |
}); |
|
148 |
} |
|
149 | ||
150 |
KeywordInfo KeywordInfos = new KeywordInfo(); |
|
151 |
DataTable dtKeyword = DB.SelectKeywordsSetting(); |
|
152 |
foreach (DataRow row in dtKeyword.Rows) |
|
153 |
{ |
|
154 |
int index = Convert.ToInt32(row["INDEX"]); |
|
155 |
string name = row["NAME"].ToString(); |
|
156 |
string keyword = row["KEYWORD"].ToString(); |
|
157 | ||
158 |
//KeywordInfo keywordInfo = new KeywordInfo(); |
|
159 |
KeywordInfos.KeywordItems.Add(new KeywordItem() |
|
160 |
{ |
|
161 |
Index = index, |
|
162 |
Name = name, |
|
163 |
Keyword = keyword |
|
164 |
}); |
|
165 |
} |
|
166 | ||
167 |
DataTable dtTopologyRule = DB.SelectTopologyRule(); |
|
168 |
DataTable PSNFluidDT = DB.SelectPSNFluidCode(); |
|
169 |
DataTable PSNPMCDT = DB.SelectPSNPIPINGMATLCLASS(); |
|
170 |
DataTable PSNINSULATIONDT = DB.SelectPSNINSULATIONPURPOSE(); |
|
171 | ||
172 |
//DB check |
|
173 |
DB.ConnTestAndCreateAnotherTable(); |
|
174 | ||
175 |
//Save |
|
176 |
if (DB.SaveAnotherPSNData(_currentPSN, HeaderInfos, VentDrainInfos, KeywordInfos.KeywordItems, dtTopologyRule, PSNFluidDT, PSNPMCDT, PSNINSULATIONDT)) |
|
177 |
{ |
|
178 |
splashScreenManager1.CloseWaitForm(); |
|
179 |
MessageBox.Show("Save was successful.", "ID2 " + ID2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Information); |
|
180 |
} |
내보내기 Unified diff