Beispiel #1
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);
            }
        }