public ISQLQuery FindSuProgramSearchResult(SuProgramSearchResult programSearchResult, short languageID) { StringBuilder strQuery = new StringBuilder(); strQuery.AppendLine(" SELECT p.ProgramID as ProgramID, p.ProgramCode as ProgramCode, p.ProgramPath as ProgramPath "); strQuery.AppendLine(" , p.Comment as Comment, p.Active as Active "); strQuery.AppendLine(" , pl.ProgramName as ProgramName, l.LanguageID as LanguageId "); strQuery.AppendLine(" FROM SuProgram p "); strQuery.AppendLine(" INNER JOIN DbLanguage l "); strQuery.AppendLine(" ON l.LanguageID = :languageID "); strQuery.AppendLine(" INNER JOIN SuProgramLang pl "); strQuery.AppendLine(" ON pl.ProgramID = p.ProgramID AND pl.LanguageID = l.LanguageID "); ISQLQuery query = GetCurrentSession().CreateSQLQuery(strQuery.ToString()); query.SetInt16("languageID", languageID); query.AddScalar("ProgramID", NHibernateUtil.Int16); query.AddScalar("ProgramCode", NHibernateUtil.String); query.AddScalar("ProgramPath", NHibernateUtil.String); query.AddScalar("ProgramName", NHibernateUtil.String); query.AddScalar("LanguageId", NHibernateUtil.Int16); query.AddScalar("Comment", NHibernateUtil.String); query.AddScalar("Active", NHibernateUtil.Boolean); query.SetResultTransformer(Transformers.AliasToBean(typeof(SuProgramSearchResult))); return(query); }
public int FindCountSuProgramSearchResult(SuProgramSearchResult programSearchResult, short languageID) { StringBuilder strQuery = new StringBuilder(); strQuery.AppendLine(" SELECT Count(*) as Count "); strQuery.AppendLine(" FROM SuProgram p "); strQuery.AppendLine(" INNER JOIN DbLanguage l "); strQuery.AppendLine(" ON l.LanguageID = :languageID "); strQuery.AppendLine(" INNER JOIN SuProgramLang pl "); strQuery.AppendLine(" ON pl.ProgramID = p.ProgramID AND pl.LanguageID = l.LanguageID "); ISQLQuery query = GetCurrentSession().CreateSQLQuery(strQuery.ToString()); query.SetInt16("languageID", languageID); query.AddScalar("Count", NHibernateUtil.Int32); return(Convert.ToInt32(query.UniqueResult())); }
public IList <SuProgramSearchResult> GetTranslatedList(SuProgramSearchResult criteria, short languageID, int firstResult, int maxResult, string sortExpression) { return(NHibernateQueryHelper.FindPagingByCriteria <SuProgramSearchResult>(QueryProvider.SuProgramQuery, "FindSuProgramSearchResult", new object[] { criteria, languageID }, firstResult, maxResult, sortExpression)); }