112 lines
2.9 KiB
C#
112 lines
2.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Datalib.EntityClasses;
|
|
using Datalib.DatabaseSpecific;
|
|
using System.Windows.Forms;
|
|
using System.IO;
|
|
using DevExpress.XtraEditors;
|
|
namespace PatientMan.usrControls
|
|
{
|
|
public partial class usrCommon : DevExpress.XtraEditors.XtraUserControl
|
|
{
|
|
private Boolean _readonly;
|
|
public DataAccessAdapter adapter = new DataAccessAdapter(SettingInfo.Constr);
|
|
public TblPatientEntity PatientInfor { get; set; }
|
|
public Boolean ControlEnabled
|
|
{
|
|
get { return _readonly; }
|
|
set
|
|
{
|
|
_readonly = value;
|
|
foreach (Control c in this.Controls)
|
|
{
|
|
c.Enabled = _readonly;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
public usrCommon()
|
|
{
|
|
|
|
InitializeComponent();
|
|
|
|
}
|
|
public virtual void SaveRecord()
|
|
{
|
|
ShowSaveInfo();
|
|
}
|
|
|
|
public virtual void DeleteRecord()
|
|
{
|
|
}
|
|
|
|
public virtual void BindingData()
|
|
{
|
|
}
|
|
|
|
public virtual void NewRecord()
|
|
{
|
|
}
|
|
|
|
public virtual void LoadData()
|
|
{
|
|
}
|
|
|
|
public virtual void Cancel()
|
|
{
|
|
}
|
|
|
|
public virtual void ShowSaveInfo()
|
|
{
|
|
var frm = new Forms.frmShowSaveInfo();
|
|
frm.Show ();
|
|
}
|
|
public virtual void ClearBinding()
|
|
{
|
|
}
|
|
public virtual void LoadLibrary()
|
|
{
|
|
}
|
|
public virtual void Print()
|
|
{
|
|
|
|
}
|
|
public void WriteLog(LogInfo log)
|
|
{
|
|
string path = Application.StartupPath;
|
|
string logs = log.RecordID + ";" + log.PatientID + ";" + log.TableName + ";" + log.EventType + ";" + DateTime.Now;
|
|
DateTime CurrDate = DateTime.Today;
|
|
string filename = path + @"/Logs/" + CurrDate.ToString("MM-yyyy") + ".txt";
|
|
using (StreamWriter w = File.AppendText(filename))
|
|
{
|
|
|
|
w.WriteLine(logs);
|
|
w.Close();
|
|
}
|
|
}
|
|
|
|
private void Reset_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;
|
|
((RadioGroup)sourceControl).EditValue = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|