public static List<BaseStatus> QueryBaseStatus(QueryCondition queryCondition) { string sql = @" SELECT A.ID AS ID,A.STATUS_ID AS StatusId,A.STATUS_NAME AS StatusName,A.GROUP_NAME AS GroupName,A.CREATED_ON AS CreatedOn,A.CREATED_BY AS CreatedBy FROM T_BASE_STATUS AS A WITH(NOLOCK) WHERE 1=1 "; var dict = new Dictionary<QueryConditionField, string> { //{QueryConditionField.Workshop, " AND WORKSHOP = "}, }; var builder = new QueryConditionBuilder(queryCondition, dict); sql += builder.Build(); //sql += " ORDER BY RECORD_STATUS DESC,MODIFIED_ON DESC "; return Dapper.Query<BaseStatus>(sql, queryCondition); }
public ActionResult UsersReadUsersSelect() { QueryCondition qc = new QueryCondition(); qc.pageIndex = Request.Form["page"] == null ? 1 : Convert.ToInt32(Request.Form["page"]); qc.pageSize = Request.Form["rows"] == null ? 10 : Convert.ToInt32(Request.Form["rows"]); var list = iTSysUser.LoadSearchData(qc); var data = new { total = qc.total, rows = list }; JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); string json = javaScriptSerializer.Serialize(data); return Content(json.ToString()); }
public QueryConditionBuilder(QueryCondition queryCondition, Dictionary<QueryConditionField, string> dictCondition) { _queryCondition = queryCondition; _dictCondition = dictCondition; }