C2017-003: Support SQL Server for storing of Referenced Object data
This commit is contained in:
@@ -135,8 +135,8 @@ namespace ROEditor
|
||||
this.textBoxDescription.TabIndex = 23;
|
||||
this.textBoxDescription.TabStop = false;
|
||||
this.textBoxDescription.Text = "Thank you for choosing PROMS for your procedure maintenance solution.\r\n\r\nPROMS is" +
|
||||
" protected under the copyright laws.\r\n\r\nPlease refer the the End User Licence Ag" +
|
||||
"reement (EULA) for the terms of use.\r\n";
|
||||
" protected under the copyright laws.\r\n\r\nPlease refer the the End User Licence Ag" +
|
||||
"reement (EULA) for the terms of use.\r\n";
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
@@ -196,7 +196,6 @@ namespace ROEditor
|
||||
this.labelServer.TabIndex = 3;
|
||||
this.labelServer.Text = "SQL Server Name";
|
||||
this.labelServer.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.labelServer.Visible = false;
|
||||
//
|
||||
// labelDatabase
|
||||
//
|
||||
@@ -210,7 +209,6 @@ namespace ROEditor
|
||||
this.labelDatabase.TabIndex = 2;
|
||||
this.labelDatabase.Text = "Database Name";
|
||||
this.labelDatabase.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.labelDatabase.Visible = false;
|
||||
//
|
||||
// panel4
|
||||
//
|
||||
|
@@ -4,12 +4,13 @@ using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Reflection;
|
||||
using RODBInterface;
|
||||
|
||||
namespace ROEditor
|
||||
{
|
||||
partial class AboutROEditor : Form
|
||||
{
|
||||
public AboutROEditor()
|
||||
public AboutROEditor(RODB myrodb)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@@ -45,8 +46,8 @@ namespace ROEditor
|
||||
// this.textBoxDescription.Text = AssemblyDescription;
|
||||
this.labelCompanyName.Links[0].LinkData = "Volian Enterprises Inc.";
|
||||
this.labelCompanyName.Links.Add(0,23,"www.volian.com");
|
||||
//this.labelServer.Text = string.Format("SQL Server: {0}", server);
|
||||
//this.labelDatabase.Text = string.Format("Database: {0}", databaseName);
|
||||
this.labelServer.Text = myrodb.RODB_GetDBServerForAbout();//string.Format("SQL Server: {0}", server);
|
||||
this.labelDatabase.Text = myrodb.RODB_GetDBNameForAbout(); //string.Format("Database: {0}", databaseName);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -112,9 +112,9 @@
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@@ -1,4 +1,4 @@
|
||||
PUSHD ..\..\..\ReferencedObjects\Exe\RefObj\ROEditor"
|
||||
"..\..\..\..\AdjustBuildRevision\bin\Debug\AdjustBuildRevision" "%CD%\AssemblyInfo.cs"
|
||||
POPD
|
||||
pause
|
||||
pause
|
@@ -553,7 +553,7 @@ namespace ROEditor
|
||||
ArrayList AvailList, InUseList;
|
||||
//first see if it is a valid 'InUse' Field.
|
||||
AvailList = myrodb.RODB_GetFields(elem, (uint) RecordType.Schema);
|
||||
InUseList = myrodb.RODB_GetFieldsInUse(elem, AvailList,"FieldsInUse", ref dummy, true);
|
||||
InUseList = myrodb.RODB_GetFieldsInUse(elem, AvailList,"FieldsInUse", ref dummy, false);
|
||||
int chkbracketo, chkbracketc; // open & close bracket indexes
|
||||
chkbracketo = this.tbValue.Text.IndexOf("<");
|
||||
chkbracketc = this.tbValue.Text.IndexOf(">");
|
||||
|
@@ -202,8 +202,11 @@ namespace ROEditor
|
||||
ROField rof;
|
||||
// Get list of available fields (all fields in this type, i.e. rectype = 'Schema'
|
||||
// or 'GroupSchema') and get list of inuse from the schema definition.
|
||||
AvailList = myrodb.RODB_GetFields(elem, editlevel);
|
||||
InUseList = myrodb.RODB_GetFieldsInUse(elem, AvailList, strFieldsInUse, ref origFieldsInUse, true);
|
||||
ArrayList tmp = myrodb.RODB_GetFields(elem, editlevel);
|
||||
// put the items in the AvailList box.
|
||||
if (AvailList == null) AvailList = new ArrayList();
|
||||
for (int i=0; i< tmp.Count; i++) AvailList.Add(tmp[i]); // don't modify the list returned from RODB_GetFields since it is part of dictionary
|
||||
InUseList = myrodb.RODB_GetFieldsInUse(elem, AvailList, strFieldsInUse, ref origFieldsInUse, false);
|
||||
FillInAvailable();
|
||||
|
||||
// set up the listbox for inuse items.
|
||||
|
@@ -415,7 +415,41 @@ namespace ROEditor
|
||||
ContextMenu treePopupMenu = new ContextMenu(ContextMenuItemList);
|
||||
|
||||
// Add the root to the tree.
|
||||
myrodb = new RODB(DbConnectPath);
|
||||
// C2017-003: support for sql server
|
||||
if (UsingSQLServer(DbConnectPath))
|
||||
myrodb = new SqlRODB(DbConnectPath, SqlConnectionStr, false);
|
||||
else
|
||||
myrodb = new AccessRODB(DbConnectPath);
|
||||
// if using the access database (not sql) and the data has been converted, try to connect using the sql connection
|
||||
// string that was written to access when data was converted:
|
||||
if (!UsingSQLServer(Directory.GetCurrentDirectory()))
|
||||
{
|
||||
string constring = myrodb.RODB_HasBeenConverted();
|
||||
if (constring != null)
|
||||
{
|
||||
MessageBox.Show("This Referenced Object Database has been converted to sql. The program will attempt to use the sql version of the database. If this does not work, you will be prompted for a connection string, if not available, contact your Database Administrator", "RO Microsoft Access problem");
|
||||
SqlConnectionStr = constring;
|
||||
bool canConnect = SqlRODB.TestConnect(constring);
|
||||
if (!canConnect) // can't get data from this sql database, ask user to enter a string.
|
||||
{
|
||||
string userConstring = SqlRODB.GetSqlDbConnectString(constring);
|
||||
if (userConstring == null)
|
||||
{
|
||||
MessageBox.Show("Cannot connect to the correct database. Contact your Database or Proms Administrator");
|
||||
return;
|
||||
}
|
||||
SqlConnectionStr = userConstring;
|
||||
// write new string to access database
|
||||
if (!myrodb.RODB_WriteSqlConnectToAccess(userConstring))
|
||||
{
|
||||
MessageBox.Show("Cannot save the new connection string. Contact your Database or Proms Administrator");
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
myrodb.dbProviderType = (int)RODB.DB_PROVIDER.SQL_SERVER;
|
||||
myrodb = new SqlRODB(DbConnectPath, SqlConnectionStr, true);
|
||||
}
|
||||
}
|
||||
myroXmlDoc = myrodb.RODB_GetRoot();
|
||||
rootXml = (VlnXmlElement) myroXmlDoc.FirstChild;
|
||||
rootNode = new TreeNode("Referenced Objects",ROGROUPIMAGE,ROGROUPIMAGE);
|
||||
@@ -1548,7 +1582,15 @@ namespace ROEditor
|
||||
ConnectionPath = FindTheRODirectory();
|
||||
}
|
||||
if (args.Length > 1)
|
||||
specificro = args[1];
|
||||
{
|
||||
if (args[1].ToUpper().Contains("DATA SOURCE")) SqlConnectionStr = args[1];
|
||||
else specificro = args[1];
|
||||
}
|
||||
if (args.Length > 2)
|
||||
{
|
||||
if (args[2].ToUpper().Contains("DATA SOURCE")) SqlConnectionStr = args[2];
|
||||
else specificro = args[2];
|
||||
}
|
||||
try
|
||||
{
|
||||
// Convert the RO data if needed
|
||||
@@ -1740,15 +1782,18 @@ namespace ROEditor
|
||||
}
|
||||
return RtnStr;
|
||||
}
|
||||
|
||||
// C2017-003: support for sql server
|
||||
static public string SqlConnectionStr = null;
|
||||
static bool UsingSQLServer(string ROdir)
|
||||
{
|
||||
// using sql if there is a connection string or if defined in roapp.ini
|
||||
if (SqlConnectionStr != null && SqlConnectionStr != "") return true;
|
||||
bool Rtn = false;
|
||||
string RtnStr;
|
||||
|
||||
string ROiniPath = ROdir + "\\ROAPP.INI";
|
||||
IniReader ini = new IniReader(ROiniPath);
|
||||
RtnStr = ini.ReadString("Database Server","Path","");
|
||||
if (RtnStr.Length > 1)
|
||||
SqlConnectionStr = ini.ReadString("Database Server", "Path", "");
|
||||
if (SqlConnectionStr.Length > 1)
|
||||
Rtn = true;
|
||||
return Rtn;
|
||||
}
|
||||
@@ -2128,7 +2173,7 @@ namespace ROEditor
|
||||
private void menuHelpAbout_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
//AboutDlg dlg = new AboutDlg();
|
||||
AboutROEditor dlg = new AboutROEditor();
|
||||
AboutROEditor dlg = new AboutROEditor(myrodb);
|
||||
dlg.ShowDialog();
|
||||
}
|
||||
|
||||
@@ -2498,7 +2543,7 @@ namespace ROEditor
|
||||
if (selele.Name != "RO_Root")
|
||||
{
|
||||
ArrayList AvailList = myrodb.RODB_GetFields(selele, 0);
|
||||
InUseList = myrodb.RODB_GetFieldsInUse(selele, AvailList, "FieldsInUse", ref tmp, true);
|
||||
InUseList = myrodb.RODB_GetFieldsInUse(selele, AvailList, "FieldsInUse", ref tmp, false);
|
||||
}
|
||||
|
||||
// Put out fields and their associated data.
|
||||
|
Reference in New Issue
Block a user