C2017-003: Support SQL Server for storing of Referenced Object data
This commit is contained in:
parent
7fbc9e358d
commit
de58331ffb
@ -15511,8 +15511,8 @@ BEGIN TRY -- Try Block
|
|||||||
set nocount on
|
set nocount on
|
||||||
DECLARE @RevDate varchar(255)
|
DECLARE @RevDate varchar(255)
|
||||||
DECLARE @RevDescription varchar(255)
|
DECLARE @RevDescription varchar(255)
|
||||||
set @RevDate = '12/13/2019 7:00 AM'
|
set @RevDate = '01/09/2020 11:00 AM'
|
||||||
set @RevDescription = 'Procedure number length when adding procedures'
|
set @RevDescription = 'Referenced Object data in sql server'
|
||||||
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
||||||
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
||||||
IF( @@TRANCOUNT > 0 ) COMMIT
|
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||||
|
42
PROMS/ReferencedObjects/LibSource/RODBInterface/InputBox.cs
Normal file
42
PROMS/ReferencedObjects/LibSource/RODBInterface/InputBox.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace RODBInterface
|
||||||
|
{
|
||||||
|
public partial class InputBox : Form
|
||||||
|
{
|
||||||
|
private string _ResultConnectString = null;
|
||||||
|
|
||||||
|
public string ResultConnectString
|
||||||
|
{
|
||||||
|
get { return _ResultConnectString; }
|
||||||
|
set { _ResultConnectString = value; }
|
||||||
|
}
|
||||||
|
public InputBox(string constring)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.tbSqlConnectString.Text = constring;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnTestConnect_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
bool canConnect = SqlRODB.TestConnect(this.tbSqlConnectString.Text);
|
||||||
|
if (!canConnect)
|
||||||
|
MessageBox.Show("Connection failed.", "Connection Failed");
|
||||||
|
else
|
||||||
|
MessageBox.Show("You have been successfully connected to the database!", "Connection Succeeded");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnOk_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ResultConnectString = this.tbSqlConnectString.Text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
111
PROMS/ReferencedObjects/LibSource/RODBInterface/InputBox.designer.cs
generated
Normal file
111
PROMS/ReferencedObjects/LibSource/RODBInterface/InputBox.designer.cs
generated
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
namespace RODBInterface
|
||||||
|
{
|
||||||
|
partial class InputBox
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.lblSqlConnectString = new System.Windows.Forms.Label();
|
||||||
|
this.tbSqlConnectString = new System.Windows.Forms.TextBox();
|
||||||
|
this.btnTestConnect = new System.Windows.Forms.Button();
|
||||||
|
this.btnOk = new System.Windows.Forms.Button();
|
||||||
|
this.btnCancel = new System.Windows.Forms.Button();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// lblSqlConnectString
|
||||||
|
//
|
||||||
|
this.lblSqlConnectString.AutoSize = true;
|
||||||
|
this.lblSqlConnectString.BackColor = System.Drawing.Color.Transparent;
|
||||||
|
this.lblSqlConnectString.Location = new System.Drawing.Point(12, 18);
|
||||||
|
this.lblSqlConnectString.Name = "lblSqlConnectString";
|
||||||
|
this.lblSqlConnectString.Size = new System.Drawing.Size(144, 17);
|
||||||
|
this.lblSqlConnectString.TabIndex = 4;
|
||||||
|
this.lblSqlConnectString.Text = "Sql Connection String";
|
||||||
|
//
|
||||||
|
// tbSqlConnectString
|
||||||
|
//
|
||||||
|
this.tbSqlConnectString.Location = new System.Drawing.Point(29, 49);
|
||||||
|
this.tbSqlConnectString.Name = "tbSqlConnectString";
|
||||||
|
this.tbSqlConnectString.Size = new System.Drawing.Size(620, 22);
|
||||||
|
this.tbSqlConnectString.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// btnTestConnect
|
||||||
|
//
|
||||||
|
this.btnTestConnect.Location = new System.Drawing.Point(300, 93);
|
||||||
|
this.btnTestConnect.Name = "btnTestConnect";
|
||||||
|
this.btnTestConnect.Size = new System.Drawing.Size(75, 42);
|
||||||
|
this.btnTestConnect.TabIndex = 6;
|
||||||
|
this.btnTestConnect.Text = "Test Connect";
|
||||||
|
this.btnTestConnect.UseVisualStyleBackColor = true;
|
||||||
|
this.btnTestConnect.Click += new System.EventHandler(this.btnTestConnect_Click);
|
||||||
|
//
|
||||||
|
// btnOk
|
||||||
|
//
|
||||||
|
this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||||
|
this.btnOk.Location = new System.Drawing.Point(435, 103);
|
||||||
|
this.btnOk.Name = "btnOk";
|
||||||
|
this.btnOk.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.btnOk.TabIndex = 7;
|
||||||
|
this.btnOk.Text = "OK";
|
||||||
|
this.btnOk.UseVisualStyleBackColor = true;
|
||||||
|
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
|
||||||
|
//
|
||||||
|
// btnCancel
|
||||||
|
//
|
||||||
|
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||||
|
this.btnCancel.Location = new System.Drawing.Point(571, 103);
|
||||||
|
this.btnCancel.Name = "btnCancel";
|
||||||
|
this.btnCancel.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.btnCancel.TabIndex = 8;
|
||||||
|
this.btnCancel.Text = "Cancel";
|
||||||
|
this.btnCancel.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// InputBox
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(691, 157);
|
||||||
|
this.Controls.Add(this.btnCancel);
|
||||||
|
this.Controls.Add(this.btnOk);
|
||||||
|
this.Controls.Add(this.btnTestConnect);
|
||||||
|
this.Controls.Add(this.lblSqlConnectString);
|
||||||
|
this.Controls.Add(this.tbSqlConnectString);
|
||||||
|
this.Name = "InputBox";
|
||||||
|
this.Text = "Sql Connection String";
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Label lblSqlConnectString;
|
||||||
|
private System.Windows.Forms.TextBox tbSqlConnectString;
|
||||||
|
private System.Windows.Forms.Button btnTestConnect;
|
||||||
|
private System.Windows.Forms.Button btnOk;
|
||||||
|
private System.Windows.Forms.Button btnCancel;
|
||||||
|
}
|
||||||
|
}
|
120
PROMS/ReferencedObjects/LibSource/RODBInterface/InputBox.resx
Normal file
120
PROMS/ReferencedObjects/LibSource/RODBInterface/InputBox.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
File diff suppressed because it is too large
Load Diff
2690
PROMS/ReferencedObjects/LibSource/RODBInterface/SqlRODB.cs
Normal file
2690
PROMS/ReferencedObjects/LibSource/RODBInterface/SqlRODB.cs
Normal file
File diff suppressed because it is too large
Load Diff
@ -939,7 +939,7 @@ namespace RODBInterface
|
|||||||
// First get the fields used for this Group.
|
// First get the fields used for this Group.
|
||||||
string tmp=null; // needed for inuse call
|
string tmp=null; // needed for inuse call
|
||||||
ArrayList AvailList = myrodb.RODB_GetFields(this, 0);
|
ArrayList AvailList = myrodb.RODB_GetFields(this, 0);
|
||||||
ArrayList InUseList = myrodb.RODB_GetFieldsInUse(this, AvailList, "GroupFieldsInUse", ref tmp, true);
|
ArrayList InUseList = myrodb.RODB_GetFieldsInUse(this, AvailList, "GroupFieldsInUse", ref tmp, false);
|
||||||
|
|
||||||
// For each field, print the header (field name) & then print data if it exists.
|
// For each field, print the header (field name) & then print data if it exists.
|
||||||
if (InUseList != null)
|
if (InUseList != null)
|
||||||
@ -1009,7 +1009,7 @@ namespace RODBInterface
|
|||||||
// Get used fields for this RO.
|
// Get used fields for this RO.
|
||||||
string tmp=null; // needed for inuse call
|
string tmp=null; // needed for inuse call
|
||||||
ArrayList AvailList = myrodb.RODB_GetFields(this, 0);
|
ArrayList AvailList = myrodb.RODB_GetFields(this, 0);
|
||||||
ArrayList InUseList = myrodb.RODB_GetFieldsInUse(this, AvailList, "FieldsInUse", ref tmp, true);
|
ArrayList InUseList = myrodb.RODB_GetFieldsInUse(this, AvailList, "FieldsInUse", ref tmp, false);
|
||||||
|
|
||||||
// put out the stored headers, i.e. the group titles up the tree.
|
// put out the stored headers, i.e. the group titles up the tree.
|
||||||
xmldoc.doHeader(headers);
|
xmldoc.doHeader(headers);
|
||||||
@ -1020,7 +1020,6 @@ namespace RODBInterface
|
|||||||
xmldoc.writeRROBegin();
|
xmldoc.writeRROBegin();
|
||||||
xmldoc.writeInt(8);
|
xmldoc.writeInt(8);
|
||||||
xmldoc.writeText(myrodb.MyDBID + MyROID);
|
xmldoc.writeText(myrodb.MyDBID + MyROID);
|
||||||
Console.WriteLine("ROID={0}", myrodb.MyDBID + MyROID);
|
|
||||||
xmldoc.writeInt(7);
|
xmldoc.writeInt(7);
|
||||||
xmldoc.writeText(this.GetAttribute("AccPageID").Trim());
|
xmldoc.writeText(this.GetAttribute("AccPageID").Trim());
|
||||||
// add items to the InUseList box.
|
// add items to the InUseList box.
|
||||||
@ -1111,6 +1110,7 @@ namespace RODBInterface
|
|||||||
// ShowGroup processes the input group node for the complete report by
|
// ShowGroup processes the input group node for the complete report by
|
||||||
// using ShowGroupDetail to output data for the group and ShowRRO to
|
// using ShowGroupDetail to output data for the group and ShowRRO to
|
||||||
// output data for the RO
|
// output data for the RO
|
||||||
|
DateTime last = DateTime.Now; // use these to control status message output
|
||||||
private bool ShowGroup(RODB myrodb, ArrayList headers, VlnStatusMessage showStat)
|
private bool ShowGroup(RODB myrodb, ArrayList headers, VlnStatusMessage showStat)
|
||||||
{
|
{
|
||||||
XmlNode chldnode;
|
XmlNode chldnode;
|
||||||
@ -1154,9 +1154,9 @@ namespace RODBInterface
|
|||||||
if (chldnode is VlnXmlElement)
|
if (chldnode is VlnXmlElement)
|
||||||
{
|
{
|
||||||
VlnXmlElement elem = (VlnXmlElement) chldnode;
|
VlnXmlElement elem = (VlnXmlElement) chldnode;
|
||||||
if (showStat !=null)
|
if (showStat != null)
|
||||||
showStat.StatusMessage = elem.InnerText;
|
showStat.StatusMessage = elem.InnerText;
|
||||||
|
|
||||||
// if it's a group, recurse through it.
|
// if it's a group, recurse through it.
|
||||||
if (chldnode.Name == "vlnGroup")
|
if (chldnode.Name == "vlnGroup")
|
||||||
elem.ShowGroup(myrodb, headers, showStat);
|
elem.ShowGroup(myrodb, headers, showStat);
|
||||||
@ -1166,8 +1166,14 @@ namespace RODBInterface
|
|||||||
int levelcnt = chldnode.ChildNodes.Count;
|
int levelcnt = chldnode.ChildNodes.Count;
|
||||||
bool isParDisData = chldnode.Name == "Parameter__Display__Data";
|
bool isParDisData = chldnode.Name == "Parameter__Display__Data";
|
||||||
string TheMenuTitle = elem.GetAttribute("MenuTitle");
|
string TheMenuTitle = elem.GetAttribute("MenuTitle");
|
||||||
if (showStat != null)
|
if (showStat != null)
|
||||||
showStat.StatusMessage = TheMenuTitle;
|
{
|
||||||
|
if (TimeSpan.FromTicks(DateTime.Now.Ticks - last.Ticks).Seconds > 1)
|
||||||
|
{
|
||||||
|
showStat.StatusMessage = TheMenuTitle;
|
||||||
|
last = DateTime.Now;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!isParDisData && ((levelcnt > 1) || (levelcnt==1 && !TheMenuTitle.Equals(""))))
|
if (!isParDisData && ((levelcnt > 1) || (levelcnt==1 && !TheMenuTitle.Equals(""))))
|
||||||
elem.ShowRRO(myrodb, headers);
|
elem.ShowRRO(myrodb, headers);
|
||||||
}
|
}
|
||||||
|
@ -15511,8 +15511,8 @@ BEGIN TRY -- Try Block
|
|||||||
set nocount on
|
set nocount on
|
||||||
DECLARE @RevDate varchar(255)
|
DECLARE @RevDate varchar(255)
|
||||||
DECLARE @RevDescription varchar(255)
|
DECLARE @RevDescription varchar(255)
|
||||||
set @RevDate = '12/13/2019 7:00 AM'
|
set @RevDate = '01/09/2020 11:00 AM'
|
||||||
set @RevDescription = 'Procedure number length when adding procedures'
|
set @RevDescription = 'Referenced Object data in sql server'
|
||||||
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
||||||
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
||||||
IF( @@TRANCOUNT > 0 ) COMMIT
|
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||||
|
828
PROMS/VEPROMS User Interface/ROBuild.Sql
Normal file
828
PROMS/VEPROMS User Interface/ROBuild.Sql
Normal file
@ -0,0 +1,828 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
--/**** DBA FUNCTION ****/
|
||||||
|
--/* The following can be used as a basis for creating the sql RO database for storing of referenced object for PROMS */
|
||||||
|
--/* Note that the default sql database name will be generated in during conversion as the current PROMS database name suffixed with '_RO'. */
|
||||||
|
--/* In the script below, the [VE_PROMS_DB_RO] should be replaced with the name that the RO database should be given */
|
||||||
|
--/* In the script below, the pathname/filename of the physical database should be modified also. */
|
||||||
|
--USE [master]
|
||||||
|
--GO
|
||||||
|
--/****** Object: Database [VEPROMS_DB_RO] Script Date: 7/23/2019 9:42:54 AM ******/
|
||||||
|
--CREATE DATABASE [VEPROMS_DB_RO]
|
||||||
|
-- ON PRIMARY
|
||||||
|
--( NAME = N'VEPROMS_DB_RO', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS_2012\MSSQL\DATA\VEPROMS_DB_RO.mdf' , SIZE = 5120KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
|
||||||
|
-- LOG ON
|
||||||
|
--( NAME = N'VEPROMS_DB_RO_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS_2012\MSSQL\DATA\VEPROMS_DB_RO_log.ldf' , SIZE = 2816KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
|
||||||
|
--GO
|
||||||
|
--ALTER DATABASE [VEPROMS_DB_RO] SET COMPATIBILITY_LEVEL = 110
|
||||||
|
--GO
|
||||||
|
--ALTER DATABASE [VEPROMS_DB_RO] set TRUSTWORTHY ON;
|
||||||
|
--GO
|
||||||
|
--USE VEPROMS_DB_RO
|
||||||
|
--GO
|
||||||
|
--EXEC dbo.sp_changedbowner @loginame = N'sa', @map = false
|
||||||
|
--GO
|
||||||
|
--sp_configure 'show advanced options', 1;
|
||||||
|
--GO
|
||||||
|
--RECONFIGURE;
|
||||||
|
--GO
|
||||||
|
--sp_configure 'clr enabled', 1;
|
||||||
|
--GO
|
||||||
|
--RECONFIGURE;
|
||||||
|
--GO
|
||||||
|
--IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
|
||||||
|
--begin
|
||||||
|
--EXEC [VEPROMS_DB_RO].[dbo].[sp_fulltext_database] @action = 'enable'
|
||||||
|
--end
|
||||||
|
--GO
|
||||||
|
--USE [VEPROMS_DB_RO]
|
||||||
|
--GO
|
||||||
|
--/**** END OF DBA FUNCTION ****/
|
||||||
|
|
||||||
|
|
||||||
|
-- AFTER THE DATABASE IS CREATED, the following should be executed to create the ROALL table & create the sql stored procedures that */
|
||||||
|
-- are used by PROMS, to migrate and access the ro data.
|
||||||
|
if db_name() in('master','model','msdn','tempdb')
|
||||||
|
begin
|
||||||
|
DECLARE @ErrorMsg varchar(255)
|
||||||
|
SET @ErrorMsg = 'Don''t add these procedures and functions to ' + db_name()
|
||||||
|
PRINT '=========================================================================='
|
||||||
|
PRINT ''
|
||||||
|
PRINT @ErrorMsg
|
||||||
|
PRINT ''
|
||||||
|
PRINT 'You probably want to be in the VEPROMS database'
|
||||||
|
PRINT ''
|
||||||
|
PRINT '=========================================================================='
|
||||||
|
RAISERROR (@ErrorMsg, 20, -1) with log
|
||||||
|
RETURN
|
||||||
|
end
|
||||||
|
print 'Adding procedures and functions to ' + db_name()
|
||||||
|
GO
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
GO
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[vlnErrorHandler] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vlnErrorHandler]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [vlnErrorHandler];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[vlnErrorHandler]
|
||||||
|
(@ExpectedCount int=-1
|
||||||
|
,@MessageFormat nvarchar(512)=N'Expected RowCount (%d) not met (%d)')
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
DECLARE @ErrorMessage NVARCHAR(4000), @ErrorNumber INT, @ErrorSeverity INT, @ErrorState INT, @ErrorProcedure NVARCHAR(126)
|
||||||
|
, @ErrorLine INT, @RowCount INT;
|
||||||
|
SELECT @ErrorMessage = ERROR_MESSAGE(), @ErrorSeverity = ERROR_SEVERITY(), @ErrorState = ERROR_STATE(),@ErrorNumber = ERROR_NUMBER()
|
||||||
|
, @ErrorLine = ERROR_LINE(), @ErrorProcedure = ERROR_PROCEDURE(), @RowCount = @@RowCount;
|
||||||
|
IF @ErrorNumber > 0
|
||||||
|
BEGIN
|
||||||
|
IF @ErrorProcedure = OBJECT_NAME(@@PROCID) -- If the Procedure is the current procedure just pass the error message
|
||||||
|
RAISERROR (@ErrorMessage, @ErrorSeverity, @ErrorState)
|
||||||
|
ELSE -- Add in the procedure name and line as well as the error number
|
||||||
|
RAISERROR (N'%s[%d] - (%d) %s', @ErrorSeverity, @ErrorState, @ErrorProcedure, @ErrorLine, @ErrorNumber, @ErrorMessage)
|
||||||
|
END
|
||||||
|
ELSE IF @ExpectedCount <> -1 AND @ExpectedCount <> @RowCount
|
||||||
|
RAISERROR (@MessageFormat, 16, 1, @ExpectedCount, @RowCount)
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: vlnErrorHandler Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: vlnErrorHandler Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[deleteByParid] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteByParid]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [deleteByParid];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[deleteByParid]
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@ParentID char(8)
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN TRY -- Try Block
|
||||||
|
BEGIN TRANSACTION
|
||||||
|
DELETE ROALL
|
||||||
|
WHERE [ROTable] = @ROTable and [ParentID] = @ParentID
|
||||||
|
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||||
|
END TRY
|
||||||
|
BEGIN CATCH -- Catch Block
|
||||||
|
IF( @@TRANCOUNT = 1 ) ROLLBACK -- Only rollback if top level
|
||||||
|
ELSE IF( @@TRANCOUNT > 1 ) COMMIT -- Otherwise commit. Top level will rollback
|
||||||
|
EXEC vlnErrorHandler
|
||||||
|
END CATCH
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: deleteByParid Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: deleteByParid Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[deleteByRecid] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteByRecid]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [deleteByRecid];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[deleteByRecid]
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@RecID char(8)
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN TRY -- Try Block
|
||||||
|
BEGIN TRANSACTION
|
||||||
|
DELETE ROALL
|
||||||
|
WHERE [ROTable] = @ROTable and [RecID] = @RecID
|
||||||
|
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||||
|
END TRY
|
||||||
|
BEGIN CATCH -- Catch Block
|
||||||
|
IF( @@TRANCOUNT = 1 ) ROLLBACK -- Only rollback if top level
|
||||||
|
ELSE IF( @@TRANCOUNT > 1 ) COMMIT -- Otherwise commit. Top level will rollback
|
||||||
|
EXEC vlnErrorHandler
|
||||||
|
END CATCH
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: deleteByRecid Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: deleteByRecid Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[deleteByROTable] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteByROTable]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [deleteByROTable];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[deleteByROTable]
|
||||||
|
(
|
||||||
|
@ROTable char(8)
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN TRY -- Try Block
|
||||||
|
BEGIN TRANSACTION
|
||||||
|
DELETE ROALL
|
||||||
|
WHERE [ROTable] = @ROTable
|
||||||
|
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||||
|
END TRY
|
||||||
|
BEGIN CATCH -- Catch Block
|
||||||
|
IF( @@TRANCOUNT = 1 ) ROLLBACK -- Only rollback if top level
|
||||||
|
ELSE IF( @@TRANCOUNT > 1 ) COMMIT -- Otherwise commit. Top level will rollback
|
||||||
|
EXEC vlnErrorHandler
|
||||||
|
END CATCH
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: deleteByROTable Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: deleteByROTable Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[getChildData] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getChildData]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getChildData];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[getChildData]
|
||||||
|
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@ParentID char(8)
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT RecID,RecType, isnull(AccPageID, '') AccPageID, Info
|
||||||
|
FROM [ROALL]
|
||||||
|
where ROTable = @ROTable and (RecType = 3 or RecType = 5) and ParentID=@ParentID ORDER BY RecID ASC
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getChildData Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getChildData Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[getCountChildrenOfChildData] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getCountChildrenOfChildData]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getCountChildrenOfChildData];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[getCountChildrenOfChildData]
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@ParentID char(8)
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT R1.ParentID,COUNT(*) AS CNT
|
||||||
|
FROM ROALL R1 INNER JOIN ROALL R2 ON R1.ParentID = R2.RecID
|
||||||
|
WHERE (R1.RecType = 3 or R1.RecType = 5) and R1.ROTable = @ROTable and R2.ROTable = @ROTable and R2.ParentID = @ParentID group by R1.ParentID
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getCountChildrenOfChildData Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getCountChildrenOfChildData Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[getCountRecidByAccid] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getCountRecidByAccid]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getCountRecidByAccid];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[getCountRecidByAccid]
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@AccPageID char(32)
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT COUNT (RecID)
|
||||||
|
FROM [ROALL]
|
||||||
|
WHERE [ROTable]=@ROTable AND AccPageID=@AccPageID
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getCountRecidByAccid Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getCountRecidByAccid Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[getCountRecidByAccidNotRecid] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getCountRecidByAccidNotRecid]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getCountRecidByAccidNotRecid];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[getCountRecidByAccidNotRecid]
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@RecID char(8),
|
||||||
|
@AccPageID char(32)
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT COUNT (RecID)
|
||||||
|
FROM [ROALL]
|
||||||
|
WHERE [ROTable]=@ROTable AND AccPageID=@AccPageID AND (NOT RecID = @RecID)
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getCountRecidByAccidNotRecid Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getCountRecidByAccidNotRecid Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[getCountRecidByParid] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getCountRecidByParid]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getCountRecidByParid];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[getCountRecidByParid]
|
||||||
|
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@ParentID char(8)
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT COUNT (RecID)
|
||||||
|
FROM [ROALL]
|
||||||
|
WHERE [ROTable]=@ROTable AND [ParentID]=@ParentID
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getCountRecidByParid Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getCountRecidByParid Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[getCountRectypeByRectype] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getCountRectypeByRectype]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getCountRectypeByRectype];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[getCountRectypeByRectype]
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@RecType char(32)
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT COUNT (RecType)
|
||||||
|
FROM [ROALL]
|
||||||
|
WHERE [ROTable]=@ROTable AND RecType=@RecType
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getCountRectypeByRectype Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getCountRectypeByRectype Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[getGroupAndSubgroups] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getGroupAndSubgroups]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getGroupAndSubgroups];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[getGroupAndSubgroups]
|
||||||
|
|
||||||
|
(
|
||||||
|
@ROTable char(8)
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT RecID, RecType, ParentID, isnull(AccPageID, '') AccPageID, Info
|
||||||
|
FROM [ROALL]
|
||||||
|
WHERE [ROTable]=@ROTable AND (RecType = 3 or RecType = 5) AND ParentID <> '00000002'
|
||||||
|
ORDER BY ParentID,RecID ASC
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getGroupAndSubgroups Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getGroupAndSubgroups Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[getInfoByParidRectype] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getInfoByParidRectype]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getInfoByParidRectype];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[getInfoByParidRectype]
|
||||||
|
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@ParentID char(8),
|
||||||
|
@RecType int
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT [Info]
|
||||||
|
FROM [ROALL]
|
||||||
|
WHERE [ROTable]=@ROTable AND [ParentID]=@ParentID AND [RecType]=@RecType
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getInfoByParidRectype Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getInfoByParidRectype Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[getInfoByRecid] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getInfoByRecid]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getInfoByRecid];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[getInfoByRecid]
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@RecID char(8)
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT [Info]
|
||||||
|
FROM [ROALL]
|
||||||
|
WHERE [ROTable]=@ROTable AND [RecID]=@RecID
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getInfoByRecid Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getInfoByRecid Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[getInfoByRecidRectype] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getInfoByRecidRectype]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getInfoByRecidRectype];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[getInfoByRecidRectype]
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@RecID char(8),
|
||||||
|
@RecType int
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT [Info]
|
||||||
|
FROM [ROALL]
|
||||||
|
WHERE [ROTable]=@ROTable AND [RecID]=@RecID AND [RecType]=@RecType
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getInfoByRecidRectype Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getInfoByRecidRectype Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[getParidAccidInfoByRecid] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getParidAccidInfoByRecid]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getParidAccidInfoByRecid];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[getParidAccidInfoByRecid]
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@RecId char(8)
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT [ParentID], [AccPageID], [Info]
|
||||||
|
FROM [ROALL]
|
||||||
|
WHERE [ROTable]=@ROTable AND [RecID]=@RecId
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getParidAccidInfoByRecid Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getParidAccidInfoByRecid Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[getParidAccidInfoByRectypeParid] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getParidAccidInfoByRectypeParid]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getParidAccidInfoByRectypeParid];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[getParidAccidInfoByRectypeParid]
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@RecType int,
|
||||||
|
@ParentID char(8)
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT [ParentID], [AccPageID], [Info]
|
||||||
|
FROM [ROALL]
|
||||||
|
WHERE [ROTable]=@ROTable AND [RecType]=@RecType AND [ParentID]= @ParentID
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getParidAccidInfoByRectypeParid Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getParidAccidInfoByRectypeParid Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[getRecidByRectypeInfo] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getRecidByRectypeInfo]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getRecidByRectypeInfo];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[getRecidByRectypeInfo]
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@RecType int,
|
||||||
|
@mstrecid nvarchar(max)
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT [RecID]
|
||||||
|
FROM [ROALL]
|
||||||
|
WHERE [ROTable]=@ROTable AND [RecType]=@RecType AND Info like @mstrecid
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getRecidByRectypeInfo Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getRecidByRectypeInfo Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[getRecidInfoByRectype] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getRecidInfoByRectype]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getRecidInfoByRectype];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[getRecidInfoByRectype]
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@RecType int
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT [RecID], [Info]
|
||||||
|
FROM [ROALL]
|
||||||
|
WHERE [ROTable]=@ROTable AND [RecType]=@RecType
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getRecidInfoByRectype Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getRecidInfoByRectype Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[getRecidInfoByRectypeAsc] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getRecidInfoByRectypeAsc]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getRecidInfoByRectypeAsc];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[getRecidInfoByRectypeAsc]
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@RecType int
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT [RecID], [Info]
|
||||||
|
FROM [ROALL]
|
||||||
|
WHERE [ROTable]=@ROTable AND [RecType]=@RecType
|
||||||
|
ORDER BY RecID ASC
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getRecidInfoByRectypeAsc Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getRecidInfoByRectypeAsc Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[getRecidInfoByRectypeParidAsc] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getRecidInfoByRectypeParidAsc]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [getRecidInfoByRectypeParidAsc];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[getRecidInfoByRectypeParidAsc]
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@RecType int,
|
||||||
|
@ParentID char(8)
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
SELECT [RecID], [Info]
|
||||||
|
FROM [ROALL]
|
||||||
|
WHERE [ROTable]=@ROTable AND [RecType]=@RecType AND [ParentID]=@ParentID
|
||||||
|
ORDER BY RecID ASC
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: getRecidInfoByRectypeParidAsc Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: getRecidInfoByRectypeParidAsc Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[insertAllRectypes] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[insertAllRectypes]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [insertAllRectypes];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[insertAllRectypes]
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@RecID char(8),
|
||||||
|
@RecType int,
|
||||||
|
@ParentID char(8),
|
||||||
|
@AccPageID char(32),
|
||||||
|
@Info nvarchar(max),
|
||||||
|
@ModDateTime char(14)
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN TRY -- Try Block
|
||||||
|
BEGIN TRANSACTION
|
||||||
|
INSERT INTO [ROALL]
|
||||||
|
(
|
||||||
|
ROTable,
|
||||||
|
RecID,
|
||||||
|
RecType,
|
||||||
|
ParentID,
|
||||||
|
ModDateTime,
|
||||||
|
AccPageID,
|
||||||
|
Info
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
@ROTable,
|
||||||
|
@RecID,
|
||||||
|
@RecType,
|
||||||
|
@ParentID,
|
||||||
|
@ModDateTime,
|
||||||
|
@AccPageID,
|
||||||
|
@Info
|
||||||
|
)
|
||||||
|
|
||||||
|
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||||
|
END TRY
|
||||||
|
BEGIN CATCH -- Catch Block
|
||||||
|
IF( @@TRANCOUNT = 1 ) ROLLBACK -- Only rollback if top level
|
||||||
|
ELSE IF( @@TRANCOUNT > 1 ) COMMIT -- Otherwise commit. Top level will rollback
|
||||||
|
EXEC vlnErrorHandler
|
||||||
|
END CATCH
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: insertAllRectypes Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: insertAllRectypes Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[updateInfoAccidByRecid] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[updateInfoAccidByRecid]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [updateInfoAccidByRecid];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[updateInfoAccidByRecid]
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@RecID char(8),
|
||||||
|
@AccPageID char(32),
|
||||||
|
@Info nvarchar(max),
|
||||||
|
@ModDateTime char(14)
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN TRY -- Try Block
|
||||||
|
BEGIN TRANSACTION
|
||||||
|
UPDATE [ROALL]
|
||||||
|
SET
|
||||||
|
[Info]=@Info,
|
||||||
|
[ModDateTime]=@ModDateTime,
|
||||||
|
[AccPageID]=@AccPageID
|
||||||
|
WHERE [ROTable]=@ROTable AND [RecID]=@RecID
|
||||||
|
IF @@ROWCOUNT = 0
|
||||||
|
BEGIN
|
||||||
|
IF NOT exists(select * from [ROALL] WHERE [ROTable]=@ROTable AND [RecID]=@RecID)
|
||||||
|
RAISERROR('ROALL record has been deleted by another user', 16, 1)
|
||||||
|
ELSE
|
||||||
|
RAISERROR('ROALL has been edited by another user', 16, 1)
|
||||||
|
END
|
||||||
|
|
||||||
|
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||||
|
END TRY
|
||||||
|
BEGIN CATCH -- Catch Block
|
||||||
|
IF( @@TRANCOUNT = 1 ) ROLLBACK -- Only rollback if top level
|
||||||
|
ELSE IF( @@TRANCOUNT > 1 ) COMMIT -- Otherwise commit. Top level will rollback
|
||||||
|
EXEC vlnErrorHandler
|
||||||
|
END CATCH
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: updateInfoAccidByRecid Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: updateInfoAccidByRecid Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[updateInfoByRecid] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[updateInfoByRecid]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [updateInfoByRecid];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[updateInfoByRecid]
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@RecID char(8),
|
||||||
|
@Info nvarchar(max),
|
||||||
|
@ModDateTime char(14)
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN TRY -- Try Block
|
||||||
|
BEGIN TRANSACTION
|
||||||
|
UPDATE [ROALL]
|
||||||
|
SET
|
||||||
|
[Info]=@Info,
|
||||||
|
[ModDateTime]=@ModDateTime
|
||||||
|
WHERE [ROTable]=@ROTable AND [RecID]=@RecID
|
||||||
|
IF @@ROWCOUNT = 0
|
||||||
|
BEGIN
|
||||||
|
IF NOT exists(select * from [ROALL] WHERE [ROTable]=@ROTable AND [RecID]=@RecID)
|
||||||
|
RAISERROR('ROALL record has been deleted by another user', 16, 1)
|
||||||
|
ELSE
|
||||||
|
RAISERROR('ROALL has been edited by another user', 16, 1)
|
||||||
|
END
|
||||||
|
|
||||||
|
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||||
|
END TRY
|
||||||
|
BEGIN CATCH -- Catch Block
|
||||||
|
IF( @@TRANCOUNT = 1 ) ROLLBACK -- Only rollback if top level
|
||||||
|
ELSE IF( @@TRANCOUNT > 1 ) COMMIT -- Otherwise commit. Top level will rollback
|
||||||
|
EXEC vlnErrorHandler
|
||||||
|
END CATCH
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: updateInfoByRecid Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: updateInfoByRecid Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[updateInfoByRecidRectype] ******/
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[updateInfoByRecidRectype]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [updateInfoByRecidRectype];
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[updateInfoByRecidRectype]
|
||||||
|
(
|
||||||
|
@ROTable char(8),
|
||||||
|
@RecID char(8),
|
||||||
|
@Info nvarchar(max),
|
||||||
|
@ModDateTime char(14),
|
||||||
|
@RecType int
|
||||||
|
)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN TRY -- Try Block
|
||||||
|
BEGIN TRANSACTION
|
||||||
|
UPDATE [ROALL]
|
||||||
|
SET
|
||||||
|
[Info]=@Info,
|
||||||
|
[ModDateTime]=@ModDateTime
|
||||||
|
WHERE [ROTable]=@ROTable AND [RecID]=@RecID AND [RecType]=@RecType
|
||||||
|
IF @@ROWCOUNT = 0
|
||||||
|
BEGIN
|
||||||
|
IF NOT exists(select * from [ROALL] WHERE [ROTable]=@ROTable AND [RecID]=@RecID AND [RecType]=@RecType)
|
||||||
|
RAISERROR('ROALL record has been deleted by another user', 16, 1)
|
||||||
|
ELSE
|
||||||
|
RAISERROR('ROALL has been edited by another user', 16, 1)
|
||||||
|
END
|
||||||
|
|
||||||
|
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||||
|
END TRY
|
||||||
|
BEGIN CATCH -- Catch Block
|
||||||
|
IF( @@TRANCOUNT = 1 ) ROLLBACK -- Only rollback if top level
|
||||||
|
ELSE IF( @@TRANCOUNT > 1 ) COMMIT -- Otherwise commit. Top level will rollback
|
||||||
|
EXEC vlnErrorHandler
|
||||||
|
END CATCH
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: updateInfoByRecidRectype Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: updateInfoByRecidRectype Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/****** Object: Table [dbo].[ROALL] ******/
|
||||||
|
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ROALL]') AND type in (N'U'))
|
||||||
|
DROP TABLE [dbo].[ROALL]
|
||||||
|
GO
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE TABLE [dbo].[ROALL](
|
||||||
|
[ROTable] [char](8) NOT NULL,
|
||||||
|
[RecID] [char](8) NOT NULL,
|
||||||
|
[RecType] [int] NOT NULL,
|
||||||
|
[ParentID] [char](8) NOT NULL,
|
||||||
|
[AccPageID] [char](32) NULL,
|
||||||
|
[ModDateTime] [char](14) NOT NULL,
|
||||||
|
[Info] [nvarchar](max) NULL,
|
||||||
|
CONSTRAINT [PK_ROMASTER] PRIMARY KEY CLUSTERED
|
||||||
|
(
|
||||||
|
[ROTable] ASC,
|
||||||
|
[RecID] ASC
|
||||||
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||||
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
||||||
|
-- Display the status of Table creation
|
||||||
|
IF (@@Error = 0) PRINT 'Table Creation: ROALL Succeeded'
|
||||||
|
ELSE PRINT 'Table Creation: DeleteLog ROALL on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
58
PROMS/VEPROMS User Interface/ROFixes.Sql
Normal file
58
PROMS/VEPROMS User Interface/ROFixes.Sql
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
if db_name() in('master','model','msdn','tempdb')
|
||||||
|
begin
|
||||||
|
DECLARE @ErrorMsg varchar(255)
|
||||||
|
SET @ErrorMsg = 'Don''t add these procedures and functions to ' + db_name()
|
||||||
|
PRINT '=========================================================================='
|
||||||
|
PRINT ''
|
||||||
|
PRINT @ErrorMsg
|
||||||
|
PRINT ''
|
||||||
|
PRINT 'You probably want to be in the VEPROMS Referenced Object (RO) database'
|
||||||
|
PRINT ''
|
||||||
|
PRINT '=========================================================================='
|
||||||
|
RAISERROR (@ErrorMsg, 20, -1) with log
|
||||||
|
RETURN
|
||||||
|
end
|
||||||
|
print 'Adding procedures and functions to ' + db_name()
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
| ADD New Code Before this Block |
|
||||||
|
| Change Date and Description |
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_GetSQLCodeRevision]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [vesp_GetSQLCodeRevision];
|
||||||
|
GO
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2019 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
CREATE PROCEDURE [dbo].[vesp_GetSQLCodeRevision]
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN TRY -- Try Block
|
||||||
|
BEGIN TRANSACTION
|
||||||
|
-- Change information in the next line when you are done
|
||||||
|
set nocount on
|
||||||
|
DECLARE @RevDate varchar(255)
|
||||||
|
DECLARE @RevDescription varchar(255)
|
||||||
|
set @RevDate = '01/09/2020 11:00 AM'
|
||||||
|
set @RevDescription = 'Initial Version'
|
||||||
|
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
||||||
|
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
||||||
|
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||||
|
END TRY
|
||||||
|
BEGIN CATCH -- Catch Block
|
||||||
|
IF( @@TRANCOUNT = 1 ) ROLLBACK -- Only rollback if top level
|
||||||
|
ELSE IF( @@TRANCOUNT > 1 ) COMMIT -- Otherwise commit. Top level will rollback
|
||||||
|
EXEC vlnErrorHandler
|
||||||
|
END CATCH
|
||||||
|
GO
|
||||||
|
-- Display the status of Proc creation
|
||||||
|
IF (@@Error = 0) PRINT 'StoredProcedure [vesp_GetSQLCodeRevision] Succeeded'
|
||||||
|
ELSE PRINT 'StoredProcedure [vesp_GetSQLCodeRevision] Error on Creation'
|
||||||
|
go
|
||||||
|
vesp_GetSQLCodeRevision
|
@ -32,6 +32,9 @@ namespace VEPROMS
|
|||||||
this.ppBtnOk = new System.Windows.Forms.Button();
|
this.ppBtnOk = new System.Windows.Forms.Button();
|
||||||
this.ppBtnCancel = new System.Windows.Forms.Button();
|
this.ppBtnCancel = new System.Windows.Forms.Button();
|
||||||
this.ppPnlRODb = new DevComponents.DotNetBar.PanelEx();
|
this.ppPnlRODb = new DevComponents.DotNetBar.PanelEx();
|
||||||
|
this.ppBtnTestSQL = new System.Windows.Forms.Button();
|
||||||
|
this.ppTxtSQL = new System.Windows.Forms.TextBox();
|
||||||
|
this.ppLblSQL = new System.Windows.Forms.Label();
|
||||||
this.ppTxtExt = new System.Windows.Forms.TextBox();
|
this.ppTxtExt = new System.Windows.Forms.TextBox();
|
||||||
this.ppTxtPath = new System.Windows.Forms.TextBox();
|
this.ppTxtPath = new System.Windows.Forms.TextBox();
|
||||||
this.ppLblGraphicFileExtLoc = new System.Windows.Forms.Label();
|
this.ppLblGraphicFileExtLoc = new System.Windows.Forms.Label();
|
||||||
@ -71,6 +74,9 @@ namespace VEPROMS
|
|||||||
//
|
//
|
||||||
this.ppPnlRODb.CanvasColor = System.Drawing.SystemColors.Control;
|
this.ppPnlRODb.CanvasColor = System.Drawing.SystemColors.Control;
|
||||||
this.ppPnlRODb.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
|
this.ppPnlRODb.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
|
||||||
|
this.ppPnlRODb.Controls.Add(this.ppBtnTestSQL);
|
||||||
|
this.ppPnlRODb.Controls.Add(this.ppTxtSQL);
|
||||||
|
this.ppPnlRODb.Controls.Add(this.ppLblSQL);
|
||||||
this.ppPnlRODb.Controls.Add(this.ppTxtExt);
|
this.ppPnlRODb.Controls.Add(this.ppTxtExt);
|
||||||
this.ppPnlRODb.Controls.Add(this.ppTxtPath);
|
this.ppPnlRODb.Controls.Add(this.ppTxtPath);
|
||||||
this.ppPnlRODb.Controls.Add(this.ppLblGraphicFileExtLoc);
|
this.ppPnlRODb.Controls.Add(this.ppLblGraphicFileExtLoc);
|
||||||
@ -92,6 +98,33 @@ namespace VEPROMS
|
|||||||
this.ppPnlRODb.Style.GradientAngle = 90;
|
this.ppPnlRODb.Style.GradientAngle = 90;
|
||||||
this.ppPnlRODb.TabIndex = 3;
|
this.ppPnlRODb.TabIndex = 3;
|
||||||
//
|
//
|
||||||
|
// ppBtnTestSQL
|
||||||
|
//
|
||||||
|
this.ppBtnTestSQL.Location = new System.Drawing.Point(542, 110);
|
||||||
|
this.ppBtnTestSQL.Name = "ppBtnTestSQL";
|
||||||
|
this.ppBtnTestSQL.Size = new System.Drawing.Size(82, 46);
|
||||||
|
this.ppBtnTestSQL.TabIndex = 44;
|
||||||
|
this.ppBtnTestSQL.Text = "Test Connect";
|
||||||
|
this.ppBtnTestSQL.UseVisualStyleBackColor = true;
|
||||||
|
this.ppBtnTestSQL.Click += new System.EventHandler(this.ppBtnTestSQL_Click);
|
||||||
|
//
|
||||||
|
// ppTxtSQL
|
||||||
|
//
|
||||||
|
this.ppTxtSQL.Location = new System.Drawing.Point(129, 156);
|
||||||
|
this.ppTxtSQL.Name = "ppTxtSQL";
|
||||||
|
this.ppTxtSQL.Size = new System.Drawing.Size(507, 22);
|
||||||
|
this.ppTxtSQL.TabIndex = 43;
|
||||||
|
this.ppTxtSQL.TextChanged += new System.EventHandler(this.ppTxtSQL_TextChanged);
|
||||||
|
//
|
||||||
|
// ppLblSQL
|
||||||
|
//
|
||||||
|
this.ppLblSQL.AutoSize = true;
|
||||||
|
this.ppLblSQL.Location = new System.Drawing.Point(30, 156);
|
||||||
|
this.ppLblSQL.Name = "ppLblSQL";
|
||||||
|
this.ppLblSQL.Size = new System.Drawing.Size(92, 17);
|
||||||
|
this.ppLblSQL.TabIndex = 42;
|
||||||
|
this.ppLblSQL.Text = "SQL Connect";
|
||||||
|
//
|
||||||
// ppTxtExt
|
// ppTxtExt
|
||||||
//
|
//
|
||||||
this.ppTxtExt.Enabled = false;
|
this.ppTxtExt.Enabled = false;
|
||||||
@ -203,5 +236,8 @@ namespace VEPROMS
|
|||||||
private System.Windows.Forms.Label ppLblExt;
|
private System.Windows.Forms.Label ppLblExt;
|
||||||
private System.Windows.Forms.TextBox ppTxtPath;
|
private System.Windows.Forms.TextBox ppTxtPath;
|
||||||
private System.Windows.Forms.TextBox ppTxtExt;
|
private System.Windows.Forms.TextBox ppTxtExt;
|
||||||
|
private System.Windows.Forms.Button ppBtnTestSQL;
|
||||||
|
private System.Windows.Forms.TextBox ppTxtSQL;
|
||||||
|
private System.Windows.Forms.Label ppLblSQL;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,6 +2,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Data.SqlClient;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
@ -58,6 +59,7 @@ namespace VEPROMS
|
|||||||
private RODbInfo _roDbInfo;
|
private RODbInfo _roDbInfo;
|
||||||
private string _origROName;
|
private string _origROName;
|
||||||
private string _origFolderPath;
|
private string _origFolderPath;
|
||||||
|
private string _origSQLConnect = null;
|
||||||
private DocVersion _docVersion;
|
private DocVersion _docVersion;
|
||||||
public frmRODbProperties(DocVersion docVersion, RODbInfo roDbInfo)
|
public frmRODbProperties(DocVersion docVersion, RODbInfo roDbInfo)
|
||||||
{
|
{
|
||||||
@ -66,6 +68,7 @@ namespace VEPROMS
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_origROName = (_roDbInfo == null) ? null : _roDbInfo.ROName;
|
_origROName = (_roDbInfo == null) ? null : _roDbInfo.ROName;
|
||||||
_origFolderPath = (_roDbInfo == null) ? null : _roDbInfo.FolderPath;
|
_origFolderPath = (_roDbInfo == null) ? null : _roDbInfo.FolderPath;
|
||||||
|
_origSQLConnect = (_roDbInfo == null) ? null : (_roDbInfo.DBConnectionString == null || _roDbInfo.DBConnectionString == "" || _roDbInfo.DBConnectionString == "cstring") ? null : _roDbInfo.DBConnectionString;
|
||||||
// Disable the OK button when initialized. Enable it if the user makes changes
|
// Disable the OK button when initialized. Enable it if the user makes changes
|
||||||
ppBtnOk.Enabled = false;
|
ppBtnOk.Enabled = false;
|
||||||
}
|
}
|
||||||
@ -86,7 +89,8 @@ namespace VEPROMS
|
|||||||
// check for modify. If the path to this rodb already exists, we've got to use that
|
// check for modify. If the path to this rodb already exists, we've got to use that
|
||||||
// as the assocation. if it's a new path, i.e. a modify of the rodb record, just save current data.
|
// as the assocation. if it's a new path, i.e. a modify of the rodb record, just save current data.
|
||||||
// Then close & return.
|
// Then close & return.
|
||||||
if (_origROName !=null && _origFolderPath !=null && (_origROName != ppRTxtName.Text || _origFolderPath != ppTxtPath.Text))
|
if ((_origROName !=null && _origFolderPath !=null && (_origROName != ppRTxtName.Text || _origFolderPath != ppTxtPath.Text)) ||
|
||||||
|
(_origSQLConnect != ppTxtSQL.Text || _origSQLConnect != ppTxtSQL.Text))
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(ppTxtPath.Text))
|
if (!Directory.Exists(ppTxtPath.Text))
|
||||||
{
|
{
|
||||||
@ -100,6 +104,12 @@ namespace VEPROMS
|
|||||||
}
|
}
|
||||||
RODb roDb = RODb.GetJustRoDb(_roDbInfo.RODbID);
|
RODb roDb = RODb.GetJustRoDb(_roDbInfo.RODbID);
|
||||||
if (_origROName != ppRTxtName.Text) roDb.ROName = ppRTxtName.Text;
|
if (_origROName != ppRTxtName.Text) roDb.ROName = ppRTxtName.Text;
|
||||||
|
if (!(_origSQLConnect == "cstring" && (ppTxtSQL.Text == null || ppTxtSQL.Text == "")) && _origSQLConnect != ppTxtSQL.Text)
|
||||||
|
{
|
||||||
|
// C2017-003: ro in sql. 'cstring' in connection string represents using MS Access database
|
||||||
|
// if connect string is null, set connect string to "cstring" otherwise, use what user typed in:
|
||||||
|
roDb.DBConnectionString = (ppTxtSQL.Text == null || ppTxtSQL.Text == "") ? "cstring" : ppTxtSQL.Text;
|
||||||
|
}
|
||||||
if (_origFolderPath != ppTxtPath.Text)
|
if (_origFolderPath != ppTxtPath.Text)
|
||||||
{
|
{
|
||||||
// see if an rodb already exists with this pathname.
|
// see if an rodb already exists with this pathname.
|
||||||
@ -184,7 +194,8 @@ namespace VEPROMS
|
|||||||
MessageBox.Show("No existing ro.fst in path " + ppTxtPath.Text + ". Check for invalid path");
|
MessageBox.Show("No existing ro.fst in path " + ppTxtPath.Text + ". Check for invalid path");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RODb newroDb = RODb.MakeRODb(ppRTxtName.Text, ppTxtPath.Text, "cstring", null);
|
string connectstr = ppTxtSQL.Text != null && ppTxtSQL.Text != "" ? ppTxtExt.Text : "cstring";
|
||||||
|
RODb newroDb = RODb.MakeRODb(ppRTxtName.Text, ppTxtPath.Text, connectstr, null);
|
||||||
RODbInfo newrdi = RODbInfo.Get(newroDb.RODbID);
|
RODbInfo newrdi = RODbInfo.Get(newroDb.RODbID);
|
||||||
newroDb.Save().Dispose();
|
newroDb.Save().Dispose();
|
||||||
ROFst rofst = ROFstInfo.AddRoFst(newrdi, _docVersion, DoProgressBarRefresh);
|
ROFst rofst = ROFstInfo.AddRoFst(newrdi, _docVersion, DoProgressBarRefresh);
|
||||||
@ -196,6 +207,7 @@ namespace VEPROMS
|
|||||||
Location = ParentLocation;
|
Location = ParentLocation;
|
||||||
ppRTxtName.Text = (_roDbInfo == null) ? null : _roDbInfo.ROName;
|
ppRTxtName.Text = (_roDbInfo == null) ? null : _roDbInfo.ROName;
|
||||||
ppTxtPath.Text = (_roDbInfo == null) ? null : _roDbInfo.FolderPath;
|
ppTxtPath.Text = (_roDbInfo == null) ? null : _roDbInfo.FolderPath;
|
||||||
|
ppTxtSQL.Text = (_roDbInfo == null) ? null : (_roDbInfo.DBConnectionString == "cstring") ? null : _roDbInfo.DBConnectionString;
|
||||||
RODbConfig cfg = (_roDbInfo == null) ? new RODbConfig() : new RODbConfig(_roDbInfo);
|
RODbConfig cfg = (_roDbInfo == null) ? new RODbConfig() : new RODbConfig(_roDbInfo);
|
||||||
// Note that the Graphic Extension data is shown in a non-editable text box here because
|
// Note that the Graphic Extension data is shown in a non-editable text box here because
|
||||||
// the data is either retrieved from the roapp.ini - and if there can only be editted from
|
// the data is either retrieved from the roapp.ini - and if there can only be editted from
|
||||||
@ -235,5 +247,38 @@ namespace VEPROMS
|
|||||||
//The OK button should only be enabled if the path has changed
|
//The OK button should only be enabled if the path has changed
|
||||||
ppBtnOk.Enabled = _origFolderPath != ppTxtPath.Text;
|
ppBtnOk.Enabled = _origFolderPath != ppTxtPath.Text;
|
||||||
}
|
}
|
||||||
|
private void ppTxtSQL_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//The OK button should only be enabled if the path has changed
|
||||||
|
ppBtnOk.Enabled = _origSQLConnect != ppTxtSQL.Text;
|
||||||
|
}
|
||||||
|
// C2017-003: test that the sql string entered can connect to the database:
|
||||||
|
private void ppBtnTestSQL_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SqlConnection connection = new SqlConnection(ppTxtSQL.Text))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
connection.Open();
|
||||||
|
if (connection.State == ConnectionState.Open)
|
||||||
|
{
|
||||||
|
MessageBox.Show("You have been successfully connected to the database!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Connection failed.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (SqlException) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Connection failed: " + ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -98,6 +98,7 @@ namespace VEPROMS
|
|||||||
this.tcpGeneral = new DevComponents.DotNetBar.TabControlPanel();
|
this.tcpGeneral = new DevComponents.DotNetBar.TabControlPanel();
|
||||||
this.tiGeneral = new DevComponents.DotNetBar.TabItem(this.components);
|
this.tiGeneral = new DevComponents.DotNetBar.TabItem(this.components);
|
||||||
this.tcpRefereceObjects = new DevComponents.DotNetBar.TabControlPanel();
|
this.tcpRefereceObjects = new DevComponents.DotNetBar.TabControlPanel();
|
||||||
|
this.ppBtnRoToSql = new System.Windows.Forms.Button();
|
||||||
this.tbRoDb = new System.Windows.Forms.TextBox();
|
this.tbRoDb = new System.Windows.Forms.TextBox();
|
||||||
this.ppBtnRoDbBrowse = new System.Windows.Forms.Button();
|
this.ppBtnRoDbBrowse = new System.Windows.Forms.Button();
|
||||||
this.btnRoDbProperties = new DevComponents.DotNetBar.ButtonX();
|
this.btnRoDbProperties = new DevComponents.DotNetBar.ButtonX();
|
||||||
@ -1161,6 +1162,7 @@ namespace VEPROMS
|
|||||||
//
|
//
|
||||||
// tcpRefereceObjects
|
// tcpRefereceObjects
|
||||||
//
|
//
|
||||||
|
this.tcpRefereceObjects.Controls.Add(this.ppBtnRoToSql);
|
||||||
this.tcpRefereceObjects.Controls.Add(this.tbRoDb);
|
this.tcpRefereceObjects.Controls.Add(this.tbRoDb);
|
||||||
this.tcpRefereceObjects.Controls.Add(this.ppBtnRoDbBrowse);
|
this.tcpRefereceObjects.Controls.Add(this.ppBtnRoDbBrowse);
|
||||||
this.tcpRefereceObjects.Controls.Add(this.btnRoDbProperties);
|
this.tcpRefereceObjects.Controls.Add(this.btnRoDbProperties);
|
||||||
@ -1185,6 +1187,17 @@ namespace VEPROMS
|
|||||||
this.tcpRefereceObjects.TabItem = this.tiRefObjs;
|
this.tcpRefereceObjects.TabItem = this.tiRefObjs;
|
||||||
this.tcpRefereceObjects.Enter += new System.EventHandler(this.tabpage_Enter);
|
this.tcpRefereceObjects.Enter += new System.EventHandler(this.tabpage_Enter);
|
||||||
//
|
//
|
||||||
|
// ppBtnRoToSql
|
||||||
|
//
|
||||||
|
this.ppBtnRoToSql.Location = new System.Drawing.Point(337, 146);
|
||||||
|
this.ppBtnRoToSql.Name = "ppBtnRoToSql";
|
||||||
|
this.ppBtnRoToSql.Size = new System.Drawing.Size(163, 46);
|
||||||
|
this.ppBtnRoToSql.TabIndex = 48;
|
||||||
|
this.ppBtnRoToSql.Text = "Migrate Data to Sql";
|
||||||
|
this.ppBtnRoToSql.UseVisualStyleBackColor = true;
|
||||||
|
this.ppBtnRoToSql.Visible = false;
|
||||||
|
this.ppBtnRoToSql.Click += new System.EventHandler(this.ppBtnRoToSql_Click);
|
||||||
|
//
|
||||||
// tbRoDb
|
// tbRoDb
|
||||||
//
|
//
|
||||||
this.tbRoDb.Enabled = false;
|
this.tbRoDb.Enabled = false;
|
||||||
@ -2903,6 +2916,7 @@ namespace VEPROMS
|
|||||||
private DevComponents.DotNetBar.Controls.ComboBoxEx ppCmbxMOSfontName;
|
private DevComponents.DotNetBar.Controls.ComboBoxEx ppCmbxMOSfontName;
|
||||||
private DevComponents.DotNetBar.ButtonX btnMergedOutputSettngs;
|
private DevComponents.DotNetBar.ButtonX btnMergedOutputSettngs;
|
||||||
private DevComponents.DotNetBar.Controls.CheckBoxX ppChbxMOSview;
|
private DevComponents.DotNetBar.Controls.CheckBoxX ppChbxMOSview;
|
||||||
|
private System.Windows.Forms.Button ppBtnRoToSql;
|
||||||
private System.Windows.Forms.CheckBox ppChbxEnhancedAllowMods;
|
private System.Windows.Forms.CheckBox ppChbxEnhancedAllowMods;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -318,6 +318,8 @@ namespace VEPROMS
|
|||||||
{
|
{
|
||||||
RODbInfo rdi = RODbInfo.GetJustRODB(SelectedROFst.RODbID);
|
RODbInfo rdi = RODbInfo.GetJustRODB(SelectedROFst.RODbID);
|
||||||
tbRoDb.Text = string.Format("{0} ({1})", rdi.ROName, rdi.FolderPath);
|
tbRoDb.Text = string.Format("{0} ({1})", rdi.ROName, rdi.FolderPath);
|
||||||
|
ppBtnRoToSql.Visible = ppBtnRoToSql.Enabled = CanMigrateRoAccessToSql(rdi); // C2017-003: make button visible if ro migration is doable
|
||||||
|
_CurRoDbInfo = rdi;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -328,7 +330,12 @@ namespace VEPROMS
|
|||||||
foreach (RODbInfo rdi in RODbInfoList.Get())
|
foreach (RODbInfo rdi in RODbInfoList.Get())
|
||||||
{
|
{
|
||||||
int i = cmbRoDb.Items.Add(string.Format("{0} ({1})", rdi.ROName, rdi.FolderPath));
|
int i = cmbRoDb.Items.Add(string.Format("{0} ({1})", rdi.ROName, rdi.FolderPath));
|
||||||
if (rdi.RODbID == myrodbid) selindx = i;
|
if (rdi.RODbID == myrodbid)
|
||||||
|
{
|
||||||
|
selindx = i;
|
||||||
|
ppBtnRoToSql.Visible = ppBtnRoToSql.Enabled = CanMigrateRoAccessToSql(rdi); // C2017-003: make button visible if ro migration is doable
|
||||||
|
_CurRoDbInfo = rdi;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (cmbRoDb.Items.Count > 0) cmbRoDb.SelectedIndex = selindx;
|
if (cmbRoDb.Items.Count > 0) cmbRoDb.SelectedIndex = selindx;
|
||||||
}
|
}
|
||||||
@ -1314,7 +1321,7 @@ namespace VEPROMS
|
|||||||
// KBR & it was decided that we'd wait to see if users end up needing this. It can be done by going
|
// KBR & it was decided that we'd wait to see if users end up needing this. It can be done by going
|
||||||
// into the sql database and modify/delete records if needed.
|
// into the sql database and modify/delete records if needed.
|
||||||
}
|
}
|
||||||
|
private RODbInfo _CurRoDbInfo = null;
|
||||||
private void cmbRoDb_SelectedIndexChanged(object sender, EventArgs e)
|
private void cmbRoDb_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// The only way that a selected index can change on the rodb combo box is if there was no rofst
|
// The only way that a selected index can change on the rodb combo box is if there was no rofst
|
||||||
@ -1337,7 +1344,9 @@ namespace VEPROMS
|
|||||||
cmbRoDb.Visible = ppBtnRoDbBrowse.Visible = false;
|
cmbRoDb.Visible = ppBtnRoDbBrowse.Visible = false;
|
||||||
tbRoDb.Visible = btnRoDbProperties.Visible = true;
|
tbRoDb.Visible = btnRoDbProperties.Visible = true;
|
||||||
tbRoDb.Text = string.Format("{0} ({1})", fst.MyRODb.ROName, fst.MyRODb.FolderPath);
|
tbRoDb.Text = string.Format("{0} ({1})", fst.MyRODb.ROName, fst.MyRODb.FolderPath);
|
||||||
|
// C2017-003: See if the selected ro databasew has been converted to sql and if not, make visible a button to convert the data.
|
||||||
|
ppBtnRoToSql.Visible = ppBtnRoToSql.Enabled = CanMigrateRoAccessToSql(fst.MyRODb);
|
||||||
|
_CurRoDbInfo = fst.MyRODb;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1359,7 +1368,31 @@ namespace VEPROMS
|
|||||||
cmbRoDb.Visible = ppBtnRoDbBrowse.Visible = false;
|
cmbRoDb.Visible = ppBtnRoDbBrowse.Visible = false;
|
||||||
tbRoDb.Visible = btnRoDbProperties.Visible = true;
|
tbRoDb.Visible = btnRoDbProperties.Visible = true;
|
||||||
tbRoDb.Text = string.Format("{0} ({1})", tmp.MyRODb.ROName, tmp.MyRODb.FolderPath);
|
tbRoDb.Text = string.Format("{0} ({1})", tmp.MyRODb.ROName, tmp.MyRODb.FolderPath);
|
||||||
|
// C2017-003: See if the selected ro database has been converted to sql and if not, make visible a button to convert the data.
|
||||||
|
RODbInfo rodbi = RODbInfo.GetJustRODB(tmp.MyRODb.RODbID);
|
||||||
|
ppBtnRoToSql.Visible = ppBtnRoToSql.Enabled = CanMigrateRoAccessToSql(rodbi);
|
||||||
|
_CurRoDbInfo = rodbi;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CanMigrateRoAccessToSql(RODbInfo rODbi)
|
||||||
|
{
|
||||||
|
// C2017-003: This method is used to determine whether RO data can be migrated from MS Access to sql server
|
||||||
|
// A command line argument 'RoInSql'. For now, this argument must be used to allow code to run for ro->sql. Later
|
||||||
|
// this will be changed so that if arugment is used, the program does NOT include button.
|
||||||
|
if (!Volian.Base.Library.VlnSettings.GetCommandFlag("RoInSql")) return false;
|
||||||
|
|
||||||
|
// The following conditions must be true in order to migrate the ro data to sql. Only the first condition can be
|
||||||
|
// tested in this executable since the roall database is interfaced to by the roeditor & the program that migrates the data.
|
||||||
|
// The migration program will make the 2-4 tests, put up a message box if it cannot migrate & will send a failure back
|
||||||
|
// to this program, PROMS.
|
||||||
|
// 1) the user must be an admin and the rodb record's connection string must be 'cstring' (it is the connection string if data was migrated)
|
||||||
|
// 2) the roall database must exist when using the rodb record's connection string and this database must have the stored procedures
|
||||||
|
// 3) roall must be empty
|
||||||
|
// 4) the database must be the correct version
|
||||||
|
UserInfo ui = UserInfo.GetByUserID(VlnSettings.UserID);
|
||||||
|
if (!ui.IsAdministrator()) return false;
|
||||||
|
return (rODbi.DBConnectionString == "cstring");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ppBtnRoDbBrowse_Click(object sender, EventArgs e)
|
private void ppBtnRoDbBrowse_Click(object sender, EventArgs e)
|
||||||
@ -1700,6 +1733,50 @@ namespace VEPROMS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// C2017-003: The button to migrate ro data from MS Access to sql server was clicked:
|
||||||
|
private void ppBtnRoToSql_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string exelocation = Application.ExecutablePath;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Application.DoEvents();
|
||||||
|
exelocation = exelocation.Substring(0, exelocation.LastIndexOf("\\")) + @"\RoAccessToSql.exe";
|
||||||
|
int indx = tbRoDb.Text.IndexOf(" (")+2;
|
||||||
|
string accesspath = tbRoDb.Text.Substring(indx, tbRoDb.Text.Length - indx - 1);
|
||||||
|
string sqldb = Database.ActiveDatabase;
|
||||||
|
indx = Database.DBServer.IndexOf(" ");
|
||||||
|
string server = Database.DBServer.Substring(0, indx);
|
||||||
|
string args = @"/acc=" + accesspath + @" /sqldb=" + sqldb + @" /server=" + server;
|
||||||
|
System.Diagnostics.Process p = System.Diagnostics.Process.Start(exelocation, args);
|
||||||
|
p.WaitForExit(); // without arguments, this will wait indefinitely
|
||||||
|
Application.DoEvents();
|
||||||
|
string _TmpFileForConnectStr = Path.GetTempPath();
|
||||||
|
_TmpFileForConnectStr = _TmpFileForConnectStr + @"\PromsConnect.txt";
|
||||||
|
if (File.Exists(_TmpFileForConnectStr)) // if conversion was done, the connection string will be added to the promsconnect.txt file
|
||||||
|
{
|
||||||
|
string constring = File.ReadAllText(_TmpFileForConnectStr);
|
||||||
|
if (constring != null && constring != "" && constring.ToUpper().Contains("DATA SOURCE"))
|
||||||
|
{
|
||||||
|
// read in the connection string & set for this rodbinfo
|
||||||
|
using (RODb rodbtmp = RODb.GetJustRoDb(_CurRoDbInfo.RODbID))
|
||||||
|
{
|
||||||
|
rodbtmp.DBConnectionString = File.ReadAllText(_TmpFileForConnectStr);
|
||||||
|
rodbtmp.Save();
|
||||||
|
}
|
||||||
|
// to be sure all aspects of program are using the converted database, tell user to restart:
|
||||||
|
MessageBox.Show(this, "Restart PROMS to have referenced object database migration take effect.", "", MessageBoxButtons.OK);
|
||||||
|
}
|
||||||
|
ppBtnRoToSql.Visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
while (ex.InnerException != null)
|
||||||
|
ex = ex.InnerException;
|
||||||
|
string tmpmsg = ex.Message;
|
||||||
|
MessageBox.Show(tmpmsg, "Migration Error: " + ex.GetType().Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
[XmlRoot("Enhanced")]
|
[XmlRoot("Enhanced")]
|
||||||
|
@ -327,7 +327,7 @@ public static string DBServer
|
|||||||
tsmi.Font = new System.Drawing.Font(tsmi.Font, System.Drawing.FontStyle.Bold);
|
tsmi.Font = new System.Drawing.Font(tsmi.Font, System.Drawing.FontStyle.Bold);
|
||||||
foreach (DataRow dr in ds.Tables[0].Rows)
|
foreach (DataRow dr in ds.Tables[0].Rows)
|
||||||
{
|
{
|
||||||
if (dr["functionality"].ToString() == "Approval")
|
if (dr["functionality"].ToString() == "Approval" && !dr["name"].ToString().EndsWith("_RO")) // don't display sql ro databases in list
|
||||||
cms.Items.Add(dr["name"].ToString(), null, new EventHandler(Database_Click));
|
cms.Items.Add(dr["name"].ToString(), null, new EventHandler(Database_Click));
|
||||||
}
|
}
|
||||||
return cms;
|
return cms;
|
||||||
|
@ -882,6 +882,8 @@ namespace Volian.Controls.Library
|
|||||||
ROFSTLookup.rochild roch = (ROFSTLookup.rochild)obj;
|
ROFSTLookup.rochild roch = (ROFSTLookup.rochild)obj;
|
||||||
_SelectedRoidBeforeRoEditor = roch.roid;
|
_SelectedRoidBeforeRoEditor = roch.roid;
|
||||||
string args = "\"" + _MyROFST.MyRODb.FolderPath + "\" " + roch.roid.ToLower();
|
string args = "\"" + _MyROFST.MyRODb.FolderPath + "\" " + roch.roid.ToLower();
|
||||||
|
// C2017-003: ro data in sql server, check for sql connection string
|
||||||
|
if (_MyROFST.MyRODb.DBConnectionString != "cstring") args = args + " \"" + _MyROFST.MyRODb.DBConnectionString + "\"";
|
||||||
System.Diagnostics.Process.Start(roapp, args);
|
System.Diagnostics.Process.Start(roapp, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -922,6 +924,8 @@ namespace Volian.Controls.Library
|
|||||||
FlexibleMessageBox.Show(string.Format("RO Database directory does not exist: {0}", _MyROFST.MyRODb.FolderPath));
|
FlexibleMessageBox.Show(string.Format("RO Database directory does not exist: {0}", _MyROFST.MyRODb.FolderPath));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// C2017-003: ro data in sql server, check for sql connection string
|
||||||
|
if (_MyROFST.MyRODb.DBConnectionString != "cstring") args = args + " \"" + _MyROFST.MyRODb.DBConnectionString + "\"";
|
||||||
System.Diagnostics.Process.Start(roapp, args);
|
System.Diagnostics.Process.Start(roapp, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -936,9 +936,11 @@ namespace Volian.Controls.Library
|
|||||||
sw.Close();
|
sw.Close();
|
||||||
}
|
}
|
||||||
string roloc = "\"" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\" \"/f=" + fname + "\"";
|
string roloc = "\"" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\" \"/f=" + fname + "\"";
|
||||||
|
// C2017-003: ro data in sql server, check for sql connection string
|
||||||
|
if (MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.DBConnectionString != "cstring") roloc = roloc + " \"/sql=" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.DBConnectionString + "\"";
|
||||||
System.Diagnostics.Process p = System.Diagnostics.Process.Start(cmpRptExePath, roloc);
|
System.Diagnostics.Process p = System.Diagnostics.Process.Start(cmpRptExePath, roloc);
|
||||||
// need to wait, sometimes the Print.tmp file that is generated is not available
|
// need to wait, sometimes the Print.tmp file that is generated is not available
|
||||||
p.WaitForExit(); // without arguments, this will wait indefinately
|
p.WaitForExit(); // without arguments, this will wait indefinitely
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -2886,6 +2886,8 @@ namespace Volian.Controls.Library
|
|||||||
FlexibleMessageBox.Show(string.Format("RO Database directory does not exist: {0}", myRODB.FolderPath));
|
FlexibleMessageBox.Show(string.Format("RO Database directory does not exist: {0}", myRODB.FolderPath));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// C2017-003: ro data in sql server, check for sql connection string
|
||||||
|
if (myRODB.DBConnectionString != "cstring") args = args + " \"" + myRODB.DBConnectionString + "\"";
|
||||||
System.Diagnostics.Process.Start(roapp, args);
|
System.Diagnostics.Process.Start(roapp, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3031,6 +3033,8 @@ namespace Volian.Controls.Library
|
|||||||
FlexibleMessageBox.Show(string.Format("RO Database directory does not exist: {0}", Mydvi.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath));
|
FlexibleMessageBox.Show(string.Format("RO Database directory does not exist: {0}", Mydvi.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// C2017-003: ro data in sql server, check for sql connection string
|
||||||
|
if (Mydvi.DocVersionAssociations[0].MyROFst.MyRODb.DBConnectionString != "cstring") roloc = roloc + " \"" + Mydvi.DocVersionAssociations[0].MyROFst.MyRODb.DBConnectionString + "\"";
|
||||||
System.Diagnostics.Process.Start(roapp, roloc);
|
System.Diagnostics.Process.Start(roapp, roloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2045,6 +2045,8 @@ namespace Volian.Controls.Library
|
|||||||
FlexibleMessageBox.Show(string.Format("RO Database directory does not exist: {0}", MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath));
|
FlexibleMessageBox.Show(string.Format("RO Database directory does not exist: {0}", MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// C2017-003: ro data in sql server, check for sql connection string
|
||||||
|
if (MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.DBConnectionString != "cstring") roloc = roloc + " \"" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.DBConnectionString + "\"";
|
||||||
System.Diagnostics.Process.Start(roapp, roloc);
|
System.Diagnostics.Process.Start(roapp, roloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user