📄 notsellsda.cs
字号:
using System;
using System.Data;
using System.Data.SqlClient;
using HouseBE;
namespace HouseDA
{
/// <summary>
/// NotSellsDA 的摘要说明。
/// </summary>
public class NotSellsDA:CommonDA
{
private SqlConnection _con;
private ConDA _cons;
private SqlCommand _cmd;
private SqlDataAdapter _adapter;
private DataSet _ds;
private HouseBE.House _house;
public HouseBE.House house
{
set
{
this._house=value;
}
get
{
return this._house;
}
}
public NotSellsDA()
{
//
// TODO: 在此处添加构造函数逻辑
//
this._cons=new ConDA();
this._con=this._cons._con;
}
#region CommonDA 成员
public DataSet select()
{
// TODO: 添加 NotSellsDA.select 实现
try
{
this._adapter=new SqlDataAdapter("select * from HouseNoSalesView",this._con);
this._ds=new DataSet();
this._adapter.Fill(this._ds,"HouseNoSalesView");
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
throw ex;
}
return this._ds;
}
public void insert()
{
// TODO: 添加 NotSellsDA.insert 实现
this._cmd=this._con.CreateCommand();
this._cmd.CommandText="insert into House values(@HouseNO,@ClientID,@LPID,@Age,@SpecID,@Area,@Address,@Price,@Remark,@Datetime)";
this._cmd.Parameters.Add("@HouseNO",this._house.HouseNO);
this._cmd.Parameters.Add("@ClientID",this._house.ClientID);
this._cmd.Parameters.Add("@LPID",this._house.LPID);
this._cmd.Parameters.Add("@Age",this._house.Age);
this._cmd.Parameters.Add("@SpecID",this._house.SpecID);
this._cmd.Parameters.Add("@Area",this._house.Area);
this._cmd.Parameters.Add("@Address",this._house.Address);
this._cmd.Parameters.Add("@Price",this._house.Price);
this._cmd.Parameters.Add("@Remark",this._house.Remark);
this._cmd.Parameters.Add("@Datetime",this._house.Datetime);
try
{
this._con.Open();
this._cmd.ExecuteNonQuery();
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
throw ex;
}
finally
{
this._con.Close();
}
}
public void update()
{
// TODO: 添加 NotSellsDA.update 实现
this._cmd=this._con.CreateCommand();
this._cmd.CommandText="update NotSells set HouseNO=@HouseNO,ClientID=@ClientID,LPID=@LPID,Age=@Age,SpecID=@SpecID,Area=@Area,Address=@Address,Price=@Price,Remark=@Remark,Datetime=@Datetime where HouseID=@HouseID";
this._cmd.Parameters.Add("@HouseNO",this._house.HouseNO);
this._cmd.Parameters.Add("@ClientID",this._house.ClientID);
this._cmd.Parameters.Add("@LPID",this._house.LPID);
this._cmd.Parameters.Add("@Age",this._house.Age);
this._cmd.Parameters.Add("@SpecID",this._house.SpecID);
this._cmd.Parameters.Add("@Area",this._house.Area);
this._cmd.Parameters.Add("@Address",this._house.Address);
this._cmd.Parameters.Add("@Price",this._house.Price);
this._cmd.Parameters.Add("@Remark",this._house.Remark);
this._cmd.Parameters.Add("@Datetime",this._house.Datetime);
this._cmd.Parameters.Add("@HouseID",this._house.HouseID);
try
{
this._con.Open();
this._cmd.ExecuteNonQuery();
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
throw ex;
}
finally
{
this._con.Close();
}
}
//调用存储过程
public void delete()
{
// TODO: 添加 NotSellsDA.delete 实现
this._cmd=this._con.CreateCommand();
this._cmd.CommandType=CommandType.StoredProcedure;
this._cmd.CommandText="proc_deleteHouse";
this._cmd.Parameters.Add("@houseID",this._house.HouseID);
this._cmd.Parameters.Add("@LPName",this._house.getLpName);
this._cmd.Parameters.Add("@ClientName",this._house.getClientName);
this._cmd.Parameters.Add("@SpecType",this._house.getSpecName);
this._cmd.Parameters.Add("@hNO",this._house.HouseNO);
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 + -