/// <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="PrimaryKey">Primary key of the record you want to be selected 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 PrimaryKey, 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_tblCustomer();

            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_Cus_LngID.IsNull)
            {
                this.param.Param_Cus_LngID = this.param_Cus_LngID;
            }


            System.Data.DataSet DS = null;

            SPs.spS_tblCustomer SP = new SPs.spS_tblCustomer();
            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 (PrimaryKey != null)
                {
                    System.Web.UI.WebControls.ListItem listItem = this.Items.FindByValue(Convert.ToString(PrimaryKey));

                    if (listItem != null)
                    {
                        listItem.Selected = true;
                    }
                }
            }

            else
            {
                SP.Dispose();
                throw new OlymarsDemo.DataClasses.CustomException(this.param, "WebDropDownListCustom_spS_tblCustomer", "RefreshData");
            }
        }
예제 #2
0
        public Tables.tblCustomer_Record GetOne_tblCustomer_Record(Int32 id)
        {
            Params.spS_tblCustomer param = new Params.spS_tblCustomer(true);

            param.SetUpConnection(string.Empty);

            param.Param_Cus_LngID = id;

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

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

                    record.Col_Cus_LngID.UseNull = sqlDataReader.IsDBNull(SPs.spS_tblCustomer.Resultset1.Fields.Column_Cus_LngID.ColumnIndex);
                    if (!record.Col_Cus_LngID.UseNull)
                    {
                        record.Col_Cus_LngID.Value = sqlDataReader.GetSqlInt32(SPs.spS_tblCustomer.Resultset1.Fields.Column_Cus_LngID.ColumnIndex).Value;
                    }

                    record.Customer_Surname.UseNull = sqlDataReader.IsDBNull(SPs.spS_tblCustomer.Resultset1.Fields.Column_Cus_StrLastName.ColumnIndex);
                    if (!record.Customer_Surname.UseNull)
                    {
                        record.Customer_Surname.Value = sqlDataReader.GetSqlString(SPs.spS_tblCustomer.Resultset1.Fields.Column_Cus_StrLastName.ColumnIndex).Value;
                    }

                    record.Col_Cus_StrFirstName.UseNull = sqlDataReader.IsDBNull(SPs.spS_tblCustomer.Resultset1.Fields.Column_Cus_StrFirstName.ColumnIndex);
                    if (!record.Col_Cus_StrFirstName.UseNull)
                    {
                        record.Col_Cus_StrFirstName.Value = sqlDataReader.GetSqlString(SPs.spS_tblCustomer.Resultset1.Fields.Column_Cus_StrFirstName.ColumnIndex).Value;
                    }

                    record.Col_Cus_StrEmail.UseNull = sqlDataReader.IsDBNull(SPs.spS_tblCustomer.Resultset1.Fields.Column_Cus_StrEmail.ColumnIndex);
                    if (!record.Col_Cus_StrEmail.UseNull)
                    {
                        record.Col_Cus_StrEmail.Value = sqlDataReader.GetSqlString(SPs.spS_tblCustomer.Resultset1.Fields.Column_Cus_StrEmail.ColumnIndex).Value;
                    }


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

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

                    return(null);
                }
            }
        }
        /// <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_tblCustomer(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;
            }

            System.Data.DataSet DS = null;

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

                SP.Dispose();
            }

            else
            {
                SP.Dispose();
                throw new OlymarsDemo.DataClasses.CustomException(this.param, "WebDataGrid_tblCustomer : System.Web.UI.WebControls.DataGrid", "RefreshData");
            }
        }
예제 #4
0
        /// <summary>
        /// Allows you to load a specific record of the [tblCustomer] table.
        /// </summary>
        /// <param name="col_Cus_LngID">Update this description in the &quot;Olymars/Description&quot; extended property of the &quot;Cus_LngID&quot; column.</param>
        public bool Refresh(System.Data.SqlTypes.SqlInt32 col_Cus_LngID)
        {
            bool Status;

            Reset();

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


            this.col_Cus_LngID = col_Cus_LngID;

            this.Param.Reset();

            this.Param.Param_Cus_LngID = this.col_Cus_LngID;

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

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

                    if (!DR.IsDBNull(SPs.spS_tblCustomer.Resultset1.Fields.Column_Cus_StrFirstName.ColumnIndex))
                    {
                        this.col_Cus_StrFirstName = DR.GetSqlString(SPs.spS_tblCustomer.Resultset1.Fields.Column_Cus_StrFirstName.ColumnIndex);
                    }

                    if (!DR.IsDBNull(SPs.spS_tblCustomer.Resultset1.Fields.Column_Cus_StrEmail.ColumnIndex))
                    {
                        this.col_Cus_StrEmail = DR.GetSqlString(SPs.spS_tblCustomer.Resultset1.Fields.Column_Cus_StrEmail.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_tblCustomer", "Refresh");
            }
        }
예제 #5
0
        /// <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="PrimaryKey">Primary key of the record you want to be selected 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 PrimaryKey, 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_tblCustomer();

            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_Cus_LngID.IsNull)
            {
                this.param.Param_Cus_LngID = this.param_Cus_LngID;
            }


            System.Data.DataSet DS = null;

            SPs.spS_tblCustomer SP = new SPs.spS_tblCustomer();
            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 (PrimaryKey != null)
                {
                    this.SelectedValue = PrimaryKey;
                }
                else
                {
                    base.OnSelectedIndexChanged(EventArgs.Empty);
                }

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

            else
            {
                SP.Dispose();
                throw new OlymarsDemo.DataClasses.CustomException(this.param, "WinListBoxCustom_spS_tblCustomer", "RefreshData");
            }
        }
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <returns>[To be supplied.]</returns>
        public bool Refresh()
        {
            this.displayName = null;

            this.col_Cus_StrLastNameWasUpdated = false;
            this.col_Cus_StrLastNameWasSet     = false;
            this.col_Cus_StrLastName           = System.Data.SqlTypes.SqlString.Null;

            this.col_Cus_StrFirstNameWasUpdated = false;
            this.col_Cus_StrFirstNameWasSet     = false;
            this.col_Cus_StrFirstName           = System.Data.SqlTypes.SqlString.Null;

            this.col_Cus_StrEmailWasUpdated = false;
            this.col_Cus_StrEmailWasSet     = false;
            this.col_Cus_StrEmail           = System.Data.SqlTypes.SqlString.Null;

            bool alreadyOpened = false;

            Params.spS_tblCustomer Param = new Params.spS_tblCustomer(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_Cus_LngID.IsNull)
            {
                Param.Param_Cus_LngID = this.col_Cus_LngID;
            }


            System.Data.SqlClient.SqlDataReader sqlDataReader = null;
            SPs.spS_tblCustomer Sp = new SPs.spS_tblCustomer(false);
            if (Sp.Execute(ref Param, out sqlDataReader))
            {
                if (sqlDataReader.Read())
                {
                    if (!sqlDataReader.IsDBNull(SPs.spS_tblCustomer.Resultset1.Fields.Column_Cus_StrLastName.ColumnIndex))
                    {
                        this.col_Cus_StrLastName = sqlDataReader.GetSqlString(SPs.spS_tblCustomer.Resultset1.Fields.Column_Cus_StrLastName.ColumnIndex);
                    }
                    if (!sqlDataReader.IsDBNull(SPs.spS_tblCustomer.Resultset1.Fields.Column_Cus_StrFirstName.ColumnIndex))
                    {
                        this.col_Cus_StrFirstName = sqlDataReader.GetSqlString(SPs.spS_tblCustomer.Resultset1.Fields.Column_Cus_StrFirstName.ColumnIndex);
                    }
                    if (!sqlDataReader.IsDBNull(SPs.spS_tblCustomer.Resultset1.Fields.Column_Cus_StrEmail.ColumnIndex))
                    {
                        this.col_Cus_StrEmail = sqlDataReader.GetSqlString(SPs.spS_tblCustomer.Resultset1.Fields.Column_Cus_StrEmail.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.tblCustomer_Record", "Refresh");
            }
        }