117 lines
3.5 KiB
C#
117 lines
3.5 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.BasicForms
|
|
{
|
|
public partial class frmCommon : DevExpress.XtraEditors.XtraForm
|
|
{
|
|
public DataAccessAdapter adapter = new DataAccessAdapter(SettingInfo.Constr);
|
|
public frmCommon()
|
|
{
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
|
|
public virtual void SaveRecord()
|
|
{
|
|
}
|
|
|
|
public virtual void DeleteRecord()
|
|
{
|
|
}
|
|
|
|
public virtual void BindingData()
|
|
{
|
|
}
|
|
public virtual void ReBinding()
|
|
{
|
|
}
|
|
|
|
public virtual void NewRecord()
|
|
{
|
|
}
|
|
|
|
public virtual void LoadData()
|
|
{
|
|
}
|
|
public virtual void WriteLog(LogInfo log)
|
|
{
|
|
|
|
}
|
|
|
|
private void grdPrint_Click(object sender, EventArgs e)
|
|
{
|
|
// Try to cast the sender to a ToolStripItem
|
|
ToolStripItem menuItem = sender as ToolStripItem;
|
|
if (menuItem != null)
|
|
{
|
|
// Retrieve the ContextMenuStrip that owns this ToolStripItem
|
|
ContextMenuStrip owner = menuItem.Owner as ContextMenuStrip;
|
|
if (owner != null)
|
|
{
|
|
// Get the control that is displaying this context menu
|
|
Control sourceControl = owner.SourceControl;
|
|
((hsphgrid)sourceControl).ShowPrintPreview();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void fullPrint_Click(object sender, EventArgs e)
|
|
{
|
|
// Try to cast the sender to a ToolStripItem
|
|
ToolStripItem menuItem = sender as ToolStripItem;
|
|
if (menuItem != null)
|
|
{
|
|
// Retrieve the ContextMenuStrip that owns this ToolStripItem
|
|
ContextMenuStrip owner = menuItem.Owner as ContextMenuStrip;
|
|
if (owner != null)
|
|
{
|
|
// Get the control that is displaying this context menu
|
|
Control sourceControl = owner.SourceControl;
|
|
hsphgrid thisGrid = ((hsphgrid)sourceControl);
|
|
if (thisGrid.Patients != null)
|
|
{
|
|
|
|
(new clsFullPrint()).PrintOut(thisGrid.Patients);
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
private void ToExcel_Click(object sender, EventArgs e)
|
|
{
|
|
// Try to cast the sender to a ToolStripItem
|
|
ToolStripItem menuItem = sender as ToolStripItem;
|
|
if (menuItem != null)
|
|
{
|
|
// Retrieve the ContextMenuStrip that owns this ToolStripItem
|
|
ContextMenuStrip owner = menuItem.Owner as ContextMenuStrip;
|
|
if (owner != null)
|
|
{
|
|
// Get the control that is displaying this context menu
|
|
Control sourceControl = owner.SourceControl;
|
|
|
|
if (baseSaveDlg.ShowDialog() == DialogResult.OK)
|
|
{
|
|
((hsphgrid)sourceControl).ExportToXlsx(baseSaveDlg.FileName);
|
|
|
|
MessageBox.Show("Dữ liệu đã được khi ra tệp Excel thành công", "Kết xuất", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|