后台:
decimal ass_id = string.IsNullOrEmpty(tbid.Text) ? 0 : decimal.Parse(tbid.Text.Trim());//判断有无
DateTime? startime = null, endtime = null;
if (!string.IsNullOrEmpty(tbbigtime.Text))
startime = DateTime.Parse(tbbigtime.Text.Trim());
if (!string.IsNullOrEmpty(tbendtime.Text))
endtime = DateTime.Parse(tbendtime.Text.Trim());
DataSet ds = moneymanager.PMoneyListGet(ass_id, startime, endtime);//绑定方法
BLL层:
public DataSet PMoneyListGet(decimal ass_id, DateTime? startime, DateTime? endtime)
{
return moneyservice.PMoneyListGet(ass_id, startime, endtime);
}
DAL层:
public DataSet PMoneyListGet(decimal ass_id, DateTime? startime, DateTime? endtime)
{
string query=string.Empty;
if (ass_id > 0)
query += string.Format(" and ass_id={0}", ass_id);
if (startime != null && endtime != null && startime <= endtime)
query += string.Format(" and (trd_dtm>='{0}' and trd_dtm<='{1}')", startime, endtime);
string sql = string.Format("select * from cc_money_rec where 1=1 " + query + " order by trd_dtm desc");
DataSet ds = null;
try
{
ds = DBHelper.GetDataSet3(sql, "money_rec");
}
catch (SqlException se)
{
throw new Exception(se.Message, se);
}
return ds;
}