Ejemplo n.º 1
0
 //For Deep Copy
 public ClubMember(ClubMember other)
     : base((Customer)other)
 {
     memberID    = other.MemberID;
     dateOfBirth = other.DateOfBirth;
     gender      = other.Gender;
 }
Ejemplo n.º 2
0
        public ClubMember ClubMemberConverterToContext(Backend.ClubMember currentClubMember)
        {
            CreditCard dataContextCreditCard = new CreditCard();
            ClubMember dataContextClubMember = new ClubMember();

            //Customer Entity
            Customer currtCusAsClub = new Customer();

            currtCusAsClub.IsAClubMember   = true;
            currtCusAsClub.FirstName       = currentClubMember.FirstName;
            currtCusAsClub.LastName        = currentClubMember.LastName;
            currtCusAsClub.Id              = currentClubMember.Id;
            dataContextClubMember.Customer = currtCusAsClub;
            //Credit Card Entity
            if (currentClubMember.CreditCard != null)
            {
                dataContextCreditCard.CreditNumber         = currentClubMember.CreditCard.CreditNumber;
                dataContextCreditCard.ExpirationDate       = currentClubMember.CreditCard.ExpirationDate;
                dataContextCreditCard.FirstName            = currentClubMember.CreditCard.FirstName;
                dataContextCreditCard.LastName             = currentClubMember.CreditCard.LastName;
                dataContextClubMember.Customer.CreditCard1 = dataContextCreditCard;
                dataContextClubMember.Customer.CreditCard  = currentClubMember.CreditCard.CreditNumber;
            }
            //Clubmember Entity
            dataContextClubMember.DateOfBirth = currentClubMember.DateOfBirth;
            dataContextClubMember.Gender      = (int)currentClubMember.Gender;
            dataContextClubMember.MemberID    = currentClubMember.MemberID;
            return(dataContextClubMember);
        }
Ejemplo n.º 3
0
        public override bool Equals(object _other)
        {
            if (!(_other is ClubMember))
            {
                return(false);
            }
            ClubMember other = (ClubMember)_other;

            return(base.Equals((Customer)_other) && memberID == other.MemberID && dateOfBirth.Equals(other.dateOfBirth) && gender.Equals(other.gender));
        }
Ejemplo n.º 4
0
 public ClubMember(ClubMember clubmember) //Copy constractor, Will provid a deep copy of a Club Member
 {
     this.memberID           = clubmember.memberID;
     this.teudatZehute       = clubmember.teudatZehute;
     this.firstName          = clubmember.firstName;
     this.lastName           = clubmember.lastName;
     this.transactionHistory = clubmember.transactionHistory;
     this.date_of_birth      = clubmember.date_of_birth;
     this.gender             = clubmember.gender;
 }
Ejemplo n.º 5
0
        public void ClubmemberTest()
        {
            Backend.ClubMember member1 = new Backend.ClubMember(123123, "asaf", "asafaa", new DateTime(2014, 09, 10), Gender.Male);
            List <object>      list    = new List <object>();

            list.Add(member1);
            linq.WriteToFile(list, member1);
            List <object> readlist = linq.ReadFromFile(Elements.ClubMember);

            Assert.Contains(member1, readlist);
        }
Ejemplo n.º 6
0
        //Club Member
        public Backend.ClubMember ClubMemberConverterToBackend(ClubMember dataContextClubMember)
        {
            Backend.ClubMember currentClubMember = new Backend.ClubMember();

            //Credit Card Entity
            if (dataContextClubMember.Customer.CreditCard != null)
            {
                currentClubMember.CreditCard.CreditNumber   = dataContextClubMember.Customer.CreditCard1.CreditNumber;
                currentClubMember.CreditCard.ExpirationDate = dataContextClubMember.Customer.CreditCard1.ExpirationDate;
                currentClubMember.CreditCard.FirstName      = dataContextClubMember.Customer.CreditCard1.FirstName;
                currentClubMember.CreditCard.LastName       = dataContextClubMember.Customer.CreditCard1.LastName;
            }
            else
            {
                currentClubMember.CreditCard = null;
            }

            //Customer Entity
            currentClubMember.FirstName = dataContextClubMember.Customer.FirstName;
            currentClubMember.LastName  = dataContextClubMember.Customer.LastName;
            currentClubMember.Id        = dataContextClubMember.Customer.Id;
            IQueryable transQuery = from Transaction trans in db.Transactions
                                    from TranHistoryLinkedTable linkedTrans in db.TranHistoryLinkedTables
                                    where (trans.TransactionID == linkedTrans.TransID && linkedTrans.CustomerID == currentClubMember.Id)
                                    select trans;

            foreach (Transaction trans in transQuery)
            {
                currentClubMember.TranHistory.Add(TransactionConverterToBackend(trans));
            }

            //Clubmember Entity
            currentClubMember.DateOfBirth = dataContextClubMember.DateOfBirth;
            currentClubMember.Gender      = (Gender)dataContextClubMember.Gender;
            currentClubMember.MemberID    = dataContextClubMember.MemberID;
            return(currentClubMember);
        }
Ejemplo n.º 7
0
 /*Removing a club member from the list of club members*/
 public void removeClubMember(ClubMember clubMemberToRemove)
 {
     clubMembers.Remove(clubMemberToRemove);
 }
Ejemplo n.º 8
0
 /*Adding a club member to the list of club members*/
 public void addClubMember(ClubMember clubMemberToAdd)
 {
     clubMembers.Add(clubMemberToAdd);
 }
Ejemplo n.º 9
0
 public void addClubMember(ClubMember clubMember)
 {
     this.clubMembers.addClubMember(clubMember);
 }