Upload to server
uploading
This commit is contained in:
207
patientman/PatientMan/Controls/usrPatientInfo.cs
Normal file
207
patientman/PatientMan/Controls/usrPatientInfo.cs
Normal file
@@ -0,0 +1,207 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Datalib.EntityClasses;
|
||||
using Datalib.DatabaseSpecific;
|
||||
using Datalib.HelperClasses;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
namespace PatientMan.Controls
|
||||
{
|
||||
public partial class usrPatientInfo : PatientMan.usrControls.usrCommon
|
||||
{
|
||||
private EntityCollection <TblProvinceEntity> prov = new EntityCollection <TblProvinceEntity>();
|
||||
private EntityCollection <TblDistrictEntity> districtCollection;
|
||||
private EntityCollection <TblCommuneEntity> communeCollection;
|
||||
public EntityCollection<TblPatientEntity> PatientsCollection { get; set; }
|
||||
private EntityCollection<TblRegimenEntity> Regimens = new EntityCollection<TblRegimenEntity>();
|
||||
|
||||
public TblPatientEntity DeletedPatient { get; set; }
|
||||
public usrPatientInfo()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public override void Cancel()
|
||||
{
|
||||
BindingContext[PatientInfor].CancelCurrentEdit ();
|
||||
base.Cancel();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override void SaveRecord()
|
||||
{
|
||||
BindingContext[PatientInfor].EndCurrentEdit();
|
||||
|
||||
if (dxValidationProvider.Validate())
|
||||
{
|
||||
var TreatmentInfo = PatientInfor.IsNew;
|
||||
|
||||
|
||||
if (this.CurrRegimen.EditValue != null)
|
||||
{
|
||||
if (TreatmentInfo)
|
||||
{
|
||||
var treat = PatientInfor.TblTreatmentInfos.AddNew();
|
||||
treat.TreatmentId = "01";
|
||||
treat.UniqueKey = Guid.NewGuid().ToString("N");
|
||||
treat.Regimenid = CurrRegimen.EditValue.ToString();
|
||||
treat.TreatmentSdate = PatientInfor.DateofRegistration;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
PatientInfor.PatientName = strUtil.Crypt(PatientInfor.PatientName);
|
||||
adapter.SaveEntity(PatientInfor, true, true);
|
||||
|
||||
this.PatientName.Text = strUtil.Decrypt(this.PatientName.Text);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Tác vụ ghi dữ liệu không thành công!", "Ghi dữ liệu", MessageBoxButtons.OK);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public override void DeleteRecord()
|
||||
{
|
||||
DeletedPatient = (TblPatientEntity)PatientsCollection[BindingContext[PatientsCollection].Position];
|
||||
PatientsCollection.Remove(DeletedPatient);
|
||||
adapter.DeleteEntity(DeletedPatient);
|
||||
}
|
||||
|
||||
public override void NewRecord()
|
||||
{
|
||||
base.NewRecord();
|
||||
}
|
||||
|
||||
public override void BindingData()
|
||||
{
|
||||
PatientId.DataBindings.Clear();
|
||||
PatientName.DataBindings.Clear();
|
||||
Sex.DataBindings.Clear();
|
||||
BirthYear.DataBindings.Clear();
|
||||
IdentityCardNo.DataBindings.Clear();
|
||||
InsuranceId.DataBindings.Clear();
|
||||
Sms.DataBindings.Clear();
|
||||
TelephoneNo.DataBindings.Clear();
|
||||
ProvinceId.DataBindings.Clear();
|
||||
Districtid.DataBindings.Clear();
|
||||
CommuneId.DataBindings.Clear();
|
||||
Address.DataBindings.Clear();
|
||||
SupporterInfo.DataBindings.Clear();
|
||||
DateofRegistration.DataBindings.Clear();
|
||||
ReferralID.DataBindings.Clear();
|
||||
Dateofreferral.DataBindings.Clear();
|
||||
ReferralName.DataBindings.Clear();
|
||||
ReferralProvinceID.DataBindings.Clear();
|
||||
OldPatientID.DataBindings.Clear();
|
||||
Regimen.DataBindings.Clear();
|
||||
|
||||
HivConfirmedDate.DataBindings.Clear();
|
||||
DateofARV.DataBindings.Clear();
|
||||
|
||||
HaveArvBefore.DataBindings.Clear();
|
||||
Status.DataBindings.Clear();
|
||||
|
||||
PatientId.DataBindings.Add("Text", PatientsCollection, "PatientId", true);
|
||||
PatientName.DataBindings.Add("Text", PatientsCollection, "PatientName", true);
|
||||
Sex.DataBindings.Add("EditValue", PatientsCollection, "Sex", true);
|
||||
BirthYear.DataBindings.Add("EditValue", PatientsCollection, "BirthYear", true);
|
||||
IdentityCardNo.DataBindings.Add("Text", PatientsCollection, "IdentityCardNo", true);
|
||||
InsuranceId.DataBindings.Add("Text", PatientsCollection, "Insuranceid", true);
|
||||
|
||||
TelephoneNo.DataBindings.Add("Text", PatientsCollection, "TelephoneNo", true);
|
||||
ProvinceId.DataBindings.Add("EditValue", PatientsCollection, "ProvinceId", true);
|
||||
Districtid.DataBindings.Add("EditValue", PatientsCollection, "DistrictId", true);
|
||||
CommuneId.DataBindings.Add("EditValue", PatientsCollection, "CommuneId", true);
|
||||
Address.DataBindings.Add("Text", PatientsCollection, "Address", true);
|
||||
SupporterInfo.DataBindings.Add("Text", PatientsCollection, "SupporterInfo", true);
|
||||
Sms.DataBindings.Add("EditValue", PatientsCollection, "Sms", true);
|
||||
DateofRegistration.DataBindings.Add("EditValue", PatientsCollection, "DateofRegistration", true);
|
||||
ReferralID.DataBindings.Add("EditValue", PatientsCollection, "ReferralID", true);
|
||||
Dateofreferral.DataBindings.Add("EditValue", PatientsCollection, "Dateofreferral", true);
|
||||
ReferralName.DataBindings.Add("Text", PatientsCollection, "ReferralName", true);
|
||||
ReferralProvinceID.DataBindings.Add("EditValue", PatientsCollection, "ReferralProvinceId", true);
|
||||
OldPatientID.DataBindings.Add("Text", PatientsCollection , "OldPatientID",true);
|
||||
HaveArvBefore.DataBindings.Add("EditValue", PatientsCollection, "HaveArvBefore",true);
|
||||
HivConfirmedDate.DataBindings.Add("EditValue", PatientsCollection, "HivConfirmedDate", true);
|
||||
DateofARV.DataBindings.Add("EditValue", PatientsCollection, "DateofArv", true);
|
||||
Status.DataBindings.Add("EditValue", PatientsCollection, "Status", true);
|
||||
Regimen.DataBindings.Add("EditValue", PatientsCollection, "Regimenid", true);
|
||||
}
|
||||
|
||||
public override void LoadLibrary()
|
||||
{
|
||||
adapter.FetchEntityCollection(prov, null);
|
||||
ProvinceId.Properties.DataSource = prov.DefaultView;
|
||||
ReferralProvinceID.Properties.DataSource = prov.DefaultView;
|
||||
ProvinceId.EditValue = prov[0].Provinceid.ToString();
|
||||
adapter.FetchEntityCollection(Regimens, null);
|
||||
this.CurrRegimen.Properties.DataSource = Regimens;
|
||||
this.Regimen.Properties.DataSource = Regimens;
|
||||
}
|
||||
|
||||
private void usrPatientInfo_Load(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void lookUpProvince_EditValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
var ProvEntity = new TblProvinceEntity(ProvinceId.EditValue.ToString());
|
||||
districtCollection = ProvEntity.TblDistricts;
|
||||
adapter.FetchEntityCollection(districtCollection, ProvEntity.GetRelationInfoTblDistricts());
|
||||
Districtid.Properties.DataSource = districtCollection;
|
||||
}
|
||||
|
||||
private void lookUpDistrict_EditValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var DistEntity = new TblDistrictEntity(Districtid.EditValue.ToString());
|
||||
communeCollection = DistEntity.TblCommunes;
|
||||
adapter.FetchEntityCollection(communeCollection, DistEntity.GetRelationInfoTblCommunes());
|
||||
CommuneId.Properties.DataSource = communeCollection;
|
||||
}
|
||||
catch (InvalidCastException err)
|
||||
{
|
||||
MessageBox.Show(err.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void ReferralID_Validated(object sender, EventArgs e)
|
||||
{
|
||||
grpReferral.Visible = (ReferralID.EditValue.ToString() == "02" || ReferralID.EditValue.ToString() == "03" || ReferralID.EditValue.ToString() == "04");
|
||||
}
|
||||
|
||||
private void ReferralID_EditValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
grpReferral.Visible = (ReferralID.EditValue==null || ReferralID.EditValue.ToString() == "02" || ReferralID.EditValue.ToString() == "03" || ReferralID.EditValue.ToString() == "04");
|
||||
}
|
||||
|
||||
private void HaveArvBefore_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void labelControl3_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void DateofARV1_EditValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Regimen_EditValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user