Exemple #1
0
 public EvernoteModel(EvernoteEntity entity)
 {
     if (entity == null)
     {
         return;
     }
     this.ID = entity.Id.ToString();
     this.Content = entity.Content;
     this.CreateUser = entity.CreateUser != null ? entity.CreateUser.Id : 0;
     this.Title = entity.Title;
     DisplayName = entity.CreateUser != null ? entity.CreateUser.OperatorName : string.Empty;
 }
Exemple #2
0
        public ActionResult AutoGenerate()
        {
            for (int i = 0; i < 20; i++)
            {
                var model = new EvernoteEntity() { Content = i.ToString(), Group = i.ToString(), Title = string.Format("第{0}个", i) };
                model.CreateUser = WebCrm.Framework.DependencyResolver.Resolver<IUserInfoService>().FindByUserName("LISG");
                model.SetId(ModelReposity.GenerateId());
                ModelReposity.Save(model);
            }

            return new JsonResult() { Data = new { Success = true }, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
        }
Exemple #3
0
 public EvernoteModel(EvernoteEntity entity)
 {
     if (entity == null)
     {
         return;
     }
     this.ID         = entity.Id.ToString();
     this.Content    = entity.Content;
     this.CreateUser = entity.CreateUser != null ? entity.CreateUser.Id : 0;
     this.Title      = entity.Title;
     DisplayName     = entity.CreateUser != null ? entity.CreateUser.OperatorName : string.Empty;
 }
Exemple #4
0
 static ModelReposity()
 {
     _models = new List <EvernoteEntity>();
     for (int i = 0; i < 20; i++)
     {
         var model = new EvernoteEntity()
         {
             Content = i.ToString(), Group = i.ToString(), Title = string.Format("第{0}个", i)
         };
         model.CreateUser = DependencyResolver.Resolver <IUserInfoService>().FindByUserName("LISG");
         model.SetId(GenerateId());
         _models.Add(model);
     }
 }
Exemple #5
0
        public static void Save(EvernoteEntity entity)
        {
            var model = FindById(entity.Id);

            if (model == null)
            {
                entity.SetId(GenerateId());
                _models.Add(entity);
            }
            else
            {
                _models.Remove(model);
                _models.Add(entity);
            }
        }
Exemple #6
0
 public static void Save(EvernoteEntity entity)
 {
     var model = FindById(entity.Id);
     if (model == null)
     {
         entity.SetId(GenerateId());
         _models.Add(entity);
     }
     else
     {
         _models.Remove(model);
         _models.Add(entity);
     }
 }
Exemple #7
0
 static ModelReposity()
 {
     _models = new List<EvernoteEntity>();
     for (int i = 0; i < 20; i++)
     {
         var model = new EvernoteEntity() { Content = i.ToString(), Group = i.ToString(), Title = string.Format("第{0}个", i) };
         model.CreateUser = DependencyResolver.Resolver<IUserInfoService>().FindByUserName("LISG");
         model.SetId(GenerateId());
         _models.Add(model);
     }
 }