Пример #1
0
 /// <summary>
 /// 根据id查询基因字典
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Gene Get(string id)
 {
     using (EFGeneRepository repository = new EFGeneRepository())
     {
         GN_GENE entity = repository.Get(id);
         if (entity == null)
         {
             throw new KeyNotFoundException();
         }
         Gene model = EntityToModel(entity);
         return(model);
     }
 }
Пример #2
0
 /// <summary>
 /// 编辑基因字典
 /// </summary>
 /// <param name="member"></param>
 /// <returns></returns>
 public bool Edit(Gene model)
 {
     using (EFGeneRepository repository = new EFGeneRepository())
     {
         if (model == null || string.IsNullOrEmpty(model.ID))
         {
             return(false);
         }
         GN_GENE entity = ModelToEntity(model);
         entity.EDITDATETIME = DateTime.Now;
         UserInfo currentUser = new UserInfoService().GetCurrentUser();
         if (currentUser != null)
         {
             entity.EDITUSERID   = currentUser.UserId;
             entity.EDITUSERNAME = currentUser.LoginName;
         }
         return(repository.Edit(entity));
     }
 }
Пример #3
0
        private Gene EntityToModel(GN_GENE entity)
        {
            return(new Gene()
            {
                ID = entity.ID,
                GeneName = entity.GENENAME,
                RefSequence = entity.REFSEQUENCE,
                SynonymName = entity.SYNONYMNAME,

                CreateDateTime = entity.CREATEDATETIME,
                CreateUserID = entity.CREATEUSERID,
                CreateUserName = entity.CREATEUSERNAME,
                EditTime = entity.EDITDATETIME,
                EditUserID = entity.EDITUSERID,
                EditUserName = entity.EDITUSERNAME,
                OwnerID = entity.OWNERID,
                OwnerName = entity.OWNERNAME,
                IsDeleted = entity.ISDELETED
            });
        }
Пример #4
0
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="gene"></param>
 /// <returns></returns>
 public string Add(Gene model)
 {
     using (EFGeneRepository repository = new EFGeneRepository())
     {
         if (model == null)
         {
             return(string.Empty);
         }
         GN_GENE entity = ModelToEntity(model);
         entity.ID             = string.IsNullOrEmpty(model.ID) ? Guid.NewGuid().ToString() : model.ID;
         entity.CREATEDATETIME = (model.CreateDateTime != null && model.CreateDateTime.HasValue) ? model.CreateDateTime.Value : DateTime.Now;
         UserInfo currentUser = new UserInfoService().GetCurrentUser();
         if (currentUser != null)
         {
             entity.CREATEUSERID   = currentUser.UserId;
             entity.CREATEUSERNAME = currentUser.LoginName;
         }
         entity.EDITDATETIME = entity.CREATEDATETIME;
         entity.EDITUSERID   = entity.CREATEUSERID;
         entity.EDITUSERNAME = entity.CREATEUSERNAME;
         return(repository.Add(entity));
     }
 }