Beispiel #1
0
 //как искать?
 static public TestCancellation BuildCancellationFromDataBaseData(string idReferral)
 {
     using (NpgsqlConnection connection = Global.GetSqlConnection())
     {
         string        findPatient = "SELECT cancellation_date, cancellation_reason_comment, id_cancellation_code, id_cancellation_reason FROM public.referral WHERE id_referral = '" + idReferral + "' ORDER BY id_referral DESC LIMIT 1";
         NpgsqlCommand person      = new NpgsqlCommand(findPatient, connection);
         using (NpgsqlDataReader personFromDataBase = person.ExecuteReader())
         {
             CancellationData p = new CancellationData();
             while (personFromDataBase.Read())
             {
                 if (personFromDataBase["cancellation_date"] != DBNull.Value)
                 {
                     p.Date = Convert.ToDateTime(personFromDataBase["cancellation_date"]);
                 }
                 if (personFromDataBase["cancellation_reason_comment"] != DBNull.Value)
                 {
                     p.ReasonComment = Convert.ToString(personFromDataBase["cancellation_reason_comment"]);
                 }
                 TestCancellation pers = new TestCancellation(p);
                 if (personFromDataBase["id_cancellation_code"] != DBNull.Value)
                 {
                     pers.source = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(personFromDataBase["id_cancellation_code"]));
                 }
                 if (personFromDataBase["id_cancellation_reason"] != DBNull.Value)
                 {
                     pers.source = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(personFromDataBase["id_cancellation_reason"]));
                 }
                 return(pers);
             }
         }
     }
     return(null);
 }
Beispiel #2
0
 //как искать?
 public static TestCancellation BuildCancellationFromDataBaseData(string idReferral)
 {
     using (NpgsqlConnection connection = Global.GetSqlConnection())
     {
         string findPatient = "SELECT cancellation_date, cancellation_reason_comment, id_cancellation_code, id_cancellation_reason FROM public.referral WHERE id_referral = '" + idReferral + "' ORDER BY id_referral DESC LIMIT 1";
         NpgsqlCommand person = new NpgsqlCommand(findPatient, connection);
         using (NpgsqlDataReader personFromDataBase = person.ExecuteReader())
         {
             CancellationData p = new CancellationData();
             while (personFromDataBase.Read())
             {
                 if (personFromDataBase["cancellation_date"] != DBNull.Value)
                     p.Date = Convert.ToDateTime(personFromDataBase["cancellation_date"]);
                 if (personFromDataBase["cancellation_reason_comment"] != DBNull.Value)
                     p.ReasonComment = Convert.ToString(personFromDataBase["cancellation_reason_comment"]);
                 TestCancellation pers = new TestCancellation(p);
                 if (personFromDataBase["id_cancellation_code"] != DBNull.Value)
                     pers.source = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(personFromDataBase["id_cancellation_code"]));
                 if (personFromDataBase["id_cancellation_reason"] != DBNull.Value)
                     pers.source = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(personFromDataBase["id_cancellation_reason"]));
                 return pers;
             }
         }
     }
     return null;
 }
Beispiel #3
0
 public TestEventsInfo(EventsInfo r)
 {
     info         = r ?? new EventsInfo();
     cancellation = new TestCancellation(info.Cancellation);
     source       = new TestEventSource(info.Source);
     target       = new TestEventTarget(info.Target);
 }
Beispiel #4
0
 public TestEventsInfo(EventsInfo r)
 {
     info = r ?? new EventsInfo();
     cancellation = new TestCancellation(info.Cancellation);
     source = new TestEventSource(info.Source);
     target = new TestEventTarget(info.Target);
 }
Beispiel #5
0
        public override bool Equals(Object obj)
        {
            TestCancellation p = obj as TestCancellation;

            if ((object)p == null)
            {
                return(false);
            }
            if (this.cancellation == p.cancellation)
            {
                return(true);
            }
            if ((this.cancellation == null) || (p.cancellation == null))
            {
                return(false);
            }
            if ((this.cancellation.Date == p.cancellation.Date) &&
                (this.cancellation.ReasonComment == p.cancellation.ReasonComment) &&
                (Global.Equals(this.reason, p.reason)) &&
                (Global.Equals(this.source, p.source)))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestCacellation");
                return(false);
            }
        }
Beispiel #6
0
 internal void UpdateTestEventsInfo(EventsInfo eventsInfo)
 {
     if (eventsInfo.Cancellation != null)
         cancellation = new TestCancellation(eventsInfo.Cancellation);
     if (eventsInfo.Source != null)
         source.UpdateTestEventSource(eventsInfo.Source);
     if (eventsInfo.Target != null)
         target.UpdateTestEventTarget(eventsInfo.Target);
 }
Beispiel #7
0
        static public TestEventsInfo BuildAdditionalFromDataBaseData(string idReferral)
        {
            TestEventsInfo p = new TestEventsInfo();

            p.cancellation = TestCancellation.BuildCancellationFromDataBaseData(idReferral);
            p.source       = TestEventSource.BuildSourceFromDataBaseData(idReferral);
            p.target       = TestEventTarget.BuildTargetFromDataBaseData(idReferral);
            return(p);
        }
Beispiel #8
0
 public TestEventsInfo(EventsInfo r)
 {
     if (r != null)
         info = r;
     else
         info = new EventsInfo();
     cancellation = new TestCancellation(info.Cancellation);
     source = new TestEventSource(info.Source);
     target = new TestEventTarget(info.Target);
 }
Beispiel #9
0
 public TestReferralInfo(ReferralInfo r)
 {
     info = r ?? new ReferralInfo();
     cancellation = new TestCancellation(info.Cancellation);
     if (info.MqReferralStatus != null)
         mqReferralStatus = new TestCoding(info.MqReferralStatus);
     if (info.ProfileMedService != null)
         profileMedService = new TestCoding(info.ProfileMedService);
     if (info.ReferralType != null)
         referralType = new TestCoding(info.ReferralType);
 }
Beispiel #10
0
 public TestEventsInfo(EventsInfo r)
 {
     if (r != null)
     {
         info = r;
     }
     else
     {
         info = new EventsInfo();
     }
     cancellation = new TestCancellation(info.Cancellation);
     source       = new TestEventSource(info.Source);
     target       = new TestEventTarget(info.Target);
 }
Beispiel #11
0
 internal void UpdateTestEventsInfo(EventsInfo eventsInfo)
 {
     if (eventsInfo.Cancellation != null)
     {
         cancellation = new TestCancellation(eventsInfo.Cancellation);
     }
     if (eventsInfo.Source != null)
     {
         source.UpdateTestEventSource(eventsInfo.Source);
     }
     if (eventsInfo.Target != null)
     {
         target.UpdateTestEventTarget(eventsInfo.Target);
     }
 }
Beispiel #12
0
 public TestReferralInfo(ReferralInfo r)
 {
     info         = r ?? new ReferralInfo();
     cancellation = new TestCancellation(info.Cancellation);
     if (info.MqReferralStatus != null)
     {
         mqReferralStatus = new TestCoding(info.MqReferralStatus);
     }
     if (info.ProfileMedService != null)
     {
         profileMedService = new TestCoding(info.ProfileMedService);
     }
     if (info.ReferralType != null)
     {
         referralType = new TestCoding(info.ReferralType);
     }
 }
Beispiel #13
0
 private void FindMismatch(TestCancellation r)
 {
     if (this.cancellation.Date != r.cancellation.Date)
     {
         Global.errors3.Add("Несовпадение Date TestCacellation");
     }
     if (this.cancellation.ReasonComment != r.cancellation.ReasonComment)
     {
         Global.errors3.Add("Несовпадение Date TestCacellation");
     }
     if (Global.GetLength(this.reason) != Global.GetLength(r.reason))
     {
         Global.errors3.Add("Несовпадение длинны reason TestCacellation");
     }
     if (Global.GetLength(this.source) != Global.GetLength(r.source))
     {
         Global.errors3.Add("Несовпадение длинны source TestCacellation");
     }
 }
Beispiel #14
0
 public void UpdateTestReferralInfo(ReferralInfo r)
 {
     if (r != null)
     {
         if (r.Comment != null)
         {
             this.info.Comment = r.Comment;
         }
         if (r.Date != null)
         {
             this.info.Date = r.Date;
         }
         if (r.IdMq != null)
         {
             this.info.IdMq = r.IdMq;
         }
         if (r.Priority != null)
         {
             this.info.Priority = r.Priority;
         }
         if (r.Reason != null)
         {
             this.info.Reason = r.Reason;
         }
         if (r.Cancellation != null)
         {
             this.cancellation = new TestCancellation(r.Cancellation);
         }
         if (r.MqReferralStatus != null)
         {
             this.mqReferralStatus = new TestCoding(r.MqReferralStatus);
         }
         if (r.ProfileMedService != null)
         {
             this.mqReferralStatus = new TestCoding(r.ProfileMedService);
         }
         if (r.ReferralType != null)
         {
             this.referralType = new TestCoding(r.ReferralType);
         }
     }
 }
Beispiel #15
0
 public void UpdateTestReferralInfo(ReferralInfo r)
 {
     if (r != null)
     {
         if (r.Comment != null)
             this.info.Comment = r.Comment;
         if (r.Date != null)
             this.info.Date = r.Date;
         if (r.IdMq != null)
             this.info.IdMq = r.IdMq;
         if (r.Priority != null)
             this.info.Priority = r.Priority;
         if (r.Reason != null)
             this.info.Reason = r.Reason;
         if (r.Cancellation != null)
             this.cancellation = new TestCancellation(r.Cancellation);
         if (r.MqReferralStatus != null)
             this.mqReferralStatus = new TestCoding(r.MqReferralStatus);
         if (r.ProfileMedService != null)
             this.mqReferralStatus = new TestCoding(r.ProfileMedService);
         if (r.ReferralType != null)
             this.referralType = new TestCoding(r.ReferralType);
     }
 }
Beispiel #16
0
 private void FindMismatch(TestCancellation r)
 {
     if (this.cancellation.Date != r.cancellation.Date)
         Global.errors3.Add("Несовпадение Date TestCacellation");
     if (this.cancellation.ReasonComment != r.cancellation.ReasonComment)
         Global.errors3.Add("Несовпадение Date TestCacellation");
     if (Global.GetLength(this.reason) != Global.GetLength(r.reason))
         Global.errors3.Add("Несовпадение длинны reason TestCacellation");
     if (Global.GetLength(this.source) != Global.GetLength(r.source))
         Global.errors3.Add("Несовпадение длинны source TestCacellation");
 }
Beispiel #17
0
 static public TestReferralInfo BuildPersonFromDataBaseData(string idReferral)
 {
     using (NpgsqlConnection connection = Global.GetSqlConnection())
     {
         string findPatient =
             "SELECT comment, priority_comment, referral_paper_date, id_referral_type, id_profile_med_service, referral_reason FROM public.referral WHERE id_referral = '" +
             idReferral +
             "' ORDER BY public.referral.id_referral DESC LIMIT 1";
         NpgsqlCommand person = new NpgsqlCommand(findPatient, connection);
         using (NpgsqlDataReader personFromDataBase = person.ExecuteReader())
         {
             ReferralInfo p = new ReferralInfo();
             while (personFromDataBase.Read())
             {
                 p.IdMq = idReferral;
                 //что делать с mqReferralStatus?
                 if (personFromDataBase["comment"] != DBNull.Value)
                 {
                     p.Comment = Convert.ToString(personFromDataBase["comment"]);
                 }
                 if (personFromDataBase["referral_paper_date"] != DBNull.Value)
                 {
                     p.Date = Convert.ToDateTime(personFromDataBase["referral_paper_date"]);
                 }
                 if (personFromDataBase["priority_comment"] != DBNull.Value)
                 {
                     p.Priority = Convert.ToString(personFromDataBase["priority_comment"]);
                 }
                 if (personFromDataBase["referral_reason"] != DBNull.Value)
                 {
                     p.Reason = Convert.ToString(personFromDataBase["referral_reason"]);
                 }
                 TestReferralInfo pers = new TestReferralInfo(p);
                 pers.cancellation = TestCancellation.BuildCancellationFromDataBaseData(idReferral);
                 if (personFromDataBase["id_referral_type"] != DBNull.Value)
                 {
                     pers.referralType =
                         TestCoding.BuildCodingFromDataBaseData(
                             Convert.ToString(personFromDataBase["id_referral_type"]));
                 }
                 if (personFromDataBase["id_profile_med_service"] != DBNull.Value)
                 {
                     pers.profileMedService =
                         TestCoding.BuildCodingFromDataBaseData(
                             Convert.ToString(personFromDataBase["id_profile_med_service"]));
                 }
                 using (NpgsqlConnection connection2 = Global.GetSqlConnection())
                 {
                     string findIdMq =
                         "SELECT id_mq_referral_status FROM public.referral, public.referral_status WHERE public.referral.id_referral = '" + idReferral + "' AND public.referral.id_referral = public.referral_status.id_referral ORDER BY public.referral_status.id_referral_status DESC LIMIT 1";
                     NpgsqlCommand com = new NpgsqlCommand(findIdMq, connection2);
                     using (NpgsqlDataReader reader = com.ExecuteReader())
                     {
                         while (reader.Read())
                         {
                             if (reader["id_mq_referral_status"] != DBNull.Value)
                             {
                                 pers.mqReferralStatus =
                                     TestCoding.BuildCodingFromDataBaseData(
                                         Convert.ToString(reader["id_mq_referral_status"]));
                             }
                         }
                     }
                 }
                 return(pers);
             }
         }
     }
     return(null);
 }