/// <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_tblSupplierProduct();

            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_Spr_GuidProductID.IsNull)
            {
                this.param.Param_Spr_GuidProductID = this.param_Spr_GuidProductID;
            }


            if (!this.param_Spr_GuidSupplierID.IsNull)
            {
                this.param.Param_Spr_GuidSupplierID = this.param_Spr_GuidSupplierID;
            }


            System.Data.DataSet DS = null;

            SPs.spS_tblSupplierProduct SP = new SPs.spS_tblSupplierProduct();
            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_tblSupplierProduct", "RefreshData");
            }
        }
        /// <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_tblSupplierProduct(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_Spr_GuidProductID.IsNull)
            {
                this.param.Param_Spr_GuidProductID = this.FK_Spr_GuidProductID;
            }

            if (!this.FK_Spr_GuidSupplierID.IsNull)
            {
                this.param.Param_Spr_GuidSupplierID = this.FK_Spr_GuidSupplierID;
            }

            System.Data.DataSet DS = null;

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

                SP.Dispose();
            }

            else
            {
                SP.Dispose();
                throw new OlymarsDemo.DataClasses.CustomException(this.param, "WebDataList_tblSupplierProduct : System.Web.UI.WebControls.DataList", "RefreshData");
            }
        }
Пример #3
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_tblSupplierProduct();

            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_Spr_GuidProductID.IsNull)
            {
                this.param.Param_Spr_GuidProductID = this.param_Spr_GuidProductID;
            }


            if (!this.param_Spr_GuidSupplierID.IsNull)
            {
                this.param.Param_Spr_GuidSupplierID = this.param_Spr_GuidSupplierID;
            }


            System.Data.DataSet DS = null;

            SPs.spS_tblSupplierProduct SP = new SPs.spS_tblSupplierProduct();
            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_tblSupplierProduct", "RefreshData");
            }
        }
Пример #4
0
        /// <summary>
        /// Allows you to load a specific record of the [tblSupplierProduct] table.
        /// </summary>
        /// <param name="col_Spr_GuidProductID">Update this description in the &quot;Olymars/Description&quot; extended property of the &quot;Spr_GuidProductID&quot; column.</param>
        /// <param name="col_Spr_GuidSupplierID">Update this description in the &quot;Olymars/Description&quot; extended property of the &quot;Spr_GuidSupplierID&quot; column.</param>
        public bool Refresh(System.Data.SqlTypes.SqlGuid col_Spr_GuidProductID, System.Data.SqlTypes.SqlGuid col_Spr_GuidSupplierID)
        {
            bool Status;

            Reset();

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

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


            this.col_Spr_GuidProductID  = col_Spr_GuidProductID;
            this.col_Spr_GuidSupplierID = col_Spr_GuidSupplierID;

            this.Param.Reset();

            this.Param.Param_Spr_GuidProductID  = this.col_Spr_GuidProductID;
            this.Param.Param_Spr_GuidSupplierID = this.col_Spr_GuidSupplierID;

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

            if (SP.Execute(ref this.Param, out DR))
            {
                Status = false;
                if (DR.Read())
                {
                    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_tblSupplierProduct", "Refresh");
            }
        }