예제 #1
0
        private void onStructChanged(int activeTopic, int initiaterId, DeviceType devType)
        {
            if (initiaterId == SessionInfo.Get().person.Id&& devType == DeviceType.Wpf)
            {
                return;
            }

            BusyWndSingleton.Show("Fetching changes...");
            try
            {
                //save selected topic
                int topicUnderSelectionId = -1;
                var sel = lstTopics.SelectedItem as Topic;
                if (sel != null)
                {
                    topicUnderSelectionId = sel.Id;
                }

                //save selected list of points
                var selectedAp = theBadge.DataContext as ArgPoint;

                ForgetDBDiscussionState();
                DiscussionSelectionChanged();

                //select previously selected topic
                if (topicUnderSelectionId != -1)
                {
                    lstTopics.SelectedItem = PrivateCenterCtx.Get().Topic.FirstOrDefault(t0 => t0.Id == topicUnderSelectionId);
                }

                //select previously selected point
                if (selectedAp != null)
                {
                    //own list
                    if (selectedAp.Person.Id == SessionInfo.Get().person.Id)
                    {
                        lstPoints.SelectedItem = null;
                        lstPoints.SelectedItem = OwnArgPoints.FirstOrDefault(ap0 => ap0.Ap.Id == selectedAp.Id);
                    }
                    else
                    {
                        lstOtherUsers.SelectedItem = OtherUsers.FirstOrDefault(u0 => u0.Pers.Id == selectedAp.Person.Id);

                        lstBadgesOfOtherUser.SelectedItem =
                            ArgPointsOfOtherUser.FirstOrDefault(ap0 => ap0.Ap.Id == selectedAp.Id);
                    }
                }
            }
            finally
            {
                BusyWndSingleton.Hide();
            }
        }
예제 #2
0
        public void DeleteTransactionUser()
        {
            if (SelectedTransactionUser != null)
            {
                OtherUsers.Add(SelectedTransactionUser.User);

                db.TransactionUsers.Remove(SelectedTransactionUser);

                TransactionUsersCollection.Remove(SelectedTransactionUser);
                SelectedUser = OtherUsers.FirstOrDefault();
            }
        }
예제 #3
0
        public void AddTransactionUser()
        {
            if (SelectedUser != null)
            {
                var thisTu = TransactionUsersCollection.First();
                var tu     = db.TransactionUsers.Create();
                tu.Transaction = thisTu.Transaction;
                tu.User        = SelectedUser;
                db.TransactionUsers.Add(tu);

                TransactionUsersCollection.Add(tu);
                OtherUsers.Remove(SelectedUser);
                SelectedUser = OtherUsers.FirstOrDefault();
            }
        }