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

71 lines
2.1 KiB
C#

using AIMSBLL;
using AIMSModel;
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 frmNoticeMain : Form
{
public AIMSExtension.EditState _state;
public frmNoticeMain()
{
InitializeComponent();
}
private void frmNoticeMain_Load(object sender, EventArgs e)
{
BindDate();
}
private void BindDate()
{
dgvHistory.Rows.Clear();
List<Notice> NoticeList = BNotice.HistoryNoticeData();
for (int i = 0; i < NoticeList.Count; i++)
{
dgvHistory.Rows.Add(NoticeList[i].Id, NoticeList[i].Contents, NoticeList[i].OperateDate);
}
}
private void tsbSava_Click(object sender, EventArgs e)
{
if (this.txtConcent.Text.Trim().Length > 0)
{
Notice NoticeObj = new Notice();
NoticeObj.Contents = txtConcent.Text.Trim();
NoticeObj.OperatorNo = AIMSExtension.PublicMethod.OperatorNo;
NoticeObj.OperatorName = AIMSExtension.PublicMethod.OperatorName;
NoticeObj.OperateDate = AIMSExtension.PublicMethod.SystemDate();
BNotice.Add(NoticeObj);
BindDate();
}
}
private void tsbExit_Click(object sender, EventArgs e)
{
Close();
}
private void tsbDelete_Click(object sender, EventArgs e)
{
if (dgvHistory.Rows.Count > 0)
{
if (MessageBox.Show("您确认需要删除该公告吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes)
{
int Id = int.Parse(dgvHistory.CurrentRow.Cells["Id"].Value.ToString());
BNotice.Delete(Id);
BindDate();
}
}
}
}
}