/// <summary>
        /// Load or reloads a subset of the chosen resultset returned by the stored procedure.
        /// You can specify which record you want to be checked by default.
        /// </summary>
        /// <param name="ArrayOf_PrimaryKeys">Primary keys of the records you want to be checked by default.</param>
        /// <param name="startRecord">The zero-based record number to start with.</param>
        /// <param name="maxRecords">The maximum number of records to retrieve.</param>
        public void RefreshData(object[] ArrayOf_PrimaryKeys, int startRecord, int maxRecords)
        {
            if (this.LastKnownConnectionType == OlymarsDemo.DataClasses.ConnectionType.None)
            {
                throw new InvalidOperationException("You must call the 'Initialize' method before calling this method.");
            }

            this.param = new Params.spS_tblOrder();

            switch (this.LastKnownConnectionType)
            {
            case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                this.param.SetUpConnection(this.connectionString);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                this.param.SetUpConnection(this.sqlConnection);
                break;
            }

            this.param.CommandTimeOut = this.commandTimeOut;


            if (!this.param_Ord_GuidID.IsNull)
            {
                this.param.Param_Ord_GuidID = this.param_Ord_GuidID;
            }


            if (!this.param_Ord_LngCustomerID.IsNull)
            {
                this.param.Param_Ord_LngCustomerID = this.param_Ord_LngCustomerID;
            }


            System.Data.DataSet DS = null;

            SPs.spS_tblOrder SP = new SPs.spS_tblOrder();
            if (SP.Execute(ref this.param, ref DS, startRecord, maxRecords))
            {
                this.DataSource     = DS.Tables[this.tableName].DefaultView;
                this.DataValueField = this.valueMember;
                this.DataTextField  = this.displayMember;
                if (this.doDataBindAfterRefreshData)
                {
                    this.DataBind();
                }

                if (ArrayOf_PrimaryKeys != null)
                {
                    this.SetRecordsChecked(ArrayOf_PrimaryKeys, true);
                }
            }

            else
            {
                SP.Dispose();
                throw new OlymarsDemo.DataClasses.CustomException(this.param, "WebCheckBoxListCustom_spS_tblOrder", "RefreshData");
            }
        }
        public Tables.tblOrder_Record GetOne_tblOrder_Record(Guid id)
        {
            Params.spS_tblOrder param = new Params.spS_tblOrder(true);

            param.SetUpConnection(string.Empty);

            param.Param_Ord_GuidID = id;

            using (SPs.spS_tblOrder sp = new SPs.spS_tblOrder(true)) {
                System.Data.SqlClient.SqlDataReader sqlDataReader = null;
                sp.Execute(ref param, out sqlDataReader);
                param.Dispose();

                if (sqlDataReader.Read())
                {
                    Tables.tblOrder_Record record = new Tables.tblOrder_Record();

                    record.Col_Ord_GuidID.UseNull = sqlDataReader.IsDBNull(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_GuidID.ColumnIndex);
                    if (!record.Col_Ord_GuidID.UseNull)
                    {
                        record.Col_Ord_GuidID.Value = sqlDataReader.GetSqlGuid(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_GuidID.ColumnIndex).Value;
                    }

                    record.Col_Ord_DatOrderedOn.UseNull = sqlDataReader.IsDBNull(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_DatOrderedOn.ColumnIndex);
                    if (!record.Col_Ord_DatOrderedOn.UseNull)
                    {
                        record.Col_Ord_DatOrderedOn.Value = sqlDataReader.GetSqlDateTime(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_DatOrderedOn.ColumnIndex).Value;
                    }

                    record.Col_Ord_LngCustomerID.UseNull = sqlDataReader.IsDBNull(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_LngCustomerID.ColumnIndex);
                    if (!record.Col_Ord_LngCustomerID.UseNull)
                    {
                        record.Col_Ord_LngCustomerID.Value = sqlDataReader.GetSqlInt32(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_LngCustomerID.ColumnIndex).Value;
                    }

                    record.Col_Ord_CurTotal.UseNull = sqlDataReader.IsDBNull(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_CurTotal.ColumnIndex);
                    if (!record.Col_Ord_CurTotal.UseNull)
                    {
                        record.Col_Ord_CurTotal.Value = sqlDataReader.GetSqlMoney(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_CurTotal.ColumnIndex).Value;
                    }


                    sqlDataReader.Close();
                    sp.Connection.Close();

                    return(record);
                }
                else
                {
                    sqlDataReader.Close();
                    sp.Connection.Close();

                    return(null);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Load or reloads a subset of the table content. In order to successfully call this method, you need to call first
        /// the Initialize method.
        /// </summary>
        /// <param name="startRecord">The zero-based record number to start with.</param>
        /// <param name="maxRecords">The maximum number of records to retrieve.</param>
        public void RefreshData(int startRecord, int maxRecords)
        {
            if (this.LastKnownConnectionType == OlymarsDemo.DataClasses.ConnectionType.None)
            {
                throw new InvalidOperationException("You must call the 'Initialize' method before calling this method.");
            }

            this.param = new Params.spS_tblOrder(true);

            switch (this.LastKnownConnectionType)
            {
            case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                this.param.SetUpConnection(this.connectionString);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                this.param.SetUpConnection(this.sqlConnection);
                break;
            }

            if (!this.FK_Ord_LngCustomerID.IsNull)
            {
                this.param.Param_Ord_LngCustomerID = this.FK_Ord_LngCustomerID;
            }

            System.Data.DataSet DS = null;

            SPs.spS_tblOrder SP = new SPs.spS_tblOrder(false);
            if (SP.Execute(ref this.param, ref DS, startRecord, maxRecords))
            {
                this.DataSource   = DS.Tables["spS_tblOrder"].DefaultView;
                this.DataKeyField = "Ord_GuidID";
                if (this.doDataBindAfterRefreshData)
                {
                    this.DataBind();
                }

                SP.Dispose();
            }

            else
            {
                SP.Dispose();
                throw new OlymarsDemo.DataClasses.CustomException(this.param, "WebDataList_tblOrder : System.Web.UI.WebControls.DataList", "RefreshData");
            }
        }
        /// <summary>
        /// Load or reloads a subset of the chosen resultset returned by the stored procedure.
        /// You can specify which record you want to be checked by default.
        /// </summary>
        /// <param name="ArrayOf_PrimaryKeys">Primary keys of the records you want to be checked by default.</param>
        /// <param name="startRecord">The zero-based record number to start with.</param>
        /// <param name="maxRecords">The maximum number of records to retrieve.</param>
        public void RefreshData(object[] ArrayOf_PrimaryKeys, int startRecord, int maxRecords)
        {
            this.CreateControl();

            if (this.LastKnownConnectionType == OlymarsDemo.DataClasses.ConnectionType.None)
            {
                throw new InvalidOperationException("You must call the 'Initialize' method before calling this method.");
            }

            this.param = new Params.spS_tblOrder();

            switch (this.LastKnownConnectionType)
            {
            case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                this.param.SetUpConnection(this.connectionString);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                this.param.SetUpConnection(this.sqlConnection);
                break;
            }

            this.param.CommandTimeOut = this.commandTimeOut;


            if (!this.param_Ord_GuidID.IsNull)
            {
                this.param.Param_Ord_GuidID = this.param_Ord_GuidID;
            }


            if (!this.param_Ord_LngCustomerID.IsNull)
            {
                this.param.Param_Ord_LngCustomerID = this.param_Ord_LngCustomerID;
            }


            System.Data.DataSet DS = null;

            SPs.spS_tblOrder SP = new SPs.spS_tblOrder();
            if (SP.Execute(ref this.param, ref DS, startRecord, maxRecords))
            {
                this.BeginUpdate();
                this.bindingInProgress = true;
                this.DataSource        = DS.Tables[this.tableName].DefaultView;
                this.ValueMember       = this.valueMember;
                this.DisplayMember     = this.displayMember;
                this.bindingInProgress = false;

                if (ArrayOf_PrimaryKeys != null && ArrayOf_PrimaryKeys.Length > 0)
                {
                    this.SetRecordsCheckState(ArrayOf_PrimaryKeys, System.Windows.Forms.CheckState.Checked);
                }
                else
                {
                    base.OnSelectedIndexChanged(EventArgs.Empty);
                }

                this.EndUpdate();
                SP.Dispose();
            }

            else
            {
                SP.Dispose();
                throw new OlymarsDemo.DataClasses.CustomException(this.param, "WinCheckedListBoxCustom_spS_tblOrder", "RefreshData");
            }
        }
        /// <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");
            }
        }
Esempio n. 6
0
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <returns>[To be supplied.]</returns>
        public bool Refresh()
        {
            this.displayName = null;

            this.col_Ord_DatOrderedOnWasUpdated = false;
            this.col_Ord_DatOrderedOnWasSet     = false;
            this.col_Ord_DatOrderedOn           = System.Data.SqlTypes.SqlDateTime.Null;

            this.col_Ord_LngCustomerIDWasUpdated = false;
            this.col_Ord_LngCustomerIDWasSet     = false;
            this.col_Ord_LngCustomerID           = System.Data.SqlTypes.SqlInt32.Null;

            this.col_Ord_CurTotalWasUpdated = false;
            this.col_Ord_CurTotalWasSet     = false;
            this.col_Ord_CurTotal           = System.Data.SqlTypes.SqlMoney.Null;

            bool alreadyOpened = false;

            Params.spS_tblOrder Param = new Params.spS_tblOrder(true);
            Param.CommandTimeOut = this.selectCommandTimeOut;
            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;
            }

            if (!this.col_Ord_GuidID.IsNull)
            {
                Param.Param_Ord_GuidID = this.col_Ord_GuidID;
            }


            System.Data.SqlClient.SqlDataReader sqlDataReader = null;
            SPs.spS_tblOrder Sp = new SPs.spS_tblOrder(false);
            if (Sp.Execute(ref Param, out sqlDataReader))
            {
                if (sqlDataReader.Read())
                {
                    if (!sqlDataReader.IsDBNull(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_DatOrderedOn.ColumnIndex))
                    {
                        this.col_Ord_DatOrderedOn = sqlDataReader.GetSqlDateTime(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_DatOrderedOn.ColumnIndex);
                    }
                    if (!sqlDataReader.IsDBNull(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_LngCustomerID.ColumnIndex))
                    {
                        this.col_Ord_LngCustomerID = sqlDataReader.GetSqlInt32(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_LngCustomerID.ColumnIndex);
                    }
                    if (!sqlDataReader.IsDBNull(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_CurTotal.ColumnIndex))
                    {
                        this.col_Ord_CurTotal = sqlDataReader.GetSqlMoney(SPs.spS_tblOrder.Resultset1.Fields.Column_Ord_CurTotal.ColumnIndex);
                    }

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

                    CloseConnection(Sp.Connection, alreadyOpened);

                    this.recordIsLoaded = true;

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

                    CloseConnection(Sp.Connection, alreadyOpened);

                    this.recordIsLoaded = false;

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

                CloseConnection(Sp.Connection, alreadyOpened);

                throw new OlymarsDemo.DataClasses.CustomException(Param, "OlymarsDemo.BusinessComponents.tblOrder_Record", "Refresh");
            }
        }