/// <summary>
        /// Loads the tblCategory 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_tblCategory != null)
                {
                    oAbstract_tblCategory.Reset();
                }
                return(false);
            }

            System.Data.SqlTypes.SqlInt32 PK_Cat_LngID = Convert.ToInt32(this.SelectedItem.Value);

            if (this.oAbstract_tblCategory == null)
            {
                switch (this.LastKnownConnectionType)
                {
                case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                    this.oAbstract_tblCategory = new OlymarsDemo.AbstractClasses.Abstract_tblCategory(this.connectionString);
                    break;

                case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                    this.oAbstract_tblCategory = new OlymarsDemo.AbstractClasses.Abstract_tblCategory(this.sqlConnection);
                    break;
                }
            }

            return(this.oAbstract_tblCategory.Refresh(PK_Cat_LngID));
        }
        /// <summary>
        /// Loads the tblCategory 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_tblCategory != null)
                {
                    oAbstract_tblCategory.Reset();
                }
                return(false);
            }

            System.Data.SqlTypes.SqlInt32 PK_Cat_LngID = (System.Int32) this.SelectedValue;

            if (this.oAbstract_tblCategory == null)
            {
                switch (this.LastKnownConnectionType)
                {
                case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                    this.oAbstract_tblCategory = new OlymarsDemo.AbstractClasses.Abstract_tblCategory(this.connectionString);
                    break;

                case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                    this.oAbstract_tblCategory = new OlymarsDemo.AbstractClasses.Abstract_tblCategory(this.sqlConnection);
                    break;
                }
            }

            return(this.oAbstract_tblCategory.Refresh(PK_Cat_LngID));
        }
        /// <summary>
        /// Disposes the current instance of this object.
        /// </summary>
        public override void Dispose()
        {
            this.oAbstract_tblCategory = 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_tblCategory = null;


                if (this.param != null)
                {
                    this.param.Dispose();
                }
            }

            base.Dispose(disposing);
        }
Example #5
0
        private bool RefreshCurrentRecord()
        {
            EmptyControls();

            Abstracts.Abstract_tblCategory oAbstract_tblCategory = null;
            switch (this.lastKnownConnectionType)
            {
            case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                oAbstract_tblCategory = new Abstracts.Abstract_tblCategory(this.connectionString);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                oAbstract_tblCategory = new Abstracts.Abstract_tblCategory(this.sqlConnection);
                break;
            }

            if (oAbstract_tblCategory.Refresh(this.currentID))
            {
                this.IgnoreChanges = true;

                if (!oAbstract_tblCategory.Col_Cat_StrName.IsNull)
                {
                    Control_Cat_StrName.Text = oAbstract_tblCategory.Col_Cat_StrName.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);
            }
        }