📄 destineda.cs
字号:
using System;
using System.Data;
using System.Data.SqlClient;
using HouseBE;
namespace HouseDA
{
/// <summary>
/// DestineDA 的摘要说明。
/// </summary>
public class DestineDA:CommonDA
{
private SqlConnection _con;
private ConDA _cons;
private SqlCommand _cmd;
private SqlDataAdapter _adapter;
private DataSet _ds;
private HouseBE.Destine _destine;
public HouseBE.Destine destine
{
set
{
this._destine=value;
}
get
{
return this._destine;
}
}
public DestineDA()
{
//
// TODO: 在此处添加构造函数逻辑
//
this._cons=new ConDA();
this._con=this._cons._con;
}
#region CommonDA 成员
public DataSet select()
{
// TODO: 添加 DestineDA.select 实现
this._adapter=new SqlDataAdapter("select * from View_Destine",this._con);
this._ds=new DataSet();
try
{
this._adapter.Fill(this._ds,"Destine");
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
throw ex;
}
return this._ds;
}
//根据客户姓名查询
public DataSet getNameSelect(string name)
{
try
{
this._adapter=new SqlDataAdapter("select * from View_Destine where 客户姓名 like '"+name+"'",this._con);
this._ds=new DataSet();
this._adapter.Fill(this._ds,"DestineName");
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
throw ex;
}
return this._ds;
}
public void insert()
{
// TODO: 添加 DestineDA.insert 实现
this._cmd=this._con.CreateCommand();
this._cmd.CommandText="insert into Destine values(@DestineID,@DestineDate,@Operator,@NotSellID,@ClientID)";
this._cmd.Parameters.Add("@DestineID",this._destine.DestineID);
this._cmd.Parameters.Add("@DestineDate",this._destine.DestineDate);
this._cmd.Parameters.Add("@Operator",this._destine.Operator);
this._cmd.Parameters.Add("@NotSellID",this._destine.NotSellID);
this._cmd.Parameters.Add("@ClientID",this._destine.ClientID);
try
{
this._con.Open();
this._cmd.ExecuteNonQuery();
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
throw ex;
}
finally
{
this._con.Close();
}
}
public void update()
{
// TODO: 添加 DestineDA.update 实现
this._cmd=this._con.CreateCommand();
this._cmd.CommandText="update Destine set DestineDate=@DestineDate,Operator=@Operator,NotSellID=@NotSellID,ClientID=@ClientID where DestineID=@DestineID";
this._cmd.Parameters.Add("@DestineDate",this._destine.DestineDate);
this._cmd.Parameters.Add("@Operator",this._destine.Operator);
this._cmd.Parameters.Add("@NotSellID",this._destine.NotSellID);
this._cmd.Parameters.Add("@ClientID",this._destine.ClientID);
this._cmd.Parameters.Add("@DestineID",this._destine.DestineID);
try
{
this._con.Open();
this._cmd.ExecuteNonQuery();
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
throw ex;
}
finally
{
this._con.Close();
}
}
public void delete()
{
// TODO: 添加 DestineDA.delete 实现
this._cmd=this._con.CreateCommand();
this._cmd.CommandType=CommandType.StoredProcedure;
this._cmd.CommandText="proc_Destine";
this._cmd.Parameters.Add("@DestineID",this._destine.DestineID);
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 + -