using AIMSBLL; using AIMSExtension; using DrawGraph; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace AIMS.PublicUI.UI { public partial class frmTemplate : Form { public OperationRecord _record; public DateTime InRoomTime; public int PatientId = 0; public int TypeId = 0; public frmTemplate() { InitializeComponent(); } private void frmTemplate_Load(object sender, EventArgs e) { dgv.AllowUserToResizeColumns = false; dgv.AllowUserToResizeRows = false; dgv.AllowUserToAddRows = false; dgv.AllowUserToDeleteRows = false; dgv.BackgroundColor = System.Drawing.Color.Snow; GetTemplateDataTable(); } private void tsbCreateTemplate_Click(object sender, EventArgs e) { frmCreateTemplate frmCreateTemplateObj = new frmCreateTemplate(); frmCreateTemplateObj._record = _record; frmCreateTemplateObj.InRoomTime = InRoomTime; frmCreateTemplateObj.PatientId = PatientId; frmCreateTemplateObj.TypeId = TypeId; frmCreateTemplateObj.IsAdd = true; frmCreateTemplateObj.FormClosed += new FormClosedEventHandler(frmCreateTemplateObj_FormClosed); frmCreateTemplateObj.ShowDialog(); } private void GetTemplateDataTable() { dgv.DataSource = BOperationTemplate.GetDataTable(TypeId); } void frmCreateTemplateObj_FormClosed(object sender, FormClosedEventArgs e) { GetTemplateDataTable(); } private void tsbExit_Click(object sender, EventArgs e) { Close(); } private void dgv_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (this.dgv.Columns[e.ColumnIndex].Name == "InputColumn") { frmTemplateSel templateSel = new frmTemplateSel(); templateSel.InRoomTime = InRoomTime; if (templateSel.ShowDialog() == System.Windows.Forms.DialogResult.OK) { BOperationTemplate.InputData(dgv.CurrentRow.Cells["TemplateNameColumn"].Value.ToString(), PatientId, templateSel.InRoomTime, TypeId, _record); this.DialogResult = System.Windows.Forms.DialogResult.OK; } //if (MessageBox.Show("确认要导入[" + dgv.CurrentRow.Cells["TemplateNameColumn"].Value.ToString() + "]模板吗?\n模板开始时间:"+ InRoomTime, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) //{ // //BOperationTemplate.ClearData(PatientId, TypeId); // BOperationTemplate.InputData(dgv.CurrentRow.Cells["TemplateNameColumn"].Value.ToString(), PatientId, InRoomTime, TypeId,_record); //} } else if (this.dgv.Columns[e.ColumnIndex].Name == "EditColumn") { frmCreateTemplate frmCreateTemplateObj = new frmCreateTemplate(); frmCreateTemplateObj.TemplateName = dgv.CurrentRow.Cells["TemplateNameColumn"].Value.ToString(); frmCreateTemplateObj.OperatorName = dgv.CurrentRow.Cells["OperatorName"].Value.ToString(); frmCreateTemplateObj.IsPublic = dgv.CurrentRow.Cells["IsPublic"].Value.ToString() == "1" ? true : false; frmCreateTemplateObj.InRoomTime = DateTime.Parse(dgv.CurrentRow.Cells["InRoomTime2"].Value.ToString()); frmCreateTemplateObj._record = _record; frmCreateTemplateObj.PatientId = PatientId; frmCreateTemplateObj.TypeId = TypeId; frmCreateTemplateObj.IsAdd = false; frmCreateTemplateObj.FormClosed += new FormClosedEventHandler(frmCreateTemplateObj_FormClosed); frmCreateTemplateObj.ShowDialog(); } else if (this.dgv.Columns[e.ColumnIndex].Name == "DeleteColumn") { bool isDelete = false; if (dgv.CurrentRow.Cells["isPublic"].Value.ToString() == "0" && dgv.CurrentRow.Cells["OperatorNo"].Value.ToString() == AIMSExtension.PublicMethod.OperatorNo || AIMSExtension.PublicMethod.RoleId == 7) { isDelete = true; } else if (dgv.CurrentRow.Cells["isPublic"].Value.ToString() == "1" && (dgv.CurrentRow.Cells["OperatorNo"].Value.ToString() == AIMSExtension.PublicMethod.OperatorNo || dgv.CurrentRow.Cells["OperatorNo"].Value.ToString() == "admin" || AIMSExtension.PublicMethod.RoleId == 7)) { isDelete = true; } if (AIMSExtension.PublicMethod.RoleId == 1) { isDelete = true; } if (isDelete == true) if (MessageBox.Show("确认要删除[" + dgv.CurrentRow.Cells["TemplateNameColumn"].Value.ToString() + "]模板吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { BOperationTemplate.Delete(dgv.CurrentRow.Cells["TemplateNameColumn"].Value.ToString(), TypeId); GetTemplateDataTable(); } } } } }