// Adds Candidate Part to Associated Parts List private void EditedAssociationAdder_Click(object sender, RoutedEventArgs e) {// Fix Me for (int i = 0; i < EditCandidateData.Rows.Count; i++) { if ((bool)EditCandidateData.Rows[i].ItemArray[0] == true) { src.Part.BasePart TemplateAssociation_e = new src.Part.BasePart(); TemplateAssociation_e.basePartID = (int)EditCandidateData.Rows[i].ItemArray[1]; TemplateAssociation_e.basePartName = (string)EditCandidateData.Rows[i].ItemArray[2]; TemplateAssociation_e.basePartPrice = (decimal)EditCandidateData.Rows[i].ItemArray[3]; TemplateAssociation_e.basePartQty = (int)EditCandidateData.Rows[i].ItemArray[4]; TemplateAssociation_e.basePartMin = (int)EditCandidateData.Rows[i].ItemArray[5]; TemplateAssociation_e.basePartMax = (int)EditCandidateData.Rows[i].ItemArray[6]; DataRow addedRow = EditAssociatedData.NewRow(); addedRow[0] = false; addedRow[1] = (int)EditCandidateData.Rows[i].ItemArray[1]; addedRow[2] = (string)EditCandidateData.Rows[i].ItemArray[2]; addedRow[3] = (decimal)EditCandidateData.Rows[i].ItemArray[3]; addedRow[4] = (int)EditCandidateData.Rows[i].ItemArray[4]; addedRow[5] = (int)EditCandidateData.Rows[i].ItemArray[5]; addedRow[6] = (int)EditCandidateData.Rows[i].ItemArray[6]; EditAssociatedData.Rows.Add(addedRow); src.InHouse AddAssoc_e = new src.InHouse(TemplateAssociation_e, 99); EditWorkingProduct.AddAssociatedPart((src.Part)AddAssoc_e); Console.WriteLine("Added Part"); } } }
// Adds Candidate Part to Associated Parts List private void NewAssociationAdder_Click(object sender, RoutedEventArgs e) { for (int i = 0; i < NewCandidateData.Rows.Count; i++) { if ((bool)NewCandidateData.Rows[i].ItemArray[0] == true) { src.Part.BasePart TemplateAssociation = new src.Part.BasePart(); TemplateAssociation.basePartID = (int)NewCandidateData.Rows[i].ItemArray[1]; TemplateAssociation.basePartName = (string)NewCandidateData.Rows[i].ItemArray[2]; TemplateAssociation.basePartPrice = (decimal)NewCandidateData.Rows[i].ItemArray[3]; TemplateAssociation.basePartQty = (int)NewCandidateData.Rows[i].ItemArray[4]; TemplateAssociation.basePartMin = (int)NewCandidateData.Rows[i].ItemArray[5]; TemplateAssociation.basePartMax = (int)NewCandidateData.Rows[i].ItemArray[6]; DataRow addedRow = NewAssociatedData.NewRow(); addedRow[0] = false; addedRow[1] = (int)NewCandidateData.Rows[i].ItemArray[1]; addedRow[2] = (string)NewCandidateData.Rows[i].ItemArray[2]; addedRow[3] = (decimal)NewCandidateData.Rows[i].ItemArray[3]; addedRow[4] = (int)NewCandidateData.Rows[i].ItemArray[4]; addedRow[5] = (int)NewCandidateData.Rows[i].ItemArray[5]; addedRow[6] = (int)NewCandidateData.Rows[i].ItemArray[6]; NewAssociatedData.Rows.Add(addedRow); src.InHouse AddAssoc = new src.InHouse(TemplateAssociation, 99); NewWorkingProduct.AddAssociatedPart((src.Part)AddAssoc); Console.WriteLine("Added Part"); } } NewAssociatedProdDataGrid.ItemsSource = NewAssociatedData.DefaultView; }