Ejemplo n.º 1
0
        /// <summary>
        /// Получение банковских данных конкретного пользователя
        /// </summary>
        /// <param name="moneyPath">Путь к файлу</param>
        /// <param name="id">Номер пользователя</param>
        /// <returns></returns>
        public BankCard GetMoneyData(string moneyPath, int id)
        {
            try
            {
                using (StreamReader sr = new StreamReader(moneyPath, Encoding.UTF8))
                {
                    var card = new BankCard();

                    string stream;
                    while ((stream = sr.ReadLine()) != null)
                    {
                        string[] line = stream.Split(';');
                        if (Convert.ToInt32(line[0]) == id)
                        {
                            card.cardNumber = Convert.ToInt64(line[1]);
                            card.validDate  = Convert.ToDateTime(line[2]);
                            card.SetMoney(Convert.ToDecimal(line[3]));
                            sr.Close();
                            return(card);
                        }
                    }
                    sr.Close();
                }
                return(null);
            }
            catch (Exception ex)
            {
                if (_del != null)
                {
                    _del(ex);
                }
                return(null);
            }
        }
Ejemplo n.º 2
0
        public new void WithdrawMoney(decimal value, BankCard card)
        {
            decimal dec = 0;

            endTime = beginTime.AddMonths(monthsCount);
            dec     = card.GetMoney() - value;
            card.SetMoney(dec);
        }
Ejemplo n.º 3
0
        public void WithdrawMoney(decimal value, BankCard card)
        {
            decimal add = 0;

            add     = card.GetMoney() - value;
            endTime = beginTime.AddMonths(monthsCount);
            card.SetMoney(add);
        }
Ejemplo n.º 4
0
        public void WithdrawMoney(decimal value, BankCard card)
        {
            decimal dec = 0;

            endTime = beginTime.AddDays(daysCount);
            dec     = card.GetMoney() - value;
            card.SetMoney(dec);
        }