示例#1
0
        public void Extension()
        {
            var a = this.CreateAccount();
            var list = new PersonalTasklist("default", a);
            list["key"] = "abc";
            this._tasklistService.Create(list);

            this.Evict(list);

            list = this._tasklistService.GetTasklist(list.ID) as PersonalTasklist;
            Assert.AreEqual("abc", list["key"]);
        }
示例#2
0
        public void Create_PersonalTasklist()
        {
            var a = this.CreateAccount();
            var list = new PersonalTasklist("default", a);
            Assert.Throws(typeof(AssertionException), () => list.SetName(null));
            this._tasklistService.Create(list);

            this.Evict(list);

            var list2 = this._tasklistService.GetTasklist(list.ID);
            Assert.IsInstanceOf<PersonalTasklist>(list2);
            Assert.AreEqual(list.Name, list2.Name);
            Assert.AreEqual(a.ID, (list2 as PersonalTasklist).OwnerAccountId);
        }
示例#3
0
        public void Update_PersonalTasklist()
        {
            var a = this.CreateAccount();
            var list = new PersonalTasklist("default", a);
            this._tasklistService.Create(list);

            this.Evict(list);

            list = this._tasklistService.GetTasklist(list.ID) as PersonalTasklist;
            list.SetName("abc");
            this._tasklistService.Update(list);

            this.Evict(list);
            list = this._tasklistService.GetTasklist(list.ID) as PersonalTasklist;
            Assert.AreEqual("abc", list.Name);
        }
示例#4
0
 public ActionResult CreateTasklists(string data)
 {
     Assert.IsNotNullOrWhiteSpace(data);
     var collects = new List<Correction>();
     var all = _serializer.JsonDeserialize<TasklistInfo[]>(data);
     foreach (var l in all)
     {
         try
         {
             var list = new PersonalTasklist(l.Name, this.Context.Current);
             this._tasklistService.Create(list);
             collects.Add(new Correction() { NewId = list.ID.ToString(), OldId = l.ID.ToString() });
         }
         catch (Exception e)
         {
             this._log.Error(string.Format("创建任务表时异常:{0}|{1}|{2}", l.ID, l.Name, l.Type), e);
         }
     }
     return Json(collects);
 }
示例#5
0
 public ActionResult CreateTasklist(string name, string type)
 {
     //目前只提供个人任务表
     var list = new PersonalTasklist(name, this.Context.Current);
     this._tasklistService.Create(list);
     return Json(list.ID);
 }
示例#6
0
 protected PersonalTasklist CreatePersonalTasklist(Account a)
 {
     var list = new PersonalTasklist(this.RandomString(), a);
     this._tasklistService.Create(list);
     return list;
 }