⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 checkresult.cs

📁 固定资产的终端程序!里面有对数据的处理。 好东西
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using Lib;
using System.Data.SqlServerCe;
using AssetCheck.Libs;
using System.IO;
using System.Data;
namespace AssetCheck
{
	/// <summary>
	/// CheckResult 的摘要说明。
	/// </summary>
	public class CheckResult : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button btnOut;
		private System.Windows.Forms.Button btnExit;
		private System.Windows.Forms.Button btnSave;
		public System.Windows.Forms.TextBox txtCode;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Button btnQuery;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Label label7;
		public System.Windows.Forms.TextBox txtName;
		public System.Windows.Forms.TextBox txtSpec;
		public System.Windows.Forms.TextBox txtdepartment;
		public System.Windows.Forms.TextBox txtStatus;
		public System.Windows.Forms.TextBox txtManager;
		public System.Windows.Forms.TextBox txtStartDate;
		private System.Windows.Forms.Button btnModifyStatus;
	    private Code code=new Code(true);
		public static string UserID="";
		public CheckResult()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();
            code.OnGetCode+=new Lib.Code.GetCode(code_OnGetCode); 
			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}
		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.btnOut = new System.Windows.Forms.Button();
			this.btnExit = new System.Windows.Forms.Button();
			this.btnSave = new System.Windows.Forms.Button();
			this.txtCode = new System.Windows.Forms.TextBox();
			this.label2 = new System.Windows.Forms.Label();
			this.btnQuery = new System.Windows.Forms.Button();
			this.txtName = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.txtSpec = new System.Windows.Forms.TextBox();
			this.label3 = new System.Windows.Forms.Label();
			this.txtdepartment = new System.Windows.Forms.TextBox();
			this.label4 = new System.Windows.Forms.Label();
			this.txtStatus = new System.Windows.Forms.TextBox();
			this.label5 = new System.Windows.Forms.Label();
			this.txtManager = new System.Windows.Forms.TextBox();
			this.label6 = new System.Windows.Forms.Label();
			this.txtStartDate = new System.Windows.Forms.TextBox();
			this.label7 = new System.Windows.Forms.Label();
			this.btnModifyStatus = new System.Windows.Forms.Button();
			// 
			// btnOut
			// 
			this.btnOut.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
			this.btnOut.Location = new System.Drawing.Point(162, 160);
			this.btnOut.Size = new System.Drawing.Size(80, 27);
			this.btnOut.Text = "> .导出";
			this.btnOut.Click += new System.EventHandler(this.btnOut_Click);
			// 
			// btnExit
			// 
			this.btnExit.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
			this.btnExit.Location = new System.Drawing.Point(81, 160);
			this.btnExit.Size = new System.Drawing.Size(80, 27);
			this.btnExit.Text = "< .退出";
			this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
			// 
			// btnSave
			// 
			this.btnSave.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
			this.btnSave.Location = new System.Drawing.Point(0, 160);
			this.btnSave.Size = new System.Drawing.Size(80, 27);
			this.btnSave.Text = "ENT.保存";
			this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
			// 
			// txtCode
			// 
			this.txtCode.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
			this.txtCode.Location = new System.Drawing.Point(44, -1);
			this.txtCode.Size = new System.Drawing.Size(190, 26);
			this.txtCode.Text = "";
			this.txtCode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.CheckResult_KeyDown);
			this.txtCode.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.CheckResult_KeyPress);
			// 
			// label2
			// 
			this.label2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
			this.label2.Location = new System.Drawing.Point(-2, 3);
			this.label2.Size = new System.Drawing.Size(72, 19);
			this.label2.Text = "条码:";
			// 
			// btnQuery
			// 
			this.btnQuery.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
			this.btnQuery.Location = new System.Drawing.Point(138, 187);
			this.btnQuery.Size = new System.Drawing.Size(104, 27);
			this.btnQuery.Text = "F+F3 .查找";
			this.btnQuery.Click += new System.EventHandler(this.btnQuery_Click);
			// 
			// txtName
			// 
			this.txtName.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
			this.txtName.Location = new System.Drawing.Point(44, 25);
			this.txtName.Size = new System.Drawing.Size(190, 26);
			this.txtName.Text = "";
			// 
			// label1
			// 
			this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
			this.label1.Location = new System.Drawing.Point(-2, 28);
			this.label1.Size = new System.Drawing.Size(72, 19);
			this.label1.Text = "名称:";
			// 
			// txtSpec
			// 
			this.txtSpec.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
			this.txtSpec.Location = new System.Drawing.Point(44, 51);
			this.txtSpec.Size = new System.Drawing.Size(190, 26);
			this.txtSpec.Text = "";
			// 
			// label3
			// 
			this.label3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
			this.label3.Location = new System.Drawing.Point(-2, 55);
			this.label3.Size = new System.Drawing.Size(72, 19);
			this.label3.Text = "型号:";
			// 
			// txtdepartment
			// 
			this.txtdepartment.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
			this.txtdepartment.Location = new System.Drawing.Point(44, 77);
			this.txtdepartment.Size = new System.Drawing.Size(190, 26);
			this.txtdepartment.Text = "";
			// 
			// label4
			// 
			this.label4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
			this.label4.Location = new System.Drawing.Point(-2, 81);
			this.label4.Size = new System.Drawing.Size(72, 19);
			this.label4.Text = "部门:";
			// 
			// txtStatus
			// 
			this.txtStatus.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
			this.txtStatus.Location = new System.Drawing.Point(170, 103);
			this.txtStatus.Size = new System.Drawing.Size(64, 26);
			this.txtStatus.Text = "";
			// 
			// label5
			// 
			this.label5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
			this.label5.Location = new System.Drawing.Point(125, 107);
			this.label5.Size = new System.Drawing.Size(72, 19);
			this.label5.Text = "状况:";
			// 
			// txtManager
			// 
			this.txtManager.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
			this.txtManager.Location = new System.Drawing.Point(44, 104);
			this.txtManager.Size = new System.Drawing.Size(80, 26);
			this.txtManager.Text = "";
			// 
			// label6
			// 
			this.label6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
			this.label6.Location = new System.Drawing.Point(-2, 109);
			this.label6.Size = new System.Drawing.Size(87, 19);
			this.label6.Text = "保管:";
			// 
			// txtStartDate
			// 
			this.txtStartDate.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
			this.txtStartDate.Location = new System.Drawing.Point(44, 131);
			this.txtStartDate.Size = new System.Drawing.Size(191, 26);
			this.txtStartDate.Text = "";
			// 
			// label7
			// 
			this.label7.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
			this.label7.Location = new System.Drawing.Point(-3, 136);
			this.label7.Size = new System.Drawing.Size(73, 19);
			this.label7.Text = "日期:";
			// 
			// btnModifyStatus
			// 
			this.btnModifyStatus.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
			this.btnModifyStatus.Location = new System.Drawing.Point(0, 187);
			this.btnModifyStatus.Size = new System.Drawing.Size(136, 27);
			this.btnModifyStatus.Text = "F+F1 .更改状况";
			this.btnModifyStatus.Click += new System.EventHandler(this.btnModifyStatus_Click);
			// 
			// CheckResult
			// 
			this.ClientSize = new System.Drawing.Size(242, 215);
			this.ControlBox = false;
			this.Controls.Add(this.btnModifyStatus);
			this.Controls.Add(this.txtStartDate);
			this.Controls.Add(this.label7);
			this.Controls.Add(this.txtManager);
			this.Controls.Add(this.label6);
			this.Controls.Add(this.txtStatus);
			this.Controls.Add(this.label5);
			this.Controls.Add(this.txtdepartment);
			this.Controls.Add(this.label4);
			this.Controls.Add(this.txtSpec);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.txtName);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.btnQuery);
			this.Controls.Add(this.btnOut);
			this.Controls.Add(this.btnExit);
			this.Controls.Add(this.btnSave);
			this.Controls.Add(this.txtCode);
			this.Controls.Add(this.label2);
			this.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold);
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Text = "盘点明细    F+F2 重置";
			this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
			this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.CheckResult_KeyDown);
			this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.CheckResult_KeyPress);
			this.Load += new System.EventHandler(this.CheckResult_Load);
			this.Closed += new System.EventHandler(this.CheckResult_Closed);

		}
		#endregion
		private bool Query()
		{
			//====
			SqlCeConnection conn=new SqlCeConnection(@"Data Source =Asset.sdf");
			//conn.Open();

			//SqlCeCommand cmd=conn.CreateCommand();
			//====

			UserID="";
			if(txtCode.Text.Trim()=="" )
			{
				MessageBox.Show("条码不能为空!");
				//E.Beep("",50,2670,2);
				//E.MessageShow(true,"条码不能空,请输入或扫描!"); 
				//E.Focus(txtCode);
				
				//====
				if(conn.State==ConnectionState.Open)
				{
					conn.Close();
				}
				//====

				return false;
			}
			SqlCeDataReader rdr=null;   
			try
			{
				//====
				//cmd.CommandText="";
				//cmd.CommandText+="select *  from Asset where BarCodes='"+txtCode.Text.Trim()+"'";
				//rdr=cmd.ExecuteReader();
				//====
				rdr=E.ExecRDR("select *  from Asset where BarCodes='"+txtCode.Text.Trim()+"'");
				
				if (rdr!=null)
				{
					if (rdr.Read())
					{
						try
						{
							txtName.Text=rdr.GetString(1).ToString();
							txtSpec.Text=rdr.GetString(2).ToString();
							txtdepartment.Text=rdr.GetString(3).ToString();
							txtManager.Text=rdr.GetString(4).ToString();

⌨️ 快捷键说明

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