public void IsInvalid_NoDocument()
 {
     var item = new PrescriptionDocumentDto()
     {
         Title = Guid.NewGuid().ToString(),
     };
     Assert.IsFalse(item.IsValid());
 }
 public void IsValid()
 {
     var item = new PrescriptionDocumentDto()
     {
         Title = Guid.NewGuid().ToString(),
     };
     item.Prescriptions.Add(new PrescriptionDto());
     Assert.IsTrue(item.IsValid());
 }
 public void IsInvalid_EmptyName()
 {
     var item = new PrescriptionDocumentDto()
     {
         Title = string.Empty,
     };
     item.Prescriptions.Add(new PrescriptionDto());
     Assert.IsFalse(item.IsValid());
 }
Пример #4
0
        /// <summary>
        /// Creates the specified prescription document for the specified patient.
        /// </summary>
        /// <param name="document">The document.</param>
        /// <param name="patient">The patient.</param>
        public void Create(PrescriptionDocumentDto document, LightPatientDto patient)
        {
            var entity = this.Session.Get<Patient>(patient.Id);
            var documentEntity = Mapper.Map<PrescriptionDocumentDto, PrescriptionDocument>(document);

            ReloadTagsFor(documentEntity);

            entity.PrescriptionDocuments.Add(documentEntity);
            this.Session.SaveOrUpdate(entity);
        }
        private void Save()
        {
            try
            {
                if (this.HasEmptyPrescriptions())
                {
                    var dr = ViewService.MessageBox.Question(Messages.Msg_EmptyNotesForPrescriptions);
                    if (!dr) { return; }
                }

                var document = new PrescriptionDocumentDto() { CreationDate = this.CreationDate };
                document.Prescriptions.AddRange(this.Prescriptions);

                this.component.Create(document, PluginContext.Host.SelectedPatient);

                this.ResetPage();
            }
            catch (Exception ex) { this.Handle.Error(ex); }
        }
Пример #6
0
 /// <summary>
 /// Creates the specified prescription document for the specified patient.
 /// </summary>
 /// <param name="document">The document.</param>
 /// <param name="patient">The patient.</param>
 public void Create(PrescriptionDocumentDto document, LightPatientDto patient)
 {
     new Creator(this.Session).Create(document, patient);
 }
Пример #7
0
 /// <summary>
 /// Removes the specified item but doesn't touch the drugs liked to it.
 /// </summary>
 /// <param name="item">The item.</param>
 public void Remove(PrescriptionDocumentDto item)
 {
     new Remover(this.Session).Remove(item);
 }