private void ProductAssociatePriceListUserControlOnClickOnAddItem(object sender, RoutedEventArgs e) { var productAssociatePrice = new ProductAssociatePrice(); WindowService.OpenUserControlDialog(new UcProductAssociatePrice(productAssociatePrice)); var dataIsAdded = ApplicationDataStore.GetData <bool>("IsAddedOrChanged"); if (dataIsAdded) { _activeProduct.ProductAssociatePrices.Add(productAssociatePrice); ProductAssociatePriceGridControl.ItemsSource = new ObservableCollection <ProductAssociatePrice>(_activeProduct.ProductAssociatePrices); } }
public UcProductAssociatePrice(ProductAssociatePrice productAssociatePrice) : this() { _productAssociatePrice = productAssociatePrice; FillData(_productAssociatePrice); LoadAssociatePriceTypes(); if (_productAssociatePrice.Id > 0) { UserControlTitle = "ویرایش هزینه مرتبط با محصول"; } else { UserControlTitle = "اضافه کردن هزینه مرتبط با محصول"; } ProductAssociatePriceTypeComboBoxEdit.Focus(); }
private void ReadData(ProductAssociatePrice productAssociatePrice) { productAssociatePrice.ProductAssociatedPriceTypeId = (int)ProductAssociatePriceTypeComboBoxEdit.EditValue; productAssociatePrice.Price = (double)PriceSpinEdit.EditValue; }
private void FillData(ProductAssociatePrice productAssociatePrice) { ProductAssociatePriceTypeComboBoxEdit.EditValue = productAssociatePrice.ProductAssociatedPriceTypeId; PriceSpinEdit.EditValue = productAssociatePrice.Price; }