/// <summary> /// Loads the tblCustomer 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_tblCustomer != null) { oAbstract_tblCustomer.Reset(); } return(false); } System.Data.SqlTypes.SqlInt32 PK_Cus_LngID = Convert.ToInt32(this.SelectedItem.Value); if (this.oAbstract_tblCustomer == null) { switch (this.LastKnownConnectionType) { case OlymarsDemo.DataClasses.ConnectionType.ConnectionString: this.oAbstract_tblCustomer = new OlymarsDemo.AbstractClasses.Abstract_tblCustomer(this.connectionString); break; case OlymarsDemo.DataClasses.ConnectionType.SqlConnection: this.oAbstract_tblCustomer = new OlymarsDemo.AbstractClasses.Abstract_tblCustomer(this.sqlConnection); break; } } return(this.oAbstract_tblCustomer.Refresh(PK_Cus_LngID)); }
/// <summary> /// Loads the tblCustomer 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_tblCustomer != null) { oAbstract_tblCustomer.Reset(); } return(false); } System.Data.SqlTypes.SqlInt32 PK_Cus_LngID = (System.Int32) this.SelectedValue; if (this.oAbstract_tblCustomer == null) { switch (this.LastKnownConnectionType) { case OlymarsDemo.DataClasses.ConnectionType.ConnectionString: this.oAbstract_tblCustomer = new OlymarsDemo.AbstractClasses.Abstract_tblCustomer(this.connectionString); break; case OlymarsDemo.DataClasses.ConnectionType.SqlConnection: this.oAbstract_tblCustomer = new OlymarsDemo.AbstractClasses.Abstract_tblCustomer(this.sqlConnection); break; } } return(this.oAbstract_tblCustomer.Refresh(PK_Cus_LngID)); }
/// <summary> /// Disposes the current instance of this object. /// </summary> public override void Dispose() { this.oAbstract_tblCustomer = null; if (this.param != null) { this.param.Dispose(); } base.Dispose(); }
/// <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_tblCustomer = null; if (this.param != null) { this.param.Dispose(); } } base.Dispose(disposing); }
private bool RefreshCurrentRecord() { EmptyControls(); Abstracts.Abstract_tblCustomer oAbstract_tblCustomer = null; switch (this.lastKnownConnectionType) { case OlymarsDemo.DataClasses.ConnectionType.ConnectionString: oAbstract_tblCustomer = new Abstracts.Abstract_tblCustomer(this.connectionString); break; case OlymarsDemo.DataClasses.ConnectionType.SqlConnection: oAbstract_tblCustomer = new Abstracts.Abstract_tblCustomer(this.sqlConnection); break; } if (oAbstract_tblCustomer.Refresh(this.currentID)) { this.IgnoreChanges = true; if (!oAbstract_tblCustomer.Col_Cus_StrLastName.IsNull) { Control_Cus_StrLastName.Text = oAbstract_tblCustomer.Col_Cus_StrLastName.Value.ToString(); } if (!oAbstract_tblCustomer.Col_Cus_StrFirstName.IsNull) { Control_Cus_StrFirstName.Text = oAbstract_tblCustomer.Col_Cus_StrFirstName.Value.ToString(); } if (!oAbstract_tblCustomer.Col_Cus_StrEmail.IsNull) { Control_Cus_StrEmail.Text = oAbstract_tblCustomer.Col_Cus_StrEmail.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); } }