📄 yessellsda.cs
字号:
using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
using HouseBE;
namespace HouseDA
{
/// <summary>
/// YesSellsDA 的摘要说明。
/// </summary>
public class YesSellsDA:CommonDA
{
private SqlConnection _con;
private ConDA _cons;
private SqlCommand _cmd;
private SqlDataAdapter _adapter;
private DataSet _ds;
private HouseBE.House _house;
private ArrayList list;
public HouseBE.House house
{
set
{
this._house=value;
}
get
{
return this._house;
}
}
public YesSellsDA()
{
//
// TODO: 在此处添加构造函数逻辑
//
this._cons=new ConDA();
this._con=this._cons._con;
}
#region CommonDA 成员
public DataSet select()
{
// TODO: 添加 YesSellsDA.select 实现
try
{
this._adapter=new SqlDataAdapter("select * from HouseSalesView",this._con);
this._ds=new DataSet();
this._adapter.Fill(this._ds,"HouseSalesView");
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
throw ex;
}
return this._ds;
}
public void insert()
{
// TODO: 添加 YesSellsDA.insert 实现
this._cmd=this._con.CreateCommand();
this._cmd.CommandType=CommandType.StoredProcedure;
this._cmd.CommandText="proc_House";
this._cmd.Parameters.Add("@HouseNO",this._house.HouseNO);
this._cmd.Parameters.Add("@LpName",this._house.getLpName);
this._cmd.Parameters.Add("@Age",this._house.Age);
this._cmd.Parameters.Add("@TypeName",this._house.getSpecName);
this._cmd.Parameters.Add("@Area",this._house.Area);
this._cmd.Parameters.Add("@Address",this._house.Address);
this._cmd.Parameters.Add("@Prise",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: 添加 YesSellsDA.update 实现
this._cmd=this._con.CreateCommand();
this._cmd.CommandType=CommandType.StoredProcedure;
this._cmd.CommandText="proc_HouseUpdate";
this._cmd.Parameters.Add("@HouseNO",this._house.HouseNO);
this._cmd.Parameters.Add("@LpName",this._house.getLpName);
this._cmd.Parameters.Add("@Age",this._house.Age);
this._cmd.Parameters.Add("@TypeName",this._house.getSpecName);
this._cmd.Parameters.Add("@Area",this._house.Area);
this._cmd.Parameters.Add("@Address",this._house.Address);
this._cmd.Parameters.Add("@Prise",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: 添加 YesSellsDA.delete 实现
this._cmd=this._con.CreateCommand();
this._cmd.CommandType=CommandType.StoredProcedure;
this._cmd.CommandText="proc_deleteHouse";
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);
this._cmd.Parameters.Add("@HID",this._house.HouseID);
try
{
this._con.Open();
this._cmd.ExecuteNonQuery();
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
throw ex;
}
finally
{
this._con.Close();
}
}
#endregion
//查询出所有的楼房信息
public ArrayList GetLou()
{
this.list=new ArrayList();
try
{
this._con.Open();
string str="select * from Loufang";
SqlCommand cmd=this._con.CreateCommand();
cmd.CommandText=str;
SqlDataReader read=cmd.ExecuteReader();
while(read.Read())
{
this._house=new House();
this._house.getLpName=read.GetValue(0).ToString();
this._house.HouseNO=read.GetValue(1).ToString();
this._house.Area=Convert.ToInt32(read.GetValue(2).ToString());
this._house.Price=Convert.ToInt32(read.GetValue(3).ToString());
this._house.getSpecName=read.GetValue(4).ToString();
this._house.Age=Convert.ToInt32(read.GetValue(5).ToString());
this._house.Datetime=read.GetValue(6).ToString();
this._house.Remark=read.GetValue(7).ToString();
this._house.Address=read.GetValue(8).ToString();
this._house.HouseID=Convert.ToInt32(read.GetValue(9).ToString());
this.list.Add(this._house);
}
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
throw ex;
}
finally
{
this._con.Close();
}
return this.list;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -