/// <summary>获得所有插件(包括被禁用的) /// </summary> public IEnumerable <PluginEntity> GetPlugins(int pageIndex, int pageSize, string searchName) { StringBuilder sql = new StringBuilder(); sql.Append("select Id,Name,Describe,Status,Author,DefaultController,DefaultAction,PVersion,MenuShow,Icon from t_plugin"); if (!string.IsNullOrEmpty(searchName)) { sql.Append(" where Name=@Name "); } if (pageSize != 0) { sql.Append(" Limit @pageSize"); } if (pageSize != 0 && pageIndex != 0) { sql.Append(" offset (@pageSize*(@pageIndex-1))"); } SQLiteParameter[] para = new SQLiteParameter[] { new SQLiteParameter("@pageSize", pageSize), new SQLiteParameter("@pageIndex", pageIndex), new SQLiteParameter("@Name", searchName) }; SqlLiteHelper sqlLiteHelper = new SqlLiteHelper(); DataTable dataTable = sqlLiteHelper.GetDataTable(sql.ToString(), para); return((from DataRow dataRow in dataTable.Rows select Convert2Entity(dataRow)).ToList()); }
/// <summary>获取角色列表 /// </summary> /// <param name="skip">跳过的记录数</param> /// <param name="count">获取的数量</param> /// <returns></returns> public List <RoleEntity> GetRoles(int skip, int pagesize, string RoleName, out int count) { StringBuilder sql = new StringBuilder(); sql.Append("select Id,Name,RightIds,IsSuper from t_roles "); if (!string.IsNullOrEmpty(RoleName)) { sql.Append(" where Name=@Name "); } if (pagesize != 0) { sql.Append(" Limit @count Offset @skip "); } SqlLiteHelper sqliteHelper = new SqlLiteHelper(); SQLiteParameter[] para = new SQLiteParameter[] { new SQLiteParameter("@count", pagesize), new SQLiteParameter("@skip", skip), new SQLiteParameter("@Name", RoleName) }; DataTable dataTable = sqliteHelper.GetDataTable(sql.ToString(), para); List <RoleEntity> roleEntities = new List <RoleEntity>(); foreach (DataRow dataRow in dataTable.Rows) { roleEntities.Add(Conver2Entity(dataRow)); } count = sqliteHelper.GetCount("t_roles"); return(roleEntities); }
public List <UserEntity> GetUsers(int skip, int pagesize, string userName, out int count) { StringBuilder sql = new StringBuilder(); sql.Append(" select Uid,Name,Photo,RolesIds,Status from t_users "); if (!string.IsNullOrEmpty(userName)) { sql.Append(" where Uid like @Uid "); } if (pagesize != 0) { sql.Append(" Limit @count Offset @skip "); } SQLiteParameter[] para = new SQLiteParameter[] { new SQLiteParameter("@count", pagesize), new SQLiteParameter("@skip", skip), new SQLiteParameter("@Uid", "%" + userName + "%") }; SqlLiteHelper sqliteHelper = new SqlLiteHelper(); DataTable dataTable = sqliteHelper.GetDataTable(sql.ToString(), para); List <UserEntity> userEntities = new List <UserEntity>(); foreach (DataRow dataRow in dataTable.Rows) { userEntities.Add(Conver2Entity(dataRow)); } count = sqliteHelper.GetCount("t_users"); return(userEntities); }
public List <RoleEntity> GetRoles() { string sql = "select Id,Name,RightIds,IsSuper from t_roles"; //, count, skip); SqlLiteHelper sqliteHelper = new SqlLiteHelper(); DataTable dataTable = sqliteHelper.GetDataTable(sql); List <RoleEntity> roleEntities = new List <RoleEntity>(); foreach (DataRow dataRow in dataTable.Rows) { roleEntities.Add(Conver2Entity(dataRow)); } return(roleEntities); }
public static DataTable ValutazioniList(int idConsulto) { var sb = new StringBuilder(); sb.Append("SELECT "); sb.Append("ID,"); sb.Append("substr(strutturale,1,100) as strutturale,"); sb.Append("substr(cranio_sacrale,1,100) as cranio_sacrale,"); sb.Append("substr(ak_ortodontica,1,100) as ak_ortodontica"); sb.Append(" FROM "); sb.Append("valutazione"); sb.Append(" WHERE "); sb.Append("id_consulto = " + idConsulto); var dt = SqlLiteHelper.GetDataTable(sb.ToString()); return(dt); }
public static DataTable TrattamentiList(int idConsulto) { var sb = new StringBuilder(); sb.Append("SELECT "); sb.Append("ID,"); sb.Append("data,"); sb.Append("substr(descrizione,1,100) as descrizione"); sb.Append(" FROM "); sb.Append("trattamento"); sb.Append(" WHERE "); sb.Append("id_consulto = " + idConsulto); sb.Append(" ORDER BY "); sb.Append("data ASC"); var dt = SqlLiteHelper.GetDataTable(sb.ToString()); return(dt); }
public int GetPluginsCount(string searchName) { StringBuilder sql = new StringBuilder(); sql.Append("select count(*) as c from t_plugin"); if (!string.IsNullOrEmpty(searchName)) { sql.Append(" where Name=@Name"); } SQLiteParameter[] para = new SQLiteParameter[] { new SQLiteParameter("@Name", searchName) }; SqlLiteHelper sqlLiteHelper = new SqlLiteHelper(); DataTable dataTable = sqlLiteHelper.GetDataTable(sql.ToString(), para); return(int.Parse(dataTable.Rows[0]["c"].ToString())); }