private IList <BillItem> SelectByMonth(DateTime date) { ISession session = NHibernateUtils.GetCurrentSession(); string hql = "from BillItem where year(date)=" + date.Year + " and month(date)=" + date.Month; IQuery query = session.CreateQuery(hql); return(query.List <BillItem>()); }
private IList <BillItem> SelectByDay(DateTime date) { ISession session = NHibernateUtils.GetCurrentSession(); string hql = "from BillItem where date='" + date.ToShortDateString() + "'"; IQuery query = session.CreateQuery(hql); return(query.List <BillItem>()); }
public bool saveNewBill(BillItem billItem) { try { ISession session = NHibernateUtils.GetCurrentSession(); ITransaction transaction = session.BeginTransaction(); transaction.Begin(); session.Save(billItem); transaction.Commit(); return(true); } catch (Exception e) { Log.exceptionLog(e); return(false); } }