private void ButtonChangeYarn_Click(object sender, RoutedEventArgs e) { YarnSpecification yarnSpecification = DataGridYarnSpecification.SelectedItem as YarnSpecification; MerchantYarnPrice merchantYarnPrice = DataGridMerchantYarnPrice.SelectedItem as MerchantYarnPrice; SpecificationYarnPrice specificationYarnPrice = new SpecificationYarnPrice { YarnPriceNo = merchantYarnPrice.YarnPriceNo, Ingredient = yarnSpecification.Ingredient, Name = merchantYarnPrice.Name, Color = yarnSpecification.Color, YarnCount = yarnSpecification.YarnCount, YarnMerchant = merchantYarnPrice.YarnMerchant, Price = merchantYarnPrice.Price }; ChangeYarnExecute(specificationYarnPrice); }
private void ChangeYarn(SpecificationYarnPrice specificationYarnPrice) { int selectedIndex = DataGridFabricIngredientProportion.SelectedIndex; int groupNo = Convert.ToInt32(ComboBoxGroup.SelectedItem); //如果紗成分比例沒有選擇一個色的話則會新增一個比例 //否則會將選擇到的比例 if (selectedIndex == -1) { MessageBox.Show("請選擇一筆要修改的資料!"); } else { var selectedItem = DataGridFabricIngredientProportion.SelectedItem as FabricIngredientProportion; FabricIngredientProportion fabricIngredientProportion = FabricModule.GetFabricIngredientProportion(selectedItem.ProportionNo, selectedItem.Proportion, specificationYarnPrice); _dictionaryFabricIngredientProportion[groupNo].RemoveAt(selectedIndex); _dictionaryFabricIngredientProportion[groupNo].Insert(selectedIndex, fabricIngredientProportion); DataGridFabricIngredientProportion.SelectedIndex = selectedIndex += 1; } }
private void ChangeYarn(SpecificationYarnPrice specificationYarnPrice) { int selectedIndex = DataGridFabricIngredientProportion.SelectedIndex; //如果紗成分比例沒有選擇一個色的話則會新增一個比例 //否則會將選擇到的比例 TextBoxMessageDialog textBoxMessageDialog = new TextBoxMessageDialog { Left = this.Left + 100, Top = this.Top + 130 }; decimal proportion = 0; if (textBoxMessageDialog.ShowDialog() == true) { proportion = decimal.Parse(textBoxMessageDialog.TextBoxProportion.Text); } else { return; } FabricIngredientProportion fabricIngredientProportion = FabricModule.GetFabricIngredientProportion(0, proportion, specificationYarnPrice); _dictionaryFabricIngredientProportion[1].Add(fabricIngredientProportion); }
/// <summary> /// 取得布種成份比例資料 /// </summary> /// <param name="proportionNo">布種比例編號,如修改布種成分時Update使用</param> /// <param name="proportion">成分比例,同一布種比例應相同</param> /// <param name="specificationYarnPrice"></param> /// <returns></returns> public FabricIngredientProportion GetFabricIngredientProportion(int proportionNo, decimal proportion, SpecificationYarnPrice specificationYarnPrice) { FabricIngredientProportion fabricIngredientProportion = new FabricIngredientProportion { ProportionNo = proportionNo, YarnPriceNo = specificationYarnPrice.YarnPriceNo, Name = specificationYarnPrice.Name, Color = specificationYarnPrice.Color, Ingredient = specificationYarnPrice.Ingredient, Price = specificationYarnPrice.Price, Proportion = proportion, YarnCount = specificationYarnPrice.YarnCount }; return(fabricIngredientProportion); }