public EditBillViewModel(int id)
        {
            this.CustomBills = new List <CustomBillViewModel>();
            this.DOTM        = new List <BootstrapLI>();

            PBProxy p = new PBProxy();
            Bill    b = p.GetBill(id);

            this.Bill = Mapper.Map <Bill, BillViewModel>(b);
            this.Bill.DueDaySuffix = Utility.IntSuffix(this.Bill.DueDay);
            for (int i = 1; i < 32; i++)
            {
                this.DOTM.Add(new BootstrapLI()
                {
                    Text = i.ToString() + Utility.IntSuffix(i), Value = i.ToString(), Selected = (i == b.DueDay)
                });
            }

            IEnumerable <CustomBill> cbills = p.GetCustomBills(b.Id);

            if (cbills != null)
            {
                this.Bill.CustomBillCount = cbills.Count();
                //this.CustomBills = Mapper.Map<List<CustomBillViewModel>>(cbills);
            }

            p = null;
        }
        public CustomBillsViewModel(int id)
        {
            this.CustomBills = new List <CustomBillViewModel>();

            PBProxy p = new PBProxy();
            Bill    b = p.GetBill(id);

            this.Bill = Mapper.Map <Bill, BillViewModel>(b);
            this.Bill.DueDaySuffix = Utility.IntSuffix(this.Bill.DueDay);

            IEnumerable <CustomBill> cbills = p.GetCustomBills(b.Id);

            if (cbills != null)
            {
                this.CustomBills = Mapper.Map <List <CustomBillViewModel> >(cbills);
            }

            p = null;
        }
        public ListBillsViewModel(Guid userid)
        {
            this.Bills = new List <BillViewModel>();

            PBProxy p = new PBProxy();

            foreach (Bill b in p.GetBills(userid).OrderBy(a => a.DueDay))
            {
                BillViewModel bill = Mapper.Map <BillViewModel>(b);
                bill.DueDaySuffix = Utility.IntSuffix(bill.DueDay);

                IEnumerable <CustomBill> cbills = p.GetCustomBills(b.Id).OrderBy(a => a.BillDate);
                if (cbills != null)
                {
                    bill.CustomBillCount = cbills.Count();
                }

                this.Bills.Add(bill);
            }
            p = null;
        }