Esempio n. 1
0
        /// <summary>ArchiveChildrens a Sector record.</summary>
        /// <param name="transaction">Commits or rejects a set of commands as a unit</param>
        /// <param name="rowVersion">the version number of this row.</param>
        /// <param name="sectorId">The value for the SectorId column.</param>
        /// <param name="archive">true to archive the object, false to unarchive it.</param>
        internal static void ArchiveChildren(AdoTransaction adoTransaction, SqlTransaction sqlTransaction, long rowVersion, int sectorId)
        {
            // Accessor for the Sector Table.
            ServerDataModel.SectorDataTable sectorTable = ServerDataModel.Sector;
            // This record can be used to iterate through all the children.
            ServerDataModel.SectorRow sectorRow = sectorTable.FindBySectorId(sectorId);
            // Archive the child records.
            for (int index = 0; (index < sectorRow.GetSectorTargetRows().Length); index = (index + 1))
            {
                ServerDataModel.SectorTargetRow childSectorTargetRow = sectorRow.GetSectorTargetRows()[index];
                SectorTarget.Archive(adoTransaction, sqlTransaction, childSectorTargetRow.RowVersion, childSectorTargetRow.ModelId, childSectorTargetRow.SectorId);
            }
            // Increment the row version
            rowVersion = ServerDataModel.RowVersion.Increment();
            // Delete the record in the ADO database.
            sectorRow[sectorTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(sectorRow);
            sectorRow.Delete();
            // Archive the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"Sector\" set \"IsArchived\" = 1 where \"SectorId\"=@sectorId");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@sectorId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, sectorId));
            sqlCommand.ExecuteNonQuery();
        }
Esempio n. 2
0
 /// <summary>Updates a Sector record using Metadata Parameters.</summary>
 /// <param name="transaction">Contains the parameters and exceptions for this command.</param>
 public new static void Update(ParameterList parameters)
 {
     // Accessor for the Sector Table.
     ServerDataModel.SectorDataTable sectorTable = ServerDataModel.Sector;
     // Extract the parameters from the command batch.
     AdoTransaction adoTransaction = parameters["adoTransaction"];
     SqlTransaction sqlTransaction = parameters["sqlTransaction"];
     object configurationId = parameters["configurationId"].Value;
     object description = parameters["description"].Value;
     object groupPermission = parameters["groupPermission"].Value;
     object hidden = parameters["hidden"].Value;
     object name = parameters["name"].Value;
     object owner = parameters["owner"].Value;
     object ownerPermission = parameters["ownerPermission"].Value;
     object readOnly = parameters["readOnly"].Value;
     object worldPermission = parameters["worldPermission"].Value;
     string externalSectorId = ((string)(parameters["sectorId"]));
     object externalTypeCode = parameters["typeCode"].Value;
     object sortOrder = parameters["sortOrder"].Value;
     // The row versioning is largely disabled for external operations.  The value is returned to the caller in the
     // event it's needed for operations within the batch.
     long rowVersion = long.MinValue;
     // Resolve External Identifiers
     int sectorId = Object.FindRequiredKey(configurationId, "sectorId", externalSectorId);
     object typeCode = Type.FindOptionalKey(configurationId, "typeCode", externalTypeCode);
     // This disables the concurrency checking logic by finding the current row version and passing it to the
     // internal method.
     ServerDataModel.SectorRow sectorRow = sectorTable.FindBySectorId(sectorId);
     rowVersion = ((long)(sectorRow[sectorTable.RowVersionColumn]));
     // Call the internal method to complete the operation.
     MarkThree.Quasar.Core.Sector.Update(adoTransaction, sqlTransaction, ref rowVersion, description, null, null, null, null, null, null, null, null, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, sectorId, typeCode, sortOrder);
     // Return values.
     parameters["rowVersion"] = rowVersion;
 }
Esempio n. 3
0
        /// <summary>Inserts a Sector record.</summary>
        /// <param name="transaction">Commits or rejects a set of commands as a unit</param>
        /// <param name="rowVersion">The version number of the row.</param>
        /// <param name="description">The value for the Description column.</param>
        /// <param name="externalId0">The value for the ExternalId0 column.</param>
        /// <param name="externalId1">The value for the ExternalId1 column.</param>
        /// <param name="externalId2">The value for the ExternalId2 column.</param>
        /// <param name="externalId3">The value for the ExternalId3 column.</param>
        /// <param name="externalId4">The value for the ExternalId4 column.</param>
        /// <param name="externalId5">The value for the ExternalId5 column.</param>
        /// <param name="externalId6">The value for the ExternalId6 column.</param>
        /// <param name="externalId7">The value for the ExternalId7 column.</param>
        /// <param name="groupPermission">The value for the GroupPermission column.</param>
        /// <param name="hidden">The value for the Hidden column.</param>
        /// <param name="name">The value for the Name column.</param>
        /// <param name="owner">The value for the Owner column.</param>
        /// <param name="ownerPermission">The value for the OwnerPermission column.</param>
        /// <param name="readOnly">The value for the ReadOnly column.</param>
        /// <param name="worldPermission">The value for the WorldPermission column.</param>
        /// <param name="typeCode">The value for the TypeCode column.</param>
        /// <param name="sortOrder">The value for the SortOrder column.</param>
        public static int Insert(
            AdoTransaction adoTransaction,
            SqlTransaction sqlTransaction,
            ref long rowVersion,
            object description,
            object externalId0,
            object externalId1,
            object externalId2,
            object externalId3,
            object externalId4,
            object externalId5,
            object externalId6,
            object externalId7,
            object groupPermission,
            object hidden,
            string name,
            object owner,
            object ownerPermission,
            object readOnly,
            object worldPermission,
            object typeCode,
            object sortOrder)
        {
            // Accessor for the Sector Table.
            ServerDataModel.SectorDataTable sectorTable = ServerDataModel.Sector;
            // Apply Defaults
            if ((typeCode == null))
            {
                typeCode = "Sector";
            }
            if ((sortOrder == null))
            {
                sortOrder = 0;
            }
            // Insert the base members using the base class.
            int sectorId = Object.Insert(adoTransaction, sqlTransaction, ref rowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, typeCode, worldPermission);

            // Increment the row version
            rowVersion = ServerDataModel.RowVersion.Increment();
            // Insert the record into the ADO database.
            ServerDataModel.SectorRow sectorRow = sectorTable.NewSectorRow();
            sectorRow[sectorTable.RowVersionColumn] = rowVersion;
            sectorRow[sectorTable.SectorIdColumn]   = sectorId;
            sectorRow[sectorTable.SortOrderColumn]  = sortOrder;
            sectorTable.AddSectorRow(sectorRow);
            adoTransaction.DataRows.Add(sectorRow);
            // Insert the record into the SQL database.
            SqlCommand sqlCommand = new SqlCommand("insert \"Sector\" (\"rowVersion\",SectorId,SortOrder) values (@rowVersion,@sectorId,@" +
                                                   "sortOrder)");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@rowVersion", SqlDbType.BigInt, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, rowVersion));
            sqlCommand.Parameters.Add(new SqlParameter("@sectorId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, sectorId));
            sqlCommand.Parameters.Add(new SqlParameter("@sortOrder", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, sortOrder));
            sqlCommand.ExecuteNonQuery();
            // Return Statements
            return(sectorRow.SectorId);
        }
Esempio n. 4
0
 /// <summary>Loads a Sector record using Metadata Parameters.</summary>
 /// <param name="transaction">Contains the parameters and exceptions for this command.</param>
 public new static void Load(ParameterList parameters)
 {
     // Accessor for the Sector Table.
     ServerDataModel.SectorDataTable sectorTable = ServerDataModel.Sector;
     // Extract the parameters from the command batch.
     AdoTransaction adoTransaction = parameters["adoTransaction"];
     SqlTransaction sqlTransaction = parameters["sqlTransaction"];
     object configurationId = parameters["configurationId"].Value;
     object description = parameters["description"].Value;
     object groupPermission = parameters["groupPermission"].Value;
     object hidden = parameters["hidden"].Value;
     string name = parameters["name"];
     object owner = parameters["owner"].Value;
     object ownerPermission = parameters["ownerPermission"].Value;
     object readOnly = parameters["readOnly"].Value;
     object worldPermission = parameters["worldPermission"].Value;
     string externalSectorId = parameters["sectorId"];
     object externalTypeCode = parameters["typeCode"].Value;
     object sortOrder = parameters["sortOrder"].Value;
     // The row versioning is largely disabled for external operations.  The value is returned to the caller in the
     // event it's needed for operations within the batch.
     long rowVersion = long.MinValue;
     // Resolve External Identifiers
     int sectorId = Object.FindKey(configurationId, "sectorId", externalSectorId);
     object typeCode = Type.FindOptionalKey(configurationId, "typeCode", externalTypeCode);
     ServerDataModel.SectorRow sectorRow = sectorTable.FindBySectorId(sectorId);
     // The load operation will create a record if it doesn't exist, or update an existing record.  The external
     // identifier is used to determine if a record exists with the same key.
     if ((sectorRow == null))
     {
         // Populate the 'externalId' varaibles so that the external identifier can be used to find the row when an
         // external method is called with the same 'configurationId' parameter.
         int externalKeyIndex = Sector.GetExternalKeyIndex(configurationId, "sectorId");
         object[] externalIdArray = new object[8];
         externalIdArray[externalKeyIndex] = externalSectorId;
         object externalId0 = externalIdArray[0];
         object externalId1 = externalIdArray[1];
         object externalId2 = externalIdArray[2];
         object externalId3 = externalIdArray[3];
         object externalId4 = externalIdArray[4];
         object externalId5 = externalIdArray[5];
         object externalId6 = externalIdArray[6];
         object externalId7 = externalIdArray[7];
         // Call the internal method to complete the operation.
         MarkThree.Quasar.Core.Sector.Insert(adoTransaction, sqlTransaction, ref rowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, typeCode, sortOrder);
     }
     else
     {
         // While the optimistic concurrency checking is disabled for the external methods, the internal methods
         // still need to perform the check.  This ncurrency checking logic by finding the current row version to be
         // will bypass the coused when the internal method is called.
         rowVersion = ((long)(sectorRow[sectorTable.RowVersionColumn]));
         // Call the internal method to complete the operation.
         MarkThree.Quasar.Core.Sector.Update(adoTransaction, sqlTransaction, ref rowVersion, description, null, null, null, null, null, null, null, null, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, sectorId, typeCode, sortOrder);
     }
     // Return values.
     parameters["rowVersion"] = rowVersion;
 }
Esempio n. 5
0
        /// <summary>Archives a Sector record.</summary>
        /// <param name="transaction">Commits or rejects a set of commands as a unit</param>
        /// <param name="rowVersion">The version number of this row.</param>
        /// <param name="sectorId">The value for the SectorId column.</param>
        /// <param name="archive">true to archive the object, false to unarchive it.</param>
        public new static void Archive(AdoTransaction adoTransaction, SqlTransaction sqlTransaction, long rowVersion, int sectorId)
        {
            // Accessor for the Sector Table.
            ServerDataModel.SectorDataTable sectorTable = ServerDataModel.Sector;
            // Rule #1: Make sure the record exists before updating it.
            ServerDataModel.SectorRow sectorRow = sectorTable.FindBySectorId(sectorId);
            if ((sectorRow == null))
            {
                throw new Exception(string.Format("The Sector table does not have an element identified by {0}", sectorId));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((sectorRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Delete the base class record.  Note that optimistic concurrency is only used
            // by the top level type in the hierarchy, it is bypassed after you pass the first test.
            long baseRowVersion = sectorRow.ObjectRow.RowVersion;

            Object.Archive(adoTransaction, sqlTransaction, baseRowVersion, sectorId);
        }
Esempio n. 6
0
 /// <summary>Archives a Sector record using Metadata Parameters.</summary>
 /// <param name="transaction">Contains the parameters and exceptions for this command.</param>
 public new static void Archive(ParameterList parameters)
 {
     // Accessor for the Sector Table.
     ServerDataModel.SectorDataTable sectorTable = ServerDataModel.Sector;
     // Extract the parameters from the command batch.
     AdoTransaction adoTransaction = parameters["adoTransaction"];
     SqlTransaction sqlTransaction = parameters["sqlTransaction"];
     object configurationId = parameters["configurationId"].Value;
     string externalSectorId = parameters["sectorId"];
     // The row versioning is largely disabled for external operations.  The value is returned to the caller in the
     // event it's needed for operations within the batch.
     long rowVersion = long.MinValue;
     // Find the internal identifier using the primary key elements.
     // identifier is used to determine if a record exists with the same key.
     int sectorId = Sector.FindRequiredKey(configurationId, "sectorId", externalSectorId);
     // This disables the concurrency checking logic by finding the current row version and passing it to the
     // internal method.
     ServerDataModel.SectorRow sectorRow = sectorTable.FindBySectorId(sectorId);
     rowVersion = ((long)(sectorRow[sectorTable.RowVersionColumn]));
     // Call the internal method to complete the operation.
     MarkThree.Quasar.Core.Sector.Archive(adoTransaction, sqlTransaction, rowVersion, sectorId);
 }
Esempio n. 7
0
        /// <summary>Archives a Object record.</summary>
        /// <param name="transaction">Commits or rejects a set of commands as a unit</param>
        /// <param name="RowVersion">The version number of this row.</param>
        /// <param name="objectId">The value for the ObjectId column.</param>
        /// <param name="archive">true to archive the object, false to unarchive it.</param>
        public static void Archive(AdoTransaction adoTransaction, SqlTransaction sqlTransaction, long rowVersion, int objectId)
        {
            // Accessor for the Object Table.
            ServerDataModel.ObjectDataTable objectTable = ServerDataModel.Object;
            // Rule #1: Make sure the record exists before updating it.
            ServerDataModel.ObjectRow objectRow = objectTable.FindByObjectId(objectId);
            if ((objectRow == null))
            {
                throw new Exception(string.Format("The Object table does not have an element identified by {0}", objectId));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((objectRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Archive the child records.
            for (int index = 0; (index < objectRow.GetFolderRows().Length); index = (index + 1))
            {
                ServerDataModel.FolderRow childFolderRow = objectRow.GetFolderRows()[index];
                Folder.ArchiveChildren(adoTransaction, sqlTransaction, childFolderRow.RowVersion, childFolderRow.FolderId);
            }
            for (int index = 0; (index < objectRow.GetAccountRows().Length); index = (index + 1))
            {
                ServerDataModel.AccountRow childAccountRow = objectRow.GetAccountRows()[index];
                Account.ArchiveChildren(adoTransaction, sqlTransaction, childAccountRow.RowVersion, childAccountRow.AccountId);
            }
            for (int index = 0; (index < objectRow.GetBlotterRows().Length); index = (index + 1))
            {
                ServerDataModel.BlotterRow childBlotterRow = objectRow.GetBlotterRows()[index];
                Blotter.ArchiveChildren(adoTransaction, sqlTransaction, childBlotterRow.RowVersion, childBlotterRow.BlotterId);
            }
            for (int index = 0; (index < objectRow.GetBrokerRows().Length); index = (index + 1))
            {
                ServerDataModel.BrokerRow childBrokerRow = objectRow.GetBrokerRows()[index];
                Broker.ArchiveChildren(adoTransaction, sqlTransaction, childBrokerRow.RowVersion, childBrokerRow.BrokerId);
            }
            for (int index = 0; (index < objectRow.GetIssuerRows().Length); index = (index + 1))
            {
                ServerDataModel.IssuerRow childIssuerRow = objectRow.GetIssuerRows()[index];
                Issuer.ArchiveChildren(adoTransaction, sqlTransaction, childIssuerRow.RowVersion, childIssuerRow.IssuerId);
            }
            for (int index = 0; (index < objectRow.GetUserRows().Length); index = (index + 1))
            {
                ServerDataModel.UserRow childUserRow = objectRow.GetUserRows()[index];
                User.ArchiveChildren(adoTransaction, sqlTransaction, childUserRow.RowVersion, childUserRow.UserId);
            }
            for (int index = 0; (index < objectRow.GetModelRows().Length); index = (index + 1))
            {
                ServerDataModel.ModelRow childModelRow = objectRow.GetModelRows()[index];
                Model.ArchiveChildren(adoTransaction, sqlTransaction, childModelRow.RowVersion, childModelRow.ModelId);
            }
            for (int index = 0; (index < objectRow.GetObjectTreeRowsByFKObjectObjectTreeChildId().Length); index = (index + 1))
            {
                ServerDataModel.ObjectTreeRow childObjectTreeRow = objectRow.GetObjectTreeRowsByFKObjectObjectTreeChildId()[index];
                ObjectTree.Archive(adoTransaction, sqlTransaction, childObjectTreeRow.RowVersion, childObjectTreeRow.ParentId, childObjectTreeRow.ChildId);
            }
            for (int index = 0; (index < objectRow.GetObjectTreeRowsByFKObjectObjectTreeParentId().Length); index = (index + 1))
            {
                ServerDataModel.ObjectTreeRow childObjectTreeRow = objectRow.GetObjectTreeRowsByFKObjectObjectTreeParentId()[index];
                ObjectTree.Archive(adoTransaction, sqlTransaction, childObjectTreeRow.RowVersion, childObjectTreeRow.ParentId, childObjectTreeRow.ChildId);
            }
            for (int index = 0; (index < objectRow.GetSchemeRows().Length); index = (index + 1))
            {
                ServerDataModel.SchemeRow childSchemeRow = objectRow.GetSchemeRows()[index];
                Scheme.ArchiveChildren(adoTransaction, sqlTransaction, childSchemeRow.RowVersion, childSchemeRow.SchemeId);
            }
            for (int index = 0; (index < objectRow.GetSectorRows().Length); index = (index + 1))
            {
                ServerDataModel.SectorRow childSectorRow = objectRow.GetSectorRows()[index];
                Sector.ArchiveChildren(adoTransaction, sqlTransaction, childSectorRow.RowVersion, childSectorRow.SectorId);
            }
            for (int index = 0; (index < objectRow.GetSecurityRows().Length); index = (index + 1))
            {
                ServerDataModel.SecurityRow childSecurityRow = objectRow.GetSecurityRows()[index];
                Security.ArchiveChildren(adoTransaction, sqlTransaction, childSecurityRow.RowVersion, childSecurityRow.SecurityId);
            }
            // Increment the row version
            rowVersion = ServerDataModel.RowVersion.Increment();
            // Delete the record in the ADO database.
            objectRow[objectTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(objectRow);
            objectRow.Delete();
            // Archive the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"Object\" set \"IsArchived\" = 1 where \"ObjectId\"=@objectId");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@objectId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, objectId));
            sqlCommand.ExecuteNonQuery();
        }
Esempio n. 8
0
        /// <summary>Updates a Sector record.</summary>
        /// <param name="transaction">Commits or rejects a set of commands as a unit</param>
        /// <param name="rowVersion">The version number of the row</param>
        /// <param name="description">The value for the Description column.</param>
        /// <param name="externalId0">The value for the ExternalId0 column.</param>
        /// <param name="externalId1">The value for the ExternalId1 column.</param>
        /// <param name="externalId2">The value for the ExternalId2 column.</param>
        /// <param name="externalId3">The value for the ExternalId3 column.</param>
        /// <param name="externalId4">The value for the ExternalId4 column.</param>
        /// <param name="externalId5">The value for the ExternalId5 column.</param>
        /// <param name="externalId6">The value for the ExternalId6 column.</param>
        /// <param name="externalId7">The value for the ExternalId7 column.</param>
        /// <param name="groupPermission">The value for the GroupPermission column.</param>
        /// <param name="hidden">The value for the Hidden column.</param>
        /// <param name="name">The value for the Name column.</param>
        /// <param name="owner">The value for the Owner column.</param>
        /// <param name="ownerPermission">The value for the OwnerPermission column.</param>
        /// <param name="readOnly">The value for the ReadOnly column.</param>
        /// <param name="worldPermission">The value for the WorldPermission column.</param>
        /// <param name="sectorId">The value for the SectorId column.</param>
        /// <param name="typeCode">The value for the TypeCode column.</param>
        /// <param name="sortOrder">The value for the SortOrder column.</param>
        public static void Update(
            AdoTransaction adoTransaction,
            SqlTransaction sqlTransaction,
            ref long rowVersion,
            object description,
            object externalId0,
            object externalId1,
            object externalId2,
            object externalId3,
            object externalId4,
            object externalId5,
            object externalId6,
            object externalId7,
            object groupPermission,
            object hidden,
            object name,
            object owner,
            object ownerPermission,
            object readOnly,
            object worldPermission,
            int sectorId,
            object typeCode,
            object sortOrder)
        {
            // Accessor for the Sector Table.
            ServerDataModel.SectorDataTable sectorTable = ServerDataModel.Sector;
            // Rule #1: Make sure the record exists before updating it.
            ServerDataModel.SectorRow sectorRow = sectorTable.FindBySectorId(sectorId);
            if ((sectorRow == null))
            {
                throw new Exception(string.Format("The Sector table does not have an element identified by {0}", sectorId));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((sectorRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Apply Defaults
            if ((sortOrder == null))
            {
                sortOrder = sectorRow[sectorTable.SortOrderColumn];
            }
            // Insert the base members using the base class.  Note that optimistic concurrency is only used
            // by the top level type in the hierarchy, it is bypassed after you pass the first test.
            long baseRowVersion = sectorRow.ObjectRow.RowVersion;

            Object.Update(adoTransaction, sqlTransaction, ref baseRowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, sectorId, owner, ownerPermission, readOnly, typeCode, worldPermission);
            // Increment the row version
            rowVersion = ServerDataModel.RowVersion.Increment();
            // Update the record in the ADO database.
            sectorRow[sectorTable.RowVersionColumn] = rowVersion;
            sectorRow[sectorTable.SortOrderColumn]  = sortOrder;
            adoTransaction.DataRows.Add(sectorRow);
            // Update the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"Sector\" set \"RowVersion\"=@rowVersion,\"SortOrder\"=@sortOrder where \"Sector" +
                                                   "Id\"=@sectorId");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@rowVersion", SqlDbType.BigInt, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, rowVersion));
            sqlCommand.Parameters.Add(new SqlParameter("@sectorId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, sectorId));
            sqlCommand.Parameters.Add(new SqlParameter("@sortOrder", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, sortOrder));
            // Update the record in the SQL database.
            sqlCommand.ExecuteNonQuery();
        }