Esempio n. 1
0
        private void DrawReportSummary(PagingSetup pagingSetup, PdfDocument document,
                                       SampleSpecInfo sampleSpecInfo)
        {
            ReportUtils.IncreaseLineHeight(pagingSetup, document, pagingSetup.RegularLineHeight);

            ReportUtils.DrawParagraphLine(pagingSetup, document, PagingSetup.CreateDefaultPDFRegularFont(),
                                          XParagraphAlignment.Left, pagingSetup.RegularLineHeight,
                                          string.Format("Mã bệnh phẩm: {0}", sampleSpecInfo.SampleSpecId));

            ReportUtils.DrawParagraphLine(pagingSetup, document, PagingSetup.CreateDefaultPDFRegularFont(),
                                          XParagraphAlignment.Left, pagingSetup.RegularLineHeight,
                                          string.Format("Tên bệnh nhân: {0}", sampleSpecInfo.PatientName));

            ReportUtils.DrawParagraphLine(pagingSetup, document, PagingSetup.CreateDefaultPDFRegularFont(),
                                          XParagraphAlignment.Left, pagingSetup.RegularLineHeight,
                                          string.Format("Giới tính: {0}", sampleSpecInfo.SexDisplay));

            ReportUtils.DrawParagraphLine(pagingSetup, document, PagingSetup.CreateDefaultPDFRegularFont(),
                                          XParagraphAlignment.Left, pagingSetup.RegularLineHeight,
                                          string.Format("Năm sinh: {0}", sampleSpecInfo.YearOfBirth));

            ReportUtils.DrawParagraphLine(pagingSetup, document, PagingSetup.CreateDefaultPDFRegularFont(),
                                          XParagraphAlignment.Left, pagingSetup.RegularLineHeight,
                                          string.Format("Nguồn: {0}", sampleSpecInfo.LocationId));

            ReportUtils.DrawParagraphLine(pagingSetup, document, PagingSetup.CreateDefaultPDFRegularFont(),
                                          XParagraphAlignment.Left, pagingSetup.RegularLineHeight,
                                          string.Format("Thời gian nhập: {0}", sampleSpecInfo.DateInputDisplay));

            ReportUtils.DrawParagraphLine(pagingSetup, document, PagingSetup.CreateDefaultPDFRegularFont(),
                                          XParagraphAlignment.Left, pagingSetup.RegularLineHeight,
                                          string.Format("Danh sách nhập"));
        }
Esempio n. 2
0
        public JsonResult Import(SampleSpecInfo sampleSpec)
        {
            CommonModelResult model = new CommonModelResult();

            try
            {
                sampleSpec.UserInput = SessionUtils.LoginUserInfo.UserId;
                sampleSpec.DateInput = DateTime.Now;
                _tubeSampleService.ImportSample(sampleSpec);
            }
            catch (BusinessException exception)
            {
                _logger.DebugFormat("BusinessException: {0}-{1}", exception.ErrorCode, exception.Message);
                model.ErrorCode        = exception.ErrorCode;
                model.ErrorDescription = exception.Message;
            }
            catch (Exception exception)
            {
                _logger.Error(string.Format("Iternal error {0}", exception));
                model.ErrorCode        = ErrorCode.InternalErrorException;
                model.ErrorDescription = CommonUtils.GetEnumDescription(ErrorCode.InternalErrorException);
            }

            return(Json(model));
        }
        public void ImportSample(SampleSpecInfo sampleSpec)
        {
            var command = new DatabaseCommand <SampleSpecInfo, bool>()
            {
                CallingInfo = sampleSpec,
                ReturnValue = false
            };

            this.ProxyCalling(ImportSampleProxy, command);
        }
        private void GetSampleSpecProxy(SpecLabEntities _entities,
                                        DatabaseCommand <string, SampleSpecInfo> paramCommand)
        {
            var sampleDbItem = (from sample in _entities.SampleSpecs
                                where sample.SampleSpecId.Equals(
                                    paramCommand.CallingInfo, StringComparison.OrdinalIgnoreCase)
                                select sample).FirstOrDefault();

            if (sampleDbItem == null)
            {
                throw new BusinessException(ErrorCode.SampleSpecIdNotExists);
            }

            SampleSpecInfo info = new SampleSpecInfo()
            {
                LocationId   = sampleDbItem.Source,
                PatientName  = sampleDbItem.PatientName,
                SampleSpecId = sampleDbItem.SampleSpecId,
                YearOfBirth  = sampleDbItem.Age,
                Sex          = (SampleSex)sampleDbItem.Sex[0],
                UserInput    = sampleDbItem.UserInput,
                DateInput    = sampleDbItem.DateInput
            };

            var tubeListDbItem = (from tube in _entities.TubeSamples
                                  where tube.SampleSpecId.Equals(
                                      paramCommand.CallingInfo, StringComparison.OrdinalIgnoreCase)
                                  select new TubeSampleSpecInfo()
            {
                Volume = tube.Volume,
                LocationNum = tube.LocationNum,
                SampleSpecId = tube.SampleSpecId,
                StorageId = tube.StorageId,
                TubeId = tube.TubeId,
                Status = (TubeSampleStatus)tube.Status,
                DateInput = sampleDbItem.DateInput,
                Type = (TubeSampleType)tube.TubeType,
                SampleType = (SampleType)tube.SampleType,
            }).ToList();

            info.TubeSampleSpecs.AddRange(tubeListDbItem);

            paramCommand.ReturnValue = info;
        }