48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Datalib.DatabaseSpecific;
|
|
using System.Windows.Forms;
|
|
using Datalib.Linq;
|
|
using Datalib.EntityClasses;
|
|
using Datalib.FactoryClasses;
|
|
using Datalib.HelperClasses;
|
|
using PatientMan.Classes;
|
|
|
|
|
|
|
|
namespace PatientMan.Classes.Actions
|
|
{
|
|
class clsUpdateReferralArv
|
|
{
|
|
public DataAccessAdapter adapter = new DataAccessAdapter(SettingInfo.Constr);
|
|
public LinqMetaData meta = new LinqMetaData(new DataAccessAdapter(SettingInfo.Constr));
|
|
|
|
public void UpdateArv()
|
|
{
|
|
var RefPatients = meta.TblPatient.Where(q => q.Dateofreferral != null && q.HaveArvBefore == 1).ToList();
|
|
|
|
foreach(var Patient in RefPatients)
|
|
{
|
|
|
|
string PatientID = Patient.PatientId;
|
|
if ( meta.TblTreatmentInfo.Where(p=>p.TreatmentId == "01" && p.PatientId == PatientID).Count() ==0)
|
|
{
|
|
|
|
TblTreatmentInfoEntity Treatment = new TblTreatmentInfoEntity();
|
|
Treatment.PatientId = PatientID;
|
|
Treatment.TreatmentId = "01";
|
|
Treatment.TreatmentSdate = Patient.Dateofreferral;
|
|
Treatment.Regimenid = Patient.Regimenid;
|
|
Treatment.UniqueKey = Guid.NewGuid().ToString("N");
|
|
adapter.SaveEntity(Treatment);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|