Exemplo n.º 1
0
 public void CopyFrom(Athlete athlete)
 {
     this.ID           = athlete.AthleteID;
     this.Name         = athlete.Name;
     this.MetroID      = athlete.MetroID;
     this.DOB          = athlete.DOB;
     this.Gender       = (GenderEnum)athlete.Gender;
     this.Picture      = athlete.Picture;
     this.TimeCreated  = athlete.TimeCreated;
     this.SnookerAbout = athlete.SnookerAbout;
 }
        public static PushNotificationMessage BuildPrivateMessage(Athlete athlete, string message)
        {
            string name = athlete.Name ?? "";

            if (name.Length > 20)
            {
                name = name.Substring(0, 20);
            }
            string text = string.Format("Message from '{0}' : {1}", name, message);

            return(new PushNotificationMessage()
            {
                Text = text, ObjectID = athlete.AthleteID
            });
        }
        public static PushNotificationMessage BuildFriendRequest(Athlete athlete)
        {
            string name = athlete.Name ?? "";

            if (name.Length > 20)
            {
                name = name.Substring(0, 20);
            }
            string text = string.Format("Friend request from '{0}'", name);

            return(new PushNotificationMessage()
            {
                Text = text, ObjectID = athlete.AthleteID
            });
        }
        public static PushNotificationMessage BuildGameCommentMessage(Athlete athlete, string commentText, int gameHostID)
        {
            string name = athlete.Name ?? "";

            if (name.Length > 20)
            {
                name = name.Substring(0, 20);
            }
            string text = string.Format("Comment from '{0}' : {1}", name, commentText);

            return(new PushNotificationMessage()
            {
                Text = text, ObjectID = gameHostID
            });
        }
Exemplo n.º 5
0
 public bool IsDifferent(Athlete athlete)
 {
     if (string.Compare(this.Name, athlete.Name, false) != 0)
     {
         return(true);
     }
     if (this.IsPro != athlete.IsPro)
     {
         return(true);
     }
     if (this.DOB != athlete.DOB)
     {
         return(true);
     }
     if (this.Gender != athlete.Gender)
     {
         return(true);
     }
     if (string.Compare(this.Country, athlete.Country, true) != 0)
     {
         return(true);
     }
     if (this.MetroID != athlete.MetroID)
     {
         return(true);
     }
     if (string.Compare(this.FacebookId, athlete.FacebookId, true) != 0)
     {
         return(true);
     }
     if (string.Compare(this.NameInFacebook, athlete.NameInFacebook, true) != 0)
     {
         return(true);
     }
     if (string.Compare(this.Picture, athlete.Picture, true) != 0)
     {
         return(true);
     }
     if (string.Compare(this.SnookerAbout, athlete.SnookerAbout, false) != 0)
     {
         return(true);
     }
     return(false);
 }
        public static PushNotificationMessage BuildGameMessage(PushNotificationMessageTypeEnum type, Athlete athlete, int gameHostID)
        {
            string name = athlete.Name ?? "";

            if (name.Length > 20)
            {
                name = name.Substring(0, 20);
            }
            string text;

            switch (type)
            {
            case PushNotificationMessageTypeEnum.GameInvite: text = string.Format("Game invite from '{0}'", name); break;

            case PushNotificationMessageTypeEnum.GameInviteAccepted: text = string.Format("Invite accepted by '{0}'", name); break;

            case PushNotificationMessageTypeEnum.GameInviteDeclined: text = string.Format("Invite declined by '{0}'", name); break;

            case PushNotificationMessageTypeEnum.GameWantsToBeInvited: text = string.Format("Wants to be invited: '{0}'", name); break;

            case PushNotificationMessageTypeEnum.GameApprovedByHost: text = string.Format("Approved by '{0}'. Come play!", name); break;

            default: throw new Exception("Invalid type: " + type.ToString());
            }
            return(new PushNotificationMessage()
            {
                Text = text, ObjectID = gameHostID
            });
        }