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

📄 financeda.cs

📁 实现房产销售的房屋管理 客户管理 并且在客户管理中实现了对预定客户和已购房客户的查询和修改
💻 CS
字号:
using System;
using System.Data;
using System.Data.SqlClient;
using HouseBE;

namespace HouseDA
{
	/// <summary>
	/// FinanceDA 的摘要说明。
	/// </summary>
	public class FinanceDA:CommonDA
	{
		private SqlConnection _con;
		private ConDA _cons;
		private SqlCommand _cmd;
		private SqlDataAdapter _adapter;
		private DataSet _ds;
		private HouseBE.Finance _finance;
       
		public HouseBE.Finance finance
		{
			set
			{
			this._finance=value;
			}
			get
			{
			 return this._finance;
			}
		}
		public FinanceDA()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
			this._cons=new ConDA();
			this._con=this._cons._con;
		}
		#region CommonDA 成员

		public DataSet select()
		{
			// TODO:  添加 FinanceDA.select 实现
			try
			{
				this._adapter=new SqlDataAdapter("select * from Finance",this._con);
				this._ds=new DataSet();
				this._adapter.Fill(this._ds,"Finance");
			}
			catch(Exception ex)
			{
			  Console.WriteLine(ex.Message);
			  throw ex;
			}
			return this._ds;
		}

		public void insert()
		{
			// TODO:  添加 FinanceDA.insert 实现
			this._cmd=this._con.CreateCommand();
			this._cmd.CommandText="insert into Finance values(@SellDate,@TotalMoney,@Remark)";
			this._cmd.Parameters.Add("@SellDate",this._finance.SellDate);
			this._cmd.Parameters.Add("@TotalMoney",this._finance.TotalMoney);
			this._cmd.Parameters.Add("@Remark",this._finance.Remark);

			try
			{
			   this._con.Open();
				this._cmd.ExecuteNonQuery();

			}
			catch(Exception ex)
			{
				Console.WriteLine(ex.Message);
				throw ex;
			}
			finally
			{
			  this._con.Close();
			}
		}

		public void update()
		{
			// TODO:  添加 FinanceDA.update 实现
			this._cmd=this._con.CreateCommand();
			this._cmd.CommandText="update Finance set SellDate=@SellDate,TotalMoney=@TotalMoney,Remark=@Remark where SellID=@SellID";
			this._cmd.Parameters.Add("@SellDate",this._finance.SellDate);
			this._cmd.Parameters.Add("@TotalMoney",this._finance.TotalMoney);
			this._cmd.Parameters.Add("@Remark",this._finance.Remark);
			this._cmd.Parameters.Add("@SellID",this._finance.SellID);

			try
			{
				this._con.Open();
				this._cmd.ExecuteNonQuery();

			}
			catch(Exception ex)
			{
				Console.WriteLine(ex.Message);
				throw ex;
			}
			finally
			{
				this._con.Close();
			}
		}
       //调用存储过程
		public void delete()
		{
			// TODO:  添加 FinanceDA.delete 实现
			this._cmd=this._con.CreateCommand();
			this._cmd.CommandType=CommandType.StoredProcedure;
			this._cmd.CommandText="proc_Finance";
			this._cmd.Parameters.Add("@SellID",this._finance.SellID);
			try
			{
				this._con.Open();
				this._cmd.ExecuteNonQuery();
			}
			catch(Exception ex)
			{
				Console.WriteLine(ex.Message);
				throw ex;
			}
			finally
			{
				this._con.Close();
			}
		}

		#endregion
	}
}

⌨️ 快捷键说明

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