private async void ExecuteAddToBillAsync() { if (NewSupplyOfferCategory.CostTotalAfterDiscount == null || NewSupplyOfferCategory.Category == null) { return; } var mySettings = new MetroDialogSettings() { AffirmativeButtonText = "موافق", DialogMessageFontSize = 25, DialogTitleFontSize = 30 }; if (_supplyOfferCategories.SingleOrDefault(s => s.CategoryID == _newSupplyOfferCategory.CategoryID) != null) { MessageDialogResult result = await _currentWindow.ShowMessageAsync("خطأ", "هذا الصنف موجود مسبقاً فى الطلبيه", MessageDialogStyle.Affirmative, mySettings); return; } _supplyOfferCategories.Add(_newSupplyOfferCategory); NewSupplyOfferCategory = new SupplyOfferCategoryVM(); NewSupplyOffer.Cost = SupplyOfferCategories.Sum(s => s.CostTotal); NewSupplyOffer.CostAfterTax = SupplyOfferCategories.Sum(s => s.CostTotalAfterTax); NewSupplyOffer.TotalDiscount = SupplyOfferCategories.Sum(s => s.DiscountValueTotal); OldCosts = new ObservableCollection <SupplyCategory>(); }
private void EditMethod() { NewSupplyOfferCategory = SelectedSupplyOfferCategory; _supplyOfferCategories.Remove(_selectedSupplyOfferCategory); SelectedSupplyOffer.Cost = SupplyOfferCategories.Sum(s => s.CostTotal); SelectedSupplyOffer.CostAfterTax = SupplyOfferCategories.Sum(s => s.CostTotalAfterTax); SelectedSupplyOffer.TotalDiscount = SupplyOfferCategories.Sum(s => s.DiscountValueTotal); OldCosts = new ObservableCollection <SupplyCategory>(_supplyCategoryServ.GetOldCosts(_newSupplyOfferCategory.CategoryID, _selectedSupplyOffer.ClientID)); }
private async void DeleteMethodAsync() { MessageDialogResult result = await _currentWindow.ShowMessageAsync("تأكيد الحذف", "هل تـريــد حــذف هـذا الصنف؟", MessageDialogStyle.AffirmativeAndNegative, new MetroDialogSettings() { AffirmativeButtonText = "موافق", NegativeButtonText = "الغاء", DialogMessageFontSize = 25, DialogTitleFontSize = 30 }); if (result == MessageDialogResult.Affirmative) { _supplyOfferCategories.Remove(_selectedSupplyOfferCategory); NewSupplyOffer.Cost = SupplyOfferCategories.Sum(s => s.CostTotal); NewSupplyOffer.CostAfterTax = SupplyOfferCategories.Sum(s => s.CostTotalAfterTax); NewSupplyOffer.TotalDiscount = SupplyOfferCategories.Sum(s => s.DiscountValueTotal); } }