frmpolice.cs

来自「很久 宏观经济韩国锦湖国家交换机海关核发个回复光滑」· CS 代码 · 共 187 行

CS
187
字号
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using HallySoft.Runtime.Database;
using HallySoft.RFID;

namespace UtPiowmsRFID
{
	public partial class frmPolice : DevComponents.DotNetBar.Office2007Form
	{
		public frmPolice()
		{
			InitializeComponent();
		}

		private void frmPolice_Resize(object sender, EventArgs e)
		{
			panel1.Left = this.Width / 2 - panel1.Width / 2;
			panel2.Left = this.Width / 2 - panel2.Width / 2;
			panel3.Left = this.Width / 2 - panel3.Width / 2;
			panel4.Left = this.Width / 2 - panel4.Width / 2;
		}

		private void frmPolice_Load(object sender, EventArgs e)
		{
			GetJYXXTable();
		}

		public void GetJYXXTable()
		{
			SqlAccess saa = new SqlAccess();
			saa.ConnectionString = AppInfo.ConnStr;
			dataGridView1.AutoGenerateColumns = true;
			dataGridView1.DataSource = saa.SQLDataSet(@"select
Number as 警员编号,
Name as 警员姓名,
Sex as 警员性别,
CardType as 证件名称,
CardNum as 证件号码,
CardClass as 人员级别,
InTime as 调入时间,
State as 在职状态,	
Remarks as 备注,
Remarks as 特征
from [Police]").Tables[0];

		}

		private void dataGridView1_Click(object sender, EventArgs e)
		{
			if (dataGridView1.SelectedRows.Count == 0)
				return;
			string num = dataGridView1.SelectedCells[0].Value.ToString();
			if (num.Trim() == "") return;
			Police pol = new Police();
			pol.GetInfo(num);
			txtPoliceID.Text = pol.ID.ToString();
			txtPoliceNumber.Text = pol.Number.Trim();
			txtPoliceName.Text = pol.Name.Trim();
			cbxPoliceSex.SelectedIndex = pol.Sex;
			cbxPoliceCardType.SelectedIndex = pol.CardType;
			txtPoliceCardNum.Text = pol.CardNum.Trim();
			txtPoliceCardAddress.Text = pol.CardAddress.Trim();
			txtPolicePostal.Text = pol.Postal.Trim();
			txtPoliceAddress.Text = pol.Address.Trim();
			txtPolicePostalCode.Text = pol.PostalCode.Trim();
			txtPolicePhone.Text = pol.Phone.Trim();
			cbxPoliceCardClass.SelectedIndex = pol.CardClass;
			tmePoliceInTime.Value = pol.InTime;
			cbxPoliceState.SelectedIndex = pol.State;
			txtPoliceRemarks.Text = pol.Remarks.Trim();
			txtPoliceResume.Text = pol.Resume.Trim();
			txtPoliceCharacteristic.Text = pol.Characteristic.Trim();

			pol = null;
		}

		private void buttonX24_Click(object sender, EventArgs e)
		{
			Police pol = new Police();
			pol.Number = txtPoliceNumber.Text.Trim();
			pol.Name = txtPoliceName.Text.Trim();
			pol.Sex = cbxPoliceSex.SelectedIndex;
			pol.CardType = cbxPoliceCardType.SelectedIndex;
			pol.CardNum = txtPoliceCardNum.Text.Trim();
			pol.CardAddress = txtPoliceAddress.Text.Trim();
			pol.Postal = txtPolicePostal.Text.Trim();
			pol.Address = txtPoliceAddress.Text.Trim();
			pol.PostalCode = txtPolicePostalCode.Text.Trim();
			pol.Phone = txtPolicePhone.Text.Trim();
			pol.CardClass = cbxPoliceCardClass.SelectedIndex;
			pol.InTime = tmePoliceInTime.Value;
			pol.State = cbxPoliceState.SelectedIndex;
			pol.Remarks = txtPoliceRemarks.Text.Trim();
			pol.Resume = txtPoliceResume.Text.Trim();
			pol.Characteristic = txtPoliceCharacteristic.Text.Trim();

			if (pol.Name == "")
			{
				MessageBox.Show("警员姓名不能为空!");
				txtPoliceName.Focus();
				return;
			}

			if (pol.Number == "")
			{
				MessageBox.Show("警员编号不能为空!");
				txtPoliceNumber.Focus();
				return;
			}

			pol.AddRecord();
			GetJYXXTable();
		}

		private void buttonX25_Click(object sender, EventArgs e)
		{
			//应用
			Police pol = new Police();
			pol.ID = Convert.ToInt32(txtPoliceID.Text);
			pol.Number = txtPoliceNumber.Text.Trim();
			pol.Name = txtPoliceName.Text.Trim();
			pol.Sex = cbxPoliceSex.SelectedIndex;
			pol.CardType = cbxPoliceCardType.SelectedIndex;
			pol.CardNum = txtPoliceCardNum.Text.Trim();
			pol.CardAddress = txtPoliceAddress.Text.Trim();
			pol.Postal = txtPolicePostal.Text.Trim();
			pol.Address = txtPoliceAddress.Text.Trim();
			pol.PostalCode = txtPolicePostalCode.Text.Trim();
			pol.Phone = txtPolicePhone.Text.Trim();
			pol.CardClass = cbxPoliceCardClass.SelectedIndex;
			pol.InTime = tmePoliceInTime.Value;
			pol.State = cbxPoliceState.SelectedIndex;
			pol.Remarks = txtPoliceRemarks.Text.Trim();
			pol.Resume = txtPoliceResume.Text.Trim();
			pol.Characteristic = txtPoliceCharacteristic.Text.Trim();

			if (pol.Name == "")
			{
				MessageBox.Show("警员姓名不能为空!");
				txtPoliceName.Focus();
				return;
			}

			if (pol.Number == "")
			{
				MessageBox.Show("警员编号不能为空!");
				txtPoliceNumber.Focus();
				return;
			}

			pol.UpDate();
			GetJYXXTable();
		}

		private void buttonX23_Click(object sender, EventArgs e)
		{
			//取消
			Police pol = new Police();
			txtPoliceID.Text = "";
			txtPoliceNumber.Text = "";
			txtPoliceName.Text = "";
			cbxPoliceSex.SelectedIndex = 0;
			cbxPoliceCardType.SelectedIndex = 0;
			txtPoliceCardNum.Text = "";
			txtPoliceCardAddress.Text = "";
			txtPolicePostal.Text = "";
			txtPoliceAddress.Text = "";
			txtPolicePostalCode.Text = "";
			txtPolicePhone.Text = "";
			cbxPoliceCardClass.SelectedIndex = 0;
			tmePoliceInTime.Value = DateTime.Now;
			cbxPoliceState.SelectedIndex = 0;
			txtPoliceRemarks.Text = "";
			txtPoliceResume.Text = "";
			txtPoliceCharacteristic.Text = "";
			this.Close();
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?