예제 #1
0
        List <Payment2> GetData(SqlCommand cmd)
        {
            cmd.Connection.Open();
            SqlDataReader   reader   = cmd.ExecuteReader();
            List <Payment2> Payment2 = new List <Payment2>();

            using (reader)
            {
                while (reader.Read())
                {
                    Payment2 ord = new Payment2();
                    ord.EmployeeId     = reader.GetInt32(0);
                    ord.EmployeeName   = reader.GetString(1);
                    ord.EmployeeSalary = reader.GetInt32(2);
                    ord.EmployeeEmail  = reader.GetString(3);
                    ord.Bomus          = reader.GetInt32(4);
                    ord.OverTime       = reader.GetInt32(5);
                    ord.Total          = reader.GetInt32(6);
                    ord.Date           = reader.GetString(7);


                    Payment2.Add(ord);
                }
                reader.Close();
            }
            cmd.Connection.Close();
            return(Payment2);
        }
예제 #2
0
        public void AddPayment(Payment payment)
        {
            Payment2 pay2 = new Payment2()
            {
                dateTime    = payment.dateTime,
                paymentType = payment.paymentType,
                totalPrice  = payment.totalPrice
            };

            _context.Payments.Add(pay2);

            foreach (var item in payment.menuItems)
            {
                PaymentList list = new PaymentList()
                {
                    dateTime  = payment.dateTime,
                    mainId    = item.Id,
                    MenuId    = item.MenuId,
                    Name      = item.Name,
                    ImagePath = item.ImagePath,
                    Price     = item.Price,
                    isUse     = item.isUse
                };

                _context.PaymentLists.Add(list);
            }
        }