Example #1
0
        /// <summary>
        /// Loads the JobPart 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_JobPart != null)
                {
                    oAbstract_JobPart.Reset();
                }
                return(false);
            }

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

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

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

            return(this.oAbstract_JobPart.Refresh(PK_JobPartId));
        }
Example #2
0
        /// <summary>
        /// Loads the JobPart 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_JobPart != null)
                {
                    oAbstract_JobPart.Reset();
                }
                return(false);
            }

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

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

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

            return(this.oAbstract_JobPart.Refresh(PK_JobPartId));
        }