private async void ExecuteAddToBillAsync() { if (NewSaleOfferCategory.PriceTotalAfterDiscount == null || NewSaleOfferCategory.Category == null) { return; } var mySettings = new MetroDialogSettings() { AffirmativeButtonText = "موافق", DialogMessageFontSize = 25, DialogTitleFontSize = 30 }; if (_saleOfferCategories.SingleOrDefault(s => s.CategoryID == _newSaleOfferCategory.CategoryID) != null) { MessageDialogResult result = await _currentWindow.ShowMessageAsync("خطأ", "هذا الصنف موجود مسبقاً فى الفاتورة", MessageDialogStyle.Affirmative, mySettings); return; } _saleOfferCategories.Add(_newSaleOfferCategory); NewSaleOfferCategory = new SaleOfferCategoryVM(); NewSaleOffer.PriceAfterDiscount = SaleOfferCategories.Sum(s => s.PriceTotalAfterDiscount); NewSaleOffer.Price = SaleOfferCategories.Sum(s => s.PriceTotal); OldPrices = new ObservableCollection <SaleCategory>(); }
private void EditMethod() { NewSaleOfferCategory = SelectedSaleOfferCategory; _saleOfferCategories.Remove(_selectedSaleOfferCategory); _selectedCategory = _categoryServ.GetCategory(_newSaleOfferCategory.CategoryID); SelectedSaleOffer.PriceAfterDiscount = SaleOfferCategories.Sum(s => s.PriceTotalAfterDiscount); SelectedSaleOffer.Price = SaleOfferCategories.Sum(s => s.PriceTotal); OldPrices = new ObservableCollection <SaleCategory>(_saleCategoryServ.GetOldPrices(_newSaleOfferCategory.CategoryID, _selectedSaleOffer.ClientID)); }
private async void DeleteMethodAsync() { MessageDialogResult result = await _currentWindow.ShowMessageAsync("تأكيد الحذف", "هل تـريــد حــذف هـذا الصنف؟", MessageDialogStyle.AffirmativeAndNegative, new MetroDialogSettings() { AffirmativeButtonText = "موافق", NegativeButtonText = "الغاء", DialogMessageFontSize = 25, DialogTitleFontSize = 30 }); if (result == MessageDialogResult.Affirmative) { _saleOfferCategories.Remove(_selectedSaleOfferCategory); NewSaleOffer.PriceAfterDiscount = SaleOfferCategories.Sum(s => s.PriceTotalAfterDiscount); NewSaleOffer.Price = SaleOfferCategories.Sum(s => s.PriceTotal); } }