brushwedgeframe.cs
来自「独立完成考勤管理软件加打卡系统(C#) 是打卡加管理系统软件 」· CS 代码 · 共 199 行
CS
199 行
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
namespace WindowsApplication
{
/// <summary>
/// BrushWedgeFrame 的摘要说明。
/// </summary>
public class BrushWedgeFrame : System.Windows.Forms.Form
{
#region Vaiable Statement
public static string strKaHao="";
public string InsertSql="";
#endregion
#region Controls Statement
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnShuaKa;
private System.Windows.Forms.TextBox textKaHao;
private System.Windows.Forms.Button btnOk;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
#endregion
#region DataBase Vairable Define
private ConnectionData conn=new ConnectionData();
private DataSet kaHaoSet=new DataSet();
private DataTable kaHaoTable=new DataTable();
#endregion
#region 构造函数
public BrushWedgeFrame()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#endregion
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(BrushWedgeFrame));
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.textKaHao = new System.Windows.Forms.TextBox();
this.btnShuaKa = new System.Windows.Forms.Button();
this.btnOk = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.BackColor = System.Drawing.SystemColors.Desktop;
this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label1.ForeColor = System.Drawing.Color.White;
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(306, 32);
this.label1.TabIndex = 0;
this.label1.Text = "刷卡记录";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label2
//
this.label2.Location = new System.Drawing.Point(16, 48);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 23);
this.label2.TabIndex = 1;
this.label2.Text = "卡号:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// textKaHao
//
this.textKaHao.BackColor = System.Drawing.Color.White;
this.textKaHao.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textKaHao.Location = new System.Drawing.Point(96, 48);
this.textKaHao.Name = "textKaHao";
this.textKaHao.Size = new System.Drawing.Size(176, 21);
this.textKaHao.TabIndex = 2;
this.textKaHao.Text = "";
//
// btnShuaKa
//
this.btnShuaKa.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnShuaKa.Location = new System.Drawing.Point(200, 88);
this.btnShuaKa.Name = "btnShuaKa";
this.btnShuaKa.Size = new System.Drawing.Size(75, 24);
this.btnShuaKa.TabIndex = 3;
this.btnShuaKa.Text = "刷卡(&R)";
this.btnShuaKa.Click += new System.EventHandler(this.btnShuaKa_Click);
//
// btnOk
//
this.btnOk.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnOk.Location = new System.Drawing.Point(104, 88);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(75, 24);
this.btnOk.TabIndex = 4;
this.btnOk.Text = "确定(&O)";
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// BrushWedgeFrame
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
this.ClientSize = new System.Drawing.Size(306, 127);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.btnShuaKa);
this.Controls.Add(this.textKaHao);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "BrushWedgeFrame";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "BrushWedgeFrame";
this.Load += new System.EventHandler(this.BrushWedgeFrame_Load);
this.ResumeLayout(false);
}
#endregion
#region 事件开始....
private void BrushWedgeFrame_Load(object sender, System.EventArgs e)
{
#region 赋值
BrushWedgeFrame.strKaHao=StandInterfaceFrame.strReserice;
#endregion
}
#endregion
#region 刷卡事件
private void btnShuaKa_Click(object sender, System.EventArgs e)
{
this.textKaHao.Text=BrushWedgeFrame.strKaHao;
StandInterfaceFrame log=new StandInterfaceFrame();
log.ShowDialog();
if(StandInterfaceFrame.strResericePortIdData.Equals(""))
{
MessageBox.Show(this,"你还没有刷卡呢???","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
this.textKaHao.Text=StandInterfaceFrame.strResericePortIdData.ToString().Trim();
}
#endregion
#region confire Event
private void btnOk_Click(object sender, System.EventArgs e)
{
InsertSql="Insert into Employee(卡号,时间)values('"+this.textKaHao.Text+"','"+StandInterfaceFrame.strResericePortIdData.ToString()+"')";
try
{
int k=conn.ExcuteStrSql(InsertSql);
if(k>0)
{
MessageBox.Show(this,"数据库加入数据成功!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
else
{
MessageBox.Show(this,"数据库加入数据失败!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
catch(Exception elee)
{
MessageBox.Show(this,elee.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
#endregion
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?