Exemplo n.º 1
0
 public override bool Delete(string ID)
 {
     XuHos.BLL.Sys.Implements.FileService fService = new Sys.Implements.FileService();
     fService.Delete(m => m.OutID == ID && m.IsDeleted == false);
     return(base.Delete(ID));
 }
Exemplo n.º 2
0
        public ApiResult Save(UserMemberEMRDTO request)
        {
            ApiResult result = new ApiResult();

            if (string.IsNullOrEmpty(request.UserMemberEMRID))
            {
                var model = request.Map <UserMemberEMRDTO, XuHos.Entity.UserMemberEMR>();
                if (Insert(model) && request.Files != null)
                {
                    request.UserMemberEMRID = model.UserMemberEMRID;
                    XuHos.BLL.Sys.Implements.FileService fService = new XuHos.BLL.Sys.Implements.FileService();
                    foreach (var f in request.Files)
                    {
                        f.FileUrl = f.FileUrl;
                        f.Remark  = "-";//必填项?
                        var file = f.Map <UserFileDTO, UserFile>();
                        file.OutID     = model.UserMemberEMRID;
                        file.UserID    = this.CurrentOperatorUserID;
                        file.AccessKey = file.ResourceID = string.Empty;
                        fService.Insert(file);
                    }
                }
            }
            else
            {
                var model = this.DBEntities.UserMemberEMRs.Where(m => m.UserMemberEMRID == request.UserMemberEMRID).FirstOrDefault();
                if (model != null)
                {
                    model.EMRName      = request.EMRName;
                    model.HospitalName = request.HospitalName;
                    model.MemberID     = request.MemberID;
                    model.Remark       = request.Remark;
                    model.Date         = request.Date;

                    if (Update(model))
                    {
                        XuHos.BLL.Sys.Implements.FileService fService = new Sys.Implements.FileService();
                        var ids = request.Files.Select(m => m.FileID);
                        fService.Delete(m => ids.Contains(m.FileID) == false && m.OutID == model.UserMemberEMRID && m.IsDeleted == false);
                        if (request.Files != null)
                        {
                            foreach (var f in request.Files)
                            {
                                if (string.IsNullOrEmpty(f.FileID))
                                {
                                    f.FileUrl = f.FileUrl;
                                    f.Remark  = "-";//必填项?
                                    var file = f.Map <UserFileDTO, UserFile>();
                                    file.OutID     = model.UserMemberEMRID;
                                    file.UserID    = this.CurrentOperatorUserID;
                                    file.AccessKey = file.ResourceID = string.Empty;
                                    fService.Insert(file);
                                }
                            }
                        }
                    }
                }
            }
            result.Data = GetUserMemberEMR(request.UserMemberEMRID);
            return(result);
        }