public TreatmentPriceControl(Model.TreatmentPayment treatment) { this.InitializeComponent(); _treatmentPayment = treatment; UpdateTreatmentInfo(); }
public AddEditTreatmentPaymentModal(Model.TreatmentPayment treatment, TreatmentPriceControl treatmentControl) { this.InitializeComponent(); cbDiscount.SelectedIndex = 0; _treatmentControl = treatmentControl; _treatment = treatment; _isUpdateTreatment = _treatment != null; if (_isUpdateTreatment) { PrepareWindowForUpdates(); UpdateTotalFieldChanged(); } }
private void btnAddTreatment_Click(object sender, System.Windows.RoutedEventArgs e) { if (AreValidFields() == false) { return; } if (_isUpdateTreatment) { _treatment.TreatmentPriceId = _selectedTreatmentPrice.TreatmentPriceId; _treatment.TreatmentDate = DateTime.Now; _treatment.Price = _price; _treatment.Discount = _discount; _treatment.Quantity = _quantity; _treatment.Total = _total; _treatmentControl.TreatmentPayment = _treatment; } else { Model.TreatmentPayment treatmentToAdd = new Model.TreatmentPayment() { TreatmentPriceId = _selectedTreatmentPrice.TreatmentPriceId, TreatmentDate = DateTime.Now, Price = _price, Discount = _discount, Quantity = _quantity, Total = _total }; _treatmentControl.TreatmentPayment = treatmentToAdd; } _treatmentControl.TreatmentPrice = _selectedTreatmentPrice; _treatmentControl.Width = Double.NaN; _treatmentControl.UpdateData(); this.Close(); }