예제 #1
0
        public Billdata getSingle(int i)
        {
            Bill a = e.Bills.Find(i);

            if (a != null)
            {
                Billdata d = new Billdata();
                d.Id               = a.Id;
                d.Biller_ID        = a.Biller_ID;
                d.Branch_ID        = a.Branch_ID;
                d.Customer_Name    = a.Customer_Name;
                d.Customer_Contact = a.Customer_Contact;
                d.Amount           = a.Amount;
                d.Date             = a.Date;
                d.Payment_Mode     = a.Payment_Mode;
                d.Location         = a.Branch.Location;
                return(d);
            }
            return(null);
        }
예제 #2
0
        public List <Billdata> selectBillperBranch(int id)
        {
            var             lpb = e.Bills.Where(m => m.Branch_ID == id).ToList();
            List <Billdata> l   = new List <Billdata>();

            foreach (Bill i in lpb)
            {
                Billdata d = new Billdata();
                d.Id               = i.Id;
                d.Biller_ID        = i.Biller_ID;
                d.Branch_ID        = i.Branch_ID;
                d.Customer_Name    = i.Customer_Name;
                d.Customer_Contact = i.Customer_Contact;
                d.Amount           = i.Amount;
                d.Date             = i.Date;
                d.Payment_Mode     = i.Payment_Mode;
                d.Location         = i.Branch.Location;

                l.Add(d);
            }
            return(l);
        }
예제 #3
0
        public Billdata updateBill(Bill a)
        {
            Bill old = e.Bills.Where(
                x => x.Id == a.Id).SingleOrDefault();

            if (old != null)
            {
                e.Entry(old).CurrentValues.SetValues(a);
                e.SaveChanges();
                Billdata d = new Billdata();
                d.Id               = a.Id;
                d.Biller_ID        = a.Biller_ID;
                d.Branch_ID        = a.Branch_ID;
                d.Customer_Name    = a.Customer_Name;
                d.Customer_Contact = a.Customer_Contact;
                d.Amount           = a.Amount;
                d.Date             = a.Date;
                d.Payment_Mode     = a.Payment_Mode;
                d.Location         = a.Branch.Location;
                return(d);
            }
            return(null);
        }