Пример #1
0
        /// <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));
        }
Пример #2
0
        /// <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));
        }