public static CustomerPointAccount CreateCustomerPointAccount(int customerID, int pointAccountID, decimal pointBalance)
 {
     CustomerPointAccount customerPointAccount = new CustomerPointAccount();
     customerPointAccount.CustomerID = customerID;
     customerPointAccount.PointAccountID = pointAccountID;
     customerPointAccount.PointBalance = pointBalance;
     return customerPointAccount;
 }
 public void AddToCustomerPointAccounts(CustomerPointAccount customerPointAccount)
 {
     base.AddObject("CustomerPointAccounts", customerPointAccount);
 }
        public CustomerPointAccount GetCustomerPointAccount(int CustomerID, int PointAccountID)
        {
            var result = new CustomerPointAccount();

            using (var reader = GetContext().GetReader(@"
                    SELECT
                        PointAccountID,
                        CustomerID,
                        PointBalance
                    FROM CustomerPointAccounts
                    WHERE
                        CustomerID = {0}
                        AND PointAccountID = {1}
                ", CustomerID, PointAccountID))
            {
                if (!reader.Read()) return null;

                result.CustomerID = reader.GetInt32("CustomerID");
                result.PointAccountID = reader.GetInt32("PointAccountID");
                result.Balance = reader.GetDecimal("PointBalance");
            }

            return result;
        }
        public CustomerPointAccount GetCustomerPointAccount(int CustomerID, int PointAccountID)
        {
            var result = new CustomerPointAccount();

            var response = GetContext().GetPointAccount(new GetPointAccountRequest()
            {
                CustomerID = CustomerID,
                PointAccountID = PointAccountID
            });
            if(response == null) return null;

            result.CustomerID = CustomerID;
            result.PointAccountID = PointAccountID;
            result.Balance = response.Balance;

            return result;
        }
        public CustomerPointAccount GetCustomerPointAccount(int CustomerID, int PointAccountID)
        {
            var result = new CustomerPointAccount();

            var response = GetContext().CustomerPointAccounts
                .Where(c => c.CustomerID == CustomerID)
                .Where(c => c.PointAccountID == PointAccountID)
                .FirstOrDefault();
            if(response == null) return null;

            result.CustomerID = CustomerID;
            result.PointAccountID = PointAccountID;
            result.Balance = response.PointBalance;

            return result;
        }