コード例 #1
0
ファイル: ModelTests.cs プロジェクト: T045T/Echo-App
        public void TestUDCListModel()
        {
            UDCListModel udc = new UDCListModel("Data Source=isostore:/Test1.sdf", true);
            UserModel testUser = new UserModel("1", "foo", "bar", "");
            udc.addUser(testUser);

            Assert.Equals(testUser, udc.UsersByFirstName[0]);
            Assert.IsTrue(udc.SubmitChanges());

            udc.LoadListsFromDatabase();

            Assert.Equals(testUser, udc.UsersByFirstName[0]);

            GroupModel testGroup = new GroupModel("TestGroup");
            udc.addGroup(testGroup);
            udc.addToGroup(testUser, testGroup);

            Assert.IsTrue(udc.GroupList[0].Users.Contains(testUser));

            CallLogEntry testEntry = new CallLogEntry();
            CallLogModel testLog = new CallLogModel(1);
            testLog.addEntry(testEntry);
            testUser.CallLogs.Add(testLog);

            Assert.IsTrue(udc.SubmitChanges());
            Assert.IsTrue(testUser.CallLogs.Any());
            Assert.Equals(testUser.CallLogs.First(), testLog);

            udc.removeGroup("TestGroup");
            Assert.IsTrue(udc.GroupList.Count == 0);
        }
コード例 #2
0
        protected override void OnActivate()
        {
            base.OnActivate();
            if (ClearBackStack)
            {
                navService.RemoveBackEntry();
                navService.RemoveBackEntry();
            }
            User = udc.GetUser(TargetUserID);
            if (User == null)
                return;
            else
                NotifyOfPropertyChange("User");
            var logList = User.CallLogs.OrderByDescending((log) => log.StartTime);
            if (logList.Any() && logList.First().Entries.Any()) {
                LastCallLog = logList.First();
                LastCallLogEntry = logList.First().Entries.First();
            }
            else
            {
                LastCallLogEntry = new CallLogEntry("You have no recent calls with " + User.FirstLast + ".", DateTime.Now, "[none]");
                //LastCallLog = new CallLogModel(User.ID, DateTime.Now);

                //LastCallLog.addEntry("Echo park synth fixie, accusamus anim gentrify occaecat photo booth.");
                //User.CallLogs.Add(LastCallLog);
                //udc.CallLogTable.InsertOnSubmit(log);
                //udc.SubmitChanges();
                //log.addEntry("And now we're testing the wrapping abilities... god, I hope this works...");
                //User.CallLogs.Add(log);
                //udc.SubmitChanges();
            }
        }
コード例 #3
0
ファイル: CallLogModel.cs プロジェクト: T045T/Echo-App
 // attachLog and detachLog are invoked whenever something is added to or removed from the CallLogEntry EntitySet.
 // They take care of maintaining the proper links between log entries and log objects.
 public void attachLog(CallLogEntry e)
 {
     NotifyPropertyChanging("CallLogEntry");
     e.CallLogID = this.CallLogID;
     NotifyOfPropertyChange("CallLogEntry");
 }
コード例 #4
0
ファイル: CallLogModel.cs プロジェクト: T045T/Echo-App
 public void detachLog(CallLogEntry e)
 {
     NotifyPropertyChanging("CallLogEntry");
     e.CallLog = null;
     NotifyOfPropertyChange("CallLogEntry");
 }
コード例 #5
0
ファイル: CallLogModel.cs プロジェクト: T045T/Echo-App
 public void addEntry(CallLogEntry e)
 {
     if (e.Timestamp.CompareTo(this.StartTime) >= 0 && e.CallLogID.Equals(this.CallLogID))
     {
         //Deployment.Current.Dispatcher.BeginInvoke(() =>
         //{
             this.Entries.Add(e);
             if (Snippet == null || Snippet.Length == 0)
                 Snippet = e.Content;
         //});
     }
 }