Ejemplo n.º 1
0
        public override bool RefundPayment(int paymentid)
        {
            bool result = false;

            using (SakilaEntities dc = new SakilaEntities())
            {
                SPayment spayment = new SPayment();


                var model = from p in dc.payments
                            where p.payment_id == paymentid
                            //orderby (p.payment_date)
                            select p;
                List <payment> payments = model.ToList <payment>();

                simulator.PerformanceSimulation();

                payment refundpayment = new payment();
                refundpayment.amount            = payments[0].amount * -1;
                refundpayment.customer_id       = payments[0].customer_id;
                refundpayment.customerReference = payments[0].customerReference;
                refundpayment.rental_id         = payments[0].rental_id;
                refundpayment.rentalReference   = payments[0].rentalReference;
                refundpayment.payment_date      = DateTime.Now;
                refundpayment.staff_id          = payments[0].staff_id;
                refundpayment.staffReference    = payments[0].staffReference;

                dc.AddTopayments(refundpayment);
                dc.AcceptAllChanges();
                dc.SaveChanges();
            }
            result = true;

            return(result);
        }
Ejemplo n.º 2
0
        public SPayment Createpayment(global::System.Int32 rental_id, global::System.Int32 payment_id, global::System.Int32 customer_id, global::System.Byte staff_id, global::System.Decimal amount, global::System.DateTime payment_date, global::System.DateTime last_update, global::System.Int32 inventory_id, global::System.String filmtitle)
        {
            SPayment payment = new SPayment();

            payment.payment_id   = payment_id;
            payment.rental_id    = rental_id;
            payment.customer_id  = customer_id;
            payment.staff_id     = staff_id;
            payment.amount       = amount;
            payment.payment_date = payment_date;
            payment.last_update  = last_update;
            payment.inventory_id = inventory_id;
            payment.filmtitle    = filmtitle;

            return(payment);
        }
Ejemplo n.º 3
0
        public override SPayment GetPayment(int id)
        {
            SPayment spayment = new SPayment();

            using (SakilaEntities dc = new SakilaEntities())
            {
                var model = from p in dc.payments
                            where p.payment_id == id
                            //orderby (p.payment_date)
                            select p;
                List <payment> payments = model.ToList <payment>();
                spayment = spayment.Createpayment((payments[0].rental_id ?? 0), payments[0].payment_id, payments[0].customer_id,
                                                  payments[0].staff_id, payments[0].amount, payments[0].payment_date, payments[0].last_update,
                                                  payments[0].rental.inventory_id, payments[0].rental.inventory.film.title);
            }

            simulator.PerformanceSimulation();

            return(spayment);
        }
Ejemplo n.º 4
0
        public override SPayment[] GetPaymentsByRental(int rentalid)
        {
            List <SPayment> spayments = new List <SPayment>();

            using (SakilaEntities dc = new SakilaEntities())
            {
                var model = from p in dc.payments
                            where p.rental_id == rentalid
                            //orderby (p.payment_date)
                            select p;
                List <payment> payments = model.ToList <payment>();

                simulator.PerformanceSimulation();

                for (int i = 0; i < payments.Count; i++)
                {
                    SPayment payment = new SPayment();
                    payment = payment.Createpayment((payments[i].rental_id ?? 0), payments[i].payment_id, payments[i].customer_id, payments[i].staff_id, payments[i].amount, payments[i].payment_date, payments[i].last_update, payments[i].rental.inventory_id, payments[i].rental.inventory.film.title);
                    spayments.Add(payment);
                }
            }
            return(spayments.ToArray <SPayment>());
        }
Ejemplo n.º 5
0
        public override bool RefundPayment(int paymentid)
        {
            bool result = false;

            using (SakilaEntities dc = new SakilaEntities())
            {

                SPayment spayment = new SPayment();

                var model = from p in dc.payments
                            where p.payment_id == paymentid
                            //orderby (p.payment_date)
                            select p;
                List<payment> payments = model.ToList<payment>();

                simulator.PerformanceSimulation();

                payment refundpayment = new payment();
                refundpayment.amount = payments[0].amount * -1;
                refundpayment.customer_id = payments[0].customer_id;
                refundpayment.customerReference = payments[0].customerReference;
                refundpayment.rental_id = payments[0].rental_id;
                refundpayment.rentalReference = payments[0].rentalReference;
                refundpayment.payment_date = DateTime.Now;
                refundpayment.staff_id = payments[0].staff_id;
                refundpayment.staffReference = payments[0].staffReference;

                dc.AddTopayments(refundpayment);
                dc.AcceptAllChanges();
                dc.SaveChanges();
            }
            result = true;

            return result;
        }
Ejemplo n.º 6
0
        public override SPayment[] GetPaymentsByRental(int rentalid)
        {
            List<SPayment> spayments = new List<SPayment>();
            using (SakilaEntities dc = new SakilaEntities())
            {
                var model = from p in dc.payments
                            where p.rental_id == rentalid
                            //orderby (p.payment_date)
                            select p;
                List<payment> payments = model.ToList<payment>();

                simulator.PerformanceSimulation();

                for (int i = 0; i < payments.Count; i++)
                {
                    SPayment payment = new SPayment();
                    payment = payment.Createpayment((payments[i].rental_id ?? 0), payments[i].payment_id, payments[i].customer_id, payments[i].staff_id, payments[i].amount, payments[i].payment_date, payments[i].last_update, payments[i].rental.inventory_id, payments[i].rental.inventory.film.title);
                    spayments.Add(payment);
                }
            }
            return spayments.ToArray<SPayment>();
        }
Ejemplo n.º 7
0
        public override SPayment GetPayment(int id)
        {
            SPayment spayment = new SPayment();
            using (SakilaEntities dc = new SakilaEntities())
            {
                var model = from p in dc.payments
                            where p.payment_id == id
                            //orderby (p.payment_date)
                            select p;
                List<payment> payments = model.ToList<payment>();
                spayment = spayment.Createpayment((payments[0].rental_id ?? 0), payments[0].payment_id, payments[0].customer_id,
                    payments[0].staff_id, payments[0].amount, payments[0].payment_date, payments[0].last_update,
                    payments[0].rental.inventory_id, payments[0].rental.inventory.film.title);
            }

            simulator.PerformanceSimulation();

            return spayment;
        }
Ejemplo n.º 8
0
        public SPayment Createpayment(global::System.Int32 rental_id, global::System.Int32 payment_id, global::System.Int32 customer_id, global::System.Byte staff_id, global::System.Decimal amount, global::System.DateTime payment_date, global::System.DateTime last_update,global::System.Int32 inventory_id, global::System.String filmtitle)
        {
            SPayment payment = new SPayment();
            payment.payment_id = payment_id;
            payment.rental_id = rental_id;
            payment.customer_id = customer_id;
            payment.staff_id = staff_id;
            payment.amount = amount;
            payment.payment_date = payment_date;
            payment.last_update = last_update;
            payment.inventory_id = inventory_id;
            payment.filmtitle = filmtitle;

            return payment;
        }