Пример #1
0
        public void AddGroup(GroupTableEntity newGroup)
        {
            IsSuccess = true;
            Message   = string.Empty;

            try
            {
                var groupInLocalStore = (from GroupTableEntity g in _dataContext.MyGroupsTable
                                         where g.GroupId == newGroup.GroupId
                                         select g).FirstOrDefault();

                if (groupInLocalStore != null)
                {
                    groupInLocalStore.IsDeleted = false;
                }
                else
                {
                    _dataContext.MyGroupsTable.InsertOnSubmit(newGroup);
                }

                _dataContext.SubmitChanges();
                this.Groups.Add(newGroup);
            }
            catch (Exception ex)
            {
                IsSuccess = false;
                Message   = ex.Message;
            }
        }
Пример #2
0
        public void UpdateGroup(string profileId, GroupTableEntity latestGroup)
        {
            var localGroup = (from GroupTableEntity b in _dataContext.MyGroupsTable
                              where b.GroupId == latestGroup.GroupId && b.MyProfileId == profileId
                              select b).FirstOrDefault();

            if (localGroup != null)
            {
                localGroup.GroupId     = latestGroup.GroupId;
                localGroup.MyProfileId = latestGroup.MyProfileId;

                localGroup.Name        = latestGroup.Name;
                localGroup.PhoneNumber = latestGroup.PhoneNumber;
                localGroup.Email       = latestGroup.Email;
                localGroup.Type        = latestGroup.Type;

                localGroup.EnrollmentType  = latestGroup.EnrollmentType;
                localGroup.EnrollmentValue = latestGroup.EnrollmentValue;
                localGroup.EnrollmentKey   = latestGroup.EnrollmentKey;


                localGroup.BorderThickness  = latestGroup.BorderThickness;
                localGroup.BuddyStatusColor = latestGroup.BuddyStatusColor;

                localGroup.IsDeleted   = latestGroup.IsDeleted;
                localGroup.IsValidated = latestGroup.IsValidated;

                _dataContext.SubmitChanges();
            }
        }
Пример #3
0
        public MembershipServiceRef.Group ConvertGroup(GroupTableEntity phoneGroup)
        {
            var serverGroup = new MembershipServiceRef.Group();

            serverGroup.GroupID     = phoneGroup.GroupId;
            serverGroup.GroupName   = phoneGroup.Name;
            serverGroup.Email       = phoneGroup.Email;
            serverGroup.PhoneNumber = phoneGroup.PhoneNumber;
            serverGroup.Type        = phoneGroup.Type;

            serverGroup.EnrollmentType  = phoneGroup.EnrollmentType;
            serverGroup.EnrollmentValue = phoneGroup.EnrollmentValue;
            serverGroup.EnrollmentKey   = phoneGroup.EnrollmentKey;

            serverGroup.ToRemove    = phoneGroup.IsDeleted;
            serverGroup.IsValidated = phoneGroup.IsValidated;

            return(serverGroup);
        }
Пример #4
0
        public GroupTableEntity ConvertGroup(GroupServiceRef.Group serverGroup, string myProfileId = "")
        {
            var phoneGroup = new GroupTableEntity();

            phoneGroup.GroupId     = serverGroup.GroupID;
            phoneGroup.MyProfileId = myProfileId;

            phoneGroup.Name        = serverGroup.GroupName;
            phoneGroup.PhoneNumber = serverGroup.PhoneNumber;
            phoneGroup.Email       = serverGroup.Email;
            phoneGroup.Type        = (MembershipServiceRef.GroupType)serverGroup.Type;

            phoneGroup.EnrollmentType  = (MembershipServiceRef.Enrollment)serverGroup.EnrollmentType;
            phoneGroup.EnrollmentValue = serverGroup.EnrollmentValue;
            phoneGroup.EnrollmentKey   = serverGroup.EnrollmentKey;

            phoneGroup.IsDeleted   = serverGroup.ToRemove;
            phoneGroup.IsValidated = serverGroup.IsValidated;

            phoneGroup.BorderThickness  = new Thickness(2);
            phoneGroup.BuddyStatusColor = Constants.WhiteColorCode;

            return(phoneGroup);
        }