/// <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_CustomerID">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.SqlInt32[] ArrayOf_PK_CustomerID, int startRecord, int maxRecords) { this.CreateControl(); this.param = new Params.spS_Customers_Display(true); switch (this.LastKnownConnectionType) { case Bob.DataClasses.ConnectionType.ConnectionString: this.param.SetUpConnection(this.connectionString); break; case Bob.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.CommandTimeOut = this.commandTimeOut; this.param.Param_TitleId = this.FK_TitleId; System.Data.DataSet DS = null; SPs.spS_Customers_Display SP = new SPs.spS_Customers_Display(false); if (SP.Execute(ref this.param, ref DS, startRecord, maxRecords)) { this.BeginUpdate(); this.bindingInProgress = true; this.DataSource = DS.Tables["spS_Customers_Display"].DefaultView; this.ValueMember = SPs.spS_Customers_Display.Resultset1.Fields.Column_ID1.ColumnName; this.DisplayMember = SPs.spS_Customers_Display.Resultset1.Fields.Column_Display.ColumnName; this.bindingInProgress = false; System.Data.DataView dataView = DS.Tables["spS_Customers_Display"].DefaultView; if (ArrayOf_PK_CustomerID != null && ArrayOf_PK_CustomerID.Length > 0) { this.SetRecordsCheckState(ArrayOf_PK_CustomerID, System.Windows.Forms.CheckState.Checked); } else { base.OnSelectedIndexChanged(EventArgs.Empty); } this.EndUpdate(); SP.Dispose(); } else { SP.Dispose(); throw new Bob.DataClasses.CustomException(this.param, "WinCheckedListBox_Customers : System.Windows.Forms.CheckedListBox", "RefreshData"); } }
/// <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_CustomerID">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.SqlInt32 PK_CustomerID, int startRecord, int maxRecords) { this.CreateControl(); if (!PK_CustomerID.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_CustomerID"); } if (this.LastKnownConnectionType == Bob.DataClasses.ConnectionType.None) { throw new InvalidOperationException("You must call the 'Initialize' method before calling this method."); } this.param = new Params.spS_Customers_Display(true); switch (this.LastKnownConnectionType) { case Bob.DataClasses.ConnectionType.ConnectionString: this.param.SetUpConnection(this.connectionString); break; case Bob.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.CommandTimeOut = this.commandTimeOut; this.param.Param_TitleId = this.FK_TitleId; System.Data.DataSet DS = null; SPs.spS_Customers_Display SP = new SPs.spS_Customers_Display(false); if (SP.Execute(ref this.param, ref DS, startRecord, maxRecords)) { this.BeginUpdate(); this.bindingInProgress = true; this.DataSource = DS.Tables["spS_Customers_Display"].DefaultView; this.ValueMember = SPs.spS_Customers_Display.Resultset1.Fields.Column_ID1.ColumnName; this.DisplayMember = SPs.spS_Customers_Display.Resultset1.Fields.Column_Display.ColumnName; this.bindingInProgress = false; if (!PK_CustomerID.IsNull) { this.SelectedValue = PK_CustomerID.Value; } else { base.OnSelectedIndexChanged(EventArgs.Empty); } this.EndUpdate(); SP.Dispose(); } else { SP.Dispose(); throw new Bob.DataClasses.CustomException(this.param, "WinListBox_Customers : System.Windows.Forms.ListBox", "RefreshData"); } }