public List <Module> Select(int pageSize, int start, Common.HashTableExp hash, out int total, String sqlWhere) { List <Module> list = new List <Module>(); sqlWhere = "1=1" + sqlWhere; #region 查询条件 if (hash["ModuleID"] != null) { sqlWhere += string.Format(" and Module_ID='{0}'", hash["ModuleID"]); } if (hash["ModuleName"] != null) { sqlWhere += string.Format(" and Module_Name='{0}'", hash["ModuleName"]); } if (hash["ModuleURL"] != null) { sqlWhere += string.Format(" and Module_URL='{0}'", hash["ModuleURL"]); } if (hash["IconUrl"] != null) { sqlWhere += string.Format(" and Icon_Url='{0}'", hash["IconUrl"]); } if (hash["ParentId"] != null) { sqlWhere += string.Format(" and Parent_Id='{0}'", hash["ParentId"]); } if (hash["OrderId"] != null) { sqlWhere += string.Format(" and Order_Id='{0}'", hash["OrderId"]); } if (hash["Notes"] != null) { sqlWhere += string.Format(" and Notes='{0}'", hash["Notes"]); } if (hash["Status"] != null) { sqlWhere += string.Format(" and STATUS='{0}'", hash["Status"]); } #endregion DataTable dt = SqlLiteHelper.GetTable("Module", "Module_ID,Module_Name,Module_URL,Icon_Url,Parent_Id,Order_Id,Notes,STATUS", pageSize, start, sqlWhere, "Order_Id", "asc", out total); for (int i = 0; i < dt.Rows.Count; i++) { Module index = new Module(); index.ModuleId = dt.Rows[i]["Module_ID"].ToString(); index.ModuleName = dt.Rows[i]["Module_Name"].ToString(); index.ModuleUrl = dt.Rows[i]["Module_URL"].ToString(); index.IconUrl = dt.Rows[i]["Icon_Url"].ToString(); index.ParentId = dt.Rows[i]["Parent_Id"].ToString(); index.OrderId = dt.Rows[i]["Order_Id"].GetInt32(); index.Notes = dt.Rows[i]["Notes"].ToString(); index.Status = dt.Rows[i]["STATUS"].GetDecimal(); list.Add(index); } return(list); }
public List <Module> Select(Common.HashTableExp hash, String sqlWhere) { List <Module> list = new List <Module>(); string sql = "select Module_ID,Module_Name,Module_URL,Icon_Url,Parent_Id,Order_Id,Notes,STATUS from Module where 1=1"; #region 查询条件 if (hash["ModuleID"] != null) { sql += string.Format(" and Module_ID='{0}'", hash["ModuleID"]); } if (hash["ModuleName"] != null) { sql += string.Format(" and Module_Name='{0}'", hash["ModuleName"]); } if (hash["ModuleURL"] != null) { sql += string.Format(" and Module_URL='{0}'", hash["ModuleURL"]); } if (hash["IconUrl"] != null) { sql += string.Format(" and Icon_Url='{0}'", hash["IconUrl"]); } if (hash["ParentId"] != null) { sql += string.Format(" and Parent_Id='{0}'", hash["ParentId"]); } if (hash["OrderId"] != null) { sql += string.Format(" and Order_Id='{0}'", hash["OrderId"]); } if (hash["Notes"] != null) { sql += string.Format(" and Notes='{0}'", hash["Notes"]); } if (hash["Status"] != null) { sql += string.Format(" and STATUS='{0}'", hash["Status"]); } #endregion sql += sqlWhere + " order by Order_Id asc"; DataTable dt = SqlLiteHelper.GetTable(sql, CommandType.Text); for (int i = 0; i < dt.Rows.Count; i++) { Module index = new Module(); index.ModuleId = dt.Rows[i]["Module_ID"].ToString(); index.ModuleName = dt.Rows[i]["Module_Name"].ToString(); index.ModuleUrl = dt.Rows[i]["Module_URL"].ToString(); index.IconUrl = dt.Rows[i]["Icon_Url"].ToString(); index.ParentId = dt.Rows[i]["Parent_Id"].ToString(); index.OrderId = dt.Rows[i]["Order_Id"].GetDecimal(); index.Notes = dt.Rows[i]["Notes"].ToString(); index.Status = dt.Rows[i]["STATUS"].GetDecimal(); list.Add(index); } return(list); }