Exemple #1
0
        internal List <ObservablePhoneBill> GetPhoneBillList()
        {
            List <ObservablePhoneBill> billList = new List <ObservablePhoneBill>();

            using (SQLiteConnection dbConn = new SQLiteConnection(dbPath))
            {
                string sql = @"select * from BillMetaData order by EpochBillDate desc;";
                using (var statement = dbConn.Prepare(sql))
                {
                    while (statement.Step() == SQLiteResult.ROW)
                    {
                        PhoneBill phone_bill = new PhoneBill();

                        phone_bill._billNo  = statement[0].ToString();
                        phone_bill.BillType = statement[1].ToString();
                        phone_bill._phoneNo = statement[2].ToString();
                        phone_bill.BillDate = statement[3].ToString();

                        try { phone_bill.FromDate = statement[4].ToString(); }
                        catch (Exception ex) { }

                        try { phone_bill.ToDate = statement[5].ToString(); }
                        catch (Exception ex) { }

                        try { phone_bill.DueDate = statement[6].ToString(); }
                        catch (Exception ex) { }

                        ObservablePhoneBill bill = new ObservablePhoneBill(phone_bill);
                        billList.Add(bill);
                    }
                }
            }

            return(billList);
        }
        public void AddBillToList(PhoneBill pb)
        {
            ObservablePhoneBill opb      = new ObservablePhoneBill(pb);
            ObservablePhoneBill old_bill = GetObservablePhoneBill(pb._billNo);

            if (old_bill != null)
            {
                _phoneBillList.Remove(old_bill);
                _phoneBillDictionary.Remove(pb._billNo);
            }


            _phoneBillList.Add(opb);
            _phoneBillDictionary.Add(pb._billNo, opb);
        }
 public ObservablePhoneBill(PhoneBill phone_bill)
 {
     _phoneBill = phone_bill;
 }