Beispiel #1
0
        public static List<FriendTag> PopulateFriendTagWithJoin(IDataReader dr)
        {
            ColumnFieldList list = new ColumnFieldList(dr);

            List<FriendTag> arr = new List<FriendTag>();

            FriendTag obj;

            while (dr.Read())
            {
                obj = new FriendTag();

                if (list.IsColumnPresent("MemberID")) { obj.MemberID = (int)dr["MemberID"]; }
                if (list.IsColumnPresent("WebMemberID")) { obj.WebMemberID = (string)dr["WebMemberID"]; }
                if (list.IsColumnPresent("CountryName")) { obj.CountryName = (string)dr["CountryName"]; }
                if (list.IsColumnPresent("NickName")) { obj.NickName = (string)dr["NickName"]; }
                if (list.IsColumnPresent("FirstName")) { obj.FirstName = (string)dr["FirstName"]; }
                if (list.IsColumnPresent("LastName")) { obj.LastName = (string)dr["LastName"]; }
                if (list.IsColumnPresent("ProfilePhotoURL")) { obj.ProfilePhotoURL = (string)dr["ProfilePhotoURL"]; }
                if (list.IsColumnPresent("TaggedDT")) { obj.TaggedDT = (DateTime)dr["TaggedDT"]; }
                if (list.IsColumnPresent("CreatedDT")) { obj._createdDT = (DateTime)dr["CreatedDT"]; }

                arr.Add(obj);
            }

            return arr;
        }
        public TagConfirmation[] UploadTags(String nickname, String password, TagUpdate tags)
        {
            if (String.IsNullOrEmpty(nickname))
            {
                Log.Logger("UpdateTags: nickname is null or an empty string.", Identifier);
                throw new ArgumentNullException("nickname");
            }

            if (String.IsNullOrEmpty(password))
            {
                Log.Logger("UpdateTags: password is null or an empty string.", Identifier);
                throw new ArgumentNullException("password");
            }
            
            if (tags == null)
            {
                Log.Logger("UpdateTags: tags is null.", Identifier);
                throw new ArgumentNullException("tags");
            }

            Log.Logger(String.Format("UpdateTags: nickname = \"{0}\".", nickname), Identifier);
            Log.Logger(String.Format("UpdateTags: password = \"{0}\".", password), Identifier);
            Log.Logger(String.Format("UpdateTags: tags.DeviceTagID.Length = {0}.", tags.DeviceTagID.Length));
            Log.Logger(String.Format("UpdateTags: tags.TagValidationString = {0}.", tags.TagValidationString.Length));
            Log.Logger(String.Format("UpdateTags: tags.DeviceTagID = {0}.", LogProcessor.ArrayToString(tags.DeviceTagID)), Identifier);
            Log.Logger(String.Format("UpdateTags: tags.TagValidationString = {0}.", LogProcessor.ArrayToString(tags.TagValidationString)), Identifier);

            var member = Member.GetMemberViaNicknamePassword(nickname, password);
            var confirmationArray = new TagConfirmation[tags.CheckArraylength()];

            for (var i = 0; i < tags.CheckArraylength(); i++)
            {
                var deviceTagID = tags.DeviceTagID[i];
                // Device tag table needs to be added and this needs to be hooked up.
                var friendMember = Member.GetMemberAndDeviceByDeviceTagID(deviceTagID);
                var confirmedByServer = false;

                if (friendMember != null)
                {
                    var friendTag = new FriendTag()
                    {
                        FirstMemberID = member.MemberID,
                        SecondMemberID = friendMember.MemberID,
                        TaggedDT = DateTime.Now,
                        CreatedDT = DateTime.Now
                    };

                    friendTag.SaveWithFriendRequest();
                    confirmedByServer = true;
                    FriendRequest.CreateBluetoothFriendRequest(member.MemberID, friendMember.MemberID);
                }

                confirmationArray[i] = new TagConfirmation(deviceTagID, confirmedByServer);
            }

            return confirmationArray;
        }
Beispiel #3
0
        public static List <FriendTag> PopulateFriendTagWithJoin(IDataReader dr)
        {
            ColumnFieldList list = new ColumnFieldList(dr);

            List <FriendTag> arr = new List <FriendTag>();

            FriendTag obj;

            while (dr.Read())
            {
                obj = new FriendTag();

                if (list.IsColumnPresent("MemberID"))
                {
                    obj.MemberID = (int)dr["MemberID"];
                }
                if (list.IsColumnPresent("WebMemberID"))
                {
                    obj.WebMemberID = (string)dr["WebMemberID"];
                }
                if (list.IsColumnPresent("CountryName"))
                {
                    obj.CountryName = (string)dr["CountryName"];
                }
                if (list.IsColumnPresent("NickName"))
                {
                    obj.NickName = (string)dr["NickName"];
                }
                if (list.IsColumnPresent("FirstName"))
                {
                    obj.FirstName = (string)dr["FirstName"];
                }
                if (list.IsColumnPresent("LastName"))
                {
                    obj.LastName = (string)dr["LastName"];
                }
                if (list.IsColumnPresent("ProfilePhotoURL"))
                {
                    obj.ProfilePhotoURL = (string)dr["ProfilePhotoURL"];
                }
                if (list.IsColumnPresent("TaggedDT"))
                {
                    obj.TaggedDT = (DateTime)dr["TaggedDT"];
                }
                if (list.IsColumnPresent("CreatedDT"))
                {
                    obj._createdDT = (DateTime)dr["CreatedDT"];
                }

                arr.Add(obj);
            }

            return(arr);
        }
        /// <summary>
        /// Takes an prepopulated IDataReader and creates an array of FriendTags
        /// </summary>
        public static List<FriendTag> PopulateObject(IDataReader dr)
        {
            ColumnFieldList list = new ColumnFieldList(dr);

            List<FriendTag> arr = new List<FriendTag>();

            FriendTag obj;

            while (dr.Read())
            {
                obj = new FriendTag();
                if (list.IsColumnPresent("FriendTagID")) { obj._friendTagID = (int)dr["FriendTagID"]; }
                if (list.IsColumnPresent("FirstMemberID")) { obj._firstMemberID = (int)dr["FirstMemberID"]; }
                if (list.IsColumnPresent("TagValidationString")) { obj._tagValidationString = (string)dr["TagValidationString"]; }
                if (list.IsColumnPresent("TaggedDT")) { obj._taggedDT = (DateTime)dr["TaggedDT"]; }
                if (list.IsColumnPresent("SecondMemberID")) { obj._secondMemberID = (int)dr["SecondMemberID"]; }
                if (list.IsColumnPresent("CreatedDT")) { obj._createdDT = (DateTime)dr["CreatedDT"]; }

                arr.Add(obj);
            }

            dr.Close();

            return arr;
        }