示例#1
0
        private void OnEventSavePaymentOther(object sender, EventArgs e)
        {
            DataTable _chkRow = ShellOutModel.chkOrder(Convert.ToInt32((int)sender));

            if (_chkRow.Rows.Count > 0)
            {
                return;
            }
            OrderPayment.insertMultiRows(ShellOut, Convert.ToInt32((int)sender));
            StaticClass.GeneralClass.lstCash.Clear();
            if (_lstIndex.Count > 0)
            {
                StaticClass.GeneralClass.customerGiftCard.Clear();
                List <int> _lstid = new List <int>();
                foreach (var _shell_ in ShellOut)
                {
                    string _strId = _shell_.PaymentId.ToString();
                    if (_strId == "11")
                    {
                        _lstid.Add(0);
                    }
                    else if (_strId.Length >= 3)
                    {
                        _strId = _strId.Substring(2);
                        _lstid.Add(Convert.ToInt32(_strId));
                    }
                }
                if (_lstid.Count > 0)
                {
                    DataTable _dt;
                    decimal   _decVal;
                    foreach (int j in _lstid)
                    {
                        if (!string.IsNullOrEmpty(_lstIndex[j]) && _lstIndex[j] != "0:0")
                        {
                            string _strVal  = _lstIndex[j];
                            int    found    = _strVal.IndexOf(":");
                            string _giftId  = _strVal.Remove(found);
                            string _giftVal = _strVal.Substring(found + 1);
                            _dt     = GiftCardModel.getGiftCard(Convert.ToInt64(_giftId));
                            _decVal = Convert.ToDecimal(_dt.Rows[0]["Balance"].ToString()) - StaticClass.GeneralClass.ConverStringToDecimal(_giftVal);
                            if (StaticClass.GeneralClass.ConverStringToDecimal(_giftVal) > 0)
                            {
                                StaticClass.GeneralClass.customerGiftCard.Add(Convert.ToInt32(_giftId));
                                StaticClass.GeneralClass.customerGiftValue.Add(_decVal);
                            }
                        }
                    }
                    if (StaticClass.GeneralClass.customerGiftCard.Count > 0)
                    {
                        if (GiftCardModel.updateMultiGiftCardUsed(StaticClass.GeneralClass.customerid_general, StaticClass.GeneralClass.customerGiftCard, StaticClass.GeneralClass.customerGiftValue) > 0)
                        {
                            StaticClass.GeneralClass.customerGiftCard.Clear();
                            StaticClass.GeneralClass.customerGiftValue.Clear();
                            _lstIndex.Clear();
                        }
                    }
                }
            }
        }