122 lines
4.5 KiB
C#
122 lines
4.5 KiB
C#
using AIMS;
|
|
using AIMSBLL;
|
|
using AIMSModel;
|
|
using System;
|
|
using System.Windows.Forms;
|
|
|
|
namespace DataDictionary.UI
|
|
{
|
|
public partial class frmOperationPosition : Form
|
|
{
|
|
public AIMSExtension.EditState _state;
|
|
private int SelectOperationRowId = 0;
|
|
public frmOperationPosition()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
private void frmOperationPosition_Load(object sender, EventArgs e)
|
|
{
|
|
ControlExtension.SetDgvAttribute(dgvOperation);
|
|
ControlExtension.EnabledControl(panel1, false);
|
|
ControlExtension.ClearControl(panel1);
|
|
_state = AIMSExtension.EditState.BROWSE;
|
|
dgvOperation.DataSource = BOperationPosition.GetDataTable();
|
|
}
|
|
private void tsbAdd_Click(object sender, EventArgs e)
|
|
{
|
|
_state = AIMSExtension.EditState.ADD;
|
|
ControlExtension.EnabledControl(panel1, true);
|
|
ControlExtension.ClearControl(panel1);
|
|
chkIsValid.Checked = true;
|
|
intMenuOrder.Value = 0;
|
|
}
|
|
|
|
private void tsbModify_Click(object sender, EventArgs e)
|
|
{
|
|
_state = AIMSExtension.EditState.EDIT;
|
|
ControlExtension.EnabledControl(panel1, true);
|
|
//txtName.Enabled = false;
|
|
if (dgvOperation.Rows.Count > 0)
|
|
{
|
|
SelectOperationRowId = int.Parse(dgvOperation.CurrentRow.Cells["Id"].Value.ToString());
|
|
txtName.Text = dgvOperation.CurrentRow.Cells["NameColumn"].Value.ToString();
|
|
txtHelpCode.Text = dgvOperation.CurrentRow.Cells["HelpCode"].Value.ToString();
|
|
txtExplain.Text = dgvOperation.CurrentRow.Cells["Explain"].Value.ToString();
|
|
intMenuOrder.Value = int.Parse(dgvOperation.CurrentRow.Cells["PositionOrder"].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())
|
|
{
|
|
OperationPosition OperationObj = new OperationPosition();
|
|
OperationObj.Name = txtName.Text.Trim();
|
|
OperationObj.HelpCode = txtHelpCode.Text;
|
|
OperationObj.Explain = txtExplain.Text;
|
|
OperationObj.PositionOrder = intMenuOrder.Value;
|
|
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 (BOperationPosition.IsExit(txtName.Text.Trim()))
|
|
{
|
|
MessageBox.Show("该部位已存在");
|
|
return;
|
|
}
|
|
BOperationPosition.Add(OperationObj);
|
|
}
|
|
if (_state == AIMSExtension.EditState.EDIT)
|
|
{
|
|
OperationObj.Id = SelectOperationRowId;
|
|
BOperationPosition.Update(OperationObj);
|
|
}
|
|
}
|
|
_state = AIMSExtension.EditState.BROWSE;
|
|
ControlExtension.EnabledControl(panel1, false);
|
|
ControlExtension.ClearControl(panel1);
|
|
dgvOperation.DataSource = BOperationPosition.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);
|
|
}
|
|
}
|
|
}
|