Skip to content

Commit

Permalink
Data Utility Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ljlclark committed Dec 24, 2024
1 parent 3dd2720 commit 9e05b3c
Show file tree
Hide file tree
Showing 7 changed files with 450 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ private void InitializeControls()
SequenceText.MaxLength = DataUtilColumn.LengthSequence;
MaxLengthText.MaxLength = DataUtilColumn.LengthMaxLength;
NewMaxLengthText.MaxLength = DataUtilColumn.LengthMaxLength;
DefaultText.MaxLength = DataUtilColumn.LengthDefaualtValue;
DefaultText.MaxLength = DataUtilColumn.LengthDefaultValue;
IdentityStartText.MaxLength = DataUtilColumn.LengthIdentityStart;
IdentityIncrementText.MaxLength = DataUtilColumn.LengthIdentityIncrement;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
<HintPath>External\LJCDBClientLib.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="LJCDBDataAccess, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\External\LJCDBDataAccess.dll</HintPath>
</Reference>
<Reference Include="LJCDBMessage">
<HintPath>..\External\LJCDBMessage.dll</HintPath>
</Reference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ public Int16 NewMaxLength
public static int LengthMaxLength = 3;

/// <summary>The MaxLength maximum length.</summary>
public static int LengthDefaualtValue = 30;
public static int LengthDefaultValue = 30;
#endregion
}

Expand Down
238 changes: 238 additions & 0 deletions CoreUtilities/LJCDataUtility/LJCDataUtilityDAL/Data/ForeignKey.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
// Copyright(c) Lester J.Clark and Contributors.
// Licensed under the MIT License.
// ForeignKey.cs
using LJCDBClientLib;
using LJCNetCommon;
using System;

namespace LJCDataUtilityDAL
{
/// <summary>The DataColumn Data Object.</summary>
public class ForeignKey : IComparable<ForeignKey>
{
#region Constructors

// Initializes an object instance.
/// <include path='items/DefaultConstructor/*' file='../../LJCDocLib/Common/Data.xml'/>
public ForeignKey()
{
}

// The Copy constructor.
/// <include path='items/CopyConstructor/*' file='../../LJCDocLib/Common/Data.xml'/>
public ForeignKey(ForeignKey item)
{
DBName = item.DBName;
TableSchema = item.TableSchema;
TableName = item.TableName;
ColumnName = item.ColumnName;
ConstraintDBName = item.ConstraintDBName;
ConstraintSchema = item.ConstraintSchema;
ConstraintName = item.ConstraintName;
UniqueConstraintName = item.UniqueConstraintName;
UpdateRule = item.UpdateRule;
DeleteRule = item.DeleteRule;
TargetTable = item.TargetTable;
TargetColumn = item.TargetColumn;
OrdinalPosition = item.OrdinalPosition;
}
#endregion

#region Data Class Methods

// Creates and returns a clone of this object.
/// <include path='items/Clone/*' file='../../LJCDocLib/Common/Data.xml'/>
public ForeignKey Clone()
{
var retValue = MemberwiseClone() as ForeignKey;
return retValue;
}

// Provides the default Sort functionality.
/// <include path='items/CompareTo/*' file='../../LJCDocLib/Common/Data.xml'/>
public int CompareTo(ForeignKey other)
{
int retValue;

if (null == other)
{
// This value is greater than null.
retValue = 1;
}
else
{
// Case sensitive.
retValue = ConstraintName.CompareTo(other.ConstraintName);
}
return retValue;
}
#endregion

#region Data Properties

// Update ChangedNames.Add() statements to "Property" constant
// if property was renamed.

/// <summary>Gets or sets the DBName value.</summary>
public String DBName
{
get { return mDBName; }
set
{
mDBName = NetString.InitString(value);
}
}
private String mDBName;

/// <summary>Gets or sets the TableSchema value.</summary>
public String TableSchema
{
get { return mTableSchema; }
set
{
mTableSchema = NetString.InitString(value);
}
}
private String mTableSchema;

/// <summary>Gets or sets the TableName value.</summary>
public String TableName
{
get { return mTableName; }
set
{
mTableName = NetString.InitString(value);
}
}
private String mTableName;

/// <summary>Gets or sets the ColumnName value.</summary>
public String ColumnName
{
get { return mColumnName; }
set
{
mColumnName = NetString.InitString(value);
}
}
private String mColumnName;

/// <summary>Gets or sets the ConstraintDBName value.</summary>
public String ConstraintDBName
{
get { return mConstraintDBName; }
set
{
mConstraintDBName = NetString.InitString(value);
}
}
private String mConstraintDBName;

/// <summary>Gets or sets the ConstraintSchema value.</summary>
public String ConstraintSchema
{
get { return mConstraintSchema; }
set
{
mConstraintSchema = NetString.InitString(value);
}
}
private String mConstraintSchema;

/// <summary>Gets or sets the ConstraintName value.</summary>
public String ConstraintName
{
get { return mConstraintName; }
set
{
mConstraintName = NetString.InitString(value);
}
}
private String mConstraintName;

/// <summary>Gets or sets the UniqueConstraintName value.</summary>
public String UniqueConstraintName
{
get { return mUniqueConstraintName; }
set
{
mUniqueConstraintName = NetString.InitString(value);
}
}
private String mUniqueConstraintName;

/// <summary>Gets or sets the UpdateRule value.</summary>
public String UpdateRule
{
get { return mUpdateRule; }
set
{
mUpdateRule = NetString.InitString(value);
}
}
private String mUpdateRule;

/// <summary>Gets or sets the DeleteRule value.</summary>
public String DeleteRule
{
get { return mDeleteRule; }
set
{
mDeleteRule = NetString.InitString(value);
}
}
private String mDeleteRule;

/// <summary>Gets or sets the TargetTable value.</summary>
public String TargetTable
{
get { return mTargetTable; }
set
{
mTargetTable = NetString.InitString(value);
}
}
private String mTargetTable;

/// <summary>Gets or sets the TargetColumn value.</summary>
public String TargetColumn
{
get { return mTargetColumn; }
set
{
mTargetColumn = NetString.InitString(value);
}
}
private String mTargetColumn;

/// <summary>Gets or sets the OrdinalPosition value.</summary>
public String OrdinalPosition
{
get { return mOrdinalPosition; }
set
{
mOrdinalPosition = NetString.InitString(value);
}
}
private String mOrdinalPosition;
#endregion

#region Class Data

/// <summary>The ID column name.</summary>
public static string ColumnDBName = "TableCatalog";
public static string ColumnTableSchema = "TableSchema";
public static string ColumnTableName = "TableName";
public static string ColumnColumnName = "ColumnName";
public static string ColumnConstraintDBName = "ConstraintDBName";
public static string ColumnConstraintSchema = "ConstraintSchema";
public static string ColumnConstraintName = "ConstraintName";
public static string ColumnUniqueConstraintName = "UniqueConstraintName";
public static string ColumnUpdateRule = "UpdateRule";
public static string ColumnDeleteRule = "DeleteRule";
public static string ColumnTargetTable = "TargetTable";
public static string ColumnTargetColumn = "TargetColumn";
public static string ColumnOrdinalPosition = "OrdinalPosition";
#endregion
}
}
111 changes: 111 additions & 0 deletions CoreUtilities/LJCDataUtility/LJCDataUtilityDAL/Data/ForeignKeys.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
// Copyright(c) Lester J.Clark and Contributors.
// Licensed under the MIT License.
// ForeignKeys.cs
using LJCNetCommon;
using System;
using System.Collections.Generic;

namespace LJCDataUtilityDAL
{
/// <summary>Represents a collection of ForeignKey objects.</summary>
public class ForeignKeys : List<ForeignKey>
{
#region Constructors

// Initializes an object instance.
/// <include path='items/DefaultConstructor/*' file='../../LJCDocLib/Common/Data.xml'/>
public ForeignKeys()
{
mPrevCount = -1;
}

// The Copy constructor.
/// <include path='items/CopyConstructor/*' file='../../LJCDocLib/Common/Collection.xml'/>
public ForeignKeys(ForeignKeys items)
{
if (NetCommon.HasItems(items))
{
foreach (var item in items)
{
Add(new ForeignKey(item));
}
}
}
#endregion

#region Collection Methods

// Creates and returns a clone of the object.
/// <include path='items/Clone/*' file='../../LJCDocLib/Common/Data.xml'/>
public ForeignKeys Clone()
{
var retValue = new ForeignKeys();
foreach (ForeignKey foreignKey in this)
{
retValue.Add(foreignKey.Clone());
}
return retValue;
}

// Checks if the collection has items.
/// <include path='items/HasItems2/*' file='../../LJCDocLib/Common/Collection.xml'/>
public bool HasItems()
{
bool retValue = false;

if (Count > 0)
{
retValue = true;
}
return retValue;
}
#endregion

#region Search and Sort Methods

// Retrieve the collection element.
/// <include path='items/LJCSearchCode/*' file='../../LJCDocLib/Common/Collection.xml'/>
public ForeignKey LJCSearchName(string constraintName)
{
ForeignKey retValue = null;

LJCSortName();
ForeignKey searchItem = new ForeignKey()
{
UpdateRule = constraintName,
};
int index = BinarySearch(searchItem);
if (index > -1)
{
retValue = this[index];
}
return retValue;
}

/// <summary>Sort on Code.</summary>
public void LJCSortName()
{
if (Count != mPrevCount)
{
mPrevCount = Count;
Sort();
}
}
#endregion

#region Properties

// The item for the specified name.
/// <include path='items/Item/*' file='Doc/DbColumns.xml'/>
public ForeignKey this[string name]
{
get { return LJCSearchName(name); }
}
#endregion

#region Class Data

private int mPrevCount;
#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Data\ForeignKey.cs" />
<Compile Include="Data\ForeignKeys.cs" />
<Compile Include="ManagersDataUtility.cs" />
<Compile Include="Data\DataUtilColumn.cs" />
<Compile Include="Data\DataColumns.cs" />
Expand All @@ -70,6 +72,7 @@
<Compile Include="Data\DataTables.cs" />
<Compile Include="Manager\DataModuleManager.cs" />
<Compile Include="Manager\DataTableManager,.cs" />
<Compile Include="Manager\ForeignKeyManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ValuesDataUtility.CS" />
</ItemGroup>
Expand Down
Loading

0 comments on commit 9e05b3c

Please sign in to comment.