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

📄 bargainda.cs

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

namespace HouseDA
{
	/// <summary>
	/// BargainDA 的摘要说明。
	/// </summary>
	public class BargainDA:CommonDA
	{
		private SqlConnection _con;
		private SqlDataAdapter _adapter;
		private SqlCommand _cmd;
		private DataSet _ds;
		private ConDA _cons;
		private HouseBE.Bargain _bargain;

		public HouseBE.Bargain bargain
		{
			set
			{
			  this._bargain=value;
			}
			get
			{
			 return this._bargain;
			}
		}
		public BargainDA()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
			this._cons=new ConDA();
			this._con=this._cons._con;
		}
		#region CommonDA 成员

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

		public void insert()
		{
			// TODO:  添加 BargainDA.insert 实现
			this._cmd=this._con.CreateCommand();
			this._cmd.CommandText="insert into Bargain values (@BargainNO,@ClientID,@SellFashion,@Remark) ";
			this._cmd.Parameters.Add("@BargainNO",this._bargain.BargainNO);
			this._cmd.Parameters.Add("@ClientID",this._bargain.ClientID);
			this._cmd.Parameters.Add("@SellFashion",this._bargain.SellFashion);
			this._cmd.Parameters.Add("@Remark",this._bargain.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:  添加 BargainDA.update 实现
			this._cmd=this._con.CreateCommand();
			this._cmd.CommandText="update Bargain set Remark=@Remark where BargainNO=@BargainNO";
			this._cmd.Parameters.Add("@Remark",this._bargain.Remark);
			this._cmd.Parameters.Add("@BargainNO",this._bargain.BargainNO);

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

		public void delete()
		{
			// TODO:  添加 BargainDA.delete 实现
			this._cmd.CommandType=CommandType.StoredProcedure;
			this._cmd.CommandText="proc_Branch";
			this._cmd.Parameters.Add("@BranchNO",this._bargain.BargainNO);
			try
			{
				this._con.Open();
				this._cmd.ExecuteNonQuery();
			}
			catch(Exception ex)
			{
				Console.WriteLine(ex.Message);
				throw ex;
			}
			finally
			{
			  this._con.Close();
			}
		}
		#endregion
		public DataSet Selects(HouseBE.Bargain bargain)
		{
			this._ds=new DataSet();
			//根据付款方式查询
			if(bargain.SellFashion!=null)
			{
				this._adapter=new SqlDataAdapter("select * from VIEW_Bargain where SellFashion='"+bargain.SellFashion+"'",this._con);
				this._adapter.Fill(this._ds,"SellFashion");
			}
			//根据客户编号查询
			else 
			{
			    this._adapter=new SqlDataAdapter("select * from VIEW_Bargain where ClientID="+bargain.ClientID+" ",this._con);
				this._adapter.Fill(this._ds,"ClientID");
			}
			return this._ds;
		}
	}
}

⌨️ 快捷键说明

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