private void AddPayment(object parameter) { if (parameter == null) { return; } foreach (var payment in Payment) { if (payment.IsSelected == true) { ShellOutViewModel.Event1ExecutionHandler(payment, null); } } this.CloseWindow((Window)parameter); }
private void onStarScanGiftCadrEvent(string param) { if (string.IsNullOrEmpty(Barcode) || Barcode.Trim().ToString() == "") { Barcode = ""; StringNotify = App.Current.FindResource("barcode_null").ToString(); OnFocusRequested(nameof(Barcode)); } else if (Barcode.Trim() == "0") { ShellOutViewModel.eventFillValueGiftCard("0:0", null); //ShellOutViewModel.eventResetListboxSelected(null, null); OnFocusRequested(nameof(Barcode)); OnRequestClose(); } else { DataTable _gift = GiftCardModel.getGiftCardByBarcode(Barcode.Trim()); if (_gift.Rows.Count == 0) { StringNotify = App.Current.FindResource("giftcard_not_existing").ToString(); } else { bool _isError = false; Int32 unixTimestamp = getCurrentUnixTime(); Int32 _expreTime = Convert.ToInt32(_gift.Rows[0]["ExpirationDate"]); if (unixTimestamp > _expreTime) { StringNotify = App.Current.FindResource("giftcard_expired").ToString(); OnFocusRequested(nameof(Barcode)); _isError = true; } else if (Convert.ToDouble(_gift.Rows[0]["Balance"]) <= 0) { StringNotify = App.Current.FindResource("giftcard_in_used").ToString(); OnFocusRequested(nameof(Barcode)); _isError = true; } else if (Convert.ToInt32(_gift.Rows[0]["GiftCardID"].ToString()) != ScanGiftId) { if (allReadyExits(StaticClass.GeneralClass.customerGiftCard, _gift.Rows[0]["GiftCardID"].ToString())) { StringNotify = App.Current.FindResource("acard_isnot_multiple").ToString(); OnFocusRequested(nameof(Barcode)); _isError = true; } } else if (!_isError && StaticClass.GeneralClass.ConverStringToDecimal(UseValue) <= 0) { StringNotify = App.Current.FindResource("enter_amount_want").ToString(); OnFocusRequested(nameof(UseValue)); _isError = true; } else if (!_isError && Convert.ToDecimal(_gift.Rows[0]["Balance"]) < StaticClass.GeneralClass.ConverStringToDecimal(UseValue)) { StringNotify = App.Current.FindResource("value_invalid").ToString(); OnFocusRequested(nameof(UseValue)); _isError = true; } if (!_isError) { if (Convert.ToInt32(_gift.Rows[0]["GiftCardID"].ToString()) != ScanGiftId) { StaticClass.GeneralClass.customerGiftCard.Remove(ScanGiftId); StaticClass.GeneralClass.customerGiftCard.Add(Convert.ToInt32(_gift.Rows[0]["GiftCardID"].ToString())); } ShellOutViewModel.eventFillValueGiftCard(_gift.Rows[0]["GiftCardID"].ToString() + ":" + UseValue, null); //ShellOutViewModel.eventResetListboxSelected(null, null); OnRequestClose(); } } } }