private void btnOk_Click(object sender, EventArgs e) { if (tbAssetName.Text.ToString().Trim() == "") { return; } try { List <TableParameters> listCol = new List <TableParameters>(); listCol.Add(new TableParameters("GEO_ID", DataType.Int, false, true, true)); for (int i = 0; i < lbAssetFields.Items.Count; i++) { String strAssetField = lbAssetFields.Items[i].ToString(); DataType dataType = ( DataType )m_htAssetFields[strAssetField]; listCol.Add(new TableParameters(strAssetField, dataType, true)); } DBMgr.CreateTable(tbAssetName.Text, listCol); } catch (Exception exc) { Global.WriteOutput("Error: " + exc.Message); return; } // Create the <asset name>_CHANGELOG table List <TableParameters> listAssetChangeLog = new List <TableParameters>(); listAssetChangeLog.Add(new TableParameters("ID", DataType.Int, false, true, true)); listAssetChangeLog.Add(new TableParameters("ATTRIBUTE_ID", DataType.Int, false, false, false)); listAssetChangeLog.Add(new TableParameters("FIELD", DataType.VarChar(50), false, false, false)); listAssetChangeLog.Add(new TableParameters("VALUE", DataType.VarChar(50), true, false, false)); listAssetChangeLog.Add(new TableParameters("USER_ID", DataType.VarChar(200), true, false, false)); listAssetChangeLog.Add(new TableParameters("WORKACTIVITY_ID", DataType.VarChar(-1), true, false, false)); listAssetChangeLog.Add(new TableParameters("DATE_MODIFIED", DataType.DateTime, false, false, false)); try { DBMgr.CreateTable(tbAssetName.Text + "_CHANGELOG", listAssetChangeLog); } catch (Exception exc) { Global.WriteOutput("Error: Couldn't create " + tbAssetName.Text + "_CHANGELOG table. " + exc.Message); } String strInsert = "INSERT INTO ASSETS (ASSET, DATE_CREATED) VALUES ('" + tbAssetName.Text + "', '" + DateTime.Now.ToString() + "')"; try { //NSERT INTO table_name (column1, column2,...)VALUES (value1, value2,....) DBMgr.ExecuteNonQuery(strInsert); } catch (Exception exc) { Global.WriteOutput("Error: Adding new asset to ASSETS table. " + exc.Message); } // This is set so SolutionExplorer can add the node with the correct name. m_strAssetTableName = tbAssetName.Text; // Create the temp shapefile Global.CreateTempShapeFile(tbShapeFilePath.Text); // Now run the select statement the user has in the select textbox. TextWriter tw = null; String strMyDocumentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); strMyDocumentsFolder += "\\RoadCare Projects\\Temp"; Directory.CreateDirectory(strMyDocumentsFolder); String strOutFile = strMyDocumentsFolder + "\\ShapeFileImport.txt"; try { tw = new StreamWriter(strOutFile); } catch (Exception exc) { Global.WriteOutput("Error: " + exc.Message); return; } String strSelect = tbSelect.Text; DataReader dr = null; try { dr = new DataReader(strSelect); List <string> listColumns = new List <string>(); for (int i = 0; i < dr.FieldCount; i++) { listColumns.Add(dr.GetName(i)); } while (dr.Read()) { //String strGeometry = dr["GEOMETRY"].ToString(); //string[] aGeometry = strGeometry.Split('(', ' ', ')'); //String strLongitude = ""; //String strLatitude = ""; //if (aGeometry[0].ToString() == "POINT") //{ // strLongitude = aGeometry[2].ToString(); // strLatitude = aGeometry[3].ToString(); //} Geometry shapefileGeom = Geometry.GeomFromText(dr["GEOMETRY"].ToString()); String strOut = "\t"; for (int i = 0; i < lbAssetFields.Items.Count; i++) { //if (lbAssetFields.Items[i].ToString() == "LATITUDE") //{ // strOut += strLatitude; //} //else if (lbAssetFields.Items[i].ToString() == "LONGITUDE") //{ // strOut += strLongitude; //} string uppered = lbAssetFields.Items[i].ToString().ToUpper(); if (uppered == "ENVELOPEMAXX") { strOut += shapefileGeom.GetBoundingBox().Max.X; } else if (uppered == "ENVELOPEMINX") { strOut += shapefileGeom.GetBoundingBox().Min.X; } else if (uppered == "ENVELOPEMAXY") { strOut += shapefileGeom.GetBoundingBox().Max.Y; } else if (uppered == "ENVELOPEMINY") { strOut += shapefileGeom.GetBoundingBox().Min.Y; } else if (listColumns.Contains(lbAssetFields.Items[i].ToString())) { strOut += dr[lbAssetFields.Items[i].ToString()].ToString(); } if (i != lbAssetFields.Items.Count - 1) { strOut += '\t'; } } tw.WriteLine(strOut); } dr.Close(); } catch (Exception exc) { Global.WriteOutput("Error: " + exc.Message); } tw.Close(); try { switch (DBMgr.NativeConnectionParameters.Provider) { case "MSSQL": DBMgr.SQLBulkLoad(m_strAssetTableName, strOutFile, '\t'); break; case "ORACLE": throw new NotImplementedException("TODO: figure out columns for btnOk_Click()"); //DBMgr.OracleBulkLoad( DBMgr.NativeConnectionParameters, m_strAssetTableName, strOutFile, //break; default: throw new NotImplementedException("TODO: Create ANSI implementation for XXXXXXXXXXXX"); //break; } } catch (Exception exc) { Global.WriteOutput("Error: " + exc.Message); } this.DialogResult = DialogResult.OK; this.Close(); }
public void DoAssetRollup() { // Loop through each asset and fill the ASSET_SECTION_<network_id> table according to the rollup logic. AssetRollupMessaging.AddMessage("Begin asset rollup in network: " + m_networkID + " at " + DateTime.Now.ToString("HH:mm:ss")); String query = ""; StreamWriter tw = null; if (DBOp.IsTableInDatabase("ASSET_SECTION_" + m_networkID)) { // Drop the table as we are going to make a new one. try { DBMgr.ExecuteNonQuery("DROP TABLE ASSET_SECTION_" + m_networkID); } catch (Exception exc) { throw exc; } } // Creating the ASSET_SECTION_<networkID> table. AssetRollupMessaging.AddMessage("Creating ASSET_SECTION table..."); List <DatabaseManager.TableParameters> listColumn = new List <DatabaseManager.TableParameters>(); listColumn.Add(new DatabaseManager.TableParameters("GEO_ID", DataType.Int, false, false)); listColumn.Add(new DatabaseManager.TableParameters("SECTIONID", DataType.Int, false, false)); listColumn.Add(new DatabaseManager.TableParameters("ASSET_TYPE", DataType.VarChar(-1), false)); listColumn.Add(new DatabaseManager.TableParameters("FACILITY", DataType.VarChar(-1), false)); listColumn.Add(new DatabaseManager.TableParameters("BEGIN_STATION", DataType.Float, true)); listColumn.Add(new DatabaseManager.TableParameters("END_STATION", DataType.Float, true)); listColumn.Add(new DatabaseManager.TableParameters("DIRECTION", DataType.VarChar(50), true)); listColumn.Add(new DatabaseManager.TableParameters("SECTION", DataType.VarChar(-1), true)); listColumn.Add(new DatabaseManager.TableParameters("AREA", DataType.Float, true)); listColumn.Add(new DatabaseManager.TableParameters("UNITS", DataType.VarChar(50), true)); String strTable = "ASSET_SECTION_" + m_networkID; try { DBMgr.CreateTable(strTable, listColumn); } catch (Exception exc) { throw exc; } // Get a text writer and file ready to do a bulk copy. String strMyDocumentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); strMyDocumentsFolder += "\\RoadCare Projects\\Temp"; Directory.CreateDirectory(strMyDocumentsFolder); // LRS, Get the LRS data from each asset table... foreach (String assetName in m_assetNames) { AssetRollupMessaging.AddMessage("Rolling up LRS based asset " + assetName + "..."); ConnectionParameters cp = DBMgr.GetAssetConnectionObject(assetName); List <String> assetColumnNames = DBMgr.GetTableColumns(assetName, cp); if (assetColumnNames.Contains("BEGIN_STATION")) { switch (cp.Provider) { case "MSSQL": query = "SELECT GEO_ID, FACILITY, DIRECTION, BEGIN_STATION, END_STATION FROM " + assetName + " WHERE (FACILITY <> '' AND FACILITY IS NOT NULL) ORDER BY FACILITY, DIRECTION, BEGIN_STATION"; break; case "ORACLE": query = "SELECT GEO_ID, FACILITY, DIRECTION, BEGIN_STATION, END_STATION FROM " + assetName + " WHERE (FACILITY LIKE '_%' AND FACILITY IS NOT NULL) ORDER BY FACILITY, DIRECTION, BEGIN_STATION"; break; default: throw new NotImplementedException("TODO: Create ANSI implementation for XXXXXXXXXXXX"); //break; } String strOutFile = strMyDocumentsFolder + "\\" + assetName + ".txt"; tw = new StreamWriter(strOutFile); DataSet sectionSet; DataReader assetReader; try { // Get the Segmented network data from the SECTION_<networkID> table. // sectionSet will hold the section data, and assetReader will loop through each asset. sectionSet = DBMgr.ExecuteQuery("SELECT SECTIONID, FACILITY, BEGIN_STATION, END_STATION, DIRECTION FROM SECTION_" + m_networkID + " WHERE BEGIN_STATION IS NOT NULL ORDER BY FACILITY, DIRECTION, BEGIN_STATION"); assetReader = new DataReader(query, cp); } catch (Exception exc) { throw exc; } // If there is data to read, start reading it. if (assetReader.Read()) { DataPoint assetInfo; DataRow sectionRow; DataPoint sectionInfo; bool bMoreData = true; int iCurrentSection = 0; // bMoreData is true while there is more data to read, and false when the dataReader is finished. // we then go back to the foreach loop (outside the while) and start rolling up the next asset. while (bMoreData) { // AssetInfo is going to hold this particular row of asset data. assetInfo = new DataPoint(-1, (int)assetReader["GEO_ID"], assetReader["FACILITY"].ToString(), assetReader["BEGIN_STATION"].ToString(), assetReader["END_STATION"].ToString(), assetReader["DIRECTION"].ToString()); // SectionInfo is going to hold this particular row of sections data. sectionRow = sectionSet.Tables[0].Rows[iCurrentSection]; sectionInfo = new DataPoint((int)sectionRow["SECTIONID"], sectionRow["FACILITY"].ToString(), sectionRow["BEGIN_STATION"].ToString(), sectionRow["END_STATION"].ToString(), sectionRow["DIRECTION"].ToString()); // We increment the section if // We increment the asset if // AssetInSection returns: // -1 increments asset // 0 adds asset to Asset Rollup Table // 1 increments section bool bIncrementSection = false; bool bIncrementAsset = false; int assetSectionComparison = AssetInSection(assetInfo, sectionInfo); // Based on the result from AssetInSection we are going to increment something. Here its the asset if (assetSectionComparison < 0) { bIncrementAsset = true; } // Here, we have a match and we need to look ahead to see how many sections a linear asset might belong to // before moving on to the next asset. In either case, point or linear, we add the asset to the Rollup table. else if (assetSectionComparison == 0) { AddAssetToRollupTable(assetInfo, sectionInfo, assetName, tw); if (assetInfo.m_ptsExtent.Y != -1) //don't bother with looking ahead if we're using point assets { // Keep looping through the sections and checking to see if this asset is still valid for each // consecutive section. When it fails on a section, we are done with the linear asset, otherwise // we add the asset to the new section. (This is why we needed the sections in a DataSet, as a // dataReader would not allow this type of operation...easily). for (int iSectionLookAhead = 1; iSectionLookAhead + iCurrentSection < sectionSet.Tables[0].Rows.Count; iSectionLookAhead++) { sectionRow = sectionSet.Tables[0].Rows[iCurrentSection + iSectionLookAhead]; sectionInfo = new DataPoint((int)sectionRow["SECTIONID"], sectionRow["FACILITY"].ToString(), sectionRow["BEGIN_STATION"].ToString(), sectionRow["END_STATION"].ToString(), sectionRow["DIRECTION"].ToString()); if (AssetInSection(assetInfo, sectionInfo) == 0) { AddAssetToRollupTable(assetInfo, sectionInfo, assetName, tw); } else { break; } } } // Point asset match...we assigned the section already so just tell the loop to move to the next asset. bIncrementAsset = true; } // AssetInSection returned non-zero, and was not negative. Which is a long way of saying, it returned positive. // so we need to increment the section on a positive result. else { bIncrementSection = true; } if (bIncrementAsset) { if (bIncrementSection) { // This can't happen logically, but was useful during debugging. throw new Exception(); } else { // Read in the new data if we are incrementing the asset bMoreData = assetReader.Read(); } } else { // Increment the section row in the section data set. (Assuming there are sections remaining) // If there arent any sections remaining, then we can't assign any more assets can we? // so that means we are done. if (bIncrementSection) { if (iCurrentSection + 1 < sectionSet.Tables[0].Rows.Count) { iCurrentSection++; bMoreData = true; } else { bMoreData = false; } } else { // Again, impossible, but useful for debugging. throw new Exception(); } } } } tw.Close(); assetReader.Close(); AssetRollupMessaging.AddMessage("Bulk loading rolled up LRS asset data..."); // Now try to load all that beautifully segmented data into an Asset Rollup table. (tab delimited). try { switch (DBMgr.NativeConnectionParameters.Provider) { case "MSSQL": DBMgr.SQLBulkLoad("ASSET_SECTION_" + m_networkID, strOutFile, '\t'); break; case "ORACLE": throw new NotImplementedException("TODO: Figure out tables for DoAssetRollup()"); //DBMgr.OracleBulkLoad( DBMgr.NativeConnectionParameters, "ASSET_SECTION_" + m_networkID, strOutFile, //break; default: throw new NotImplementedException("TODO: Create ANSI implementation for XXXXXXXXXXXX"); //break; } } catch (Exception exc) { throw exc; } } } AssetRollupMessaging.AddMessage("Finished LRS asset data rollup..."); //foreach (String assetName in m_assetNames) //{ // AssetRollupMessaging.AddMessge("Rolling up SRS asset " + assetName + "..."); // ConnectionParameters cp = DBMgr.GetAssetConnectionObject(assetName); // List<String> assetColumnNames = DBMgr.GetTableColumns(assetName, cp); // if (assetColumnNames.Contains("SECTION")) // { // query = "SELECT GEO_ID, FACILITY, SECTION FROM " + assetName + " WHERE (SECTION <> '' AND SECTION IS NOT NULL) ORDER BY FACILITY, SECTION"; // String strOutFile = strMyDocumentsFolder + "\\" + assetName + ".txt"; // tw = new StreamWriter(strOutFile); // DataReader sectionReader = null; // DataReader assetReader = null; // try // { // // Get the Segmented network data from the SECTION_<networkID> table. // // sectionSet will hold the section data, and assetReader will loop through each asset. // //sectionSet = DBMgr.ExecuteQuery("SELECT SECTIONID, FACILITY, SECTION SECTION_" + m_networkID + " WHERE SECTION IS NOT NULL ORDER BY FACILITY, SECTION"); // sectionReader = new DataReader("SELECT SECTIONID, FACILITY, SECTION FROM SECTION_" + m_networkID + " WHERE SECTION IS NOT NULL ORDER BY FACILITY, SECTION"); // assetReader = new DataReader(query, cp); // } // catch (Exception exc) // { // throw exc; // } // bool bContinue = true; // String strFacility = ""; // String strSection = ""; // String strSectionID = ""; // String strAssetFacility = ""; // String strAssetSection = ""; // String strGeoID = ""; // while (bContinue) // { // if (strFacility == "") // { // if (!sectionReader.Read()) // { // bContinue = false; // continue; // } // strFacility = sectionReader["FACILITY"].ToString(); // strSection = sectionReader["SECTION"].ToString(); // strSectionID = sectionReader["SECTIONID"].ToString(); // //if (strSectionID == "1006136") // //{ } // //strFacility = strFacility.Replace(" ", ""); // //strSection = strSection.Replace(" ", ""); // } // if (strAssetFacility == "") // { // if (!assetReader.Read()) // { // bContinue = false; // continue; // } // strAssetFacility = assetReader["FACILITY"].ToString(); // strAssetSection = assetReader["SECTION"].ToString(); // strGeoID = assetReader["GEO_ID"].ToString(); // //if (strAssetFacility == "NW - Connecticut Ave") // //{ } // //strAssetFacility = strAssetFacility.Replace(" ", ""); // //strAssetSection = strAssetSection.Replace(" ", ""); // } // if (CompareInfo.GetCompareInfo("en-US").Compare(strFacility, strAssetFacility) < 0) // { // strFacility = ""; // } // else if (CompareInfo.GetCompareInfo("en-US").Compare(strFacility, strAssetFacility) == 0) // { // if (CompareInfo.GetCompareInfo("en-US").Compare(strSection, strAssetSection) < 0) // { // strFacility = ""; // } // else if (CompareInfo.GetCompareInfo("en-US").Compare(strSection, strAssetSection) == 0) // { // //Write out to file // tw.WriteLine(strGeoID // + "\t" + strSectionID // + "\t" + assetName // + "\t" + sectionReader["FACILITY"].ToString() // + "\t" //+ a.m_ptsExtent.X.ToString() // + "\t" //+ ((a.m_ptsExtent.Y == -1) ? "" : a.m_ptsExtent.Y.ToString()) // + "\t" //+ a.m_strDirection // + "\t" + sectionReader["SECTION"].ToString() // + "\t" //+ a.m_strArea // + "\t"); //+ a.m_strUnit); // strAssetFacility = ""; // } // else // { // strAssetFacility = ""; // } // } // else // { // strAssetFacility = ""; // } // } // tw.Close(); // assetReader.Close(); // sectionReader.Close(); // AssetRollupMessaging.AddMessge("Bulk loading rolled up SRS asset data..."); // // Now try to load all that beautifully segmented data into an Asset Rollup table. (tab delimited). // try // { // switch (cp.Provider) // { // case "MSSQL": // //query = "SELECT GEO_ID, FACILITY, SECTION FROM " + assetName + " WHERE (SECTION <> '' AND SECTION IS NOT NULL) ORDER BY FACILITY, SECTION"; // DBMgr.SQLBulkLoad("ASSET_SECTION_" + m_networkID, strOutFile, '\t'); // break; // case "ORACLE": // query = "SELECT GEO_ID, FACILITY, SECTION FROM " + assetName + " WHERE (SECTION LIKE '_%' AND SECTION IS NOT NULL) ORDER BY FACILITY, SECTION"; // break; // default: // throw new NotImplementedException("TODO: Create ANSI implementation for XXXXXXXXXXXX"); // break; // } // } // catch (Exception exc) // { // throw exc; // } // } //} AssetRollupMessaging.AddMessage("Asset Rollup complete."); }
private void CreateNativeAssetTables() { List <TableParameters> listTP = new List <TableParameters>(); List <TableParameters> listTPHistory = new List <TableParameters>(); String strProperty; String strDataType; this.DialogResult = DialogResult.OK; // Now add several default rows to the asset being created in the database as table "ASSET NAME" listTP.Add(new TableParameters("ID", DataType.Int, false, true, true)); listTP.Add(new TableParameters("FACILITY", DataType.VarChar(-1), true, false, false)); listTP.Add(new TableParameters("SECTION", DataType.VarChar(-1), true, false, false)); listTP.Add(new TableParameters("BEGIN_STATION", DataType.Float, true, false, false)); listTP.Add(new TableParameters("END_STATION", DataType.Float, true, false, false)); listTP.Add(new TableParameters("DIRECTION", DataType.VarChar(50), true, false, false)); listTP.Add(new TableParameters("ENTRY_DATE", DataType.DateTime, true, false, false)); listTP.Add(new TableParameters("GEOMETRY", DataType.VarChar(-1), true, false, false)); listTP.Add(new TableParameters("EnvelopeMaxX", DataType.Float, true, false, false)); listTP.Add(new TableParameters("EnvelopeMinX", DataType.Float, true, false, false)); listTP.Add(new TableParameters("EnvelopeMaxY", DataType.Float, true, false, false)); listTP.Add(new TableParameters("EnvelopeMinY", DataType.Float, true, false, false)); listTPHistory.Add(new TableParameters("ID", DataType.Int, false, true, true)); listTPHistory.Add(new TableParameters("ATTRIBUTE_ID", DataType.Int, false, false, false)); listTPHistory.Add(new TableParameters("FIELD", DataType.VarChar(50), false, false, false)); listTPHistory.Add(new TableParameters("VALUE", DataType.VarChar(50), true, false, false)); listTPHistory.Add(new TableParameters("USER_ID", DataType.VarChar(200), true, false, false)); listTPHistory.Add(new TableParameters("WORKACTIVITY", DataType.VarChar(-1), true, false, false)); listTPHistory.Add(new TableParameters("WORKACTIVITY_ID", DataType.VarChar(-1), true, false, false)); listTPHistory.Add(new TableParameters("DATE_MODIFIED", DataType.DateTime, false, false, false)); for (int i = 0; i < pgProperties.Item.Count; i++) { if (pgProperties.Item[i].Category != "Database Information" && pgProperties.Item[i].Category != "Required Fields" && pgProperties.Item[i].Name != "Asset Name") { strProperty = pgProperties.Item[i].Name; strDataType = pgProperties.Item[i].Value.ToString(); DataType dataTypeToInsert = Global.ConvertStringToDataType(strDataType); // Create the table params list to pass into the DBMgr.CreateTable function. listTP.Add(new TableParameters(strProperty, dataTypeToInsert, false, false)); } } String strInsert; // Now create the row in the ASSETS tables. switch (DBMgr.NativeConnectionParameters.Provider) { case "MSSQL": strInsert = "Insert INTO ASSETS (ASSET, DATE_CREATED, CREATOR_ID, LAST_MODIFIED) " + "Values ('" + pgProperties.Item["Asset Name"].Value + "', '" + DateTime.Now + "', '" + DBMgr.NativeConnectionParameters.UserName + "', '" + DateTime.Now + "')"; break; case "ORACLE": strInsert = "Insert INTO ASSETS (ASSET, DATE_CREATED, CREATOR_ID, LAST_MODIFIED) Values ('" + pgProperties.Item["Asset Name"].Value + "', TO_DATE('" + DateTime.Now.ToShortDateString() + "', 'MM/DD/YYYY')" + ", '" + DBMgr.NativeConnectionParameters.UserName + "', TO_DATE('" + DateTime.Now.ToShortDateString() + "', 'MM/DD/YYYY')" + ")"; break; default: throw new NotImplementedException("TODO: Create ANSI implementation for XXXXXXXXXXXX"); //break; } try { DBMgr.ExecuteNonQuery(strInsert); } catch (Exception exc) { Global.WriteOutput("Error: Insert new asset failed. " + exc.Message); return; } // Now create the table in the database <asset name> try { DBMgr.CreateTable(pgProperties.Item["Asset Name"].Value.ToString(), listTP); } catch (FailedOperationException exc) { Global.WriteOutput("Error: Create asset data table failed. " + exc.Message); return; } // Now create the <asset name>_CHANGELOG table for this asset in the database. try { DBMgr.CreateTable(pgProperties.Item["Asset Name"].Value.ToString() + "_" + "CHANGELOG", listTPHistory); } catch (FailedOperationException exc) { Global.WriteOutput("Error: Create asset Changelog failed. " + exc.Message); return; } }
public String SavePropertiesToDatabase() { if (IsPropertyGridComplete()) { RoadCare3.Properties.Settings.Default.LAST_DB_TYPE = m_pgProperties.Item["Provider"].Value.ToString(); RoadCare3.Properties.Settings.Default.LAST_DB_SERVER = m_pgProperties.Item["Server"].Value.ToString(); RoadCare3.Properties.Settings.Default.LAST_DB = m_pgProperties.Item["Database"].Value.ToString(); RoadCare3.Properties.Settings.Default.LAST_ONE = m_pgProperties.Item["One"].Value.ToString(); RoadCare3.Properties.Settings.Default.LAST_TWO = m_pgProperties.Item["Two"].Value.ToString(); RoadCare3.Properties.Settings.Default.LAST_THREE = m_pgProperties.Item["Three"].Value.ToString(); RoadCare3.Properties.Settings.Default.LAST_FOUR = m_pgProperties.Item["Four"].Value.ToString(); RoadCare3.Properties.Settings.Default.LAST_FIVE = m_pgProperties.Item["Five"].Value.ToString(); RoadCare3.Properties.Settings.Default.LAST_GROUP = m_pgProperties.Item["Grouping"].Value.ToString(); RoadCare3.Properties.Settings.Default.LAST_DEFAULT = m_pgProperties.Item["Default_Value"].Value.ToString(); RoadCare3.Properties.Settings.Default.LAST_FORMAT = m_pgProperties.Item["Format"].Value.ToString(); RoadCare3.Properties.Settings.Default.LAST_MINIMUM = m_pgProperties.Item["Minimum"].Value.ToString(); RoadCare3.Properties.Settings.Default.LAST_MAXIMUM = m_pgProperties.Item["Maximum"].Value.ToString(); RoadCare3.Properties.Settings.Default.LAST_LOGIN = m_pgProperties.Item["Login"].Value.ToString(); RoadCare3.Properties.Settings.Default.LAST_PASSWORD = m_pgProperties.Item["Password"].Value.ToString(); RoadCare3.Properties.Settings.Default.DBNETWORKALIAS = m_pgProperties.Item["Network Alias"].Value.ToString(); RoadCare3.Properties.Settings.Default.CONNECTION_TYPE = m_pgProperties.Item["Connection Type"].Value.ToString(); RoadCare3.Properties.Settings.Default.NETWORK_DEFINITION_NAME = m_pgProperties.Item["Network Definition Name"].Value.ToString(); RoadCare3.Properties.Settings.Default.Save(); m_strAttributeName = m_pgProperties.Item["Attribute"].Value.ToString().ToUpper(); _netDefName = m_pgProperties.Item["Network Definition Name"].Value.ToString(); if (m_pgProperties.Item["Native"].Value.ToString().ToLower() == "false") { string createViewStatement = "CREATE VIEW "; switch (m_pgProperties.Item["Provider"].Value.ToString()) { case "MSSQL": createViewStatement += "[" + m_strAttributeName + "]" + " AS " + viewSelectStatement; break; case "ORACLE": createViewStatement += "\"" + m_strAttributeName.ToUpper() + "\" AS " + viewSelectStatement; break; default: throw new NotImplementedException("TODO: Create ANSI implementation for SavePropertiesToDatabase()"); //break; } for (int i = 0; i < m_pgProperties.Item.Count; i++) { if (m_pgProperties.Item[i].Value == null) { m_pgProperties.Item[i].Value = ""; } } DBMgr.ExecuteNonQuery(createViewStatement, new ConnectionParameters( m_pgProperties.Item["Port"].Value.ToString(), m_pgProperties.Item["SID"].Value.ToString(), m_pgProperties.Item["Network Alias"].Value.ToString(), m_pgProperties.Item["Login"].Value.ToString(), m_pgProperties.Item["Password"].Value.ToString(), Convert.ToBoolean(m_pgProperties.Item["Integrated Security"].Value), m_pgProperties.Item["Server"].Value.ToString(), m_pgProperties.Item["Database"].Value.ToString(), "", "", "", "", m_pgProperties.Item["Provider"].Value.ToString(), false)); } String strInsert = "INSERT INTO ATTRIBUTES_ (ATTRIBUTE_, "; String strValues = " VALUES ('" + m_strAttributeName.ToUpper() + "', '"; for (int i = 1; i < m_pgProperties.Item.Count; i++) { String strDatabaseAttribteName = ( String )Global.m_htFieldMapping[m_pgProperties.Item[i].Name]; if (m_pgProperties.Item[i].Value.ToString() != "") { switch (DBMgr.NativeConnectionParameters.Provider) { case "MSSQL": switch (strDatabaseAttribteName.ToUpper()) { case "GROUPING": strInsert += "GROUPING, "; break; case "TYPE": strInsert += "TYPE_, "; break; case "NATIVE": strInsert += "NATIVE_, "; break; case "MINIMUM": strInsert += "MINIMUM_, "; break; case "PASSWORD": strInsert += "PASSWORD_, "; break; default: strInsert += "[" + strDatabaseAttribteName + "], "; break; } strValues += m_pgProperties.Item[i].Value + "', '"; break; case "ORACLE": switch (strDatabaseAttribteName.ToUpper()) { case "GROUPING": strInsert += "GROUPING, "; break; case "TYPE": strInsert += "TYPE_, "; break; case "NATIVE": strInsert += "NATIVE_, "; break; case "MINIMUM": strInsert += "MINIMUM_, "; break; case "PASSWORD": strInsert += "PASSWORD_, "; break; default: strInsert += "\"" + strDatabaseAttribteName + "\", "; break; } if (m_pgProperties.Item[i].Value.ToString().ToLower() != "true") { if (m_pgProperties.Item[i].Value.ToString().ToLower() != "false") { strValues += m_pgProperties.Item[i].Value.ToString().Trim() + "', '"; } else { strValues += "0', '"; } } else { strValues += "1', '"; } break; default: throw new NotImplementedException("TODO: Create ANSI implementation for XXXXXXXXXXXX"); //break; } } } strInsert = strInsert.Substring(0, strInsert.Length - 2) + ")"; strValues = strValues.Substring(0, strValues.Length - 3); strInsert += strValues + ")"; try { DBMgr.ExecuteNonQuery(strInsert); } catch (Exception sqlE) { Global.WriteOutput("Error: Insert new attribute into database failed. " + sqlE.Message); } if (bool.Parse(m_pgProperties.Item[1].Value.ToString()) == true) { // Now create the attribute table List <TableParameters> listColumn = new List <TableParameters>(); listColumn.Add(new TableParameters("ID_", DataType.Int, false, true, true)); listColumn.Add(new TableParameters("ROUTES", DataType.VarChar(4000), true)); listColumn.Add(new TableParameters("BEGIN_STATION", DataType.Float, true)); listColumn.Add(new TableParameters("END_STATION", DataType.Float, true)); listColumn.Add(new TableParameters("DIRECTION", DataType.VarChar(50), true)); listColumn.Add(new TableParameters("FACILITY", DataType.VarChar(4000), true)); listColumn.Add(new TableParameters("SECTION", DataType.VarChar(4000), true)); listColumn.Add(new TableParameters("SAMPLE_", DataType.VarChar(50), true)); listColumn.Add(new TableParameters("DATE_", DataType.DateTime, true)); if (m_pgProperties.Item["Type"].Value.ToString() == "NUMBER") { listColumn.Add(new TableParameters("DATA_", DataType.Float, true)); } else { listColumn.Add(new TableParameters("DATA_", DataType.VarChar(200), true)); } try { DBMgr.CreateTable(m_pgProperties.Item[0].Value.ToString(), listColumn); Global.SecurityOperations.AddAction("ATTRIBUTE", m_strAttributeName, "", ""); Global.SecurityOperations.SetUserActionPermissions(Global.SecurityOperations.CurrentUser, Global.SecurityOperations.GetAction("ATTRIBUTE", m_strAttributeName, "", ""), "CreateDestroy"); Global.SecurityOperations.AddActionToGroup(Global.SecurityOperations.GetAction("ATTRIBUTE", m_strAttributeName, "", ""), "ALL_ACTIONS"); } catch (Exception exc) { Global.WriteOutput("Error creating attribute: " + exc.Message); return(null); } } } return(m_strAttributeName); }
private void btnOk_Click(object sender, EventArgs e) { if (myProperties[0].Value.ToString() != "") { String strProperty; String strDataType; this.DialogResult = DialogResult.OK; // Now add several default rows to the asset being created in the database as table "ASSET NAME" m_listTP.Add(new TableParameters("ID", DataType.Int, false, true, true)); m_listTP.Add(new TableParameters("ROUTE", DataType.VarChar(-1), true, false, false)); m_listTP.Add(new TableParameters("BEGIN_STATION", DataType.Float, true, false, false)); m_listTP.Add(new TableParameters("END_STATION", DataType.Float, true, false, false)); m_listTP.Add(new TableParameters("DIRECTION", DataType.VarChar(50), true, false, false)); m_listTP.Add(new TableParameters("FACILITY", DataType.VarChar(-1), true, false, false)); m_listTP.Add(new TableParameters("SECTION", DataType.VarChar(-1), true, false, false)); m_listTP.Add(new TableParameters("ENTRY_DATE", DataType.DateTime, true, false, false)); m_listTP.Add(new TableParameters("LATITUDE", DataType.Float, true, false, false)); m_listTP.Add(new TableParameters("LONGITUDE", DataType.Float, true, false, false)); m_listTP.Add(new TableParameters("GEOMETRY", DataType.VarChar(-1), true, false, false)); m_listTPHistory.Add(new TableParameters("ID", DataType.Int, false, true, true)); m_listTPHistory.Add(new TableParameters("ATTRIBUTE_ID", DataType.Int, false, false, false)); m_listTPHistory.Add(new TableParameters("FIELD", DataType.VarChar(50), false, false, false)); m_listTPHistory.Add(new TableParameters("VALUE", DataType.VarChar(50), true, false, false)); m_listTPHistory.Add(new TableParameters("USER_ID", DataType.VarChar(200), true, false, false)); m_listTPHistory.Add(new TableParameters("WORKACTIVITY", DataType.VarChar(-1), true, false, false)); m_listTPHistory.Add(new TableParameters("WORKACTIVITY_ID", DataType.VarChar(-1), true, false, false)); m_listTPHistory.Add(new TableParameters("DATE_MODIFIED", DataType.DateTime, false, false, false)); for (int i = 1; i < myProperties.Count; i++) { strProperty = myProperties[i].Name; strDataType = myProperties[i].Value.ToString(); DataType dataTypeToInsert = Global.ConvertStringToDataType(strDataType); // Create the table params list to pass into the DBMgr.CreateTable function. m_listTP.Add(new TableParameters(strProperty, dataTypeToInsert, false, false)); } String strInsert; // Now create the row in the ASSETS tables. strInsert = "Insert INTO ASSETS (ASSET, DATE_CREATED, CREATOR_ID, LAST_MODIFIED) " + "Values ('" + myProperties[0].Value + "', '" + DateTime.Now + "', '" + DBMgr.NativeConnectionParameters.UserName + "', '" + DateTime.Now + "')"; try { DBMgr.ExecuteNonQuery(strInsert); } catch (Exception sqlE) { Global.WriteOutput("Error: Insert new asset failed. " + sqlE.Message); return; } // Now create the table in the database <asset name> try { DBMgr.CreateTable(myProperties[0].Value.ToString(), m_listTP); } catch (FailedOperationException sqlE) { Global.WriteOutput("Error: Create asset data table failed. " + sqlE.Message); return; } // Now create the <asset name>_CHANGELOG table for this asset in the database. try { DBMgr.CreateTable(myProperties[0].Value.ToString() + "_" + "CHANGELOG", m_listTPHistory); } catch (FailedOperationException sqlE) { Global.WriteOutput("Error: Create asset Changelog failed. " + sqlE.Message); return; } } }
private void buttonCreate_Click(object sender, EventArgs e) { m_strNewNetworkName = textBoxNetworkName.Text; String strWhere = textBoxFilter.Text; this.Cursor = Cursors.WaitCursor; if (m_strNewNetworkName.Trim() == "") { Global.WriteOutput("Error: Network Name must be entered.."); this.Cursor = Cursors.Default; return; } //Check if Network Name is already in use. String strSelect = "SELECT * FROM NETWORKS WHERE NETWORK_NAME='" + m_strNewNetworkName + "'"; String strDescription = ""; String strDesignerUserID = ""; String strDesignerUserName = ""; //String strLock = ""; //String strPrivate = ""; try { DataSet ds = DBMgr.ExecuteQuery(strSelect); if (ds.Tables[0].Rows.Count > 0) { //Network with this name exists. Global.WriteOutput("Error: Network with this name already exists. Please select another."); this.Cursor = Cursors.Default; return; } } catch (Exception exception) { Global.WriteOutput("Error: Checking Network Name uniqueness. Please select a different Network Name." + exception.Message); this.Cursor = Cursors.Default; return; } strSelect = "SELECT * FROM NETWORKS WHERE NETWORKID=" + m_strNetworkID; try { DataSet ds = DBMgr.ExecuteQuery(strSelect); if (ds.Tables[0].Rows.Count == 1) { DataRow dr = ds.Tables[0].Rows[0]; strDescription = dr["DESCRIPTION"].ToString(); strDesignerUserID = dr["DESIGNER_USERID"].ToString(); strDesignerUserName = dr["DESIGNER_NAME"].ToString(); //strLock = dr["LOCK_"].ToString(); //strPrivate = dr["PRIVATE_"].ToString(); } } catch (Exception exception) { Global.WriteOutput("Error: Checking Network Name uniqueness. Please select a different Network Name." + exception.Message); this.Cursor = Cursors.Default; return; } String strInsert = "INSERT INTO NETWORKS (NETWORK_NAME"; String strValues = " VALUES ('" + m_strNewNetworkName + "'"; if (strDescription != "") { strInsert += ",DESCRIPTION"; strValues += ",'" + strDescription + "'"; } if (strDesignerUserID != "") { strInsert += ",DESIGNER_USERID"; strValues += ",'" + strDesignerUserID + "'"; } if (strDesignerUserName != "") { strInsert += ",DESIGNER_NAME"; strValues += ",'" + strDesignerUserName + "'"; } //if (strLock != "") //{ // strInsert += ",LOCK_"; // strValues += ",'" + strLock + "'"; //} //if (strPrivate != "") //{ // strInsert += ",PRIVATE_"; // strValues += ",'" + strPrivate + "'"; //} strInsert += ",DATE_CREATED"; switch (DBMgr.NativeConnectionParameters.Provider) { case "MSSQL": strValues += ",'" + DateTime.Now.ToString() + "'"; break; case "ORACLE": strValues += ",to_date('" + DateTime.Now.ToString("MM/dd/yyyy") + "','MM/DD/YYYY')"; break; default: throw new NotImplementedException("TODO: Implement ANSI version of buttonCreate_Click()"); } strInsert += ",DATE_LAST_EDIT)"; switch (DBMgr.NativeConnectionParameters.Provider) { case "MSSQL": strValues += ",'" + DateTime.Now.ToString() + "')"; break; case "ORACLE": strValues += ",to_date('" + DateTime.Now.ToString("MM/dd/yyyy") + "','MM/DD/YYYY'))"; break; default: throw new NotImplementedException("TODO: Implement ANSI version of buttonCreate_Click()"); } strInsert += strValues; try { DBMgr.ExecuteNonQuery(strInsert); } catch (Exception exception) { Global.WriteOutput("Error: Creating new subnetwork NETWORKS entry" + exception.Message); this.Cursor = Cursors.Default; return; } String strIdentity = ""; switch (DBMgr.NativeConnectionParameters.Provider) { case "MSSQL": strIdentity = "SELECT IDENT_CURRENT ('NETWORKS') FROM NETWORKS"; break; case "ORACLE": //strIdentity = "SELECT NETWORKS_NETWORKID_SEQ.CURRVAL FROM DUAL"; //strIdentity = "SELECT LAST_NUMBER - CACHE_SIZE FROM USER_SEQUENCES WHERE SEQUENCE_NAME = 'NETWORKS_NETWORKID_SEQ'"; strIdentity = "SELECT MAX(NETWORKID) FROM NETWORKS"; break; default: throw new NotImplementedException("TODO: Create ANSI implementation for XXXXXXXXXXXX"); //break; } try { DataSet ds = DBMgr.ExecuteQuery(strIdentity); strIdentity = ds.Tables[0].Rows[0].ItemArray[0].ToString(); } catch (Exception exception) { Global.WriteOutput("Error: Creating new subnetwork NETWORKS entry." + exception.Message); this.Cursor = Cursors.Default; return; } //Now have the new NetworkInserted. Must create tables. SECTION_NID and SEGMENT_NID_NS0 String strSelectSection = "SELECT SECTION_" + m_strNetworkID + ".SECTIONID,FACILITY,BEGIN_STATION,END_STATION,DIRECTION,SECTION,AREA,UNITS,GEOMETRY,Envelope_MinX,Envelope_MaxX,Envelope_MinY,Envelope_MaxY FROM SECTION_" + m_strNetworkID + " INNER JOIN SEGMENT_" + m_strNetworkID.ToString() + "_NS0 ON SECTION_" + m_strNetworkID.ToString() + ".SECTIONID=SEGMENT_" + m_strNetworkID + "_NS0.SECTIONID"; if (strWhere.Trim() != "") { strSelectSection += " WHERE " + strWhere; } //String strSelectSegment = "SELECT * FROM SEGMENT_" + m_strNetworkID + "_NS0"; String strSelectSegment = "SELECT * " + DBOp.BuildFromStatement(m_strNetworkID); if (strWhere.Trim() != "") { strSelectSegment += " WHERE " + strWhere; this.Cursor = Cursors.Default; } //In try { // Create new SECTION_ // Create new tables // SEGMENT_networkid // This table is for SECTIONID, FACILITY, BEGIN_STATION, END_STATION, DIRECTION, SECTION,AREA,UNITS List <DatabaseManager.TableParameters> listColumn = new List <DatabaseManager.TableParameters>(); listColumn.Add(new DatabaseManager.TableParameters("SECTIONID", DataType.Int, false, true)); listColumn.Add(new DatabaseManager.TableParameters("FACILITY", DataType.VarChar(4000), false)); listColumn.Add(new DatabaseManager.TableParameters("BEGIN_STATION", DataType.Float, true)); listColumn.Add(new DatabaseManager.TableParameters("END_STATION", DataType.Float, true)); listColumn.Add(new DatabaseManager.TableParameters("DIRECTION", DataType.VarChar(50), true)); listColumn.Add(new DatabaseManager.TableParameters("SECTION", DataType.VarChar(4000), false)); listColumn.Add(new DatabaseManager.TableParameters("AREA", DataType.Float, true)); listColumn.Add(new DatabaseManager.TableParameters("UNITS", DataType.VarChar(50), true)); listColumn.Add(new DatabaseManager.TableParameters("GEOMETRY", DataType.VarChar(-1), true)); listColumn.Add(new DatabaseManager.TableParameters("ENVELOPE_MINX", DataType.Float, true)); listColumn.Add(new DatabaseManager.TableParameters("ENVELOPE_MAXX", DataType.Float, true)); listColumn.Add(new DatabaseManager.TableParameters("ENVELOPE_MINY", DataType.Float, true)); listColumn.Add(new DatabaseManager.TableParameters("ENVELOPE_MAXY", DataType.Float, true)); List <string> orderedOracleColumns = new List <string>(); orderedOracleColumns.Add("SECTIONID"); orderedOracleColumns.Add("FACILITY"); orderedOracleColumns.Add("BEGIN_STATION"); orderedOracleColumns.Add("END_STATION"); orderedOracleColumns.Add("DIRECTION"); orderedOracleColumns.Add("SECTION"); orderedOracleColumns.Add("AREA"); orderedOracleColumns.Add("UNITS"); orderedOracleColumns.Add("GEOMETRY"); orderedOracleColumns.Add("ENVELOPE_MINX"); orderedOracleColumns.Add("ENVELOPE_MAXX"); orderedOracleColumns.Add("ENVELOPE_MINY"); orderedOracleColumns.Add("ENVELOPE_MAXY"); String strTable = "SECTION_" + strIdentity; DBMgr.CreateTable(strTable, listColumn); //String strMyDocumentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); //strMyDocumentsFolder += "\\RoadCare Projects\\Temp"; //Directory.CreateDirectory(strMyDocumentsFolder); string specialFolder = Directory.GetCurrentDirectory() + "\\Temp"; Directory.CreateDirectory(specialFolder); String strOutFile = specialFolder + "\\subnetwork_section.txt"; TextWriter tw = new StreamWriter(strOutFile); DataSet dsSection = DBMgr.ExecuteQuery(strSelectSection); foreach (DataRow dr in dsSection.Tables[0].Rows) { String strOut = ""; for (int i = 0; i < dr.ItemArray.Length; i++) { strOut += dr.ItemArray[i].ToString(); if (i == dr.ItemArray.Length - 1) { tw.WriteLine(strOut); } else { strOut += "\t"; } } } tw.Close(); switch (DBMgr.NativeConnectionParameters.Provider) { case "MSSQL": DBMgr.SQLBulkLoad(strTable, strOutFile, '\t'); break; case "ORACLE": DBMgr.OracleBulkLoad(DBMgr.NativeConnectionParameters, strTable, strOutFile, orderedOracleColumns, "\t"); break; default: throw new NotImplementedException("TODO: Create ANSI implementation for XXXXXXXXXXXX"); //break; } } catch (Exception exception) { Global.WriteOutput("Error: Creating SECTION_ table for Network = " + m_strNewNetworkName + ". " + exception.Message); this.Cursor = Cursors.Default; return; } try { DataSet dsSegment = DBMgr.ExecuteQuery("SELECT * FROM SEGMENT_" + m_strNetworkID + "_NS0"); List <DatabaseManager.TableParameters> listColumn = new List <DatabaseManager.TableParameters>(); foreach (DataColumn dc in dsSegment.Tables[0].Columns) { DataType dt = DataType.Int; Microsoft.SqlServer.Management.Smo.DataType smoDT = Microsoft.SqlServer.Management.Smo.DataType.Int; if (dc.DataType == typeof(int)) { smoDT = Microsoft.SqlServer.Management.Smo.DataType.Int; } if (dc.DataType == typeof(double)) { smoDT = Microsoft.SqlServer.Management.Smo.DataType.Float; } if (dc.DataType == typeof(string)) { smoDT = Microsoft.SqlServer.Management.Smo.DataType.VarChar(4000); } if (dc.ColumnName == "SECTIONID") { listColumn.Add(new DatabaseManager.TableParameters(dc.ColumnName, smoDT, false, true)); } else { listColumn.Add(new DatabaseManager.TableParameters(dc.ColumnName, smoDT, true, false)); } } String strTable = "SEGMENT_" + strIdentity + "_NS0"; DBMgr.CreateTable(strTable, listColumn); String strMyDocumentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); strMyDocumentsFolder += "\\RoadCare Projects\\Temp"; Directory.CreateDirectory(strMyDocumentsFolder); String strOutFile = strMyDocumentsFolder + "\\subnetwork_segment.txt"; TextWriter tw = new StreamWriter(strOutFile); DataSet dsSection = DBMgr.ExecuteQuery(strSelectSection); foreach (DataRow dr in dsSegment.Tables[0].Rows) { String strOut = ""; for (int i = 0; i < dr.ItemArray.Length; i++) { strOut += dr.ItemArray[i].ToString(); if (i == dr.ItemArray.Length - 1) { tw.WriteLine(strOut); } else { strOut += "\t"; } } } tw.Close(); switch (DBMgr.NativeConnectionParameters.Provider) { case "MSSQL": DBMgr.SQLBulkLoad(strTable, strOutFile, '\t'); break; case "ORACLE": List <string> oracleSegmentColumns = new List <string>(); foreach (DataColumn segmentColumn in dsSegment.Tables[0].Columns) { oracleSegmentColumns.Add(segmentColumn.ColumnName); } DBMgr.OracleBulkLoad(DBMgr.NativeConnectionParameters, strTable, strOutFile, oracleSegmentColumns, "\t"); //throw new NotImplementedException("TODO: figure out columns for buttonCreate_Click()"); //DBMgr.OracleBulkLoad( DBMgr.NativeConnectionParameters, strTable, strOutFile, break; default: throw new NotImplementedException("TODO: Create ANSI implementation for XXXXXXXXXXXX"); //break; } } catch (Exception exception) { Global.WriteOutput("Error: Creating SEGMENT_ table for Network = " + m_strNewNetworkName + ". " + exception.Message); this.Cursor = Cursors.Default; return; } strSelect = "SELECT * FROM SEGMENT_CONTROL WHERE NETWORKID = " + m_strNetworkID; try { DataSet ds = DBMgr.ExecuteQuery(strSelect); foreach (DataRow dr in ds.Tables[0].Rows) { String strTable = dr["SEGMENT_TABLE"].ToString(); strInsert = ""; if (strTable.Contains("SECTION")) { strInsert = "INSERT INTO SEGMENT_CONTROL (NETWORKID,SEGMENT_TABLE) VALUES (" + strIdentity + ",'SECTION_" + strIdentity + "')"; } else { strInsert = "INSERT INTO SEGMENT_CONTROL (NETWORKID,SEGMENT_TABLE"; String strValue = " VALUES (" + strIdentity + ",'SEGMENT_" + strIdentity + "_NS0'"; if (dr["ATTRIBUTE_"].ToString() != "") { strInsert += ",ATTRIBUTE_"; strValue += ",'" + dr["ATTRIBUTE_"].ToString() + "'"; } strInsert += ")" + strValue + ")"; } DBMgr.ExecuteNonQuery(strInsert); } } catch (Exception exception) { Global.WriteOutput("Error: Inserting values into SEGMENT_CONTROL." + exception.Message); } Global.SecurityOperations.CopyNetworkPoliciesFromTo(m_strNetworkID, strIdentity); NewNetworkID = strIdentity; this.DialogResult = DialogResult.OK; this.Close(); this.Cursor = Cursors.Default; }