Files
csharpcode/patientman/PatientMan/Forms/frmExp.cs
2025-08-02 05:20:17 +07:00

64 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using Datalib.EntityClasses;
using Datalib.HelperClasses;
using System.Linq;
using DevExpress.XtraEditors;
using System.Windows.Forms;
using Datalib.Linq;
namespace PatientMan.Forms
{
public partial class frmExp : PatientMan.BasicForms.frmCommon
{
public frmExp()
{
InitializeComponent();
}
public override void LoadData()
{
LinqMetaData meta = new LinqMetaData(adapter);
this.cbProv.DataSource = meta.TblProvince.Select(p => new { p.Provinceid, p.Provincename });
this.cbDistrict.DataSource = meta.TblDistrict;
this.cbReasons.DataSource = meta.TblRegimenStopReason;
this.cbRegimens.DataSource = meta.TblRegimen.Select(p => new { p.Regimenid, p.VRegimenname });
this.cbCommunes.DataSource = meta.TblCommune;
base.LoadData();
}
private void barPrint_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
grdExport.ShowPrintPreview();
}
private void barExcel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
this.SaveFileDialog.FileName = "Patients" + DateTime.Today.ToString("dd") + DateTime.Today.ToString("MM") + DateTime.Today.ToString("yy") + ".xls";
this.SaveFileDialog.Filter = "Excel File|*.xls";
if (this.SaveFileDialog.ShowDialog() == DialogResult.OK)
{
this.grdExport.ExportToXls(SaveFileDialog.FileName);
}
}
private void barEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
var frm = new frmPatientInfo();
frm.PatientsCollection = new EntityCollection<TblPatientEntity>();
var Patientid = this.gridView1.GetFocusedRowCellValue(colPatientID).ToString();
var PatientInfo = new TblPatientEntity(Patientid);
adapter.FetchEntity(PatientInfo);
frm.PatientsCollection.Add(PatientInfo);
frm.PatientInfo = PatientInfo;
frm.LoadData();
frm.ShowDialog();
}
}
}