📄 frmaddusercheck.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using PMS.PMSClass;
namespace PMS
{
public partial class frmAddUserCheck : Form
{
public frmAddUserCheck()
{
InitializeComponent();
}
DBOperate operate = new DBOperate();
private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void frmAddUserCheck_Load(object sender, EventArgs e)
{
operate.BindDropdownlist("tb_employee",cbbnum,1);
}
private void cbbnum_SelectedIndexChanged(object sender, EventArgs e)
{
string sql = "select * from tb_employee where employeeID='"+cbbnum.Text+"'";
DataSet ds = operate.GetTable(sql);
ds.Dispose();
txtdep.Text = ds.Tables[0].Rows[0][4].ToString();
txtname.Text = ds.Tables[0].Rows[0][2].ToString();
}
private void 添加ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (cbbnum.Text == "" || txtcontent.Text == "" || txtresult.Text == "" || txtkp.Text == "" || txtscore.Text == "")
{
MessageBox.Show("请将信息填写完整", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
else
{
string sql = "select count(*) from tb_check where PID='"+cbbnum.Text+"'";
int i = operate.HumanNum(sql);
if (i > 0)
{
MessageBox.Show("该员工已经做过考评!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
else
{
string addstr = "insert into tb_check(PID,Pname,Pdep,PKpcontent,PKpResult,PKpscore,PKpPeople,PKpDate) values('" + cbbnum.Text + "','" + txtname.Text + "','" + txtdep.Text + "','" + txtcontent.Text + "','" + txtresult.Text + "','" + txtscore.Text + "','" + txtkp.Text + "','" + txtkpdate.Text+ "')";
if (operate.OperateData(addstr) > 0)
{
MessageBox.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
private void txtscore_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar != 8 && !char.IsDigit(e.KeyChar))
{
MessageBox.Show("只能输入数字", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
e.Handled = true;
}
}
private void txtscore_TextChanged(object sender, EventArgs e)
{
try
{
if (txtscore.Text == "")
{
MessageBox.Show("分数不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
else
{
if (Convert.ToInt32(txtscore.Text) > 100)
{
MessageBox.Show("满分为100分", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
}
catch
{
MessageBox.Show("输入有误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -