128 lines
4.5 KiB
C#
128 lines
4.5 KiB
C#
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;
|
|
using AIMS;
|
|
using AIMSBLL;
|
|
using AIMSModel;
|
|
using HelperDB;
|
|
|
|
namespace DataDictionary.UI
|
|
{
|
|
public partial class frmOperation : Form
|
|
{
|
|
public AIMSExtension.EditState _state;
|
|
private int SelectOperationRowId = 0;
|
|
public frmOperation()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
private void frmOperation_Load(object sender, EventArgs e)
|
|
{
|
|
ControlExtension.SetDgvAttribute(dgvOperation);
|
|
ControlExtension.EnabledControl(panel1, false);
|
|
ControlExtension.ClearControl(panel1);
|
|
_state = AIMSExtension.EditState.BROWSE;
|
|
dgvOperation.DataSource = BOperation.GetDataTable();
|
|
}
|
|
private void tsbAdd_Click(object sender, EventArgs e)
|
|
{
|
|
_state = AIMSExtension.EditState.ADD;
|
|
ControlExtension.EnabledControl(panel1, true);
|
|
ControlExtension.ClearControl(panel1);
|
|
chkIsValid.Checked = true;
|
|
|
|
}
|
|
|
|
private void tsbModify_Click(object sender, EventArgs e)
|
|
{
|
|
_state = AIMSExtension.EditState.EDIT;
|
|
ControlExtension.EnabledControl(panel1, true);
|
|
txtICDcode.Enabled = false;
|
|
txtName.Enabled = false;
|
|
if (dgvOperation.Rows.Count > 0)
|
|
{
|
|
SelectOperationRowId = int.Parse(dgvOperation.CurrentRow.Cells["Id"].Value.ToString());
|
|
txtICDcode.Text = dgvOperation.CurrentRow.Cells["IcdCode"].Value.ToString();
|
|
txtName.Text = dgvOperation.CurrentRow.Cells["NameColumn"].Value.ToString();
|
|
txtHelpCode.Text = dgvOperation.CurrentRow.Cells["HelpCode"].Value.ToString();
|
|
if (dgvOperation.CurrentRow.Cells["IsValid"].Value.ToString() == "有效")
|
|
{
|
|
chkIsValid.Checked = true;
|
|
}
|
|
else
|
|
{
|
|
chkIsValid.Checked = false;
|
|
}
|
|
}
|
|
}
|
|
private bool ValidInput()
|
|
{
|
|
bool result = false;
|
|
|
|
if (this.txtName.Text.Trim().Length < 1)
|
|
{
|
|
MessageBox.Show("请输入名称!");
|
|
}
|
|
else
|
|
{
|
|
result = true;
|
|
}
|
|
return result;
|
|
}
|
|
private void tsbSava_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.ValidInput())
|
|
{
|
|
Operation OperationObj = new Operation();
|
|
OperationObj.Name = txtName.Text.Trim();
|
|
OperationObj.IcdCode = txtICDcode.Text.Trim();
|
|
OperationObj.HelpCode = txtHelpCode.Text;
|
|
OperationObj.IsValid = int.Parse(chkIsValid.Checked ? "1" : "0");
|
|
OperationObj.OperatorNo = AIMSExtension.PublicMethod.OperatorNo;
|
|
OperationObj.OperatorName = AIMSExtension.PublicMethod.OperatorName;
|
|
OperationObj.OperateDate = AIMSExtension.PublicMethod.SystemDate();
|
|
if (_state == AIMSExtension.EditState.ADD)
|
|
{
|
|
if (BOperation.IsExit(txtName.Text.Trim()))
|
|
{
|
|
MessageBox.Show("该事件已存在");
|
|
return;
|
|
}
|
|
BOperation.Add(OperationObj);
|
|
}
|
|
if (_state == AIMSExtension.EditState.EDIT)
|
|
{
|
|
OperationObj.Id = SelectOperationRowId;
|
|
BOperation.Update(OperationObj);
|
|
}
|
|
}
|
|
_state = AIMSExtension.EditState.BROWSE;
|
|
ControlExtension.EnabledControl(panel1, false);
|
|
ControlExtension.ClearControl(panel1);
|
|
dgvOperation.DataSource = BOperation.GetDataTable();
|
|
}
|
|
|
|
private void tsbCancel_Click(object sender, EventArgs e)
|
|
{
|
|
_state = AIMSExtension.EditState.BROWSE;
|
|
ControlExtension.EnabledControl(panel1, false);
|
|
ControlExtension.ClearControl(panel1);
|
|
}
|
|
|
|
private void tsbExit_Click(object sender, EventArgs e)
|
|
{
|
|
Close();
|
|
}
|
|
|
|
private void txtName_TextChanged(object sender, EventArgs e)
|
|
{
|
|
txtHelpCode.Text = AIMSExtension.PublicMethod.GetFirstLetter(txtName.Text);
|
|
}
|
|
}
|
|
}
|