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));
        }
Esempio n. 3
0
        /// <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_JobPartType = null;


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

            base.Dispose(disposing);
        }
Esempio n. 4
0
        private bool RefreshCurrentRecord()
        {
            EmptyControls();

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

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

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

                if (!oAbstract_JobPartType.Col_Description.IsNull)
                {
                    Control_Description.Text = oAbstract_JobPartType.Col_Description.Value.ToString();
                }


                if (!oAbstract_JobPartType.Col_GeneralUnitCost.IsNull)
                {
                    Control_GeneralUnitCost.Text = oAbstract_JobPartType.Col_GeneralUnitCost.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);
            }
        }