/// <summary>
        /// Allows you to load a specific record of the [tblOrder] table.
        /// </summary>
        /// <param name="col_Ord_GuidID">Update this description in the &quot;Olymars/Description&quot; extended property of the &quot;Ord_GuidID&quot; column.</param>
        public bool Refresh(System.Data.SqlTypes.SqlGuid col_Ord_GuidID)
        {
            bool Status;

            Reset();

            if (col_Ord_GuidID.IsNull)
            {
                throw new ArgumentNullException("col_Ord_GuidID", "The primary key 'col_Ord_GuidID' can not have a Null value!");
            }


            this.col_Ord_GuidID = col_Ord_GuidID;

            this.Param.Reset();

            this.Param.Param_Ord_GuidID = this.col_Ord_GuidID;

            System.Data.SqlClient.SqlDataReader DR;
            SPs.spS_tblOrder SP = new SPs.spS_tblOrder(false);

            if (SP.Execute(ref this.Param, out DR))
            {
                Status = false;
                if (DR.Read())
                {
                    if (!DR.IsDBNull(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_DatOrderedOn.ColumnIndex))
                    {
                        this.col_Ord_DatOrderedOn = DR.GetSqlDateTime(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_DatOrderedOn.ColumnIndex);
                    }

                    if (!DR.IsDBNull(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_LngCustomerID.ColumnIndex))
                    {
                        this.col_Ord_LngCustomerID = DR.GetSqlInt32(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_LngCustomerID.ColumnIndex);
                    }

                    if (!DR.IsDBNull(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_CurTotal.ColumnIndex))
                    {
                        this.col_Ord_CurTotal = DR.GetSqlMoney(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_CurTotal.ColumnIndex);
                    }

                    Status = true;
                }

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

                if (CloseConnectionAfterUse && SP.Connection != null && SP.Connection.State == System.Data.ConnectionState.Open)
                {
                    SP.Connection.Close();
                    SP.Connection.Dispose();
                }

                return(Status);
            }

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

                if (CloseConnectionAfterUse && SP.Connection != null && SP.Connection.State == System.Data.ConnectionState.Open)
                {
                    SP.Connection.Close();
                    SP.Connection.Dispose();
                }

                throw new OlymarsDemo.DataClasses.CustomException(this.Param, "OlymarsDemo.AbstractClasses.Abstract_tblOrder", "Refresh");
            }
        }
Example #2
0
        /// <summary>
        /// Allows you to load a specific record of the [Job] table.
        /// </summary>
        /// <param name="col_JobId">Update this description in the &quot;Olymars/Description&quot; extended property of the &quot;JobId&quot; column.</param>
        public bool Refresh(System.Data.SqlTypes.SqlInt32 col_JobId)
        {
            bool Status;

            Reset();

            if (col_JobId.IsNull)
            {
                throw new ArgumentNullException("col_JobId", "The primary key 'col_JobId' can not have a Null value!");
            }


            this.col_JobId = col_JobId;

            this.Param.Reset();

            this.Param.Param_JobId = this.col_JobId;

            System.Data.SqlClient.SqlDataReader DR;
            SPs.spS_Job SP = new SPs.spS_Job(false);

            if (SP.Execute(ref this.Param, out DR))
            {
                Status = false;
                if (DR.Read())
                {
                    if (!DR.IsDBNull(SPs.spS_Job.Resultset1.Fields.Column_Description.ColumnIndex))
                    {
                        this.col_Description = DR.GetSqlString(SPs.spS_Job.Resultset1.Fields.Column_Description.ColumnIndex);
                    }

                    if (!DR.IsDBNull(SPs.spS_Job.Resultset1.Fields.Column_Price.ColumnIndex))
                    {
                        this.col_Price = DR.GetSqlMoney(SPs.spS_Job.Resultset1.Fields.Column_Price.ColumnIndex);
                    }

                    if (!DR.IsDBNull(SPs.spS_Job.Resultset1.Fields.Column_StartDate.ColumnIndex))
                    {
                        this.col_StartDate = DR.GetSqlDateTime(SPs.spS_Job.Resultset1.Fields.Column_StartDate.ColumnIndex);
                    }

                    if (!DR.IsDBNull(SPs.spS_Job.Resultset1.Fields.Column_EndDate.ColumnIndex))
                    {
                        this.col_EndDate = DR.GetSqlDateTime(SPs.spS_Job.Resultset1.Fields.Column_EndDate.ColumnIndex);
                    }

                    if (!DR.IsDBNull(SPs.spS_Job.Resultset1.Fields.Column_CustomerId.ColumnIndex))
                    {
                        this.col_CustomerId = DR.GetSqlInt32(SPs.spS_Job.Resultset1.Fields.Column_CustomerId.ColumnIndex);
                    }

                    Status = true;
                }

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

                if (CloseConnectionAfterUse && SP.Connection != null && SP.Connection.State == System.Data.ConnectionState.Open)
                {
                    SP.Connection.Close();
                    SP.Connection.Dispose();
                }

                return(Status);
            }

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

                if (CloseConnectionAfterUse && SP.Connection != null && SP.Connection.State == System.Data.ConnectionState.Open)
                {
                    SP.Connection.Close();
                    SP.Connection.Dispose();
                }

                throw new Bob.DataClasses.CustomException(this.Param, "Bob.AbstractClasses.Abstract_Job", "Refresh");
            }
        }