Esempio n. 1
0
        /// <summary>
        /// Loads the JobPartType 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_JobPartType != null)
                {
                    oAbstract_JobPartType.Reset();
                }
                return(false);
            }

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

            if (this.oAbstract_JobPartType == null)
            {
                switch (this.LastKnownConnectionType)
                {
                case Bob.DataClasses.ConnectionType.ConnectionString:
                    this.oAbstract_JobPartType = new Bob.AbstractClasses.Abstract_JobPartType(this.connectionString);
                    break;

                case Bob.DataClasses.ConnectionType.SqlConnection:
                    this.oAbstract_JobPartType = new Bob.AbstractClasses.Abstract_JobPartType(this.sqlConnection);
                    break;
                }
            }

            return(this.oAbstract_JobPartType.Refresh(PK_JobPartTypeId));
        }
        /// <summary>
        /// Loads the JobPartType 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_JobPartType != null)
                {
                    oAbstract_JobPartType.Reset();
                }
                return(false);
            }

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

            if (this.oAbstract_JobPartType == null)
            {
                switch (this.LastKnownConnectionType)
                {
                case Bob.DataClasses.ConnectionType.ConnectionString:
                    this.oAbstract_JobPartType = new Bob.AbstractClasses.Abstract_JobPartType(this.connectionString);
                    break;

                case Bob.DataClasses.ConnectionType.SqlConnection:
                    this.oAbstract_JobPartType = new Bob.AbstractClasses.Abstract_JobPartType(this.sqlConnection);
                    break;
                }
            }

            return(this.oAbstract_JobPartType.Refresh(PK_JobPartTypeId));
        }