示例#1
0
        private void onEventRemoveShellOut(object parameter)
        {
            int _shellSelected = SelectedIndex;

            if (ShellOut.Count() == 1)
            {
                _shellSelected = 0;
            }
            else if (_shellSelected == ShellOut.Count() - 1)
            {
                _shellSelected = ShellOut.Count() - 2;
            }
            if (parameter == null)
            {
                ModernDialog md = new ModernDialog();
                md.CloseButton.FindResource("close").ToString();
                md.Content = "Please select payment to delete !";
                md.Title   = App.Current.FindResource("notification").ToString();
                md.ShowDialog();
            }
            else
            {
                ShellOutModel shellout = (ShellOutModel)parameter;
                StaticClass.GeneralClass.lstCash.Remove(shellout.PaymentId);
                int    _index       = SelectedIndex;
                string _customgift_ = ShellOut[_index].PaymentId.ToString();
                if (Convert.ToInt32(_customgift_) == 11)
                {
                    string _giftValue = _lstIndex[0];
                    if (!string.IsNullOrEmpty(_giftValue))
                    {
                        _lstIndex[0] = string.Empty;
                        int    _found   = _giftValue.IndexOf(":");
                        string _strVal_ = _giftValue.Remove(_found);
                        StaticClass.GeneralClass.customerGiftCard.Remove(Convert.ToInt32(_strVal_));
                    }
                }
                else if (_customgift_.Length >= 3)
                {
                    int    _tempIndex_ = Convert.ToInt16(_customgift_.Remove(0, 2));
                    string _giftValue  = _lstIndex[_tempIndex_];
                    if (!string.IsNullOrEmpty(_giftValue))
                    {
                        _lstIndex[_tempIndex_] = string.Empty;
                        int    _found   = _giftValue.IndexOf(":");
                        string _strVal_ = _giftValue.Remove(_found);
                        StaticClass.GeneralClass.customerGiftCard.Remove(Convert.ToInt32(_strVal_));
                    }
                }
                ShellOut.RemoveAt(_index);
                CanculatorTotalBalance();
                SelectedIndex = _shellSelected;
                _isDeleting   = false;
                string _strId = ShellOut[SelectedIndex].PaymentId.ToString();
                if (_strId.Length >= 3)
                {
                    _strId = _strId.Remove(2);
                }
                if (Convert.ToInt32(_strId) == 11 && !_isDeleting)
                {
                    onMouseDownCmdEvent(null);
                }
            }
        }