コード例 #1
0
ファイル: WebUtility.cs プロジェクト: lulzzz/simias
		/// <summary>
		/// Get the SmartException Type
		/// </summary>
		/// <param name="e">The SoapException with Detail.</param>
		/// <returns>The Exception Type</returns>
		public static string GetSmartExceptionType(SoapException e)
		{
			// exception type
			string type = e.GetType().Name;

			try
			{
				XmlNode node = e.Detail.SelectSingleNode("OriginalException");

				if (node == null)
				{
					// try inside the <detail> tags
					node = e.Detail.SelectSingleNode("*/OriginalException");
				}

				if (node != null)
				{
					type = node.Attributes.GetNamedItem("type").Value;
					type = type.Substring(type.LastIndexOf(".") + 1);
				}
			}
			catch { }

			return type;
		}
コード例 #2
0
        public string EndPatientCare(string exitDate, int exitReason, string facilityOutTransfer, string dateOfDeath, string careEndingNotes)
        {
            try
            {
                DateTime?emptyDateOfDeath = null;

                PatientCareEndingManager careEndingManager    = new PatientCareEndingManager();
                PatientEnrollmentManager enrollmentManager    = new PatientEnrollmentManager();
                PatientLookupManager     patientLookupManager = new PatientLookupManager();



                patientId            = int.Parse(Session["PatientPK"].ToString());
                patientMasterVisitId = int.Parse(Session["PatientMasterVisitId"].ToString());
                var enrollments = enrollmentManager.GetPatientEnrollmentByPatientId(patientId);
                if (enrollments.Count > 0)
                {
                    patientEnrollmentId = enrollments[0].Id;
                }

                var patient = patientLookupManager.GetPatientDetailSummary(patientId);

                if (patientEnrollmentId > 0)
                {
                    if (!String.IsNullOrWhiteSpace(facilityOutTransfer))
                    {
                        careEndingManager.AddPatientCareEndingTransferOut(patientId, patientMasterVisitId,
                                                                          patientEnrollmentId,
                                                                          exitReason, DateTime.Parse(exitDate), GlobalObject.unescape(facilityOutTransfer),
                                                                          GlobalObject.unescape(careEndingNotes));
                    }
                    else if (String.IsNullOrWhiteSpace(facilityOutTransfer) && String.IsNullOrWhiteSpace(dateOfDeath))
                    {
                        careEndingManager.AddPatientCareEndingOther(patientId, patientMasterVisitId,
                                                                    patientEnrollmentId,
                                                                    exitReason, DateTime.Parse(exitDate), GlobalObject.unescape(careEndingNotes));
                    }
                    else
                    {
                        careEndingManager.AddPatientCareEndingDeath(patientId, patientMasterVisitId, patientEnrollmentId,
                                                                    exitReason, DateTime.Parse(exitDate), (string.IsNullOrEmpty(dateOfDeath))?DateTime.Parse(dateOfDeath):emptyDateOfDeath, GlobalObject.unescape(careEndingNotes));
                    }



                    PatientEntityEnrollment entityEnrollment =
                        enrollmentManager.GetPatientEntityEnrollment(patientEnrollmentId);
                    entityEnrollment.CareEnded = true;
                    enrollmentManager.updatePatientEnrollment(entityEnrollment);
                    Session["EncounterStatusId"] = 0;
                    Session["PatientEditId"]     = 0;
                    Session["PatientPK"]         = 0;
                    Msg = "Patient has been successfully care ended";
                    MessageEventArgs args = new MessageEventArgs()
                    {
                        PatientId     = patientId,
                        EntityId      = patientEnrollmentId,
                        MessageType   = MessageType.UpdatedClientInformation,
                        EventOccurred = "Patient CareEnded Identifier = ",
                        FacilityId    = patient.FacilityId
                    };
                    Publisher.RaiseEventAsync(this, args).ConfigureAwait(false);
                }
                else
                {
                    SoapException b = new SoapException();
                    SoapException e = (SoapException)Activator.CreateInstance(b.GetType(), "Patient is already care ended", b);
                    Msg = e.Message;
                }
            }
            catch (SoapException e)
            {
                Msg = e.Message;
            }
            return(Msg);
        }