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

📄 assetoperate.cs

📁 本系统为资产管理系统
💻 CS
📖 第 1 页 / 共 5 页
字号:
				}
				else
				{
					if (asset)
					{
						asset ass = new asset();
						SqlConnection conn = new SqlConnection(ass.getConnectionString);
						conn.Open();
						SqlCommand cmd = new SqlCommand("AddValuation",conn);
						cmd.CommandType = CommandType.StoredProcedure;
						SqlParameter ValuationNo = new SqlParameter("@valuationNo",SqlDbType.VarChar,10);
						ValuationNo.Value = this.textBox14.Text;
						cmd.Parameters.Add(ValuationNo);
						SqlParameter AssetNo = new SqlParameter("@assetNo",SqlDbType.VarChar,10);
						AssetNo.Value = this.textBox12.Text;
						cmd.Parameters.Add(AssetNo);
						SqlParameter employeeNo = new SqlParameter("@employeeNo",SqlDbType.VarChar,10);
						employeeNo.Value = this.EmployeeNo;
						cmd.Parameters.Add(employeeNo);
						SqlParameter valuation = new SqlParameter("@valuationDate",SqlDbType.VarChar,20);
						valuation.Value = this.dateTimePicker6.Value.ToString();
						cmd.Parameters.Add(valuation);
						SqlParameter valuationPrice = new SqlParameter("@valuationPrice",SqlDbType.Float,8);
						try
						{
							valuationPrice.Value = float.Parse(this.textBox16.Text);
						}
						catch
						{
							MessageBox.Show("价格输入格式不正确!");
						}
						cmd.Parameters.Add(valuationPrice);
						try
						{
							cmd.ExecuteNonQuery();
							MessageBox.Show("success");

						}
						catch
						{
							MessageBox.Show("error");
						}
						conn.Close();
					}
					else
					{
						MessageBox.Show("资产号不存在!");
						this.textBox12.Text = "";
						this.textBox12.Focus();
					}
				}
			}
		}

		private void dateTimePicker1_ValueChanged(object sender, System.EventArgs e)
		{
		
		}

		private void tabPage1_Click(object sender, System.EventArgs e)
		{
		
		}

		private void tabPage4_Click(object sender, System.EventArgs e)
		{
		
		}

		private void textBox4_TextChanged(object sender, System.EventArgs e)
		{
			if (this.textBox4.Text.Trim().Length > 8)
			{
				MessageBox.Show ("员工号不超过8位!");
				this.textBox4.Text = "";
				this.textBox4.Focus();
			}
			else
			{
				Connection s = new Connection();
				SqlConnection conn = new SqlConnection(s.getConnectionString);
				conn.Open();
				string str1 = "select * from employee";
				SqlCommand cmd1 = new SqlCommand(str1,conn);
				SqlDataReader dr1 = cmd1.ExecuteReader();
				while (dr1.Read())
				{
					if (this.textBox4.Text.Trim() == Convert.ToString(dr1["employeeNo"]))
					{
						this.label12.Text = Convert.ToString(dr1["employeeName"]);
						this.checking = true;
						break;
					}
					checking = false;
				}
				dr1.Close();
				conn.Close();
			}
			if (!checking)
			{
				this.label12.Text = "";
			}
		}

		private void comboBox2_SelectedIndexChanged(object sender, System.EventArgs e)
		{

		}

		private void comboBox2_TextChanged(object sender, System.EventArgs e)
		{
			this.comboBox2.Text = "";
		}

		private void comboBox1_TextChanged(object sender, System.EventArgs e)
		{
			this.comboBox1.Text = "";
		}

		private void button3_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void textBox12_TextChanged(object sender, System.EventArgs e)
		{
			if (this.textBox12.Text.Trim().Length > 10)
			{
				MessageBox.Show("资产号长度不超过10位!");
				this.textBox12.Focus();
			}
			else
			{
				Connection s = new Connection();
				SqlConnection conn = new SqlConnection(s.getConnectionString);
				conn.Open();
				string str = "select * from asset";
				SqlCommand cmd  = new SqlCommand(str,conn);
				SqlDataReader dr = cmd.ExecuteReader();
				while (dr.Read())
				{
					if (this.textBox12.Text.Trim() == Convert.ToString(dr["assetNo"]))
					{
						asset = true;
						break;
					}
					asset = false;
				}
				dr.Close();
				conn.Close();
			}
		}

		private void button2_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void button4_Click(object sender, System.EventArgs e)
		{
			this.textBox12.Text = "";
			this.textBox14.Text = "";
			this.textBox16.Text = "";
		}

		private void button11_Click_1(object sender, System.EventArgs e)
		{
			this.textBox17.Text = "";
			this.textBox18.Text = "";
			this.textBox20.Text = "";
			this.textBox4.Text = "";
			this.textBox24.Text = "";
		}

		private void button12_Click(object sender, System.EventArgs e)
		{
			this.textBox1.Text = "";
			this.textBox3.Text = "";
			this.textBox5.Text = "";
			this.textBox2.Text = "";
			this.textBox27.Text = "";
		}

		private void textBox5_TextChanged(object sender, System.EventArgs e)
		{
			bool shen  = false;
			if (this.textBox5.Text.Trim().Length > 8)
			{
				MessageBox.Show ("员工号不超过8位!");
				this.textBox5.Text = "";
				this.textBox5.Focus();
			}
			else
			{
				Connection s = new Connection();
				SqlConnection conn = new SqlConnection(s.getConnectionString);
				conn.Open();
				string str1 = "select * from employee";
				SqlCommand cmd1 = new SqlCommand(str1,conn);
				SqlDataReader dr1 = cmd1.ExecuteReader();
				while (dr1.Read())
				{
					if (this.textBox5.Text.Trim() == Convert.ToString(dr1["employeeNo"]))
					{
						this.label8.Text = Convert.ToString(dr1["employeeName"]);
						shen = true;
						break;
					}
					//shen = false;
				}
				dr1.Close();
				conn.Close();
			}
			if (!shen)
			{
				this.label8.Text = "";
			}
		}

		private void textBox1_TextChanged(object sender, System.EventArgs e)
		{
		
		}

		private void textBox2_TextChanged(object sender, System.EventArgs e)
		{
			string s = "";
			if (this.textBox2.Text.Trim().Length > 20)
			{
				MessageBox.Show("输入数据无效!");
				this.textBox2.Text = "";
				this.textBox2.Focus();
			}
			else
			{
				if (this.textBox2.Text.Trim() != "")
				{
					s = this.textBox2.Text.Trim();
					for (int i = 0;i < s.Length;i++)
					{
						if (s[i] >= '0'&&s[i] <= '9')
						{
							continue;
						}
						else
						{
							MessageBox.Show(" 序列号应为数字!");
							this.textBox2.Text = "";
							this.textBox2.Focus();
						}
					}
				}
			}
		}

		private void textBox3_TextChanged(object sender, System.EventArgs e)
		{
			string s = "";
			if (this.textBox3.Text.Trim().Length > 10)
			{
				MessageBox.Show("输入数据无效!");
				this.textBox3.Text = "";
				this.textBox3.Focus();
			}
			else
			{
				if (this.textBox3.Text.Trim() != "")
				{
					s = this.textBox3.Text.Trim();
					for (int i = 0;i < s.Length;i++)
					{
						if (s[i] >= '0'&&s[i] <= '9')
						{
							continue;
						}
						else
						{
							MessageBox.Show(" 购买价格应为数字!");
							this.textBox3.Text = "";
							this.textBox3.Focus();
						}
					}
					if ((s.Length >= 2) && (s[0] == '0'))
					{
						MessageBox.Show("无效数据,请重输!");
						this.textBox3.Text = "";
						this.textBox3.Focus();
					}
				}
			}
		}

		private void textBox16_TextChanged(object sender, System.EventArgs e)
		{
			string s = "";
			if (this.textBox16.Text.Trim().Length > 10)
			{
				MessageBox.Show("输入数据无效!");
				this.textBox16.Text = "";
				this.textBox16.Focus();
			}
			else
			{
				if (this.textBox16.Text.Trim() != "")
				{
					s = this.textBox16.Text.Trim();
					for (int i = 0;i < s.Length;i++)
					{
						if (s[i] >= '0'&&s[i] <= '9')
						{
							continue;
						}
						else
						{
							MessageBox.Show(" 当前价值应为数字!");
							this.textBox16.Text = "";
							this.textBox16.Focus();
						}
					}
					if ((s.Length >= 2) && (s[0] == '0'))
					{
						MessageBox.Show("无效数据,请重输!");
						this.textBox16.Text = "";
						this.textBox16.Focus();
					}
				}
			}
		}

		private void textBox20_TextChanged(object sender, System.EventArgs e)
		{
			string s = "";
			if (this.textBox20.Text.Trim().Length > 10)
			{
				MessageBox.Show("输入数据无效!");
				this.textBox20.Text = "";
				this.textBox20.Focus();
			}
			else
			{
				if (this.textBox20.Text.Trim() != "")
				{
					s = this.textBox20.Text.Trim();
					for (int i = 0;i < s.Length;i++)
					{
						if (s[i] >= '0'&&s[i] <= '9')
						{
							continue;
						}
						else
						{
							MessageBox.Show(" 购买价格应为数字!");
							this.textBox20.Text = "";
							this.textBox20.Focus();
						}
					}
					if ((s.Length >= 2) && (s[0] == '0'))
					{
						MessageBox.Show("无效数据,请重输!");
						this.textBox20.Text = "";
						this.textBox20.Focus();
					}
				}
			}
		}



		/*private void button3_Click(object sender, System.EventArgs e)
		{
			asset Asset = new asset();
			Asset.Open();
			string str = "select * from Asset";
			SqlCommand cmd = new SqlCommand(str,Asset.getConnection);
			SqlDataReader dr = cmd.ExecuteReader();
			while (dr.Read())
			{
				if (dr.GetString(0) == this.textBox6.Text)
				{

				}
			}
		}*/



	}
}

⌨️ 快捷键说明

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