示例#1
0
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="col_Spr_GuidSupplierID">[To be supplied.]</param>
        /// <param name="parent">[To be supplied.]</param>
        internal void LoadFrom_Spr_GuidSupplierID(System.Data.SqlTypes.SqlGuid col_Spr_GuidSupplierID, Supplier parent)
        {
            if (col_Spr_GuidSupplierID.IsNull)
            {
                throw new ArgumentException("Parameter can not be null", "col_Spr_GuidSupplierID");
            }

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

            this.col_Spr_GuidSupplierID = col_Spr_GuidSupplierID;
            this.parent     = parent;
            this.parentType = tblSupplierProduct_CollectionParentType.Col_Spr_GuidSupplierID;
        }
示例#2
0
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="col_JobPartTypeId">[To be supplied.]</param>
        /// <param name="parent">[To be supplied.]</param>
        internal void LoadFrom_JobPartTypeId(System.Data.SqlTypes.SqlInt32 col_JobPartTypeId, JobPartType_Record parent)
        {
            if (col_JobPartTypeId.IsNull)
            {
                throw new ArgumentException("Parameter can not be null", "col_JobPartTypeId");
            }

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

            this.col_JobPartTypeId = col_JobPartTypeId;
            this.parent            = parent;
            this.parentType        = JobPart_CollectionParentType.Col_JobPartTypeId;
        }
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="col_Oit_GuidProductID">[To be supplied.]</param>
        /// <param name="parent">[To be supplied.]</param>
        internal void LoadFrom_Oit_GuidProductID(System.Data.SqlTypes.SqlGuid col_Oit_GuidProductID, Product parent)
        {
            if (col_Oit_GuidProductID.IsNull)
            {
                throw new ArgumentException("Parameter can not be null", "col_Oit_GuidProductID");
            }

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

            this.col_Oit_GuidProductID = col_Oit_GuidProductID;
            this.parent     = parent;
            this.parentType = tblOrderItem_CollectionParentType.Col_Oit_GuidProductID;
        }
示例#4
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;
        }
示例#5
0
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="col_Pro_LngCategoryID">[To be supplied.]</param>
        /// <param name="parent">[To be supplied.]</param>
        internal void LoadFrom_Pro_LngCategoryID(System.Data.SqlTypes.SqlInt32 col_Pro_LngCategoryID, Category parent)
        {
            if (col_Pro_LngCategoryID.IsNull)
            {
                throw new ArgumentException("Parameter can not be null", "col_Pro_LngCategoryID");
            }

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

            this.col_Pro_LngCategoryID = col_Pro_LngCategoryID;
            this.parent     = parent;
            this.parentType = ProductsParentType.CategoryID;
        }
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="col_TitleId">[To be supplied.]</param>
        /// <param name="parent">[To be supplied.]</param>
        internal void LoadFrom_TitleId(System.Data.SqlTypes.SqlInt32 col_TitleId, Title parent)
        {
            if (col_TitleId.IsNull)
            {
                throw new ArgumentException("Parameter can not be null", "col_TitleId");
            }

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

            this.col_TitleId = col_TitleId;
            this.parent      = parent;
            this.parentType  = CustomersParentType.TitleId;
        }
示例#7
0
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="record">[To be supplied.]</param>
        public void Remove(IBusinessComponentRecord record)
        {
            tblSupplierProduct_Record recordToDelete = record as tblSupplierProduct_Record;

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

            bool alreadyOpened = false;

            Params.spD_tblSupplierProduct Param = new Params.spD_tblSupplierProduct(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_Spr_GuidProductID = recordToDelete.Col_Spr_GuidProductID;

            Param.Param_Spr_GuidSupplierID = recordToDelete.Col_Spr_GuidSupplierID;

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

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

            if (internalRecords != null)
            {
                internalRecords.Remove(recordToDelete);
            }
        }
示例#8
0
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="record">[To be supplied.]</param>
        public void Remove(IBusinessComponentRecord record)
        {
            JobPartType_Record recordToDelete = record as JobPartType_Record;

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

            bool alreadyOpened = false;

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

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

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

            Param.Param_JobPartTypeId = recordToDelete.Col_JobPartTypeId;

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

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

            if (internalRecords != null)
            {
                internalRecords.Remove(recordToDelete);
            }
        }
示例#9
0
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="record">[To be supplied.]</param>
        /// <returns>[To be supplied.]</returns>
        public IBusinessComponentRecord Add(IBusinessComponentRecord record)
        {
            JobPartType_Record recordToAdd = record as JobPartType_Record;

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

            bool alreadyOpened = false;

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

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

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

            Param.Param_JobPartTypeId   = recordToAdd.Col_JobPartTypeId;
            Param.Param_Description     = recordToAdd.Col_Description;
            Param.Param_GeneralUnitCost = recordToAdd.Col_GeneralUnitCost;

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

                switch (this.lastKnownConnectionType)
                {
                case Bob.DataClasses.ConnectionType.ConnectionString:
                    newRecord = new JobPartType_Record(this.connectionString, Param.Param_JobPartTypeId);
                    break;

                case Bob.DataClasses.ConnectionType.SqlConnection:
                    newRecord = new JobPartType_Record(this.sqlConnection, Param.Param_JobPartTypeId);
                    break;

                case Bob.DataClasses.ConnectionType.SqlTransaction:
                    newRecord = new JobPartType_Record(this.sqlTransaction, Param.Param_JobPartTypeId);
                    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 Bob.DataClasses.CustomException(Param, "Bob.BusinessComponents.JobPartType_Collection", "Add");
            }
        }
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="record">[To be supplied.]</param>
        /// <returns>[To be supplied.]</returns>
        public IBusinessComponentRecord Add(IBusinessComponentRecord record)
        {
            tblOrderItem_Record recordToAdd = record as tblOrderItem_Record;

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

            switch (this.parentType)
            {
            case tblOrderItem_CollectionParentType.Col_Oit_GuidOrderID:
                recordToAdd.Col_Oit_GuidOrderID = ((tblOrder_Record)this.parent).Col_Ord_GuidID;
                break;

            case tblOrderItem_CollectionParentType.Col_Oit_GuidProductID:
                recordToAdd.Col_Oit_GuidProductID = ((Product)this.parent).Col_Pro_GuidID;
                break;
            }

            bool alreadyOpened = false;

            Params.spI_tblOrderItem Param = new Params.spI_tblOrderItem(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_Oit_GuidID        = recordToAdd.Col_Oit_GuidID;
            Param.Param_Oit_GuidOrderID   = recordToAdd.Col_Oit_GuidOrderID;
            Param.Param_Oit_GuidProductID = recordToAdd.Col_Oit_GuidProductID;
            Param.Param_Oit_LngAmount     = recordToAdd.Col_Oit_LngAmount;

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

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

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

                case OlymarsDemo.DataClasses.ConnectionType.SqlTransaction:
                    newRecord = new tblOrderItem_Record(this.sqlTransaction, Param.Param_Oit_GuidID);
                    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.tblOrderItem_Collection", "Add");
            }
        }
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="record">[To be supplied.]</param>
        /// <returns>[To be supplied.]</returns>
        public IBusinessComponentRecord Add(IBusinessComponentRecord record)
        {
            Supplier recordToAdd = record as Supplier;

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

            bool alreadyOpened = false;

            Params.spI_tblSupplier Param = new Params.spI_tblSupplier(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_Sup_GuidID  = recordToAdd.Col_Sup_GuidID;
            Param.Param_Sup_StrName = recordToAdd.Col_Sup_StrName;

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

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

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

                case OlymarsDemo.DataClasses.ConnectionType.SqlTransaction:
                    newRecord = new Supplier(this.sqlTransaction, Param.Param_Sup_GuidID);
                    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.Suppliers", "Add");
            }
        }
示例#12
0
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="record">[To be supplied.]</param>
        /// <returns>[To be supplied.]</returns>
        public IBusinessComponentRecord Add(IBusinessComponentRecord record)
        {
            Product recordToAdd = record as Product;

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

            switch (this.parentType)
            {
            case ProductsParentType.CategoryID:
                recordToAdd.CategoryID = ((Category)this.parent).Col_Cat_LngID;
                break;
            }

            bool alreadyOpened = false;

            Params.spI_tblProduct Param = new Params.spI_tblProduct(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_Pro_GuidID        = recordToAdd.Col_Pro_GuidID;
            Param.Param_Pro_StrName       = recordToAdd.Name;
            Param.Param_Pro_CurPrice      = recordToAdd.Col_Pro_CurPrice;
            Param.Param_Pro_LngCategoryID = recordToAdd.CategoryID;

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

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

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

                case OlymarsDemo.DataClasses.ConnectionType.SqlTransaction:
                    newRecord = new Product(this.sqlTransaction, Param.Param_Pro_GuidID);
                    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.Products", "Add");
            }
        }
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="record">[To be supplied.]</param>
        /// <returns>[To be supplied.]</returns>
        public IBusinessComponentRecord Add(IBusinessComponentRecord record)
        {
            Customer recordToAdd = record as Customer;

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

            switch (this.parentType)
            {
            case CustomersParentType.TitleId:
                recordToAdd.TitleId = ((Title)this.parent).TitleId;
                break;
            }

            bool alreadyOpened = false;

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

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

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

            Param.Param_CustomerID  = recordToAdd.CustomerID;
            Param.Param_CompanyName = recordToAdd.CompanyName;
            Param.Param_ContactName = recordToAdd.ContactName;
            Param.Param_TitleId     = recordToAdd.TitleId;
            Param.Param_Address     = recordToAdd.Address;
            Param.Param_City        = recordToAdd.City;
            Param.Param_PostalCode  = recordToAdd.PostalCode;
            Param.Param_Phone       = recordToAdd.Phone;
            Param.Param_Email       = recordToAdd.Email;
            Param.Param_WebAddress  = recordToAdd.WebAddress;
            Param.Param_Fax         = recordToAdd.Fax;
            Param.Param_Active      = recordToAdd.Active;

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

                switch (this.lastKnownConnectionType)
                {
                case Bob.DataClasses.ConnectionType.ConnectionString:
                    newRecord = new Customer(this.connectionString, Param.Param_CustomerID);
                    break;

                case Bob.DataClasses.ConnectionType.SqlConnection:
                    newRecord = new Customer(this.sqlConnection, Param.Param_CustomerID);
                    break;

                case Bob.DataClasses.ConnectionType.SqlTransaction:
                    newRecord = new Customer(this.sqlTransaction, Param.Param_CustomerID);
                    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 Bob.DataClasses.CustomException(Param, "Bob.BusinessComponents.Customers", "Add");
            }
        }