コード例 #1
0
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        public new tblCustomer_Record MemberwiseClone()
        {
            tblCustomer_Record newRecord = new tblCustomer_Record();

            newRecord.recordWasLoadedFromDB = this.recordWasLoadedFromDB;
            newRecord.recordIsLoaded        = this.recordIsLoaded;
            newRecord.connectionString      = this.connectionString;

            newRecord.col_Cus_LngID = this.col_Cus_LngID;


            newRecord.col_Cus_StrLastNameWasSet     = this.col_Cus_StrLastNameWasSet;
            newRecord.col_Cus_StrLastNameWasUpdated = this.col_Cus_StrLastNameWasUpdated;
            newRecord.col_Cus_StrLastName           = this.col_Cus_StrLastName;

            newRecord.col_Cus_StrFirstNameWasSet     = this.col_Cus_StrFirstNameWasSet;
            newRecord.col_Cus_StrFirstNameWasUpdated = this.col_Cus_StrFirstNameWasUpdated;
            newRecord.col_Cus_StrFirstName           = this.col_Cus_StrFirstName;

            newRecord.col_Cus_StrEmailWasSet     = this.col_Cus_StrEmailWasSet;
            newRecord.col_Cus_StrEmailWasUpdated = this.col_Cus_StrEmailWasUpdated;
            newRecord.col_Cus_StrEmail           = this.col_Cus_StrEmail;

            newRecord.displayName = this.displayName;

            return(newRecord);
        }
コード例 #2
0
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="record">[To be supplied.]</param>
        public void Remove(IBusinessComponentRecord record)
        {
            tblCustomer_Record recordToDelete = record as tblCustomer_Record;

            if (recordToDelete == null)
            {
                throw new ArgumentException("Invalid record type. Must be 'OlymarsDemo.BusinessComponents.tblCustomer_Record'.", "record");
            }

            bool alreadyOpened = false;

            Params.spD_tblCustomer Param = new Params.spD_tblCustomer(true);
            Param.CommandTimeOut = this.deleteCommandTimeOut;
            switch (this.lastKnownConnectionType)
            {
            case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                Param.SetUpConnection(this.connectionString);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                Param.SetUpConnection(this.sqlConnection);
                alreadyOpened = (this.sqlConnection.State == System.Data.ConnectionState.Open);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlTransaction:
                Param.SetUpConnection(this.sqlTransaction);
                break;
            }

            Param.Param_Cus_LngID = recordToDelete.Col_Cus_LngID;

            SPs.spD_tblCustomer Sp = new SPs.spD_tblCustomer(true);

            Sp.Execute(ref Param);
            CloseConnection(Sp.Connection, alreadyOpened);

            if (internalRecords != null)
            {
                internalRecords.Remove(recordToDelete);
            }
        }
コード例 #3
0
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="col_Ord_LngCustomerID">[To be supplied.]</param>
        /// <param name="parent">[To be supplied.]</param>
        internal void LoadFrom_Ord_LngCustomerID(System.Data.SqlTypes.SqlInt32 col_Ord_LngCustomerID, tblCustomer_Record parent)
        {
            if (col_Ord_LngCustomerID.IsNull)
            {
                throw new ArgumentException("Parameter can not be null", "col_Ord_LngCustomerID");
            }

            if (parent == null)
            {
                throw new ArgumentException("Parameter can not be null", "parent");
            }

            this.col_Ord_LngCustomerID = col_Ord_LngCustomerID;
            this.parent     = parent;
            this.parentType = tblOrder_CollectionParentType.Col_Ord_LngCustomerID;
        }
コード例 #4
0
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        public void Refresh()
        {
            internalRecords = new System.Collections.ArrayList();

            bool alreadyOpened = false;

            Params.spS_tblCustomer_Display Param = new Params.spS_tblCustomer_Display(true);
            Param.CommandTimeOut = this.selectCollectionCommandTimeOut;
            switch (this.lastKnownConnectionType)
            {
            case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                Param.SetUpConnection(this.connectionString);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                Param.SetUpConnection(this.sqlConnection);
                alreadyOpened = (this.sqlConnection.State == System.Data.ConnectionState.Open);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlTransaction:
                Param.SetUpConnection(this.sqlTransaction);
                break;
            }

            System.Data.SqlClient.SqlDataReader sqlDataReader = null;
            SPs.spS_tblCustomer_Display         Sp            = new SPs.spS_tblCustomer_Display(false);
            if (Sp.Execute(ref Param, out sqlDataReader))
            {
                while (sqlDataReader.Read())
                {
                    tblCustomer_Record record = null;

                    switch (this.lastKnownConnectionType)
                    {
                    case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                        record = new tblCustomer_Record(this.connectionString, sqlDataReader.GetSqlInt32(SPs.spS_tblCustomer_Display.Resultset1.Fields.Column_ID1.ColumnIndex));
                        break;

                    case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                        record = new tblCustomer_Record(this.sqlConnection, sqlDataReader.GetSqlInt32(SPs.spS_tblCustomer_Display.Resultset1.Fields.Column_ID1.ColumnIndex));
                        break;

                    case OlymarsDemo.DataClasses.ConnectionType.SqlTransaction:
                        record = new tblCustomer_Record(this.sqlTransaction, sqlDataReader.GetSqlInt32(SPs.spS_tblCustomer_Display.Resultset1.Fields.Column_ID1.ColumnIndex));
                        break;
                    }


                    record.UpdateCommandTimeOut = this.updateCommandTimeOut;
                    record.SelectCommandTimeOut = this.selectCommandTimeOut;

                    if (sqlDataReader.GetFieldType(SPs.spS_tblCustomer_Display.Resultset1.Fields.Column_Display.ColumnIndex) == typeof(string))
                    {
                        record.displayName = sqlDataReader.GetString(SPs.spS_tblCustomer_Display.Resultset1.Fields.Column_Display.ColumnIndex);
                    }
                    else
                    {
                        record.displayName = sqlDataReader.GetValue(SPs.spS_tblCustomer_Display.Resultset1.Fields.Column_Display.ColumnIndex).ToString();
                    }

                    internalRecords.Add(record);
                }

                if (sqlDataReader != null && !sqlDataReader.IsClosed)
                {
                    sqlDataReader.Close();
                }

                CloseConnection(Sp.Connection, alreadyOpened);

                this.recordsAreLoaded = true;
            }
            else
            {
                if (sqlDataReader != null && !sqlDataReader.IsClosed)
                {
                    sqlDataReader.Close();
                }

                CloseConnection(Sp.Connection, alreadyOpened);

                this.recordsAreLoaded = false;
                throw new OlymarsDemo.DataClasses.CustomException(Param, "OlymarsDemo.BusinessComponents.tblCustomer_Collection", "Refresh");
            }
        }
コード例 #5
0
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="record">[To be supplied.]</param>
        /// <returns>[To be supplied.]</returns>
        public IBusinessComponentRecord Add(IBusinessComponentRecord record)
        {
            tblCustomer_Record recordToAdd = record as tblCustomer_Record;

            if (recordToAdd == null)
            {
                throw new ArgumentException("Invalid record type. Must be 'OlymarsDemo.BusinessComponents.tblCustomer_Record'.", "record");
            }

            bool alreadyOpened = false;

            Params.spI_tblCustomer Param = new Params.spI_tblCustomer(true);
            Param.CommandTimeOut = this.insertCommandTimeOut;
            switch (this.lastKnownConnectionType)
            {
            case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                Param.SetUpConnection(this.connectionString);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                Param.SetUpConnection(this.sqlConnection);
                alreadyOpened = (this.sqlConnection.State == System.Data.ConnectionState.Open);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlTransaction:
                Param.SetUpConnection(this.sqlTransaction);
                break;
            }

            Param.Param_Cus_LngID        = recordToAdd.Col_Cus_LngID;
            Param.Param_Cus_StrLastName  = recordToAdd.Customer_Surname;
            Param.Param_Cus_StrFirstName = recordToAdd.Col_Cus_StrFirstName;
            Param.Param_Cus_StrEmail     = recordToAdd.Col_Cus_StrEmail;

            SPs.spI_tblCustomer Sp = new SPs.spI_tblCustomer(false);
            if (Sp.Execute(ref Param))
            {
                tblCustomer_Record newRecord = null;

                switch (this.lastKnownConnectionType)
                {
                case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                    newRecord = new tblCustomer_Record(this.connectionString, Param.Param_Cus_LngID);
                    break;

                case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                    newRecord = new tblCustomer_Record(this.sqlConnection, Param.Param_Cus_LngID);
                    break;

                case OlymarsDemo.DataClasses.ConnectionType.SqlTransaction:
                    newRecord = new tblCustomer_Record(this.sqlTransaction, Param.Param_Cus_LngID);
                    break;
                }

                CloseConnection(Sp.Connection, alreadyOpened);

                if (internalRecords != null)
                {
                    internalRecords.Add(newRecord);
                }

                if (this.addedRecords == null)
                {
                    this.addedRecords = new System.Collections.ArrayList();
                }
                this.addedRecords.Add(newRecord);

                return(newRecord);
            }
            else
            {
                throw new OlymarsDemo.DataClasses.CustomException(Param, "OlymarsDemo.BusinessComponents.tblCustomer_Collection", "Add");
            }
        }