📄 补发卡系统.cs
字号:
namespace 毕业设计
{
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace 软件系统
{
/// <summary>
/// 补发卡 的摘要说明。
/// </summary>
public class 补发卡系统 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox cmbUserid;
private int usertype=-1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox cmbType;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnConfirm;
public string CardNo=null;
毕业设计.数据处理.数据处理 处理数据;
public 补发卡系统()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.cmbUserid = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.cmbType = new System.Windows.Forms.ComboBox();
this.btnCancel = new System.Windows.Forms.Button();
this.btnConfirm = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(24, 24);
this.label1.Name = "label1";
this.label1.TabIndex = 0;
this.label1.Text = "学号/编号";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// cmbUserid
//
this.cmbUserid.Location = new System.Drawing.Point(136, 24);
this.cmbUserid.Name = "cmbUserid";
this.cmbUserid.Size = new System.Drawing.Size(121, 20);
this.cmbUserid.TabIndex = 1;
//
// label2
//
this.label2.Location = new System.Drawing.Point(24, 64);
this.label2.Name = "label2";
this.label2.TabIndex = 2;
this.label2.Text = "用户类型";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// cmbType
//
this.cmbType.Items.AddRange(new object[] {
"全部",
"学生",
"老师"});
this.cmbType.Location = new System.Drawing.Point(136, 64);
this.cmbType.Name = "cmbType";
this.cmbType.Size = new System.Drawing.Size(121, 20);
this.cmbType.TabIndex = 3;
this.cmbType.Text = "全部";
this.cmbType.SelectedIndexChanged += new System.EventHandler(this.cmbType_SelectedIndexChanged);
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(160, 96);
this.btnCancel.Name = "btnCancel";
this.btnCancel.TabIndex = 4;
this.btnCancel.Text = "取消";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnConfirm
//
this.btnConfirm.Location = new System.Drawing.Point(48, 96);
this.btnConfirm.Name = "btnConfirm";
this.btnConfirm.TabIndex = 5;
this.btnConfirm.Text = "确定";
this.btnConfirm.Click += new System.EventHandler(this.btnConfirm_Click);
//
// 补发卡系统
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 134);
this.Controls.Add(this.btnConfirm);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.cmbType);
this.Controls.Add(this.label2);
this.Controls.Add(this.cmbUserid);
this.Controls.Add(this.label1);
this.Name = "补发卡系统";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "补发卡系统";
this.Load += new System.EventHandler(this.补发卡系统_Load);
this.ResumeLayout(false);
}
#endregion
private void 补发卡系统_Load(object sender, System.EventArgs e)
{
处理数据=new 毕业设计.数据处理.数据处理();
this.cmbUserid.DataSource=处理数据.GetNoCardUser(usertype).Tables[0];
this.cmbUserid.DisplayMember="userid";
this.cmbUserid.ValueMember="userid";
}
private void cmbType_SelectedIndexChanged(object sender, System.EventArgs e)
{
if(this.cmbType.Text=="全部")
{
this.usertype=-1;
}
if(this.cmbType.Text=="学生")
{
this.usertype=0;
}
if(this.cmbType.Text=="老师")
{
this.usertype=1;
}
System.Data.DataTable dtb=处理数据.GetNoCardUser(usertype).Tables[0];
this.cmbUserid.DataSource=处理数据.GetNoCardUser(usertype).Tables[0];
this.cmbUserid.DisplayMember="userid";
this.cmbUserid.ValueMember="userid";
}
private void btnCancel_Click(object sender, System.EventArgs e)
{
this.Dispose(true);
}
private void btnConfirm_Click(object sender, System.EventArgs e)
{
if(处理数据.UpdataCard(this.cmbUserid.Text,this.CardNo))
{
MessageBox.Show("发卡成功!");
this.Dispose(true);
}
else
{
MessageBox.Show("发卡失败!");
this.Dispose(true);
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -