public TestCaseBase(string guid, CaseBase cb) { GUID = guid.ToLower(); if (cb != null) { caseBase = cb; if (caseBase.OpenDate == null) { caseBase.OpenDate = DateTime.MinValue; } if (caseBase.CloseDate == null) { caseBase.CloseDate = DateTime.MinValue; } } if (cb.Author != null) { autor = new TestParticipant(cb.Author, cb.IdLpu); if (autor.doctor.doctor.IdLpu == null) { autor.doctor.doctor.IdLpu = cb.IdLpu; } } if (cb.Authenticator != null) { authenticator = new TestParticipant(cb.Authenticator, cb.IdLpu); if (authenticator.doctor.doctor.IdLpu == null) { authenticator.doctor.doctor.IdLpu = cb.IdLpu; } } if (cb.LegalAuthenticator != null) { legalAuthenticator = new TestParticipant(cb.LegalAuthenticator, cb.IdLpu); if (legalAuthenticator.doctor.doctor.IdLpu == null) { legalAuthenticator.doctor.doctor.IdLpu = cb.IdLpu; } } if (cb.DoctorInCharge != null) { doctorInCharge = new TestDoctor(cb.DoctorInCharge, cb.IdLpu); if (doctorInCharge.doctor.IdLpu == null) { doctorInCharge.doctor.IdLpu = cb.IdLpu; } } if (cb.Guardian != null) { guardian = new TestGuardian(cb.Guardian); } if (cb.IdPatientMis != null) { patient = TestPatient.BuildPatientFromDataBaseData(guid, cb.IdLpu, cb.IdPatientMis); } }
public TestCaseBase(string guid, CaseBase cb) { GUID = guid.ToLower(); if (cb != null) { caseBase = cb; if (caseBase.OpenDate == null) caseBase.OpenDate = DateTime.MinValue; if (caseBase.CloseDate == null) caseBase.CloseDate = DateTime.MinValue; } if (cb.Author != null) { autor = new TestParticipant(cb.Author, cb.IdLpu); if (autor.doctor.doctor.IdLpu == null) autor.doctor.doctor.IdLpu = cb.IdLpu; } if (cb.Authenticator != null) { authenticator = new TestParticipant(cb.Authenticator, cb.IdLpu); if (authenticator.doctor.doctor.IdLpu == null) authenticator.doctor.doctor.IdLpu = cb.IdLpu; } if (cb.LegalAuthenticator != null) { legalAuthenticator = new TestParticipant(cb.LegalAuthenticator, cb.IdLpu); if (legalAuthenticator.doctor.doctor.IdLpu == null) legalAuthenticator.doctor.doctor.IdLpu = cb.IdLpu; } if (cb.DoctorInCharge != null) { doctorInCharge = new TestDoctor(cb.DoctorInCharge, cb.IdLpu); if (doctorInCharge.doctor.IdLpu == null) doctorInCharge.doctor.IdLpu = cb.IdLpu; } if (cb.Guardian != null) guardian = new TestGuardian(cb.Guardian); if (cb.IdPatientMis != null) patient = TestPatient.BuildPatientFromDataBaseData(guid, cb.IdLpu, cb.IdPatientMis); }
static public TestCaseBase BuildBaseCaseFromDataBaseData(string guid, string idlpu, string mis, string idPerson) { //idPerson = TestPerson.GetPersonId(guid, idlpu, idPerson); string caseId = GetCaseId(guid, idlpu, mis, idPerson); if (caseId != null) { using (SqlConnection connection = Global.GetSqlConnection()) { string IdDoctor = ""; string IdGuardian = ""; int idCaseT = 0; bool isCanceld = false; CaseBase p = new CaseBase(); string findCase = "SELECT TOP(1) * FROM \"Case\" WHERE IdCase = '" + caseId + "'"; SqlCommand caseCommand = new SqlCommand(findCase, connection); using (SqlDataReader caseReader = caseCommand.ExecuteReader()) { while (caseReader.Read()) { if (caseReader["CloseDate"].ToString() != "") { p.CloseDate = Convert.ToDateTime(caseReader["CloseDate"]); } else { p.CloseDate = DateTime.MinValue; } if (caseReader["Comment"].ToString() != "") { p.Comment = Convert.ToString(caseReader["Comment"]); } else { p.Comment = null; } if (caseReader["HistoryNumber"].ToString() != "") { p.HistoryNumber = Convert.ToString(caseReader["HistoryNumber"]); } else { p.HistoryNumber = null; } if (caseReader["IdCaseAidType"].ToString() != "") { p.IdCaseAidType = Convert.ToByte(caseReader["IdCaseAidType"]); } else { p.IdCaseAidType = 0; } if (caseReader["IdCaseMis"].ToString() != "") { p.IdCaseMis = Convert.ToString(caseReader["IdCaseMis"]); } else { p.IdCaseMis = null; } if (caseReader["IdCaseResult"].ToString() != "") { p.IdCaseResult = Convert.ToByte(caseReader["IdCaseResult"]); } else { p.IdCaseResult = 0; } if (caseReader["IdCasePaymentType"].ToString() != "") { p.IdPaymentType = Convert.ToByte(caseReader["IdCasePaymentType"]); } else { p.IdPaymentType = 0; } if (caseReader["OpenDate"].ToString() != "") { p.OpenDate = Convert.ToDateTime(caseReader["OpenDate"]); } else { p.OpenDate = DateTime.MinValue; } if (caseReader["IDDoctor"].ToString() != "") { IdDoctor = Convert.ToString(caseReader["IDDoctor"]); } if (caseReader["IdGuardian"].ToString() != "") { IdGuardian = Convert.ToString(caseReader["IDGuardian"]); } if (caseReader["IdCaseType"].ToString() != "") { idCaseT = Convert.ToInt32(caseReader["IdCaseType"]); } isCanceld = Convert.ToBoolean(caseReader["IsCancelled"]); } } findCase = "SELECT * FROM mm_AccessRole2Case WHERE IdCase = '" + caseId + "'"; caseCommand = new SqlCommand(findCase, connection); using (SqlDataReader caseReader = caseCommand.ExecuteReader()) { while (caseReader.Read()) { switch (caseReader["IdAccessRole"].ToString()) { case "1": p.Confidentiality = Convert.ToByte(caseReader["IdPrivacyLevel"]); break; case "2": p.DoctorConfidentiality = Convert.ToByte(caseReader["IdPrivacyLevel"]); break; case "3": p.CuratorConfidentiality = Convert.ToByte(caseReader["IdPrivacyLevel"]); break; } } } p.IdCaseMis = mis; p.IdLpu = idlpu; TestCaseBase cb = new TestCaseBase(guid, p); cb.idCaseType = idCaseT; cb.isCanceld = isCanceld; if (IdDoctor != "") { cb.doctorInCharge = TestDoctor.BuildTestDoctorFromDataBase(IdDoctor); } else { cb.doctorInCharge = null; } if (IdGuardian != "") { cb.guardian = TestGuardian.BuildTestGuardianFromDataBase(IdGuardian, idPerson); } else { cb.guardian = null; } if (idPerson != "") { cb.patient = TestPatient.BuildPatientFromDataBaseData(patientId: idPerson); } else { cb.patient = null; } findCase = "SELECT * FROM mm_Author2Case WHERE IdCase = '" + caseId + "'"; caseCommand = new SqlCommand(findCase, connection); using (SqlDataReader caseReader = caseCommand.ExecuteReader()) { while (caseReader.Read()) { switch (caseReader["IdAuthorshipType"].ToString()) { case "1": cb.autor = TestParticipant.BuildTestParticipantFromDataBase(caseId, Convert.ToString(caseReader["IdDoctor"]), 1); break; case "3": cb.authenticator = TestParticipant.BuildTestParticipantFromDataBase(caseId, Convert.ToString(caseReader["IdDoctor"]), 3); break; case "4": cb.legalAuthenticator = TestParticipant.BuildTestParticipantFromDataBase(caseId, Convert.ToString(caseReader["IdDoctor"]), 4); break; } } } return(cb); } } return(null); }
//private EMKServise.StepBase[] ConvertSteps(StepBase[] c) //{ // StepAmb[] ca = c as StepAmb[]; // if ((object)ca != null) // { // List<EMKServise.StepAmb> l = new List<EMKServise.StepAmb>(); // foreach (StepAmb i in ca) // { // EMKServise.StepAmb esa = new EMKServise.StepAmb(); // if (i.Comment != "") // esa.Comment = i.Comment; // if (i.DateEnd != DateTime.MinValue) // esa.DateEnd = i.DateEnd; // if (i.DateStart != DateTime.MinValue) // esa.DateStart = i.DateStart; // esa.Doctor = ConvertMedicalStaff(i.Doctor); // esa.IdPaymentType = i.IdPaymentType; // if (i.IdStepMis != "") // esa.IdStepMis = i.IdStepMis; // esa.IdVisitPlace = i.IdVisitPlace; // esa.IdVisitPurpose = i.IdVisitPurpose; // esa.MedRecords = ConvertMedRecords(i.MedRecords); // l.Add(esa); // } // return l.ToArray(); // } // StepStat[] cs = c as StepStat[]; // if ((object)cs != null) // { // List<EMKServise.StepStat> l = new List<EMKServise.StepStat>(); // foreach (StepStat i in cs) // { // EMKServise.StepStat esa = new EMKServise.StepStat(); // if (i.BedNumber != "") // esa.BedNumber = i.BedNumber; // esa.BedProfile = i.BedProfile; // if (i.Comment != "") // esa.Comment = i.Comment; // if (i.DateEnd != DateTime.MinValue) // esa.DateEnd = i.DateEnd; // if (i.DateStart != DateTime.MinValue) // esa.DateStart = i.DateStart; // esa.DaySpend = i.DaySpend; // esa.Doctor = ConvertMedicalStaff(i.Doctor); // if (i.HospitalDepartmentName != "") // esa.HospitalDepartmentName = i.HospitalDepartmentName; // if (i.IdHospitalDepartment != "") // esa.IdHospitalDepartment = i.IdHospitalDepartment; // esa.IdPaymentType = i.IdPaymentType; // esa.IdRegimen = i.IdRegimen; // if (i.IdStepMis != "") // esa.IdStepMis = i.IdStepMis; // esa.MedRecords = ConvertMedRecords(i.MedRecords); // l.Add(esa); // } // return l.ToArray(); // } // return null; //} private EMKServise.CaseBase ConvertCase(CaseBase c) { CaseAmb ca = c as CaseAmb; if ((object)ca != null) { EMKServise.CaseAmb eca = new EMKServise.CaseAmb(); eca.Authenticator = ConvertParticipant(ca.Authenticator); eca.Author = ConvertParticipant(ca.Author); if (ca.CloseDate != DateTime.MinValue) eca.CloseDate = ca.CloseDate; if (ca.Comment != "") eca.Comment = ca.Comment; eca.Confidentiality = ca.Confidentiality; eca.CuratorConfidentiality = ca.CuratorConfidentiality; eca.DoctorConfidentiality = ca.DoctorConfidentiality; eca.DoctorInCharge = ConvertMedicalStaff(ca.DoctorInCharge); eca.Guardian = ConvertGuardian(ca.Guardian); if (ca.HistoryNumber != "") eca.HistoryNumber = ca.HistoryNumber; eca.IdAmbResult = ca.IdAmbResult; eca.IdAmbResult = ca.IdAmbResult; eca.IdCaseAidType = ca.IdCaseAidType; if (ca.IdCaseMis != "") eca.IdCaseMis = ca.IdCaseMis; eca.IdCasePurpose = ca.IdCasePurpose; eca.IdCaseResult = ca.IdCaseResult; eca.IdCaseType = ca.IdCaseType; if (ca.IdLpu != "") eca.IdLpu = ca.IdLpu; if (ca.IdPatientMis != "") eca.IdPatientMis = ca.IdPatientMis; eca.IdPaymentType = ca.IdPaymentType; eca.IsActive = ca.IsActive; eca.LegalAuthenticator = ConvertParticipant(ca.LegalAuthenticator); eca.MedRecords = ConvertMedRecords(ca.MedRecords); if (ca.OpenDate != DateTime.MinValue) eca.OpenDate = ca.OpenDate; eca.Steps = ConvertAmbSteps(ca.Steps); return eca; } CaseStat cs = c as CaseStat; if ((object)cs != null) { EMKServise.CaseStat eca = new EMKServise.CaseStat(); eca.AIDSMark = cs.AIDSMark; eca.Authenticator = ConvertParticipant(cs.Authenticator); eca.Author = ConvertParticipant(cs.Author); if (cs.CloseDate != DateTime.MinValue) eca.CloseDate = cs.CloseDate; if (cs.Comment != "") eca.Comment = cs.Comment; eca.Confidentiality = cs.Confidentiality; eca.CuratorConfidentiality = cs.CuratorConfidentiality; if (cs.DeliveryCode != "") eca.DeliveryCode = cs.DeliveryCode; eca.DoctorConfidentiality = cs.DoctorConfidentiality; eca.DoctorInCharge = ConvertMedicalStaff(cs.DoctorInCharge); eca.Guardian = ConvertGuardian(cs.Guardian); if (cs.HistoryNumber != "") eca.HistoryNumber = cs.HistoryNumber; eca.HospitalizationOrder = cs.HospitalizationOrder; eca.HospResult = cs.HospResult; eca.IdCaseAidType = cs.IdCaseAidType; if (cs.IdCaseMis != "") eca.IdCaseMis = cs.IdCaseMis; //eca.IdCaseResult = cs.IdCasePurpose; eca.IdCaseResult = cs.IdCaseResult; eca.IdHospChannel = cs.IdHospChannel; eca.IdIntoxicationType = cs.IdIntoxicationType; if (cs.IdLpu != "") eca.IdLpu = cs.IdLpu; eca.IdPatientConditionOnAdmission = cs.IdPatientConditionOnAdmission; if (cs.IdPatientMis != "") eca.IdPatientMis = cs.IdPatientMis; eca.IdPaymentType = cs.IdPaymentType; eca.IdRepetition = cs.IdRepetition; eca.IdTransportIntern = cs.IdTransportIntern; eca.IdTypeFromDiseaseStart = cs.IdTypeFromDiseaseStart; eca.LegalAuthenticator = ConvertParticipant(cs.LegalAuthenticator); eca.MedRecords = ConvertMedRecords(cs.MedRecords); if (cs.OpenDate != DateTime.MinValue) eca.OpenDate = cs.OpenDate; eca.PrehospitalDefects = cs.PrehospitalDefects.ToList<byte>(); eca.RW1Mark = cs.RW1Mark; eca.Steps = ConvertStatSteps(cs.Steps); return eca; } return null; }
private void CaseWork(string guid, CaseBase c, string method) { try { CaseAmb ca = c as CaseAmb; if ((object)ca != null) { TestAmbCase example = null; switch (method) { case "AddCase": client.AddCase(guid, ca); example = new TestAmbCase(guid, ca); break; case "CreateCase": client.CreateCase(guid, ca); example = new TestAmbCase(guid, ca); break; case "CloseCase": string patientId = TestPerson.GetPersonId(guid, ca.IdLpu, ca.IdPatientMis); example = TestAmbCase.BuildAmbCaseFromDataBaseData(guid, ca.IdLpu, ca.IdCaseMis, patientId); client.CloseCase(guid, ca); example.ChangeUpdateAmbCase(guid, ca); break; case "UpdateCase": client.UpdateCase(guid, ca); example = new TestAmbCase(guid, ca); break; } if (!example.CheckCaseInDataBase()) { Global.errors1.AddRange(Global.errors2); Global.errors1.Add("Несовпадение"); } } CaseStat cs = c as CaseStat; if ((object)cs != null) { TestStatCase example = null; switch (method) { case "AddCase": client.AddCase(guid, cs); example = new TestStatCase(guid, cs); break; case "CreateCase": client.CreateCase(guid, cs); example = new TestStatCase(guid, cs); break; case "CloseCase": string patientId = TestPerson.GetPersonId(guid, cs.IdLpu, cs.IdPatientMis); example = TestStatCase.BuildAmbCaseFromDataBaseData(guid, cs.IdLpu, cs.IdCaseMis, patientId); client.CloseCase(guid, cs); example.ChangeUpdateStatCase(guid, cs); break; case "UpdateCase": client.UpdateCase(guid, cs); example = new TestStatCase(guid, cs); break; } if (!example.CheckCaseInDataBase()) { Global.errors1.AddRange(Global.errors2); Global.errors1.Add("Несовпадение"); } } } catch (System.ServiceModel.FaultException <List <PixServiseTests.EMKServise.RequestFault> > e) { getErrors(e.Detail); } catch (System.ServiceModel.FaultException <PixServiseTests.EMKServise.RequestFault[]> e) { getErrors(e.Detail); } catch (System.ServiceModel.FaultException <PixServiseTests.EMKServise.RequestFault> e) { Global.errors1.Add(e.Detail.PropertyName + " - " + e.Detail.Message); getErrors(e.Detail.Errors); } //catch (Exception e) //{ //} }
public void UpdateCase(string guid, CaseBase c) { CaseWork(guid, c, "UpdateCase"); }
public void CloseCase(string guid, CaseBase c) { CaseWork(guid, c, "CloseCase"); }
public void CreateCase(string guid, CaseBase c) { CaseWork(guid, c, "CreateCase"); }
//private EMKServise.StepBase[] ConvertSteps(StepBase[] c) //{ // StepAmb[] ca = c as StepAmb[]; // if ((object)ca != null) // { // List<EMKServise.StepAmb> l = new List<EMKServise.StepAmb>(); // foreach (StepAmb i in ca) // { // EMKServise.StepAmb esa = new EMKServise.StepAmb(); // if (i.Comment != "") // esa.Comment = i.Comment; // if (i.DateEnd != DateTime.MinValue) // esa.DateEnd = i.DateEnd; // if (i.DateStart != DateTime.MinValue) // esa.DateStart = i.DateStart; // esa.Doctor = ConvertMedicalStaff(i.Doctor); // esa.IdPaymentType = i.IdPaymentType; // if (i.IdStepMis != "") // esa.IdStepMis = i.IdStepMis; // esa.IdVisitPlace = i.IdVisitPlace; // esa.IdVisitPurpose = i.IdVisitPurpose; // esa.MedRecords = ConvertMedRecords(i.MedRecords); // l.Add(esa); // } // return l.ToArray(); // } // StepStat[] cs = c as StepStat[]; // if ((object)cs != null) // { // List<EMKServise.StepStat> l = new List<EMKServise.StepStat>(); // foreach (StepStat i in cs) // { // EMKServise.StepStat esa = new EMKServise.StepStat(); // if (i.BedNumber != "") // esa.BedNumber = i.BedNumber; // esa.BedProfile = i.BedProfile; // if (i.Comment != "") // esa.Comment = i.Comment; // if (i.DateEnd != DateTime.MinValue) // esa.DateEnd = i.DateEnd; // if (i.DateStart != DateTime.MinValue) // esa.DateStart = i.DateStart; // esa.DaySpend = i.DaySpend; // esa.Doctor = ConvertMedicalStaff(i.Doctor); // if (i.HospitalDepartmentName != "") // esa.HospitalDepartmentName = i.HospitalDepartmentName; // if (i.IdHospitalDepartment != "") // esa.IdHospitalDepartment = i.IdHospitalDepartment; // esa.IdPaymentType = i.IdPaymentType; // esa.IdRegimen = i.IdRegimen; // if (i.IdStepMis != "") // esa.IdStepMis = i.IdStepMis; // esa.MedRecords = ConvertMedRecords(i.MedRecords); // l.Add(esa); // } // return l.ToArray(); // } // return null; //} private EMKServise.CaseBase ConvertCase(CaseBase c) { CaseAmb ca = c as CaseAmb; if ((object)ca != null) { EMKServise.CaseAmb eca = new EMKServise.CaseAmb(); eca.Authenticator = ConvertParticipant(ca.Authenticator); eca.Author = ConvertParticipant(ca.Author); if (ca.CloseDate != DateTime.MinValue) { eca.CloseDate = ca.CloseDate; } if (ca.Comment != "") { eca.Comment = ca.Comment; } eca.Confidentiality = ca.Confidentiality; eca.CuratorConfidentiality = ca.CuratorConfidentiality; eca.DoctorConfidentiality = ca.DoctorConfidentiality; eca.DoctorInCharge = ConvertMedicalStaff(ca.DoctorInCharge); eca.Guardian = ConvertGuardian(ca.Guardian); if (ca.HistoryNumber != "") { eca.HistoryNumber = ca.HistoryNumber; } eca.IdAmbResult = ca.IdAmbResult; eca.IdAmbResult = ca.IdAmbResult; eca.IdCaseAidType = ca.IdCaseAidType; if (ca.IdCaseMis != "") { eca.IdCaseMis = ca.IdCaseMis; } eca.IdCasePurpose = ca.IdCasePurpose; eca.IdCaseResult = ca.IdCaseResult; eca.IdCaseType = ca.IdCaseType; if (ca.IdLpu != "") { eca.IdLpu = ca.IdLpu; } if (ca.IdPatientMis != "") { eca.IdPatientMis = ca.IdPatientMis; } eca.IdPaymentType = ca.IdPaymentType; eca.IsActive = ca.IsActive; eca.LegalAuthenticator = ConvertParticipant(ca.LegalAuthenticator); eca.MedRecords = ConvertMedRecords(ca.MedRecords); if (ca.OpenDate != DateTime.MinValue) { eca.OpenDate = ca.OpenDate; } eca.Steps = ConvertAmbSteps(ca.Steps); return(eca); } CaseStat cs = c as CaseStat; if ((object)cs != null) { EMKServise.CaseStat eca = new EMKServise.CaseStat(); eca.AIDSMark = cs.AIDSMark; eca.Authenticator = ConvertParticipant(cs.Authenticator); eca.Author = ConvertParticipant(cs.Author); if (cs.CloseDate != DateTime.MinValue) { eca.CloseDate = cs.CloseDate; } if (cs.Comment != "") { eca.Comment = cs.Comment; } eca.Confidentiality = cs.Confidentiality; eca.CuratorConfidentiality = cs.CuratorConfidentiality; if (cs.DeliveryCode != "") { eca.DeliveryCode = cs.DeliveryCode; } eca.DoctorConfidentiality = cs.DoctorConfidentiality; eca.DoctorInCharge = ConvertMedicalStaff(cs.DoctorInCharge); eca.Guardian = ConvertGuardian(cs.Guardian); if (cs.HistoryNumber != "") { eca.HistoryNumber = cs.HistoryNumber; } eca.HospitalizationOrder = cs.HospitalizationOrder; eca.HospResult = cs.HospResult; eca.IdCaseAidType = cs.IdCaseAidType; if (cs.IdCaseMis != "") { eca.IdCaseMis = cs.IdCaseMis; } //eca.IdCaseResult = cs.IdCasePurpose; eca.IdCaseResult = cs.IdCaseResult; eca.IdHospChannel = cs.IdHospChannel; eca.IdIntoxicationType = cs.IdIntoxicationType; if (cs.IdLpu != "") { eca.IdLpu = cs.IdLpu; } eca.IdPatientConditionOnAdmission = cs.IdPatientConditionOnAdmission; if (cs.IdPatientMis != "") { eca.IdPatientMis = cs.IdPatientMis; } eca.IdPaymentType = cs.IdPaymentType; eca.IdRepetition = cs.IdRepetition; eca.IdTransportIntern = cs.IdTransportIntern; eca.IdTypeFromDiseaseStart = cs.IdTypeFromDiseaseStart; eca.LegalAuthenticator = ConvertParticipant(cs.LegalAuthenticator); eca.MedRecords = ConvertMedRecords(cs.MedRecords); if (cs.OpenDate != DateTime.MinValue) { eca.OpenDate = cs.OpenDate; } eca.PrehospitalDefects = cs.PrehospitalDefects.ToList <byte>(); eca.RW1Mark = cs.RW1Mark; eca.Steps = ConvertStatSteps(cs.Steps); return(eca); } return(null); }
public void AddCase(string guid, CaseBase c) { CaseWork(guid, c, "AddCase"); }
private void CaseWork(string guid, CaseBase c, string method) { try { CaseAmb ca = c as CaseAmb; if ((object)ca != null) { TestAmbCase example = null; switch (method) { case "AddCase": client.AddCase(guid, ca); example = new TestAmbCase(guid, ca); break; case "CreateCase": client.CreateCase(guid, ca); example = new TestAmbCase(guid, ca); break; case "CloseCase": string patientId = TestPerson.GetPersonId(guid, ca.IdLpu, ca.IdPatientMis); example = TestAmbCase.BuildAmbCaseFromDataBaseData(guid, ca.IdLpu, ca.IdCaseMis, patientId); client.CloseCase(guid, ca); example.ChangeUpdateAmbCase(guid, ca); break; case "UpdateCase": client.UpdateCase(guid, ca); example = new TestAmbCase(guid, ca); break; } if (!example.CheckCaseInDataBase()) { Global.errors1.AddRange(Global.errors2); Global.errors1.Add("Несовпадение"); } } CaseStat cs = c as CaseStat; if ((object)cs != null) { TestStatCase example = null; switch (method) { case "AddCase": client.AddCase(guid, cs); example = new TestStatCase(guid, cs); break; case "CreateCase": client.CreateCase(guid, cs); example = new TestStatCase(guid, cs); break; case "CloseCase": string patientId = TestPerson.GetPersonId(guid, cs.IdLpu, cs.IdPatientMis); example = TestStatCase.BuildAmbCaseFromDataBaseData(guid, cs.IdLpu, cs.IdCaseMis, patientId); client.CloseCase(guid, cs); example.ChangeUpdateStatCase(guid, cs); break; case "UpdateCase": client.UpdateCase(guid, cs); example = new TestStatCase(guid, cs); break; } if (!example.CheckCaseInDataBase()) { Global.errors1.AddRange(Global.errors2); Global.errors1.Add("Несовпадение"); } } } catch (System.ServiceModel.FaultException<List<PixServiseTests.EMKServise.RequestFault>> e) { getErrors(e.Detail); } catch (System.ServiceModel.FaultException<PixServiseTests.EMKServise.RequestFault[]> e) { getErrors(e.Detail); } catch (System.ServiceModel.FaultException<PixServiseTests.EMKServise.RequestFault> e) { Global.errors1.Add(e.Detail.PropertyName + " - " + e.Detail.Message); getErrors(e.Detail.Errors); } //catch (Exception e) //{ //} }
public static TestCaseBase BuildBaseCaseFromDataBaseData(string guid, string idlpu, string mis, string idPerson) { //idPerson = TestPerson.GetPersonId(guid, idlpu, idPerson); string caseId = GetCaseId(guid, idlpu, mis, idPerson); if (caseId != null) { using (SqlConnection connection = Global.GetSqlConnection()) { string IdDoctor = ""; string IdGuardian = ""; int idCaseT = 0; bool isCanceld = false; CaseBase p = new CaseBase(); string findCase = "SELECT TOP(1) * FROM \"Case\" WHERE IdCase = '" + caseId + "'"; SqlCommand caseCommand = new SqlCommand(findCase, connection); using (SqlDataReader caseReader = caseCommand.ExecuteReader()) { while (caseReader.Read()) { if (caseReader["CloseDate"].ToString() != "") p.CloseDate = Convert.ToDateTime(caseReader["CloseDate"]); else p.CloseDate = DateTime.MinValue; if (caseReader["Comment"].ToString() != "") p.Comment = Convert.ToString(caseReader["Comment"]); else p.Comment = null; if (caseReader["HistoryNumber"].ToString() != "") p.HistoryNumber = Convert.ToString(caseReader["HistoryNumber"]); else p.HistoryNumber = null; if (caseReader["IdCaseAidType"].ToString() != "") p.IdCaseAidType = Convert.ToByte(caseReader["IdCaseAidType"]); else p.IdCaseAidType = 0; if (caseReader["IdCaseMis"].ToString() != "") p.IdCaseMis = Convert.ToString(caseReader["IdCaseMis"]); else p.IdCaseMis = null; if (caseReader["IdCaseResult"].ToString() != "") p.IdCaseResult = Convert.ToByte(caseReader["IdCaseResult"]); else p.IdCaseResult = 0; if (caseReader["IdCasePaymentType"].ToString() != "") p.IdPaymentType = Convert.ToByte(caseReader["IdCasePaymentType"]); else p.IdPaymentType = 0; if (caseReader["OpenDate"].ToString() != "") p.OpenDate = Convert.ToDateTime(caseReader["OpenDate"]); else p.OpenDate = DateTime.MinValue; if (caseReader["IDDoctor"].ToString() != "") IdDoctor = Convert.ToString(caseReader["IDDoctor"]); if (caseReader["IdGuardian"].ToString() != "") IdGuardian = Convert.ToString(caseReader["IDGuardian"]); if (caseReader["IdCaseType"].ToString() != "") idCaseT = Convert.ToInt32(caseReader["IdCaseType"]); isCanceld = Convert.ToBoolean(caseReader["IsCancelled"]); } } findCase = "SELECT * FROM mm_AccessRole2Case WHERE IdCase = '" + caseId + "'"; caseCommand = new SqlCommand(findCase, connection); using (SqlDataReader caseReader = caseCommand.ExecuteReader()) { while (caseReader.Read()) { switch (caseReader["IdAccessRole"].ToString()) { case "1": p.Confidentiality = Convert.ToByte(caseReader["IdPrivacyLevel"]); break; case "2": p.DoctorConfidentiality = Convert.ToByte(caseReader["IdPrivacyLevel"]); break; case "3": p.CuratorConfidentiality = Convert.ToByte(caseReader["IdPrivacyLevel"]); break; } } } p.IdCaseMis = mis; p.IdLpu = idlpu; TestCaseBase cb = new TestCaseBase(guid, p); cb.idCaseType = idCaseT; cb.isCanceld = isCanceld; if (IdDoctor != "") cb.doctorInCharge = TestDoctor.BuildTestDoctorFromDataBase(IdDoctor); else cb.doctorInCharge = null; if (IdGuardian != "") cb.guardian = TestGuardian.BuildTestGuardianFromDataBase(IdGuardian, idPerson); else cb.guardian = null; if (idPerson != "") cb.patient = TestPatient.BuildPatientFromDataBaseData(patientId: idPerson); else cb.patient = null; findCase = "SELECT * FROM mm_Author2Case WHERE IdCase = '" + caseId + "'"; caseCommand = new SqlCommand(findCase, connection); using (SqlDataReader caseReader = caseCommand.ExecuteReader()) { while (caseReader.Read()) { switch (caseReader["IdAuthorshipType"].ToString()) { case "1": cb.autor = TestParticipant.BuildTestParticipantFromDataBase(caseId, Convert.ToString(caseReader["IdDoctor"]), 1); break; case "3": cb.authenticator = TestParticipant.BuildTestParticipantFromDataBase(caseId, Convert.ToString(caseReader["IdDoctor"]), 3); break; case "4": cb.legalAuthenticator = TestParticipant.BuildTestParticipantFromDataBase(caseId, Convert.ToString(caseReader["IdDoctor"]), 4); break; } } } return cb; } } return null; }
public void UpdateCaseBase(string guid, CaseBase cb) { if (guid != "") { GUID = guid.ToLower(); } if (cb != null) { if (cb.CloseDate != DateTime.MinValue) { this.caseBase.CloseDate = cb.CloseDate; } if (cb.Comment != "") { this.caseBase.Comment = cb.Comment; } if (cb.Confidentiality != 0) { this.caseBase.Confidentiality = cb.Confidentiality; } if (cb.CuratorConfidentiality != 0) { this.caseBase.CuratorConfidentiality = cb.CuratorConfidentiality; } if (cb.DoctorConfidentiality != 0) { this.caseBase.DoctorConfidentiality = cb.DoctorConfidentiality; } if (cb.HistoryNumber != "") { this.caseBase.HistoryNumber = cb.HistoryNumber; } if (cb.IdCaseAidType != 0) { this.caseBase.IdCaseAidType = cb.IdCaseAidType; } if (cb.IdCaseMis != "") { this.caseBase.IdCaseMis = cb.IdCaseMis; } if (cb.IdCaseResult != 0) { this.caseBase.IdCaseResult = cb.IdCaseResult; } if (cb.IdLpu != "") { this.caseBase.IdLpu = cb.IdLpu; } if (cb.IdPaymentType != 0) { this.caseBase.IdPaymentType = cb.IdPaymentType; } if (cb.OpenDate != DateTime.MinValue) { this.caseBase.OpenDate = cb.OpenDate; } if (cb.Author != null) { autor = new TestParticipant(cb.Author, cb.IdLpu); if (autor.doctor.doctor.IdLpu == null) { autor.doctor.doctor.IdLpu = cb.IdLpu; } } if (cb.Authenticator != null) { authenticator = new TestParticipant(cb.Authenticator, cb.IdLpu); if (authenticator.doctor.doctor.IdLpu == null) { authenticator.doctor.doctor.IdLpu = cb.IdLpu; } } if (cb.LegalAuthenticator != null) { legalAuthenticator = new TestParticipant(cb.LegalAuthenticator, cb.IdLpu); if (legalAuthenticator.doctor.doctor.IdLpu == null) { legalAuthenticator.doctor.doctor.IdLpu = cb.IdLpu; } } if (cb.DoctorInCharge != null) { doctorInCharge = new TestDoctor(cb.DoctorInCharge, cb.IdLpu); if (doctorInCharge.doctor.IdLpu == null) { doctorInCharge.doctor.IdLpu = cb.IdLpu; } } if (cb.Guardian != null) { guardian = new TestGuardian(cb.Guardian); } if (cb.IdPatientMis != null) { patient = TestPatient.BuildPatientFromDataBaseData(guid, cb.IdLpu, cb.IdPatientMis); } } }
public void UpdateCaseBase(string guid, CaseBase cb) { if (guid != "") GUID = guid.ToLower(); if (cb != null) { if (cb.CloseDate != DateTime.MinValue) this.caseBase.CloseDate = cb.CloseDate; if (cb.Comment != "") this.caseBase.Comment = cb.Comment; if (cb.Confidentiality != 0) this.caseBase.Confidentiality = cb.Confidentiality; if (cb.CuratorConfidentiality != 0) this.caseBase.CuratorConfidentiality = cb.CuratorConfidentiality; if (cb.DoctorConfidentiality != 0) this.caseBase.DoctorConfidentiality = cb.DoctorConfidentiality; if (cb.HistoryNumber != "") this.caseBase.HistoryNumber = cb.HistoryNumber; if (cb.IdCaseAidType != 0) this.caseBase.IdCaseAidType = cb.IdCaseAidType; if (cb.IdCaseMis != "") this.caseBase.IdCaseMis = cb.IdCaseMis; if (cb.IdCaseResult != 0) this.caseBase.IdCaseResult = cb.IdCaseResult; if (cb.IdLpu != "") this.caseBase.IdLpu = cb.IdLpu; if (cb.IdPaymentType != 0) this.caseBase.IdPaymentType = cb.IdPaymentType; if (cb.OpenDate != DateTime.MinValue) this.caseBase.OpenDate = cb.OpenDate; if (cb.Author != null) { autor = new TestParticipant(cb.Author, cb.IdLpu); if (autor.doctor.doctor.IdLpu == null) autor.doctor.doctor.IdLpu = cb.IdLpu; } if (cb.Authenticator != null) { authenticator = new TestParticipant(cb.Authenticator, cb.IdLpu); if (authenticator.doctor.doctor.IdLpu == null) authenticator.doctor.doctor.IdLpu = cb.IdLpu; } if (cb.LegalAuthenticator != null) { legalAuthenticator = new TestParticipant(cb.LegalAuthenticator, cb.IdLpu); if (legalAuthenticator.doctor.doctor.IdLpu == null) legalAuthenticator.doctor.doctor.IdLpu = cb.IdLpu; } if (cb.DoctorInCharge != null) { doctorInCharge = new TestDoctor(cb.DoctorInCharge, cb.IdLpu); if (doctorInCharge.doctor.IdLpu == null) doctorInCharge.doctor.IdLpu = cb.IdLpu; } if (cb.Guardian != null) guardian = new TestGuardian(cb.Guardian); if (cb.IdPatientMis != null) patient = TestPatient.BuildPatientFromDataBaseData(guid, cb.IdLpu, cb.IdPatientMis); } }