示例#1
0
        /// <summary>
        /// Load or reloads a subset of the chosen resultset returned by the stored procedure.
        /// 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_tblOrderItem_Full();

            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_Oit_GuidID.IsNull)
            {
                this.param.Param_Oit_GuidID = this.param_Oit_GuidID;
            }

            if (!this.param_Oit_GuidOrderID.IsNull)
            {
                this.param.Param_Oit_GuidOrderID = this.param_Oit_GuidOrderID;
            }

            if (!this.param_Oit_GuidProductID.IsNull)
            {
                this.param.Param_Oit_GuidProductID = this.param_Oit_GuidProductID;
            }

            System.Data.DataSet DS = null;

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

            else
            {
                SP.Dispose();
                throw new OlymarsDemo.DataClasses.CustomException(this.param, "WebDataListCustom_spS_tblOrderItem_Full", "RefreshData");
            }
        }
示例#2
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)
        {
            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_tblOrderItem_Full();

            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_Oit_GuidID.IsNull)
            {
                this.param.Param_Oit_GuidID = this.param_Oit_GuidID;
            }


            if (!this.param_Oit_GuidOrderID.IsNull)
            {
                this.param.Param_Oit_GuidOrderID = this.param_Oit_GuidOrderID;
            }


            if (!this.param_Oit_GuidProductID.IsNull)
            {
                this.param.Param_Oit_GuidProductID = this.param_Oit_GuidProductID;
            }


            System.Data.DataSet DS = null;

            SPs.spS_tblOrderItem_Full SP = new SPs.spS_tblOrderItem_Full();
            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, "WebListBoxCustom_spS_tblOrderItem_Full", "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="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_tblOrderItem_Full();

            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_Oit_GuidID.IsNull)
            {
                this.param.Param_Oit_GuidID = this.param_Oit_GuidID;
            }


            if (!this.param_Oit_GuidOrderID.IsNull)
            {
                this.param.Param_Oit_GuidOrderID = this.param_Oit_GuidOrderID;
            }


            if (!this.param_Oit_GuidProductID.IsNull)
            {
                this.param.Param_Oit_GuidProductID = this.param_Oit_GuidProductID;
            }


            System.Data.DataSet DS = null;

            SPs.spS_tblOrderItem_Full SP = new SPs.spS_tblOrderItem_Full();
            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, "WinComboBoxCustom_spS_tblOrderItem_Full", "RefreshData");
            }
        }