Esempio n. 1
0
        void SaveToAccountCurrentSwingEvents(FundEvent eve)
        {
            var account = BillBook.GetInstance().Find(eve.Account);

            if (account != null && eve.Type == "刷卡")
            {
                account.SwingEvents.Add(eve);
            }
        }
Esempio n. 2
0
 public static BillBook GetInstance()
 {
     if (m_instance == null)
     {
         m_instance = new BillBook();
         m_instance.m_total.Account.Name = "总计";
     }
     return(m_instance);
 }
Esempio n. 3
0
        private void SetCardNumber(int selectedIndex)
        {
            var bill = BillBook.GetInstance().GetAll()[selectedIndex];

            m_cardNumTxt.Text = Utility.FormatAccountString(bill.Account.Number);
            m_rateLb.Text     = "刷卡手续费率:" + bill.Account.Rate.ToString();

            m_noRepayAmountTxt.Text   = Utility.ConvertDouble(bill.NoRepayAmount);
            m_avaliableAmountTxt.Text = Utility.ConvertDouble(bill.AvaliableAmount);
        }
Esempio n. 4
0
        public void RemoveAccount(string account)
        {
            BillBook.GetInstance().Remove(account);
            ResetView();
            m_billDB.Remove(account);

            AccountBook.GetInstance().Remove(account);
            m_accountBD.Remove(account);

            m_fundEventDB.Remove(account);
        }
        private void InitBillDruction(string accountName)
        {
            AccountBill bill = BillBook.GetInstance().Find(accountName);

            if (Bill == null)
            {
                var lastBillStart = new DateTime();
                var lastBillEnd   = new DateTime();
                Utility.CalcLastBillDruction(bill.Account.BillStartDay, ref lastBillStart, ref lastBillEnd);
                m_billDructionLB.Text = Utility.FormatDateString(lastBillStart) + " - " + Utility.FormatDateString(lastBillEnd);
            }
            else
            {
                m_billDructionLB.Text = "";
            }
        }
Esempio n. 6
0
        public void UpdateTotal()
        {
            // 先清空,然后重新计算。
            m_total.Account.CreditAmount = 0;
            m_total.AvaliableAmount      = 0;
            m_total.BillAmount           = 0;
            m_total.RepayAmount          = 0;
            m_total.NoRepayAmount        = 0;
            m_total.SwingAmount          = 0;
            m_total.Charge = 0;

            foreach (var account in BillBook.GetInstance().GetAll())
            {
                UpdateTotal(account);
            }
        }
Esempio n. 7
0
        public void Clear()
        {
            // history
            m_billDB.Clear();
            m_accountBD.Clear();
            m_fundEventDB.Clear();
            var historyDB = new HistoryBillDB();

            historyDB.Clear();

            // cache
            AccountBook.GetInstance().Clear();
            BillBook.GetInstance().Clear();

            ResetView();
        }
Esempio n. 8
0
        public void Load()
        {
            if (!File.Exists(m_fileName))
            {
                return;
            }

            StreamReader reader = new StreamReader(m_fileName);

            if (reader == null)
            {
                return;
            }

            reader.ReadLine();
            while (!reader.EndOfStream)
            {
                string   line  = reader.ReadLine();
                string[] items = line.Split(',');

                // bind account
                string      accountName = items[0];
                Account     account     = AccountBook.GetInstance().Find(accountName);
                AccountBill bill        = new AccountBill(account);

                bill.LastBillStart   = DateTime.Parse(items[2]);
                bill.LastBillEnd     = DateTime.Parse(items[3]);
                bill.AvaliableAmount = double.Parse(items[4]);
                bill.BillAmount      = double.Parse(items[5]);
                bill.RepayAmount     = double.Parse(items[6]);
                bill.NoRepayAmount   = double.Parse(items[7]);
                bill.SwingAmount     = double.Parse(items[8]);
                bill.BillSetDate     = items[9];
                bill.LastDateTime    = items[10];
                bill.Charge          = double.Parse(items[11]);

                BillBook.GetInstance().Add(bill);
            }

            reader.Close();
        }
Esempio n. 9
0
        // 调整数值显示格式
        private void m_amoutTxt_TextChanged(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(m_amoutTxt.Text))
            {
                m_chargeTxt.Text = "0.0";
                return;
            }

            m_amoutTxt.Text = Utility.FormatDoubleString(Utility.ConvertToOrigin(m_amoutTxt.Text));
            Utility.SetSelectToLastest(m_amoutTxt);

            if (m_withdraw)
            {
                var bill = BillBook.GetInstance().Find(m_accountComb.SelectedItem.ToString());
                if (bill != null)
                {
                    double origin = double.Parse(Utility.ConvertToOrigin(m_amoutTxt.Text));
                    m_chargeTxt.Text = (origin * bill.Account.Rate).ToString();
                }
            }
        }
Esempio n. 10
0
        // update and save to file
        private void UpdateDB()
        {
            StreamWriter writer = new StreamWriter(m_fileName);

            writer.Write("账号名称,信用额度,账单起始日期,账单截止日期,可用额度,账单金额,已还金额,未还金额,刷卡合计,上次设置账单日期时间,最后操作日期时间,刷卡手续费");
            writer.Write("\r\n");
            writer.Flush();

            foreach (var bill in BillBook.GetInstance().GetAll())
            {
                writer.Write(bill.Account.Name);
                WriteSpliter(writer);
                writer.Write(bill.Account.CreditAmount);
                WriteSpliter(writer);
                writer.Write(bill.LastBillStart);
                WriteSpliter(writer);
                writer.Write(bill.LastBillEnd);
                WriteSpliter(writer);
                writer.Write(bill.AvaliableAmount);
                WriteSpliter(writer);
                writer.Write(bill.BillAmount);
                WriteSpliter(writer);
                writer.Write(bill.RepayAmount);
                WriteSpliter(writer);
                writer.Write(bill.NoRepayAmount);
                WriteSpliter(writer);
                writer.Write(bill.SwingAmount);
                WriteSpliter(writer);
                writer.Write(bill.BillSetDate);
                WriteSpliter(writer);
                writer.Write(bill.LastDateTime);
                WriteSpliter(writer);
                writer.Write(bill.Charge);
                writer.Write("\r\n");
                writer.Flush();
            }

            writer.Close();
        }