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

            System.Data.SqlTypes.SqlGuid PK_Sup_GuidID = (System.Guid) this.SelectedValue;

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

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

            return(this.oAbstract_tblSupplier.Refresh(PK_Sup_GuidID));
        }
        /// <summary>
        /// Loads the tblSupplier 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_tblSupplier != null)
                {
                    oAbstract_tblSupplier.Reset();
                }
                return(false);
            }

            System.Data.SqlTypes.SqlGuid PK_Sup_GuidID = new Guid(this.SelectedItem.Value);

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

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

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


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

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

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

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

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

                if (!oAbstract_tblSupplier.Col_Sup_StrName.IsNull)
                {
                    Control_Sup_StrName.Text = oAbstract_tblSupplier.Col_Sup_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);
            }
        }