コード例 #1
0
        public LabFileUploadDataDTO GetLabFileUploadDataById(string lfu_id)
        {
            log.MethodStart();
            LabFileUploadDataDTO objModel = new LabFileUploadDataDTO();

            using (var trans = _db.Database.BeginTransaction())
            {
                try
                {
                    var objReturn1 = _db.TRLabFileUploads.FirstOrDefault(x => x.lfu_id.ToString() == lfu_id);

                    objModel = _mapper.Map <LabFileUploadDataDTO>(objReturn1);

                    trans.Commit();
                }
                catch (Exception ex)
                {
                    // TODO: Handle failure
                    trans.Rollback();
                }
                finally
                {
                    trans.Dispose();
                }
            }


            log.MethodFinish();

            return(objModel);
        }
コード例 #2
0
        public async Task <LabFileUploadDataDTO> UploadFileAsync(IFileListEntry fileEntry, LabFileUploadDataDTO model)
        {
            LabFileUploadDataDTO objReturn = new LabFileUploadDataDTO();


            if (model.lfu_id.Equals(Guid.Empty))
            {
                model.lfu_id = Guid.NewGuid();
                //model.lfu_Path = path;
                model.lfu_AerobicCulture = 0;
                model.lfu_status         = 'N';
                model.lfu_flagdelete     = false;
            }
            else
            {
                model.lfu_status = 'E';
            }

            model.lfu_updatedate = DateTime.Now;
            objReturn            = await _apiHelper.PostDataAsync <LabFileUploadDataDTO>("labfileupload_api/Post_SaveLabFileUploadData", model);



            return(objReturn);
        }
コード例 #3
0
        public async Task <LabFileUploadDataDTO> GetLabFileUploadDataAsync(string lfu_Id)
        {
            LabFileUploadDataDTO LabFileUpload = new LabFileUploadDataDTO();

            LabFileUpload = await _apiHelper.GetDataByIdAsync <LabFileUploadDataDTO>("labfileupload_api/GetLabFileUploadDataById", lfu_Id);

            return(LabFileUpload);
        }
コード例 #4
0
        public async Task <LabFileUploadDataDTO> SaveLabFileUploadDataAsync(LabFileUploadDataDTO model)
        {
            if (model.lfu_id.Equals(Guid.Empty))
            {
                model.lfu_id         = Guid.NewGuid();
                model.lfu_status     = 'N';
                model.lfu_flagdelete = false;
            }



            var LabFile = await _apiHelper.PostDataAsync <LabFileUploadDataDTO>("labfileupload_api/Post_SaveLabFileUploadData", model);

            return(LabFile);
        }
コード例 #5
0
        public LabFileUploadDataDTO SaveLabFileUploadData(LabFileUploadDataDTO model)
        {
            log.MethodStart();

            var currentDateTime            = DateTime.Now;
            LabFileUploadDataDTO objReturn = new LabFileUploadDataDTO();

            using (var trans = _db.Database.BeginTransaction())
            {
                try
                {
                    var objModel = new TRLabFileUpload();

                    if (model.lfu_status == 'N')
                    {
                        objModel = _mapper.Map <TRLabFileUpload>(model);

                        objModel.lfu_createdate = currentDateTime;
                        objModel.lfu_updatedate = currentDateTime;

                        _db.TRLabFileUploads.Add(objModel);
                    }
                    else
                    {
                        objModel                     = _db.TRLabFileUploads.FirstOrDefault(x => x.lfu_id == model.lfu_id);
                        objModel.lfu_status          = model.lfu_status;
                        objModel.lfu_version         = model.lfu_version;
                        objModel.lfu_flagdelete      = model.lfu_flagdelete;
                        objModel.lfu_lab             = model.lfu_lab;
                        objModel.lfu_FileName        = model.lfu_FileName;
                        objModel.lfu_Program         = model.lfu_Program;
                        objModel.lfu_Path            = model.lfu_Path;
                        objModel.lfu_FileType        = model.lfu_FileType;
                        objModel.lfu_TotalRecord     = model.lfu_TotalRecord;
                        objModel.lfu_AerobicCulture  = model.lfu_AerobicCulture;
                        objModel.lfu_ErrorRecord     = model.lfu_ErrorRecord;
                        objModel.lfu_StartDatePeriod = model.lfu_StartDatePeriod;
                        objModel.lfu_EndDatePeriod   = model.lfu_EndDatePeriod;
                        objModel.lfu_approveduser    = model.lfu_approveduser;
                        objModel.lfu_approveddate    = model.lfu_approveddate;
                        objModel.lfu_updateuser      = model.lfu_updateuser;
                        objModel.lfu_updatedate      = currentDateTime;
                    }


                    _db.SaveChanges();

                    trans.Commit();

                    objReturn = _mapper.Map <LabFileUploadDataDTO>(objModel);
                }
                catch (Exception ex)
                {
                    // TODO: Handle failure
                    trans.Rollback();
                }
                finally
                {
                    trans.Dispose();
                }
            }

            return(objReturn);
        }
コード例 #6
0
        public LabFileUploadDataDTO Post_SaveLabFileUploadData([FromBody] LabFileUploadDataDTO model)
        {
            var objReturn = _service.SaveLabFileUploadData(model);

            return(objReturn);
        }