/// <summary> /// Gets an IDataReader with rows from the mp_EmailSendQueue table where DateToSend >= CurrentTime. /// </summary> /// <param name="currentTime"> currentTime </param> public static IDataReader GetEmailToSend(DateTime currentTime) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT * "); sqlCommand.Append("FROM mp_EmailSendQueue "); sqlCommand.Append("WHERE "); sqlCommand.Append("DateToSend >= @CurrentTime "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@CurrentTime", FbDbType.TimeStamp); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = currentTime; return(FBSqlHelper.ExecuteReader( GetReadConnectionString(), sqlCommand.ToString(), arParams)); }
public static int GetMaxSortRank(Guid contentGuid) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT COALESCE(MAX(SortRank),1) "); sqlCommand.Append("FROM mp_ContentMetaLink "); sqlCommand.Append("WHERE "); sqlCommand.Append("ContentGuid = @ContentGuid "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@ContentGuid", FbDbType.Char, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = contentGuid.ToString(); return(Convert.ToInt32(FBSqlHelper.ExecuteScalar( GetReadConnectionString(), sqlCommand.ToString(), arParams))); }
public static IDataReader GetByUser(string userId) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT * "); sqlCommand.Append("FROM mp_UserClaims "); sqlCommand.Append("WHERE "); sqlCommand.Append("UserId = @UserId "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@UserId", FbDbType.VarChar, 128); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = userId; return(FBSqlHelper.ExecuteReader( ConnectionString.GetReadConnectionString(), sqlCommand.ToString(), arParams)); }
public static IDataReader GetHistoryByModule(int moduleId) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT * "); sqlCommand.Append("FROM mp_SharedFilesHistory "); sqlCommand.Append("WHERE "); sqlCommand.Append("ModuleID = @ModuleID "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@ModuleID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = moduleId; return(FBSqlHelper.ExecuteReader( GetConnectionString(), sqlCommand.ToString(), arParams)); }
public static int GetCountOfStateAllUsers(Guid pathId) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT Count(*) "); sqlCommand.Append("FROM mp_SitePersonalizationAllUsers "); sqlCommand.Append("WHERE PathID = @PathID ; "); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@PathID", FbDbType.VarChar, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = pathId.ToString(); int count = Convert.ToInt32(FBSqlHelper.ExecuteScalar( GetConnectionString(), sqlCommand.ToString(), arParams)); return(count); }
public static bool DeleteWebPart(Guid webPartId) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_WebParts "); sqlCommand.Append("WHERE "); sqlCommand.Append("WebPartID = @WebPartID ;"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@WebPartID", FbDbType.VarChar, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = webPartId.ToString(); int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > 0); }
public static bool DeleteBySite(int siteId) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_CalendarEvents "); sqlCommand.Append("WHERE "); sqlCommand.Append("ModuleID IN (SELECT ModuleID FROM mp_Modules WHERE SiteID = @SiteID) ;"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@SiteID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = siteId; int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > 0); }
public static IDataReader SelectByUser(Guid userGuid) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT * "); sqlCommand.Append("FROM mp_UserPages "); sqlCommand.Append("WHERE "); sqlCommand.Append("UserGuid = @UserGuid "); sqlCommand.Append("ORDER BY PageOrder ;"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@UserGuid", FbDbType.VarChar, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = userGuid.ToString(); return(FBSqlHelper.ExecuteReader( GetConnectionString(), sqlCommand.ToString(), arParams)); }
/// <summary> /// Gets a count of rows in the mp_Links table. /// </summary> public static int GetCount(int moduleId) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT Count(*) "); sqlCommand.Append("FROM mp_Links "); sqlCommand.Append("WHERE "); sqlCommand.Append("ModuleID = @ModuleID "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@ModuleID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = moduleId; return(Convert.ToInt32(FBSqlHelper.ExecuteScalar( GetConnectionString(), sqlCommand.ToString(), arParams))); }
public static IDataReader GetLinks(int moduleId) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT * "); sqlCommand.Append("FROM mp_Links "); sqlCommand.Append("WHERE ModuleID = @ModuleID "); sqlCommand.Append("ORDER BY ViewOrder, Title ;"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@ModuleID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = moduleId; return(FBSqlHelper.ExecuteReader( GetConnectionString(), sqlCommand.ToString(), arParams)); }
/// <summary> /// Gets an IDataReader with one row from the mp_UserLocation table. /// </summary> /// <param name="rowID"> rowID </param> public static IDataReader GetOne(Guid rowID) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT * "); sqlCommand.Append("FROM mp_UserLocation "); sqlCommand.Append("WHERE "); sqlCommand.Append("RowID = @RowID "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@RowID", FbDbType.Char, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = rowID.ToString(); return(FBSqlHelper.ExecuteReader( GetConnectionString(), sqlCommand.ToString(), arParams)); }
/// <summary> /// Gets an IDataReader with rows from the mp_FileAttachment table. /// </summary> /// <param name="rowGuid"> rowGuid </param> public static IDataReader SelectBySpecial2(Guid specialGuid2) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT * "); sqlCommand.Append("FROM mp_FileAttachment "); sqlCommand.Append("WHERE "); sqlCommand.Append("SpecialGuid2 = @SpecialGuid2 "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@SpecialGuid2", FbDbType.Char, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = specialGuid2.ToString(); return(FBSqlHelper.ExecuteReader( GetReadConnectionString(), sqlCommand.ToString(), arParams)); }
public static int OnlyCount(int siteId) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT Count(*) "); sqlCommand.Append("FROM mp_WebParts m "); sqlCommand.Append("WHERE m.SiteID = @SiteID AND m.AvailableForMyPage = 1 ;"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@SiteID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = siteId; int count = Convert.ToInt32(FBSqlHelper.ExecuteScalar( GetConnectionString(), sqlCommand.ToString(), arParams)); return(count); }
public static bool DeleteModuleDefinitionFromSites(int moduleDefId) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_SiteModuleDefinitions "); sqlCommand.Append("WHERE "); sqlCommand.Append("ModuleDefID = @ModuleDefID ;"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@ModuleDefID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = moduleDefId; int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > 0); }
/// <summary> /// Deletes a row from the mp_ContentTemplate table. Returns true if row deleted. /// </summary> /// <param name="guid"> guid </param> /// <returns>bool</returns> public static bool Delete(Guid guid) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_ContentTemplate "); sqlCommand.Append("WHERE "); sqlCommand.Append("Guid = @Guid "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@Guid", FbDbType.Char, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = guid.ToString(); int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetWriteConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
/// <summary> /// Gets an IDataReader with one row from the mp_Tag table. /// </summary> /// <param name="guid"> guid </param> public static IDataReader GetOne(Guid guid) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT * "); sqlCommand.Append("FROM mp_Tag "); sqlCommand.Append("WHERE "); sqlCommand.Append("Guid = @Guid "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@Guid", FbDbType.Char, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = guid.ToString(); return(FBSqlHelper.ExecuteReader( GetReadConnectionString(), sqlCommand.ToString(), arParams)); }
/// <summary> /// Gets a count of rows in the mp_Tag table. /// </summary> public static int GetCount(Guid moduleGuid) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT Count(*) "); sqlCommand.Append("FROM mp_Tag "); sqlCommand.Append("WHERE "); sqlCommand.Append("ModuleGuid = @ModuleGuid "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@ModuleGuid", FbDbType.Char, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = moduleGuid.ToString(); return(Convert.ToInt32(FBSqlHelper.ExecuteScalar( GetReadConnectionString(), sqlCommand.ToString(), null))); }
/// <summary> /// Gets a count of rows in the mp_GeoZone table. /// </summary> public static int GetCount(Guid countryGuid) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT Count(*) "); sqlCommand.Append("FROM mp_GeoZone "); sqlCommand.Append("WHERE CountryGuid = @CountryGuid "); sqlCommand.Append("OR CountryGuid = UPPER(@CountryGuid) "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@CountryGuid", FbDbType.Char, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = countryGuid.ToString(); return(Convert.ToInt32(FBSqlHelper.ExecuteScalar( GetConnectionString(), sqlCommand.ToString(), arParams))); }
/// <summary> /// Gets an IDataReader with one row from the mp_SavedQuery table. /// </summary> /// <param name="id"> id </param> public static IDataReader GetOne(string name) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT * "); sqlCommand.Append("FROM mp_SavedQuery "); sqlCommand.Append("WHERE "); sqlCommand.Append("Name = @Name "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@Name", FbDbType.VarChar, 50); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = name; return(FBSqlHelper.ExecuteReader( GetReadConnectionString(), sqlCommand.ToString(), arParams)); }
/// <summary> /// Gets an IDataReader with one row from the mp_GeoCountry table. /// </summary> /// <param name="countryISOCode2"> countryISOCode2 </param> public static IDataReader GetByISOCode2(string countryISOCode2) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT * "); sqlCommand.Append("FROM mp_GeoCountry "); sqlCommand.Append("WHERE "); sqlCommand.Append("ISOCode2 = @ISOCode2 "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@ISOCode2", FbDbType.Char, 2); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = countryISOCode2; return(FBSqlHelper.ExecuteReader( GetConnectionString(), sqlCommand.ToString(), arParams)); }
/// <summary> /// Gets a count of rows in the mp_GoogleCheckoutLog table. /// </summary> public static int GetCountByStore(Guid storeGuid) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT Count(*) "); sqlCommand.Append("FROM mp_GoogleCheckoutLog "); sqlCommand.Append("WHERE "); sqlCommand.Append("StoreGuid = @StoreGuid "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@StoreGuid", FbDbType.Char, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = storeGuid.ToString(); return(Convert.ToInt32(FBSqlHelper.ExecuteScalar( GetConnectionString(), sqlCommand.ToString(), arParams))); }
public static IDataReader SchemaVersionGetSchemaVersion( Guid applicationId) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT * "); sqlCommand.Append("FROM mp_SchemaVersion "); sqlCommand.Append("WHERE "); sqlCommand.Append("ApplicationID = @ApplicationID ;"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@ApplicationID", FbDbType.VarChar, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = applicationId.ToString(); return(FBSqlHelper.ExecuteReader( GetConnectionString(), sqlCommand.ToString(), arParams)); }
public static bool SchemaScriptHistoryDeleteSchemaScriptHistory(int id) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_SchemaScriptHistory "); sqlCommand.Append("WHERE "); sqlCommand.Append("ID = @ID ;"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@ID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = id; int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > 0); }
public static bool Exists(string folderName) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT Count(*) "); sqlCommand.Append("FROM mp_SiteFolders "); sqlCommand.Append("WHERE FolderName = @FolderName ; "); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@FolderName", FbDbType.VarChar, 255); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = folderName; int count = Convert.ToInt32(FBSqlHelper.ExecuteScalar( GetConnectionString(), sqlCommand.ToString(), arParams)); return(count > 0); }
public static IDataReader GetModuleDefinition( Guid featureGuid) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT * "); sqlCommand.Append("FROM mp_ModuleDefinitions "); sqlCommand.Append("WHERE "); sqlCommand.Append("Guid = @FeatureGuid ;"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@FeatureGuid", FbDbType.VarChar, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = featureGuid.ToString(); return(FBSqlHelper.ExecuteReader( GetConnectionString(), sqlCommand.ToString(), arParams)); }
public static IDataReader SelectBySite(int siteId) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT * "); sqlCommand.Append("FROM mp_WebParts "); sqlCommand.Append("WHERE "); sqlCommand.Append("SiteID = @SiteID AND AvailableForContentSystem = 1 "); sqlCommand.Append("ORDER BY Title, ClassName ;"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@SiteID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = siteId; return(FBSqlHelper.ExecuteReader( GetConnectionString(), sqlCommand.ToString(), arParams)); }
public static bool DeleteSharedFileFolder(int folderId) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_SharedFileFolders "); sqlCommand.Append("WHERE "); sqlCommand.Append("FolderID = @FolderID ;"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@FolderID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = folderId; int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > 0); }
public static DataTable GetBySite(int siteId) { DataTable dt = new DataTable(); dt.Columns.Add("UrlID", typeof(int)); dt.Columns.Add("FriendlyUrl", typeof(string)); dt.Columns.Add("RealUrl", typeof(string)); dt.Columns.Add("IsPattern", typeof(bool)); StringBuilder sqlCommand = new StringBuilder(); FbParameter[] arParams = new FbParameter[1]; sqlCommand.Append("SELECT * "); sqlCommand.Append("FROM mp_FriendlyUrls "); sqlCommand.Append("WHERE "); sqlCommand.Append("SiteID = @SiteID ORDER BY FriendlyUrl ;"); arParams[0] = new FbParameter("@SiteID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = siteId; using (IDataReader reader = FBSqlHelper.ExecuteReader( GetConnectionString(), sqlCommand.ToString(), arParams)) { while (reader.Read()) { DataRow row = dt.NewRow(); row["UrlID"] = reader["UrlID"]; row["FriendlyUrl"] = reader["FriendlyUrl"]; row["RealUrl"] = reader["RealUrl"]; row["IsPattern"] = reader["IsPattern"]; dt.Rows.Add(row); } } return(dt); }
public static bool DeleteBySite(int siteId) { FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@SiteID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = siteId; StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_ContentHistory "); sqlCommand.Append("WHERE ContentGuid IN (SELECT ItemGuid FROM mp_HtmlContent WHERE ModuleID IN "); sqlCommand.Append("(SELECT ModuleID FROM mp_Modules WHERE SiteID = @SiteID) ); "); int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_ContentRating "); sqlCommand.Append("WHERE ContentGuid IN (SELECT ItemGuid FROM mp_HtmlContent WHERE ModuleID IN "); sqlCommand.Append("(SELECT ModuleID FROM mp_Modules WHERE SiteID = @SiteID) ); "); rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_HtmlContent "); sqlCommand.Append("WHERE ModuleID IN (SELECT ModuleID FROM mp_Modules WHERE SiteID = @SiteID) ;"); rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > 0); }
public static Guid CreatePath(int siteId, String path) { Guid newPathID = Guid.NewGuid(); StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("INSERT INTO mp_SitePaths (PathID, SiteID, SiteGuid, Path, LoweredPath)"); sqlCommand.Append("VALUES ("); sqlCommand.Append(" @PathID , "); sqlCommand.Append(" @SiteID , "); sqlCommand.Append(" (SELECT FIRST 1 SiteGuid FROM mp_Sites WHERE SiteID = @SiteID) , "); sqlCommand.Append(" @Path , "); sqlCommand.Append(" @LoweredPath "); sqlCommand.Append(");"); FbParameter[] arParams = new FbParameter[4]; arParams[0] = new FbParameter("@PathID", FbDbType.VarChar, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = newPathID.ToString(); arParams[1] = new FbParameter("@SiteID", FbDbType.Integer); arParams[1].Direction = ParameterDirection.Input; arParams[1].Value = siteId; arParams[2] = new FbParameter("@Path", FbDbType.VarChar, 255); arParams[2].Direction = ParameterDirection.Input; arParams[2].Value = path; arParams[3] = new FbParameter("@LoweredPath", FbDbType.VarChar, 255); arParams[3].Direction = ParameterDirection.Input; arParams[3].Value = path.ToLower(); int rowsAffected = Convert.ToInt32(FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams).ToString()); return(newPathID); }