Example #1
0
        public List <Entity.Membership> GetAll()
        {
            string        query  = "SELECT MembershipID, MemberTypeID, MemberName, MemberAddress, PhoneNumber, Email, MemberFrom, TotalShopping FROM Membership";
            SqlDataReader reader = DataAccess.GetData(query);

            Entity.Membership        membership     = null;
            List <Entity.Membership> membershipList = new List <Entity.Membership>();

            while (reader.Read())
            {
                membership = new Entity.Membership(reader["MembershipID"].ToString());
                membership.MemberTypeID  = reader["MemberTypeID"].ToString();
                membership.MemberName    = reader["MemberName"].ToString();
                membership.MemberAddress = reader["MemberAddress"].ToString();
                membership.PhoneNumber   = reader["PhoneNumber"].ToString();;
                membership.Email         = reader["Email"].ToString();
                membership.MemberFrom    = Convert.ToDateTime(reader["MemberFrom"]);
                membership.TotalShopping = Convert.ToDouble(reader["TotalShopping"]);

                membershipList.Add(membership);
            }
            return(membershipList);
        }
Example #2
0
        public int Edit(Entity.Membership membership)
        {
            string query = string.Format("UPDATE Membership SET MemberTypeID='" + membership.MemberTypeID + "', MemberName='" + membership.MemberName + "', MemberAddress='" + membership.MemberAddress + "', PhoneNumber='" + membership.PhoneNumber + "', Email='" + membership.Email + "', MemberFrom='" + membership.MemberFrom + "', TotalShopping='" + membership.TotalShopping + "' WHERE MembershipID='{0}'", membership.MemberID);

            return(DataAccess.ExecuteQuery(query));
        }
Example #3
0
 public int Edit(Entity.Membership membership)
 {
     return(MembershipService.membershipDataAccess.Edit(membership));
 }
Example #4
0
        public int Add(Entity.Membership membership)
        {
            string query = string.Format("INSERT INTO Membership(MembershipID, MemberTypeID, MemberName, MemberAddress, PhoneNumber, Email, MemberFrom, TotalShopping) VALUES('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', {7})", membership.MemberID, membership.MemberTypeID, membership.MemberName, membership.MemberAddress, membership.PhoneNumber, membership.Email, membership.MemberFrom, membership.TotalShopping);

            return(DataAccess.ExecuteQuery(query));
        }
Example #5
0
 public int Add(Entity.Membership membership)
 {
     return(MembershipService.membershipDataAccess.Add(membership));
 }