/// <summary> /// Loads the Title abstract class for the current selected record primary key. /// </summary> /// <returns>true if the call succeeded; false, otherwise.</returns> public bool RefreshCurrentRecord() { if (this.SelectedIndex == -1) { if (oAbstract_Title != null) { oAbstract_Title.Reset(); } return(false); } System.Data.SqlTypes.SqlInt32 PK_TitleId = (System.Int32) this.SelectedValue; if (this.oAbstract_Title == null) { switch (this.LastKnownConnectionType) { case Bob.DataClasses.ConnectionType.ConnectionString: this.oAbstract_Title = new Bob.AbstractClasses.Abstract_Title(this.connectionString); break; case Bob.DataClasses.ConnectionType.SqlConnection: this.oAbstract_Title = new Bob.AbstractClasses.Abstract_Title(this.sqlConnection); break; } } return(this.oAbstract_Title.Refresh(PK_TitleId)); }
/// <summary> /// Loads the Title abstract class for the current selected record primary key. /// </summary> /// <returns>true if the call succeeded; false, otherwise.</returns> public bool RefreshCurrentRecord() { if (this.SelectionMode != System.Windows.Forms.SelectionMode.One) { throw new InvalidOperationException("SelectionMode property is not set to One. Hence, you cannot call this method."); } if (this.SelectedIndex == -1) { if (oAbstract_Title != null) { oAbstract_Title.Reset(); } return(false); } System.Data.SqlTypes.SqlInt32 PK_TitleId = (System.Int32) this.SelectedValue; if (this.oAbstract_Title == null) { switch (this.LastKnownConnectionType) { case Bob.DataClasses.ConnectionType.ConnectionString: this.oAbstract_Title = new Bob.AbstractClasses.Abstract_Title(this.connectionString); break; case Bob.DataClasses.ConnectionType.SqlConnection: this.oAbstract_Title = new Bob.AbstractClasses.Abstract_Title(this.sqlConnection); break; } } return(this.oAbstract_Title.Refresh(PK_TitleId)); }
/// <summary> /// Disposes the current instance of this object. /// </summary> /// <param name="disposing"> /// true to release both managed and unmanaged resources; /// false to release only unmanaged resources. /// </param> protected override void Dispose(bool disposing) { if (disposing) { this.oAbstract_Title = null; if (this.param != null) { this.param.Dispose(); } } base.Dispose(disposing); }
private bool RefreshCurrentRecord() { EmptyControls(); Abstracts.Abstract_Title oAbstract_Title = null; switch (this.lastKnownConnectionType) { case Bob.DataClasses.ConnectionType.ConnectionString: oAbstract_Title = new Abstracts.Abstract_Title(this.connectionString); break; case Bob.DataClasses.ConnectionType.SqlConnection: oAbstract_Title = new Abstracts.Abstract_Title(this.sqlConnection); break; } if (oAbstract_Title.Refresh(this.currentID)) { this.IgnoreChanges = true; if (!oAbstract_Title.Col_Title.IsNull) { Control_Title.Text = oAbstract_Title.Col_Title.Value.ToString(); } this.IgnoreChanges = false; return(true); } else { MessageBox.Show("The record does not exist any more !", "Record not found", MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } }