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

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

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

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

            return(this.oAbstract_Job.Refresh(PK_JobId));
        }
Beispiel #2
0
        /// <summary>
        /// Loads the Job 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_Job != null)
                {
                    oAbstract_Job.Reset();
                }
                return(false);
            }

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

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

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

            return(this.oAbstract_Job.Refresh(PK_JobId));
        }
        private bool RefreshCurrentRecord()
        {
            EmptyControls();

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

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

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

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


                if (!oAbstract_Job.Col_Price.IsNull)
                {
                    Control_Price.Text = oAbstract_Job.Col_Price.Value.ToString();
                }


                if (!oAbstract_Job.Col_StartDate.IsNull)
                {
                    Control_StartDate.Text = oAbstract_Job.Col_StartDate.Value.ToString();
                }


                if (!oAbstract_Job.Col_EndDate.IsNull)
                {
                    Control_EndDate.Text = oAbstract_Job.Col_EndDate.Value.ToString();
                }


                if (!oAbstract_Job.Col_CustomerId.IsNull)
                {
                    Control_CustomerId.SelectedValue = oAbstract_Job.Col_CustomerId.Value;
                }

                this.IgnoreChanges = false;
                return(true);
            }

            else
            {
                MessageBox.Show("The record does not exist any more !", "Record not found", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return(false);
            }
        }
        /// <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_Job = null;

                this.FK_CustomerId = System.Data.SqlTypes.SqlInt32.Null;

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

            base.Dispose(disposing);
        }