/// <summary> /// Gets the type of the part. /// </summary> private void GetPartType() { try { F8044MaterialsData.ListMaterialsResourceDataTable tempPartList = new F8044MaterialsData.ListMaterialsResourceDataTable(); ////Fills DataTable with parts that are currently active. ////IsActive(1) - Gets only active parts this.partTypeDataTable = this.form8044Control.WorkItem.F8044_ListMaterialsResourceType(1, this.keyId).ListMaterialsResource; F8044MaterialsData.ListMaterialsResourceRow dr; dr = tempPartList.NewListMaterialsResourceRow(); ////Sets the default DisplayMember for PartComboBox as <Select> dr.PartDescription = "<Select>"; tempPartList.Rows.Add(dr); tempPartList.Merge(this.partTypeDataTable); ////Populates the parts that are currently active. this.PartComboBox.DataSource = tempPartList; this.PartComboBox.ValueMember = tempPartList.PartIDColumn.ColumnName; this.PartComboBox.DisplayMember = tempPartList.PartDescriptionColumn.ColumnName; } catch (SoapException ex) { ExceptionManager.ManageException(ex, ExceptionManager.ActionType.CloseCurrentForm, this.ParentForm); } catch (Exception ex) { ExceptionManager.ManageException(ex, ExceptionManager.ActionType.CloseCurrentForm, this.ParentForm); } }
/// <summary> /// Customizes the materials grid view. /// </summary> private void CustomizeMaterialsGridView() { this.MaterialsGridView.AutoGenerateColumns = false; DataGridViewColumnCollection columns = this.MaterialsGridView.Columns; this.gridUserTypeList = this.form8044Control.WorkItem.F8040_ListTimeResourceInformation(4).ListTimeResource; this.gridPartTypeDataTableAll = this.form8044Control.WorkItem.F8044_ListMaterialsResourceType(2, this.keyId).ListMaterialsResource; columns["User"].DataPropertyName = this.materialDetailsDataSet.ListMaterials.UserIDColumn.ColumnName; columns["Part"].DataPropertyName = this.materialDetailsDataSet.ListMaterials.PartIDColumn.ColumnName; columns["Qnty"].DataPropertyName = this.materialDetailsDataSet.ListMaterials.QuantityColumn.ColumnName; columns["Comment"].DataPropertyName = this.materialDetailsDataSet.ListMaterials.CommentColumn.ColumnName; columns["MaterialId"].DataPropertyName = this.materialDetailsDataSet.ListMaterials.MaterialIDColumn.ColumnName; columns["EventID"].DataPropertyName = this.materialDetailsDataSet.ListMaterials.EventIDColumn.ColumnName; columns["WOID"].DataPropertyName = this.materialDetailsDataSet.ListMaterials.WOIDColumn.ColumnName; columns["User"].DisplayIndex = 0; columns["Part"].DisplayIndex = 1; columns["Qnty"].DisplayIndex = 2; columns["Comment"].DisplayIndex = 3; columns["MaterialId"].DisplayIndex = 4; columns["EventId"].DisplayIndex = 5; columns["WOID"].DisplayIndex = 6; this.MaterialsGridView.DataSource = this.materialDetailsDataSet.ListMaterials; (this.MaterialsGridView.Columns["User"] as DataGridViewComboBoxColumn).DataSource = this.gridUserTypeList; (this.MaterialsGridView.Columns["User"] as DataGridViewComboBoxColumn).DisplayMember = this.gridUserTypeList.ResourceNameColumn.ColumnName; ////"ResourceName"; (this.MaterialsGridView.Columns["User"] as DataGridViewComboBoxColumn).ValueMember = this.gridUserTypeList.ResourceIDColumn.ColumnName; ////"ResourceID"; (this.MaterialsGridView.Columns["Part"] as DataGridViewComboBoxColumn).DataSource = this.gridPartTypeDataTableAll; (this.MaterialsGridView.Columns["Part"] as DataGridViewComboBoxColumn).DisplayMember = this.gridPartTypeDataTableAll.PartDescriptionColumn.ColumnName; ////"PartDescription"; (this.MaterialsGridView.Columns["Part"] as DataGridViewComboBoxColumn).ValueMember = this.gridPartTypeDataTableAll.PartIDColumn.ColumnName; ////"PartID"; }