Beispiel #1
0
        //delete elements in db
        public void delPFP()
        {
            PaymentEntities db = new PaymentEntities();

            foreach (PrepForPay pfp in this.PrepForPay)
            {
                db.PrepForPay.Remove(db.PrepForPay.Find(pfp.Id));
                db.SaveChanges();
            }
            this.PrepForPay.Clear();
            db.SaveChanges();
        }
Beispiel #2
0
        //add elements in db
        public void addPrepForPays(PrepForPay[] pfp)
        {
            PaymentEntities db = new PaymentEntities();

            foreach (PrepForPay pp in pfp)
            {
                pp.PayTypeId = this.Id;
                PrepForPay newPrepForPay = db.PrepForPay.Add(pp);
                this.PrepForPay.Add(newPrepForPay);
                db.SaveChanges();
            }
        }
Beispiel #3
0
        //delet elements in db
        public void delPD()
        {
            PaymentEntities db = new PaymentEntities();

            foreach (PayDone pd in this.PayDone)
            {
                pd.delPD();
                db.PayDone.Remove(db.PayDone.Find(pd.Id));
                db.SaveChanges();
            }
            this.PayDone.Clear();
            db.SaveChanges();
        }
Beispiel #4
0
        //Cycle for add elements
        public void addPaid(PayDoneDTO[] dto)
        {
            PaymentEntities db = new PaymentEntities();

            foreach (PayDoneDTO pd in dto)
            {
                pd.payDone.BillId = this.Id;
                PayDone newPayDone = db.PayDone.Add(pd.payDone);
                this.PayDone.Add(newPayDone);
                db.SaveChanges();
                newPayDone.addPayType(pd.payTypes);
            }
        }
        //delete elements in db
        public void delPD()
        {
            PaymentEntities db = new PaymentEntities();

            foreach (PayType pt in this.PayType)
            {
                pt.delPFP();
                db.PayType.Remove(db.PayType.Find(pt.Id));
                db.SaveChanges();
            }
            this.PayType.Clear();
            db.SaveChanges();
        }
        //add elements in  db
        public void addPayType(PayTypeDTO[] dto)
        {
            PaymentEntities db = new PaymentEntities();

            foreach (PayTypeDTO pt in dto)
            {
                pt.payType.PayDoneId = this.Id;
                PayType newPayType = db.PayType.Add(pt.payType);
                this.PayType.Add(newPayType);
                db.SaveChanges();
                newPayType.addPrepForPays(pt.prepForPays);
            }
        }