/// <summary> /// Gets the type of the user. /// </summary> private void GetUserType() { try { F8040TimeData.ListTimeResourceDataTable tempUserTypeList = new F8040TimeData.ListTimeResourceDataTable(); ////Fills DataTable with users that are currently active. ////IsActive(3) - Gets only active parts this.userTypeDataTable = this.form8044Control.WorkItem.F8040_ListTimeResourceInformation(3).ListTimeResource; F8040TimeData.ListTimeResourceRow dr; dr = tempUserTypeList.NewListTimeResourceRow(); dr.ResourceID = 0; ////Sets the default DisplayMember for UserComboBox as <Select> dr.ResourceName = "<Select>"; dr.IsUser = "******"; tempUserTypeList.Rows.Add(dr); tempUserTypeList.Merge(this.userTypeDataTable); ////Populates the users that are currently active. this.UserComboBox.DataSource = tempUserTypeList; this.UserComboBox.ValueMember = tempUserTypeList.ResourceIDColumn.ColumnName; this.UserComboBox.DisplayMember = tempUserTypeList.ResourceNameColumn.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"; }