Esempio n. 1
0
        /// <summary>
        /// Releases this System.Windows.Forms.DataGrid.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (this.sqlDataAdapter != null)
                {
                    this.sqlDataAdapter = null;
                }
                this.FK_JobId         = System.Data.SqlTypes.SqlInt32.Null;
                this.FK_JobPartTypeId = System.Data.SqlTypes.SqlInt32.Null;
            }

            base.Dispose(disposing);
        }
Esempio n. 2
0
        /// <summary>
        /// Load or reloads a subset of the table content. In order to successfully
        /// call this method, you need to call first the Initialize method.
        /// </summary>
        /// <param name="startRecord">The zero-based record number to start with.</param>
        /// <param name="maxRecords">The maximum number of records to retrieve.</param>
        public void RefreshData(int startRecord, int maxRecords)
        {
            this.CreateControl();

            if (this.LastKnownConnectionType == Bob.DataClasses.ConnectionType.None)
            {
                throw new InvalidOperationException("You must call the 'Initialize' method before calling this method.");
            }


            switch (this.LastKnownConnectionType)
            {
            case Bob.DataClasses.ConnectionType.ConnectionString:
                this.sqlDataAdapter = new Bob.SqlDataAdapters.SqlDataAdapter_JobPart(this.connectionString, this.FK_JobId, this.FK_JobPartTypeId, "JobPart");
                break;

            case Bob.DataClasses.ConnectionType.SqlConnection:
                this.sqlDataAdapter = new Bob.SqlDataAdapters.SqlDataAdapter_JobPart(this.sqlConnection, this.FK_JobId, this.FK_JobPartTypeId, "JobPart");
                break;
            }

            this.dataSet = null;

            if (startRecord == -1 && maxRecords == -1)
            {
                this.sqlDataAdapter.FillDataSet(ref this.dataSet);
            }
            else
            {
                this.sqlDataAdapter.FillDataSet(ref this.dataSet, startRecord, maxRecords);
            }

            this.dataSet.Tables["JobPart"].Columns["JobPartId"].Caption     = "JobPartId (update this label in the \"Olymars/ColumnLabel\" extended property of the \"JobPartId\" column)";
            this.dataSet.Tables["JobPart"].Columns["JobId"].Caption         = "JobId (update this label in the \"Olymars/ColumnLabel\" extended property of the \"JobId\" column)";
            this.dataSet.Tables["JobPart"].Columns["Description"].Caption   = "Description (update this label in the \"Olymars/ColumnLabel\" extended property of the \"Description\" column)";
            this.dataSet.Tables["JobPart"].Columns["JobPartTypeId"].Caption = "JobPartTypeId (update this label in the \"Olymars/ColumnLabel\" extended property of the \"JobPartTypeId\" column)";
            this.dataSet.Tables["JobPart"].Columns["Units"].Caption         = "Units (update this label in the \"Olymars/ColumnLabel\" extended property of the \"Units\" column)";
            this.dataSet.Tables["JobPart"].Columns["PricePerUnit"].Caption  = "PricePerUnit (update this label in the \"Olymars/ColumnLabel\" extended property of the \"PricePerUnit\" column)";
            this.dataSet.Tables["JobPart"].Columns["TotalPrice"].Caption    = "TotalPrice (update this label in the \"Olymars/ColumnLabel\" extended property of the \"TotalPrice\" column)";

            this.bindingInProgress = true;
            this.DataSource        = this.dataSet.Tables["JobPart"].DefaultView;
            this.bindingInProgress = false;
        }