コード例 #1
0
        /// <summary>
        /// Load or reloads all the table content. You can specify which records you want to be checked by default.
        /// In order to successfully call this method, you need to call first the Initialize method.
        /// </summary>
        /// <param name="ArrayOf_PK_Ord_GuidID">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(System.Data.SqlTypes.SqlGuid[] ArrayOf_PK_Ord_GuidID, int startRecord, int maxRecords)
        {
            this.param = new Params.spS_tblOrder_Display(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;

            default:
                throw new InvalidOperationException("This control has not been initialized. You must call the Initialize method before calling this method.");
            }

            this.param.Param_Ord_LngCustomerID = this.FK_Ord_LngCustomerID;

            System.Data.DataSet DS = null;

            SPs.spS_tblOrder_Display SP = new SPs.spS_tblOrder_Display(false);

            if (SP.Execute(ref this.param, ref DS, startRecord, maxRecords))
            {
                this.BeginUpdate();
                this.bindingInProgress = true;
                this.DataSource        = DS.Tables["spS_tblOrder_Display"].DefaultView;
                this.ValueMember       = SPs.spS_tblOrder_Display.Resultset1.Fields.Column_ID1.ColumnName;
                this.DisplayMember     = SPs.spS_tblOrder_Display.Resultset1.Fields.Column_Display.ColumnName;
                this.bindingInProgress = false;

                System.Data.DataView dataView = DS.Tables["spS_tblOrder_Display"].DefaultView;

                if (ArrayOf_PK_Ord_GuidID != null && ArrayOf_PK_Ord_GuidID.Length > 0)
                {
                    this.SetRecordsCheckState(ArrayOf_PK_Ord_GuidID, System.Windows.Forms.CheckState.Checked);
                }
                else
                {
                    base.OnSelectedIndexChanged(EventArgs.Empty);
                }
                this.EndUpdate();
                SP.Dispose();
            }
            else
            {
                SP.Dispose();
                throw new OlymarsDemo.DataClasses.CustomException(this.param, "WinCheckedListBox_tblOrder : System.Windows.Forms.CheckedListBox", "RefreshData");
            }
        }
コード例 #2
0
        /// <summary>
        /// Load or reloads a subset of the table content. You can specify which record you want to be selected
        /// by default. In order to successfully call this method, you need to call first the Initialize method.
        /// </summary>
        /// <param name="PK_Ord_GuidID">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(System.Data.SqlTypes.SqlGuid PK_Ord_GuidID, int startRecord, int maxRecords)
        {
            this.param = new Params.spS_tblOrder_Display(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;

            default:
                throw new InvalidOperationException("This control has not been initialized. You must call the Initialize method before calling this method.");
            }

            this.param.Param_Ord_LngCustomerID = this.FK_Ord_LngCustomerID;

            System.Data.DataSet DS = null;

            SPs.spS_tblOrder_Display SP = new SPs.spS_tblOrder_Display(false);

            if (SP.Execute(ref this.param, ref DS, startRecord, maxRecords))
            {
                this.DataSource     = DS.Tables["spS_tblOrder_Display"].DefaultView;
                this.DataValueField = SPs.spS_tblOrder_Display.Resultset1.Fields.Column_ID1.ColumnName;
                this.DataTextField  = SPs.spS_tblOrder_Display.Resultset1.Fields.Column_Display.ColumnName;
                if (this.doDataBindAfterRefreshData)
                {
                    this.DataBind();
                }

                if (!PK_Ord_GuidID.IsNull)
                {
                    System.Web.UI.WebControls.ListItem listItem = this.Items.FindByValue(PK_Ord_GuidID.Value.ToString());
                    if (listItem != null)
                    {
                        listItem.Selected = true;
                    }
                }
            }
            else
            {
                SP.Dispose();
                throw new OlymarsDemo.DataClasses.CustomException(this.param, "WebListBox_tblOrder : System.Web.UI.WebControls.ListBox", "RefreshData");
            }
        }
コード例 #3
0
        public Common.Item[] GetAllDisplay_tblOrder_Collection_Array(WSTypes.WSInt32 col_Ord_LngCustomerID)
        {
            Params.spS_tblOrder_Display param = new Params.spS_tblOrder_Display(true);

            param.SetUpConnection(string.Empty);

            if (col_Ord_LngCustomerID == null || col_Ord_LngCustomerID.UseNull)
            {
                param.Param_Ord_LngCustomerID = SqlInt32.Null;
            }
            else if (!col_Ord_LngCustomerID.UseDefault)
            {
                param.Param_Ord_LngCustomerID = col_Ord_LngCustomerID.Value;
            }


            using (SPs.spS_tblOrder_Display sp = new SPs.spS_tblOrder_Display(true)) {
                System.Collections.ArrayList records = new System.Collections.ArrayList();

                System.Data.SqlClient.SqlDataReader sqlDataReader = null;
                sp.Execute(ref param, out sqlDataReader);

                while (sqlDataReader.Read())
                {
                    records.Add(new Common.Item(sqlDataReader.GetGuid(SPs.spS_tblOrder_Display.Resultset1.Fields.Column_ID1.ColumnIndex), sqlDataReader.GetString(SPs.spS_tblOrder_Display.Resultset1.Fields.Column_Display.ColumnIndex)));
                }

                sqlDataReader.Close();

                if (sp.Connection.State == System.Data.ConnectionState.Open)
                {
                    sp.Connection.Close();
                }

                sp.Dispose();
                param.Dispose();

                return((Common.Item[])records.ToArray(typeof(Common.Item)));
            }
        }
コード例 #4
0
        /// <summary>
        /// Load or reloads a subset of the table content. You can specify which record you want to be selected
        /// by default. In order to successfully call this method, you need to call first the Initialize method.
        /// </summary>
        /// <param name="PK_Ord_GuidID">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(System.Data.SqlTypes.SqlGuid PK_Ord_GuidID, int startRecord, int maxRecords)
        {
            if (!PK_Ord_GuidID.IsNull && this.SelectionMode == System.Windows.Forms.SelectionMode.None)
            {
                throw new ArgumentException("You cannot supply a value to this parameter when SelectionMode property is set to None.", "PK_Ord_GuidID");
            }

            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_Display(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;

            default:
                throw new InvalidOperationException("This control has not been initialized. You must call the Initialize method before calling this method.");
            }

            this.param.Param_Ord_LngCustomerID = this.FK_Ord_LngCustomerID;

            System.Data.DataSet DS = null;

            SPs.spS_tblOrder_Display SP = new SPs.spS_tblOrder_Display(false);

            if (SP.Execute(ref this.param, ref DS, startRecord, maxRecords))
            {
                this.BeginUpdate();
                this.bindingInProgress = true;
                this.DataSource        = DS.Tables["spS_tblOrder_Display"].DefaultView;
                this.ValueMember       = SPs.spS_tblOrder_Display.Resultset1.Fields.Column_ID1.ColumnName;
                this.DisplayMember     = SPs.spS_tblOrder_Display.Resultset1.Fields.Column_Display.ColumnName;
                this.bindingInProgress = false;

                if (!PK_Ord_GuidID.IsNull)
                {
                    this.SelectedValue = PK_Ord_GuidID.Value;
                }
                else
                {
                    base.OnSelectedIndexChanged(EventArgs.Empty);
                }

                this.EndUpdate();
                SP.Dispose();
            }
            else
            {
                SP.Dispose();
                throw new OlymarsDemo.DataClasses.CustomException(this.param, "WinListBox_tblOrder : System.Windows.Forms.ListBox", "RefreshData");
            }
        }