Exemplo n.º 1
0
 public static VoucherDetail GetVoucherDetail(Guid ID)
 {
     using (VouchersDBEntities ctx = new VouchersDBEntities())
     {
         return(ctx.VoucherDetails.FirstOrDefault(v => v.ID == ID));
     }
 }
Exemplo n.º 2
0
 public static List <Account> GetAllAcccounts()
 {
     using (VouchersDBEntities ctx = new VouchersDBEntities())
     {
         return(ctx.Accounts.OrderBy(v => v.Name).ToList());
     }
 }
Exemplo n.º 3
0
        //Voucher Details

        public static List <VoucherDetail> GetVoucherDetails(Guid ID)
        {
            using (VouchersDBEntities ctx = new VouchersDBEntities())
            {
                return(ctx.VoucherDetails.Where(v => v.VoucherID == ID).ToList());
            }
        }
Exemplo n.º 4
0
        //Vouchers

        public static List <Voucher> GetVouchers()
        {
            using (VouchersDBEntities ctx = new VouchersDBEntities())
            {
                return(ctx.Vouchers.OrderByDescending(v => v.Date).ToList());
            }
        }
Exemplo n.º 5
0
        //Accounts

        public static List <Account> GetAccountsByType(int Type)
        {
            using (VouchersDBEntities ctx = new VouchersDBEntities())
            {
                var isIncome = Convert.ToBoolean(Type);
                return(ctx.Accounts.Where(v => v.Type == isIncome).OrderByDescending(v => v.Type).ToList());
            }
        }
Exemplo n.º 6
0
 public static void AddDetail(VoucherDetail Item)
 {
     using (VouchersDBEntities ctx = new VouchersDBEntities())
     {
         ctx.VoucherDetails.Add(Item);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 7
0
 public static void RemoveDetail(VoucherDetail Item)
 {
     using (VouchersDBEntities ctx = new VouchersDBEntities())
     {
         var d = ctx.VoucherDetails.FirstOrDefault(vd => vd.ID == Item.ID);
         ctx.VoucherDetails.Remove(d);
         ctx.SaveChanges();
     }
 }