AIMS/AIMSControls/PublicUI/frmNotice.cs
2023-08-16 22:32:16 +08:00

122 lines
4.6 KiB
C#

using AIMSBLL;
using AIMSModel;
using DataDictionary;
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 frmNotice : Form
{
public AIMSExtension.EditState _state;
public frmNotice()
{
InitializeComponent();
}
private void frmNotice_Load(object sender, EventArgs e)
{
ControlExtension.SetDgvAttribute(dgvOperation);
ControlExtension.EnabledControl(groupBox2, false);
ControlExtension.ClearControl(groupBox2);
_state = AIMSExtension.EditState.BROWSE;
dgvOperation.DataSource = BNotice.GetOperation();
dgvNoticeTemplate.DataSource = BNotice.GetOperationList();
}
private void tsbAdd_Click(object sender, EventArgs e)
{
_state = AIMSExtension.EditState.ADD;
ControlExtension.EnabledControl(panel1, true);
ControlExtension.ClearControl(panel1);
}
private void tsbSava_Click(object sender, EventArgs e)
{
if (this.txtContentTemplate.Text.Trim().Length > 0)
{
Notice NoticeObj = new Notice();
NoticeObj.Contents = txtContentTemplate.Text.Trim();
NoticeObj.OperatorNo = AIMSExtension.PublicMethod.OperatorNo;
NoticeObj.OperatorName = AIMSExtension.PublicMethod.OperatorName;
NoticeObj.OperateDate = AIMSExtension.PublicMethod.SystemDate();
if (_state == AIMSExtension.EditState.ADD)
{
BNotice.Add(NoticeObj);
}
_state = AIMSExtension.EditState.BROWSE;
ControlExtension.EnabledControl(panel1, false);
ControlExtension.ClearControl(panel1);
dgvOperation.DataSource = BNotice.GetOperation();
dgvNoticeTemplate.DataSource = BNotice.GetOperationList();
}
}
private void tsbExit_Click(object sender, EventArgs e)
{
Close();
}
private void dgvOperation_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (dgvOperation.Rows.Count > 0)
{
txtMdrecNo.Text = dgvOperation.CurrentRow.Cells["MdrecNoColumn"].Value.ToString();
txtPatientName.Text = dgvOperation.CurrentRow.Cells["PatientNameColumn"].Value.ToString();
}
}
private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (dgvNoticeTemplate.Rows.Count > 0)
{
txtConcent.Text = txtPatientName.Text + " " + dgvNoticeTemplate.CurrentRow.Cells["ContentsColumn1"].Value.ToString();
}
}
private void tsbDelete_Click(object sender, EventArgs e)
{
if (dgvNoticeTemplate.Rows.Count > 0)
{
if (MessageBox.Show("您确认需要删除该名联系人吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes)
{
int Id = int.Parse(dgvNoticeTemplate.CurrentRow.Cells["NoticeTemplateIdColumn"].Value.ToString());
BNotice.Delete(Id);
dgvNoticeTemplate.DataSource = BNotice.GetOperationList();
}
}
}
private void sendout_Click(object sender, EventArgs e)
{
if (this.txtConcent.Text.Trim().Length > 0)
{
Notice NoticeObj = new Notice();
NoticeObj.Contents = txtConcent.Text.Trim();
NoticeObj.SendState = 1;
NoticeObj.OperatorNo = AIMSExtension.PublicMethod.OperatorNo;
NoticeObj.OperatorName = AIMSExtension.PublicMethod.OperatorName;
NoticeObj.OperateDate = AIMSExtension.PublicMethod.SystemDate();
BNotice.sendout(NoticeObj);
}
txtMdrecNo.Clear();
txtPatientName.Clear();
txtConcent.Clear();
}
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
dgvHistory.Rows.Clear();
List<Notice> NoticeList = BNotice.HistoryNoticeData();
for(int i=0;i<NoticeList.Count;i++)
{
dgvHistory.Rows.Add(NoticeList[i].Contents, NoticeList[i].OperateDate);
}
}
}
}