示例#1
0
 /// <summary>
 /// 删除基因字典
 /// </summary>
 /// <param name="member"></param>
 /// <returns></returns>
 public bool Delete(string id)
 {
     using (EFGeneRepository repository = new EFGeneRepository())
     {
         return(repository.Delete(id));
     }
 }
示例#2
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);
     }
 }
示例#3
0
        public List <Gene> GetList(string geneName, ref PageInfo pager)
        {
            using (EFGeneRepository repository = new EFGeneRepository())
            {
                IEnumerable <GN_GENE> list = null;
                if (!string.IsNullOrEmpty(geneName))
                {
                    list = repository.FindAll(o => o.GENENAME.Contains(geneName) && !o.ISDELETED).Paging(ref pager).ToList();
                }
                else
                {
                    list = repository.FindAll(o => !o.ISDELETED).Paging(ref pager).ToList();
                }

                List <Gene> modelList = (from g in list select EntityToModel(g)).ToList();
                return(modelList);
            }
        }
示例#4
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));
     }
 }
示例#5
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));
     }
 }