public static bool Delete(int id) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_UserClaims "); sqlCommand.Append("WHERE "); sqlCommand.Append("Id = @Id "); sqlCommand.Append(";"); 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( ConnectionString.GetWriteConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
public static bool DeleteGalleryImage( int itemId) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_GalleryImages "); sqlCommand.Append("WHERE "); sqlCommand.Append("ItemID = @ItemID ;"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@ItemID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = itemId; int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > 0); }
///// <summary> ///// Updates a row in the mp_IndexingQueue table. Returns true if row updated. ///// </summary> ///// <param name="rowId"> rowId </param> ///// <param name="indexPath"> indexPath </param> ///// <param name="serializedItem"> serializedItem </param> ///// <param name="itemKey"> itemKey </param> ///// <param name="removeOnly"> removeOnly </param> ///// <returns>bool</returns> //public static bool Update( // Int64 rowId, // string indexPath, // string serializedItem, // string itemKey, // bool removeOnly) //{ // #region Bit Conversion // int intRemoveOnly; // if (removeOnly) // { // intRemoveOnly = 1; // } // else // { // intRemoveOnly = 0; // } // #endregion // StringBuilder sqlCommand = new StringBuilder(); // sqlCommand.Append("UPDATE mp_IndexingQueue "); // sqlCommand.Append("SET "); // sqlCommand.Append("IndexPath = @IndexPath, "); // sqlCommand.Append("SerializedItem = @SerializedItem, "); // sqlCommand.Append("ItemKey = @ItemKey, "); // sqlCommand.Append("RemoveOnly = @RemoveOnly "); // sqlCommand.Append("WHERE "); // sqlCommand.Append("RowId = @RowId "); // sqlCommand.Append(";"); // FbParameter[] arParams = new FbParameter[5]; // arParams[0] = new FbParameter("@RowId", FbDbType.BigInt); // arParams[0].Direction = ParameterDirection.Input; // arParams[0].Value = rowId; // arParams[1] = new FbParameter("@IndexPath", FbDbType.VarChar, 255); // arParams[1].Direction = ParameterDirection.Input; // arParams[1].Value = indexPath; // arParams[2] = new FbParameter("@SerializedItem", FbDbType.VarChar); // arParams[2].Direction = ParameterDirection.Input; // arParams[2].Value = serializedItem; // arParams[3] = new FbParameter("@ItemKey", FbDbType.VarChar, 255); // arParams[3].Direction = ParameterDirection.Input; // arParams[3].Value = itemKey; // arParams[4] = new FbParameter("@RemoveOnly", FbDbType.SmallInt); // arParams[4].Direction = ParameterDirection.Input; // arParams[4].Value = intRemoveOnly; // int rowsAffected = FBSqlHelper.ExecuteNonQuery( // GetConnectionString(), // sqlCommand.ToString(), // arParams); // return (rowsAffected > -1); //} /// <summary> /// Deletes a row from the mp_IndexingQueue table. Returns true if row deleted. /// </summary> /// <param name="rowId"> rowId </param> /// <returns>bool</returns> public static bool Delete(Int64 rowId) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_IndexingQueue "); sqlCommand.Append("WHERE "); sqlCommand.Append("RowId = @RowId "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@RowId", FbDbType.BigInt); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = rowId; int rowsAffected = FBSqlHelper.ExecuteNonQuery( ConnectionString.GetWriteConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
public static bool DeleteBySite(Guid siteGuid) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_UserClaims "); sqlCommand.Append("WHERE "); sqlCommand.Append("UserId IN (SELECT UserGuid FROM mp_Users WHERE SiteGuid = @SiteGuid) "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@SiteGuid", FbDbType.VarChar, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = siteGuid.ToString(); int rowsAffected = FBSqlHelper.ExecuteNonQuery( ConnectionString.GetWriteConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
/// <summary> /// Deletes rows from the mp_SystemLog table. Returns true if rows deleted. /// </summary> /// <param name="id"> id </param> /// <returns>bool</returns> public static bool DeleteOlderThan(DateTime cutoffDate) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_SystemLog "); sqlCommand.Append("WHERE "); sqlCommand.Append("LogDate < @CutoffDate "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@CutoffDate", FbDbType.TimeStamp); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = cutoffDate; int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetWriteConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
/// <summary> /// Deletes rows from the mp_SystemLog table. Returns true if rows deleted. /// </summary> /// <param name="id"> id </param> /// <returns>bool</returns> public static bool DeleteByLevel(string logLevel) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_SystemLog "); sqlCommand.Append("WHERE "); sqlCommand.Append("LogLevel = @LogLevel "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@LogLevel", FbDbType.VarChar, 20); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = logLevel; int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetWriteConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
/// <summary> /// Deletes rows from the mp_SystemLog table. Returns true if rows deleted. /// </summary> public static void DeleteAll() { //TODO: does firebird support truncate table? StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_SystemLog "); //sqlCommand.Append("WHERE "); //sqlCommand.Append("ID = @ID "); sqlCommand.Append(";"); //FbParameter[] arParams = new FbParameter[1]; //arParams[0] = new FbParameter("@ID", FbDbType.Integer); //arParams[0].Direction = ParameterDirection.Input; //arParams[0].Value = id; FBSqlHelper.ExecuteNonQuery( GetWriteConnectionString(), sqlCommand.ToString(), null); }
public static bool DeleteBySite(int siteId) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_ContactFormMessage "); sqlCommand.Append("WHERE "); sqlCommand.Append("SiteGuid IN (SELECT SiteGuid FROM mp_Sites WHERE SiteID = @SiteID) "); sqlCommand.Append(";"); 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 > -1); }
/// <summary> /// Deletes rows from the mp_RssFeedEntries table. Returns true if row deleted. /// </summary> /// <param name="feedId"> feedId </param> /// <returns>bool</returns> public static bool DeleteEntriesByFeed(int feedId) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_RssFeedEntries "); sqlCommand.Append("WHERE "); sqlCommand.Append("FeedId = @FeedId "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@FeedId", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = feedId; int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
/// <summary> /// Deletes a row from the mp_TaxClass 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_TaxClass "); 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( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
/// <summary> /// Deletes rows from the mp_Comments table. Returns true if row deleted. /// </summary> /// <param name="guid"> guid </param> /// <returns>bool</returns> public static bool DeleteByContent(Guid contentGuid) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_Comments "); 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(); int rowsAffected = FBSqlHelper.ExecuteNonQuery( ConnectionString.GetWriteConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
public static bool DeleteByModule(int moduleId) { FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@ModuleID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = moduleId; StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_ContentHistory "); sqlCommand.Append("WHERE ContentGuid IN (SELECT ItemGuid FROM mp_HtmlContent WHERE ModuleID "); sqlCommand.Append("ModuleID = @ModuleID ); "); int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); sqlCommand.Append("DELETE FROM mp_ContentRating "); sqlCommand.Append("WHERE ContentGuid IN (SELECT ItemGuid FROM mp_HtmlContent WHERE ModuleID "); sqlCommand.Append("ModuleID = @ModuleID ); "); rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_HtmlContent "); sqlCommand.Append("WHERE ModuleID = @ModuleID ;"); rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > 0); }
public static bool Create(string loginProvider, string providerKey, string userId) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("INSERT INTO mp_UserLogins ("); sqlCommand.Append("LoginProvider ,"); sqlCommand.Append("ProviderKey, "); sqlCommand.Append("UserId "); sqlCommand.Append(") "); sqlCommand.Append("VALUES ("); sqlCommand.Append("@LoginProvider, "); sqlCommand.Append("@ProviderKey, "); sqlCommand.Append("@UserId "); sqlCommand.Append(")"); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[3]; arParams[0] = new FbParameter("@LoginProvider", FbDbType.VarChar, 128); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = loginProvider; arParams[1] = new FbParameter("@ProviderKey", FbDbType.VarChar, 128); arParams[1].Direction = ParameterDirection.Input; arParams[1].Value = providerKey; arParams[2] = new FbParameter("@UserId", FbDbType.VarChar, 128); arParams[2].Direction = ParameterDirection.Input; arParams[2].Value = userId; int rowsAffected = FBSqlHelper.ExecuteNonQuery( ConnectionString.GetWriteConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > 0); }
/// <summary> /// Deletes a row from the mp_LetterSubscribe table. Returns true if row deleted. /// </summary> /// <param name="guid"> guid </param> /// <returns>bool</returns> public static bool DeleteByLetter(Guid letterInfoGuid) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_LetterSubscribe "); sqlCommand.Append("WHERE "); sqlCommand.Append("LetterInfoGuid = @LetterInfoGuid "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@LetterInfoGuid", FbDbType.Char, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = letterInfoGuid.ToString(); int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetWriteConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
public static bool DeleteByUser(string userId) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_UserLogins "); 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; int rowsAffected = FBSqlHelper.ExecuteNonQuery( ConnectionString.GetWriteConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
/// <summary> /// Records the complete of sending in the db /// </summary> /// <param name="letterGuid"> letterGuid </param> /// <param name="sendClickedUtc"> sendClickedUtc </param> /// <returns>bool</returns> public static bool SendComplete( Guid letterGuid, DateTime sendCompleteUtc, int sendCount) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("UPDATE mp_Letter "); sqlCommand.Append("SET "); sqlCommand.Append("SendCompleteUTC = @SendCompleteUTC, "); sqlCommand.Append("SendCount = @SendCount "); sqlCommand.Append("WHERE "); sqlCommand.Append("LetterGuid = @LetterGuid "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[3]; arParams[0] = new FbParameter("@LetterGuid", FbDbType.Char, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = letterGuid.ToString(); arParams[1] = new FbParameter("@SendCompleteUTC", FbDbType.TimeStamp); arParams[1].Direction = ParameterDirection.Input; arParams[1].Value = sendCompleteUtc; arParams[2] = new FbParameter("@SendCount", FbDbType.Integer); arParams[2].Direction = ParameterDirection.Input; arParams[2].Value = sendCount; int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
public static bool IncrementDownloadCount(int itemId) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("UPDATE mp_SharedFiles "); sqlCommand.Append("SET "); sqlCommand.Append("DownloadCount = DownloadCount + 1 "); sqlCommand.Append("WHERE "); sqlCommand.Append("ItemID = @ItemID ;"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@ItemID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = itemId; int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
/// <summary> /// Deletes rows from the mp_RssFeedEntries table. Returns true if row deleted. /// </summary> /// <param name="moduleGuid"> moduleGuid </param> /// <returns>bool</returns> public static bool DeleteUnPublishedEntriesByModule(Guid moduleGuid) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_RssFeedEntries "); sqlCommand.Append("WHERE "); sqlCommand.Append("ModuleGuid = @ModuleGuid "); sqlCommand.Append(" AND Confirmed = 0 "); 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(); int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
public static void EnsureInstallationInAdminSites() { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("INSERT INTO mp_SiteModuleDefinitions "); sqlCommand.Append("("); sqlCommand.Append("SiteID, "); sqlCommand.Append("SiteGuid, "); sqlCommand.Append("FeatureGuid, "); sqlCommand.Append("AuthorizedRoles, "); sqlCommand.Append("ModuleDefID "); sqlCommand.Append(") "); sqlCommand.Append("SELECT "); sqlCommand.Append("s.SiteID, "); sqlCommand.Append("s.SiteGuid, "); sqlCommand.Append("md.Guid, "); sqlCommand.Append("'All Users', "); sqlCommand.Append("md.ModuleDefID "); sqlCommand.Append("FROM "); sqlCommand.Append("mp_Sites s, "); sqlCommand.Append("mp_ModuleDefinitions md "); sqlCommand.Append("WHERE s.IsServerAdminSite = 1 "); sqlCommand.Append("AND md.ModuleDefID NOT IN "); sqlCommand.Append("( "); sqlCommand.Append("SELECT sd.ModuleDefID "); sqlCommand.Append("FROM mp_SiteModuleDefinitions sd "); sqlCommand.Append("WHERE sd.SiteID = s.SiteID "); sqlCommand.Append(") "); sqlCommand.Append(" ;"); FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), null); }
public static bool Update( Guid guid, Guid siteGuid, string folderName) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("UPDATE mp_SiteFolders "); sqlCommand.Append("SET "); sqlCommand.Append("SiteGuid = @SiteGuid, "); sqlCommand.Append("FolderName = @FolderName "); sqlCommand.Append("WHERE "); sqlCommand.Append("Guid = @Guid ;"); FbParameter[] arParams = new FbParameter[3]; arParams[0] = new FbParameter("@Guid", FbDbType.VarChar, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = guid.ToString(); arParams[1] = new FbParameter("@SiteGuid", FbDbType.VarChar, 36); arParams[1].Direction = ParameterDirection.Input; arParams[1].Value = siteGuid.ToString(); arParams[2] = new FbParameter("@FolderName", FbDbType.VarChar, 255); arParams[2].Direction = ParameterDirection.Input; arParams[2].Value = folderName; int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
/// <summary> /// Updates a row in the mp_TaskQueue table. Returns true if row updated. /// </summary> /// <param name="guid"> guid </param> /// <param name="notificationSentUTC"> notificationSentUTC </param> /// <returns>bool</returns> public static bool UpdateNotification( Guid guid, DateTime notificationSentUTC) { #region Bit Conversion #endregion StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("UPDATE mp_TaskQueue "); sqlCommand.Append("SET "); sqlCommand.Append("NotificationSentUTC = @NotificationSentUTC "); sqlCommand.Append("WHERE "); sqlCommand.Append("Guid = @Guid ;"); FbParameter[] arParams = new FbParameter[2]; arParams[0] = new FbParameter("@Guid", FbDbType.Char, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = guid.ToString(); arParams[1] = new FbParameter("@NotificationSentUTC", FbDbType.TimeStamp); arParams[1].Direction = ParameterDirection.Input; arParams[1].Value = notificationSentUTC; int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
/// <summary> /// Deletes a row from the mp_LetterSendLog table. Returns true if row deleted. /// </summary> /// <param name="rowID"> rowID </param> /// <returns>bool</returns> public static bool Delete( int rowID) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_LetterSendLog "); sqlCommand.Append("WHERE "); sqlCommand.Append("RowID = @RowID "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@RowID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = rowID; int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
/// <summary> /// Updates the subscriber count on a row in the mp_LetterInfo table. Returns true if row updated. /// </summary> /// <param name="letterInfoGuid"> letterInfoGuid </param> /// <returns>bool</returns> public static bool UpdateSubscriberCount(Guid letterInfoGuid) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("UPDATE mp_LetterInfo "); sqlCommand.Append("SET "); sqlCommand.Append("SubscriberCount = ( "); sqlCommand.Append("SELECT COUNT(*) "); sqlCommand.Append("FROM mp_LetterSubscribe "); sqlCommand.Append("WHERE "); sqlCommand.Append("LetterInfoGuid = @LetterInfoGuid "); sqlCommand.Append("),"); sqlCommand.Append("UnVerifiedCount = ( "); sqlCommand.Append("SELECT COUNT(*) "); sqlCommand.Append("FROM mp_LetterSubscribe "); sqlCommand.Append("WHERE "); sqlCommand.Append("LetterInfoGuid = @LetterInfoGuid AND IsVerified = 0 "); sqlCommand.Append(") "); sqlCommand.Append("WHERE "); sqlCommand.Append("LetterInfoGuid = @LetterInfoGuid "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@LetterInfoGuid", FbDbType.Char, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = letterInfoGuid.ToString(); int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
public static bool UpdateModuleDefinitionSettingById( int id, int moduleDefId, string resourceFile, string groupName, string settingName, string settingValue, string controlType, string regexValidationExpression, string controlSrc, string helpKey, int sortOrder) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("UPDATE mp_ModuleDefinitionSettings "); sqlCommand.Append("SET SettingName = @SettingName, "); sqlCommand.Append("ResourceFile = @ResourceFile, "); sqlCommand.Append("SettingValue = @SettingValue, "); sqlCommand.Append("ControlType = @ControlType, "); sqlCommand.Append("ControlSrc = @ControlSrc, "); sqlCommand.Append("HelpKey = @HelpKey, "); sqlCommand.Append("SortOrder = @SortOrder, "); sqlCommand.Append("GroupName = @GroupName, "); sqlCommand.Append("RegexValidationExpression = @RegexValidationExpression "); sqlCommand.Append("WHERE ID = @ID "); sqlCommand.Append("AND ModuleDefID = @ModuleDefID ; "); FbParameter[] arParams = new FbParameter[11]; arParams[0] = new FbParameter("@ID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = id; arParams[1] = new FbParameter("@ModuleDefID", FbDbType.Integer); arParams[1].Direction = ParameterDirection.Input; arParams[1].Value = moduleDefId; arParams[2] = new FbParameter("@SettingName", FbDbType.VarChar, 50); arParams[2].Direction = ParameterDirection.Input; arParams[2].Value = settingName; arParams[3] = new FbParameter("@SettingValue", FbDbType.VarChar, 255); arParams[3].Direction = ParameterDirection.Input; arParams[3].Value = settingValue; arParams[4] = new FbParameter("@ControlType", FbDbType.VarChar, 50); arParams[4].Direction = ParameterDirection.Input; arParams[4].Value = controlType; arParams[5] = new FbParameter("@RegexValidationExpression", FbDbType.VarChar); arParams[5].Direction = ParameterDirection.Input; arParams[5].Value = regexValidationExpression; arParams[6] = new FbParameter("@ResourceFile", FbDbType.VarChar, 255); arParams[6].Direction = ParameterDirection.Input; arParams[6].Value = resourceFile; arParams[7] = new FbParameter("@ControlSrc", FbDbType.VarChar, 255); arParams[7].Direction = ParameterDirection.Input; arParams[7].Value = controlSrc; arParams[8] = new FbParameter("@HelpKey", FbDbType.VarChar, 255); arParams[8].Direction = ParameterDirection.Input; arParams[8].Value = helpKey; arParams[9] = new FbParameter("@SortOrder", FbDbType.Integer); arParams[9].Direction = ParameterDirection.Input; arParams[9].Value = sortOrder; arParams[10] = new FbParameter("@GroupName", FbDbType.VarChar, 255); arParams[10].Direction = ParameterDirection.Input; arParams[10].Value = groupName; int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > 0); }
//public static void SyncDefinitions() //{ // StringBuilder sqlCommand = new StringBuilder(); // sqlCommand.Append("UPDATE mp_ModuleSettings "); // sqlCommand.Append("SET ControlSrc = (SELECT FIRST 1 mds.ControlSrc "); // sqlCommand.Append("FROM mp_ModuleDefinitionSettings mds "); // sqlCommand.Append("WHERE mds.ModuleDefId IN (SELECT ModuleDefId "); // sqlCommand.Append("FROM mp_Modules m "); // sqlCommand.Append("WHERE m.ModuleID = mp_ModuleSettings.ModuleID) "); // sqlCommand.Append("AND mds.SettingName = mp_ModuleSettings.SettingName); "); // sqlCommand.Append(" "); // FBSqlHelper.ExecuteNonQuery( // GetConnectionString(), // sqlCommand.ToString(), // null); // sqlCommand = new StringBuilder(); // sqlCommand.Append("UPDATE mp_ModuleSettings "); // sqlCommand.Append("SET ControlType = (SELECT FIRST 1 mds.ControlType "); // sqlCommand.Append("FROM mp_ModuleDefinitionSettings mds "); // sqlCommand.Append("WHERE mds.ModuleDefId IN (SELECT ModuleDefId "); // sqlCommand.Append("FROM mp_Modules m "); // sqlCommand.Append("WHERE m.ModuleID = mp_ModuleSettings.ModuleID) "); // sqlCommand.Append("AND mds.SettingName = mp_ModuleSettings.SettingName); "); // sqlCommand.Append(" "); // FBSqlHelper.ExecuteNonQuery( // GetConnectionString(), // sqlCommand.ToString(), // null); // sqlCommand = new StringBuilder(); // sqlCommand.Append("UPDATE mp_ModuleSettings "); // sqlCommand.Append("SET SortOrder = (SELECT FIRST 1 mds.SortOrder "); // sqlCommand.Append("FROM mp_ModuleDefinitionSettings mds "); // sqlCommand.Append("WHERE mds.ModuleDefId IN (SELECT ModuleDefId "); // sqlCommand.Append("FROM mp_Modules m "); // sqlCommand.Append("WHERE m.ModuleID = mp_ModuleSettings.ModuleID) "); // sqlCommand.Append("AND mds.SettingName = mp_ModuleSettings.SettingName); "); // sqlCommand.Append(" "); // FBSqlHelper.ExecuteNonQuery( // GetConnectionString(), // sqlCommand.ToString(), // null); // sqlCommand = new StringBuilder(); // sqlCommand.Append("UPDATE mp_ModuleSettings "); // sqlCommand.Append("SET HelpKey = (SELECT FIRST 1 mds.HelpKey "); // sqlCommand.Append("FROM mp_ModuleDefinitionSettings mds "); // sqlCommand.Append("WHERE mds.ModuleDefId IN (SELECT ModuleDefId "); // sqlCommand.Append("FROM mp_Modules m "); // sqlCommand.Append("WHERE m.ModuleID = mp_ModuleSettings.ModuleID) "); // sqlCommand.Append("AND mds.SettingName = mp_ModuleSettings.SettingName); "); // sqlCommand.Append(" "); // FBSqlHelper.ExecuteNonQuery( // GetConnectionString(), // sqlCommand.ToString(), // null); // sqlCommand = new StringBuilder(); // sqlCommand.Append("UPDATE mp_ModuleSettings "); // sqlCommand.Append("SET RegexValidationExpression = (SELECT FIRST 1 mds.RegexValidationExpression "); // sqlCommand.Append("FROM mp_ModuleDefinitionSettings mds "); // sqlCommand.Append("WHERE mds.ModuleDefId IN (SELECT ModuleDefId "); // sqlCommand.Append("FROM mp_Modules m "); // sqlCommand.Append("WHERE m.ModuleID = mp_ModuleSettings.ModuleID) "); // sqlCommand.Append("AND mds.SettingName = mp_ModuleSettings.SettingName); "); // sqlCommand.Append(" "); // FBSqlHelper.ExecuteNonQuery( // GetConnectionString(), // sqlCommand.ToString(), // null); //} public static bool UpdateModuleDefinitionSetting( Guid featureGuid, int moduleDefId, string resourceFile, string groupName, string settingName, string settingValue, string controlType, string regexValidationExpression, string controlSrc, string helpKey, int sortOrder) { StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("SELECT count(*) "); sqlCommand.Append("FROM mp_ModuleDefinitionSettings "); sqlCommand.Append("WHERE (ModuleDefID = @ModuleDefID OR FeatureGuid = @FeatureGuid) "); sqlCommand.Append("AND SettingName = @SettingName ;"); FbParameter[] arParams = new FbParameter[3]; arParams[0] = new FbParameter("@ModuleDefID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = moduleDefId; arParams[1] = new FbParameter("@SettingName", FbDbType.VarChar, 50); arParams[1].Direction = ParameterDirection.Input; arParams[1].Value = settingName; arParams[2] = new FbParameter("@FeatureGuid", FbDbType.VarChar, 36); arParams[2].Direction = ParameterDirection.Input; arParams[2].Value = featureGuid; int count = Convert.ToInt32(FBSqlHelper.ExecuteScalar( GetConnectionString(), sqlCommand.ToString(), arParams).ToString()); sqlCommand = new StringBuilder(); int rowsAffected = 0; if (count > 0) { sqlCommand.Append("UPDATE mp_ModuleDefinitionSettings "); sqlCommand.Append("SET SettingValue = @SettingValue, "); sqlCommand.Append("FeatureGuid = @FeatureGuid, "); sqlCommand.Append("ResourceFile = @ResourceFile, "); sqlCommand.Append("ControlType = @ControlType, "); sqlCommand.Append("ControlSrc = @ControlSrc, "); sqlCommand.Append("HelpKey = @HelpKey, "); sqlCommand.Append("SortOrder = @SortOrder, "); sqlCommand.Append("GroupName = @GroupName, "); sqlCommand.Append("RegexValidationExpression = @RegexValidationExpression "); sqlCommand.Append("WHERE (ModuleDefID = @ModuleDefID OR FeatureGuid = @FeatureGuid) "); sqlCommand.Append("AND SettingName = @SettingName ; "); arParams = new FbParameter[11]; arParams[0] = new FbParameter("@ModuleDefID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = moduleDefId; arParams[1] = new FbParameter("@SettingName", FbDbType.VarChar, 50); arParams[1].Direction = ParameterDirection.Input; arParams[1].Value = settingName; arParams[2] = new FbParameter("@SettingValue", FbDbType.VarChar, 255); arParams[2].Direction = ParameterDirection.Input; arParams[2].Value = settingValue; arParams[3] = new FbParameter("@ControlType", FbDbType.VarChar, 50); arParams[3].Direction = ParameterDirection.Input; arParams[3].Value = controlType; arParams[4] = new FbParameter("@RegexValidationExpression", FbDbType.VarChar); arParams[4].Direction = ParameterDirection.Input; arParams[4].Value = regexValidationExpression; arParams[5] = new FbParameter("@FeatureGuid", FbDbType.VarChar, 36); arParams[5].Direction = ParameterDirection.Input; arParams[5].Value = featureGuid; arParams[6] = new FbParameter("@ResourceFile", FbDbType.VarChar, 255); arParams[6].Direction = ParameterDirection.Input; arParams[6].Value = resourceFile; arParams[7] = new FbParameter("@ControlSrc", FbDbType.VarChar, 255); arParams[7].Direction = ParameterDirection.Input; arParams[7].Value = controlSrc; arParams[8] = new FbParameter("@HelpKey", FbDbType.VarChar, 255); arParams[8].Direction = ParameterDirection.Input; arParams[8].Value = helpKey; arParams[9] = new FbParameter("@SortOrder", FbDbType.Integer); arParams[9].Direction = ParameterDirection.Input; arParams[9].Value = sortOrder; arParams[10] = new FbParameter("@GroupName", FbDbType.VarChar, 255); arParams[10].Direction = ParameterDirection.Input; arParams[10].Value = groupName; rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > 0); } else { arParams = new FbParameter[11]; arParams[0] = new FbParameter(":ModuleDefID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = moduleDefId; arParams[1] = new FbParameter(":SettingName", FbDbType.VarChar, 50); arParams[1].Direction = ParameterDirection.Input; arParams[1].Value = settingName; arParams[2] = new FbParameter(":SettingValue", FbDbType.VarChar, 255); arParams[2].Direction = ParameterDirection.Input; arParams[2].Value = settingValue; arParams[3] = new FbParameter(":ControlType", FbDbType.VarChar, 50); arParams[3].Direction = ParameterDirection.Input; arParams[3].Value = controlType; arParams[4] = new FbParameter(":RegexValidationExpression", FbDbType.VarChar); arParams[4].Direction = ParameterDirection.Input; arParams[4].Value = regexValidationExpression; arParams[5] = new FbParameter(":FeatureGuid", FbDbType.Char, 36); arParams[5].Direction = ParameterDirection.Input; arParams[5].Value = featureGuid.ToString(); arParams[6] = new FbParameter(":ResourceFile", FbDbType.VarChar, 255); arParams[6].Direction = ParameterDirection.Input; arParams[6].Value = resourceFile; arParams[7] = new FbParameter(":ControlSrc", FbDbType.VarChar, 255); arParams[7].Direction = ParameterDirection.Input; arParams[7].Value = controlSrc; arParams[8] = new FbParameter(":HelpKey", FbDbType.VarChar, 255); arParams[8].Direction = ParameterDirection.Input; arParams[8].Value = helpKey; arParams[9] = new FbParameter(":SortOrder", FbDbType.Integer); arParams[9].Direction = ParameterDirection.Input; arParams[9].Value = sortOrder; arParams[10] = new FbParameter(":GroupName", FbDbType.VarChar, 255); arParams[10].Direction = ParameterDirection.Input; arParams[10].Value = groupName; rowsAffected = Convert.ToInt32(FBSqlHelper.ExecuteScalar( GetConnectionString(), CommandType.StoredProcedure, "EXECUTE PROCEDURE MP_MODULEDEFINITIONSETTINGS_INS (" + FBSqlHelper.GetParamString(arParams.Length) + ")", arParams)); return(rowsAffected > 0); } }
public static int AddModuleDefinition( Guid featureGuid, int siteId, string featureName, string controlSrc, int sortOrder, int defaultCacheTime, String icon, bool isAdmin, string resourceFile, bool isCacheable, bool isSearchable, string searchListName, bool supportsPageReuse, string deleteProvider, string partialView) { #region Bit Conversion int intIsAdmin = 0; if (isAdmin) { intIsAdmin = 1; } int intIsCacheable = 0; if (isCacheable) { intIsCacheable = 1; } int intIsSearchable = 0; if (isSearchable) { intIsSearchable = 1; } int intSupportsPageReuse = 0; if (supportsPageReuse) { intSupportsPageReuse = 1; } #endregion FbParameter[] arParams = new FbParameter[14]; arParams[0] = new FbParameter(":FeatureName", FbDbType.VarChar, 255); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = featureName; arParams[1] = new FbParameter(":ControlSrc", FbDbType.VarChar, 255); arParams[1].Direction = ParameterDirection.Input; arParams[1].Value = controlSrc; arParams[2] = new FbParameter(":SortOrder", FbDbType.Integer); arParams[2].Direction = ParameterDirection.Input; arParams[2].Value = sortOrder; arParams[3] = new FbParameter(":IsAdmin", FbDbType.SmallInt); arParams[3].Direction = ParameterDirection.Input; arParams[3].Value = intIsAdmin; arParams[4] = new FbParameter(":Icon", FbDbType.VarChar, 255); arParams[4].Direction = ParameterDirection.Input; arParams[4].Value = icon; arParams[5] = new FbParameter(":DefaultCacheTime", FbDbType.Integer); arParams[5].Direction = ParameterDirection.Input; arParams[5].Value = defaultCacheTime; arParams[6] = new FbParameter(":Guid", FbDbType.Char, 36); arParams[6].Direction = ParameterDirection.Input; arParams[6].Value = featureGuid.ToString(); arParams[7] = new FbParameter(":ResourceFile", FbDbType.VarChar, 255); arParams[7].Direction = ParameterDirection.Input; arParams[7].Value = resourceFile; arParams[8] = new FbParameter(":IsCacheable", FbDbType.SmallInt); arParams[8].Direction = ParameterDirection.Input; arParams[8].Value = intIsCacheable; arParams[9] = new FbParameter(":IsSearchable", FbDbType.SmallInt); arParams[9].Direction = ParameterDirection.Input; arParams[9].Value = intIsSearchable; arParams[10] = new FbParameter(":SearchListName", FbDbType.VarChar, 255); arParams[10].Direction = ParameterDirection.Input; arParams[10].Value = searchListName; arParams[11] = new FbParameter(":SupportsPageReuse", FbDbType.SmallInt); arParams[11].Direction = ParameterDirection.Input; arParams[11].Value = intSupportsPageReuse; arParams[12] = new FbParameter(":DeleteProvider", FbDbType.VarChar, 255); arParams[12].Direction = ParameterDirection.Input; arParams[12].Value = deleteProvider; arParams[13] = new FbParameter(":PartialView", FbDbType.VarChar, 255); arParams[13].Direction = ParameterDirection.Input; arParams[13].Value = partialView; int newID = Convert.ToInt32(FBSqlHelper.ExecuteScalar( GetConnectionString(), CommandType.StoredProcedure, "EXECUTE PROCEDURE MP_MODULEDEFINITIONS_INSERT (" + FBSqlHelper.GetParamString(arParams.Length) + ")", arParams)); if (siteId > -1) { StringBuilder sqlCommand = new StringBuilder(); // now add to mp_SiteModuleDefinitions sqlCommand.Append("INSERT INTO mp_SiteModuleDefinitions ("); sqlCommand.Append("SiteID, "); sqlCommand.Append("SiteGuid, "); sqlCommand.Append("FeatureGuid, "); sqlCommand.Append("AuthorizedRoles, "); sqlCommand.Append("ModuleDefID ) "); sqlCommand.Append(" VALUES ("); sqlCommand.Append("@SiteID, "); sqlCommand.Append("(SELECT FIRST 1 SiteGuid FROM mp_Sites WHERE SiteID = @SiteID), "); sqlCommand.Append("(SELECT FIRST 1 Guid FROM mp_ModuleDefinitions WHERE ModuleDefID = @ModuleDefID), "); sqlCommand.Append("'All Users', "); sqlCommand.Append("@ModuleDefID ) ; "); arParams = new FbParameter[2]; arParams[0] = new FbParameter("@SiteID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = siteId; arParams[1] = new FbParameter("@ModuleDefID", FbDbType.Integer); arParams[1].Direction = ParameterDirection.Input; arParams[1].Value = newID; FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); } return(newID); }
public static bool UpdateModuleDefinition( int moduleDefId, string featureName, string controlSrc, int sortOrder, int defaultCacheTime, String icon, bool isAdmin, string resourceFile, bool isCacheable, bool isSearchable, string searchListName, bool supportsPageReuse, string deleteProvider, string partialView) { int intIsAdmin = 0; if (isAdmin) { intIsAdmin = 1; } int intIsCacheable = 0; if (isCacheable) { intIsCacheable = 1; } int intIsSearchable = 0; if (isSearchable) { intIsSearchable = 1; } int intSupportsPageReuse = 0; if (supportsPageReuse) { intSupportsPageReuse = 1; } StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("UPDATE mp_ModuleDefinitions "); sqlCommand.Append("SET "); sqlCommand.Append("FeatureName = @FeatureName, "); sqlCommand.Append("ControlSrc = @ControlSrc, "); sqlCommand.Append("SortOrder = @SortOrder, "); sqlCommand.Append("DefaultCacheTime = @DefaultCacheTime, "); sqlCommand.Append("Icon = @Icon, "); sqlCommand.Append("IsAdmin = @IsAdmin, "); sqlCommand.Append("IsCacheable = @IsCacheable, "); sqlCommand.Append("IsSearchable = @IsSearchable, "); sqlCommand.Append("SearchListName = @SearchListName, "); sqlCommand.Append("SupportsPageReuse = @SupportsPageReuse, "); sqlCommand.Append("DeleteProvider = @DeleteProvider, "); sqlCommand.Append("PartialView = @PartialView, "); sqlCommand.Append("ResourceFile = @ResourceFile "); sqlCommand.Append("WHERE "); sqlCommand.Append("ModuleDefID = @ModuleDefID ;"); FbParameter[] arParams = new FbParameter[14]; arParams[0] = new FbParameter("@ModuleDefID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = moduleDefId; arParams[1] = new FbParameter("@FeatureName", FbDbType.VarChar, 255); arParams[1].Direction = ParameterDirection.Input; arParams[1].Value = featureName; arParams[2] = new FbParameter("@ControlSrc", FbDbType.VarChar, 255); arParams[2].Direction = ParameterDirection.Input; arParams[2].Value = controlSrc; arParams[3] = new FbParameter("@SortOrder", FbDbType.Integer); arParams[3].Direction = ParameterDirection.Input; arParams[3].Value = sortOrder; arParams[4] = new FbParameter("@IsAdmin", FbDbType.Integer); arParams[4].Direction = ParameterDirection.Input; arParams[4].Value = intIsAdmin; arParams[5] = new FbParameter("@Icon", FbDbType.VarChar, 255); arParams[5].Direction = ParameterDirection.Input; arParams[5].Value = icon; arParams[6] = new FbParameter("@DefaultCacheTime", FbDbType.Integer); arParams[6].Direction = ParameterDirection.Input; arParams[6].Value = defaultCacheTime; arParams[7] = new FbParameter("@ResourceFile", FbDbType.VarChar, 255); arParams[7].Direction = ParameterDirection.Input; arParams[7].Value = resourceFile; arParams[8] = new FbParameter("@IsCacheable", FbDbType.SmallInt); arParams[8].Direction = ParameterDirection.Input; arParams[8].Value = intIsCacheable; arParams[9] = new FbParameter("@IsSearchable", FbDbType.SmallInt); arParams[9].Direction = ParameterDirection.Input; arParams[9].Value = intIsSearchable; arParams[10] = new FbParameter("@SearchListName", FbDbType.VarChar, 255); arParams[10].Direction = ParameterDirection.Input; arParams[10].Value = searchListName; arParams[11] = new FbParameter("@SupportsPageReuse", FbDbType.SmallInt); arParams[11].Direction = ParameterDirection.Input; arParams[11].Value = intSupportsPageReuse; arParams[12] = new FbParameter("@DeleteProvider", FbDbType.VarChar, 255); arParams[12].Direction = ParameterDirection.Input; arParams[12].Value = deleteProvider; arParams[13] = new FbParameter("@PartialView", FbDbType.VarChar, 255); arParams[13].Direction = ParameterDirection.Input; arParams[13].Value = partialView; int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
/// <summary> /// Inserts a row in the mp_UserLocation table. Returns rows affected count. /// </summary> /// <param name="rowID"> rowID </param> /// <param name="userGuid"> userGuid </param> /// <param name="siteGuid"> siteGuid </param> /// <param name="iPAddress"> iPAddress </param> /// <param name="iPAddressLong"> iPAddressLong </param> /// <param name="hostname"> hostname </param> /// <param name="longitude"> longitude </param> /// <param name="latitude"> latitude </param> /// <param name="iSP"> iSP </param> /// <param name="continent"> continent </param> /// <param name="country"> country </param> /// <param name="region"> region </param> /// <param name="city"> city </param> /// <param name="timeZone"> timeZone </param> /// <param name="captureCount"> captureCount </param> /// <param name="firstCaptureUTC"> firstCaptureUTC </param> /// <param name="lastCaptureUTC"> lastCaptureUTC </param> /// <returns>int</returns> public static int Create( Guid rowID, Guid userGuid, Guid siteGuid, string iPAddress, long iPAddressLong, string hostname, double longitude, double latitude, string iSP, string continent, string country, string region, string city, string timeZone, int captureCount, DateTime firstCaptureUTC, DateTime lastCaptureUTC) { #region Bit Conversion #endregion FbParameter[] arParams = new FbParameter[17]; arParams[0] = new FbParameter("@RowID", FbDbType.Char, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = rowID.ToString(); arParams[1] = new FbParameter("@UserGuid", FbDbType.Char, 36); arParams[1].Direction = ParameterDirection.Input; arParams[1].Value = userGuid.ToString(); arParams[2] = new FbParameter("@SiteGuid", FbDbType.Char, 36); arParams[2].Direction = ParameterDirection.Input; arParams[2].Value = siteGuid.ToString(); arParams[3] = new FbParameter("@IPAddress", FbDbType.VarChar, 50); arParams[3].Direction = ParameterDirection.Input; arParams[3].Value = iPAddress; arParams[4] = new FbParameter("@IPAddressLong", FbDbType.BigInt); arParams[4].Direction = ParameterDirection.Input; arParams[4].Value = iPAddressLong; arParams[5] = new FbParameter("@Hostname", FbDbType.VarChar, 255); arParams[5].Direction = ParameterDirection.Input; arParams[5].Value = hostname; arParams[6] = new FbParameter("@Longitude", FbDbType.Float); arParams[6].Direction = ParameterDirection.Input; arParams[6].Value = longitude; arParams[7] = new FbParameter("@Latitude", FbDbType.Float); arParams[7].Direction = ParameterDirection.Input; arParams[7].Value = latitude; arParams[8] = new FbParameter("@ISP", FbDbType.VarChar, 255); arParams[8].Direction = ParameterDirection.Input; arParams[8].Value = iSP; arParams[9] = new FbParameter("@Continent", FbDbType.VarChar, 255); arParams[9].Direction = ParameterDirection.Input; arParams[9].Value = continent; arParams[10] = new FbParameter("@Country", FbDbType.VarChar, 255); arParams[10].Direction = ParameterDirection.Input; arParams[10].Value = country; arParams[11] = new FbParameter("@Region", FbDbType.VarChar, 255); arParams[11].Direction = ParameterDirection.Input; arParams[11].Value = region; arParams[12] = new FbParameter("@City", FbDbType.VarChar, 255); arParams[12].Direction = ParameterDirection.Input; arParams[12].Value = city; arParams[13] = new FbParameter("@TimeZone", FbDbType.VarChar, 255); arParams[13].Direction = ParameterDirection.Input; arParams[13].Value = timeZone; arParams[14] = new FbParameter("@CaptureCount", FbDbType.Integer); arParams[14].Direction = ParameterDirection.Input; arParams[14].Value = captureCount; arParams[15] = new FbParameter("@FirstCaptureUTC", FbDbType.TimeStamp); arParams[15].Direction = ParameterDirection.Input; arParams[15].Value = firstCaptureUTC; arParams[16] = new FbParameter("@LastCaptureUTC", FbDbType.TimeStamp); arParams[16].Direction = ParameterDirection.Input; arParams[16].Value = lastCaptureUTC; StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("INSERT INTO mp_UserLocation ("); sqlCommand.Append("RowID, "); sqlCommand.Append("UserGuid, "); sqlCommand.Append("SiteGuid, "); sqlCommand.Append("IPAddress, "); sqlCommand.Append("IPAddressLong, "); sqlCommand.Append("Hostname, "); sqlCommand.Append("Longitude, "); sqlCommand.Append("Latitude, "); sqlCommand.Append("ISP, "); sqlCommand.Append("Continent, "); sqlCommand.Append("Country, "); sqlCommand.Append("Region, "); sqlCommand.Append("City, "); sqlCommand.Append("TimeZone, "); sqlCommand.Append("CaptureCount, "); sqlCommand.Append("FirstCaptureUTC, "); sqlCommand.Append("LastCaptureUTC )"); sqlCommand.Append(" VALUES ("); sqlCommand.Append("@RowID, "); sqlCommand.Append("@UserGuid, "); sqlCommand.Append("@SiteGuid, "); sqlCommand.Append("@IPAddress, "); sqlCommand.Append("@IPAddressLong, "); sqlCommand.Append("@Hostname, "); sqlCommand.Append("@Longitude, "); sqlCommand.Append("@Latitude, "); sqlCommand.Append("@ISP, "); sqlCommand.Append("@Continent, "); sqlCommand.Append("@Country, "); sqlCommand.Append("@Region, "); sqlCommand.Append("@City, "); sqlCommand.Append("@TimeZone, "); sqlCommand.Append("@CaptureCount, "); sqlCommand.Append("@FirstCaptureUTC, "); sqlCommand.Append("@LastCaptureUTC )"); sqlCommand.Append(";"); int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected); }
/// <summary> /// Inserts a row in the mp_Letter table. Returns rows affected count. /// </summary> /// <param name="letterGuid"> letterGuid </param> /// <param name="letterInfoGuid"> letterInfoGuid </param> /// <param name="subject"> subject </param> /// <param name="htmlBody"> htmlBody </param> /// <param name="textBody"> textBody </param> /// <param name="createdBy"> createdBy </param> /// <param name="createdUTC"> createdUTC </param> /// <param name="lastModBy"> lastModBy </param> /// <param name="lastModUTC"> lastModUTC </param> /// <param name="isApproved"> isApproved </param> /// <param name="approvedBy"> approvedBy </param> /// <returns>int</returns> public static int Create( Guid letterGuid, Guid letterInfoGuid, string subject, string htmlBody, string textBody, Guid createdBy, DateTime createdUtc, Guid lastModBy, DateTime lastModUtc, bool isApproved, Guid approvedBy) { #region Bit Conversion int intIsApproved; if (isApproved) { intIsApproved = 1; } else { intIsApproved = 0; } #endregion FbParameter[] arParams = new FbParameter[11]; arParams[0] = new FbParameter("@LetterGuid", FbDbType.Char, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = letterGuid.ToString(); arParams[1] = new FbParameter("@LetterInfoGuid", FbDbType.Char, 36); arParams[1].Direction = ParameterDirection.Input; arParams[1].Value = letterInfoGuid.ToString(); arParams[2] = new FbParameter("@Subject", FbDbType.VarChar, 255); arParams[2].Direction = ParameterDirection.Input; arParams[2].Value = subject; arParams[3] = new FbParameter("@HtmlBody", FbDbType.VarChar); arParams[3].Direction = ParameterDirection.Input; arParams[3].Value = htmlBody; arParams[4] = new FbParameter("@TextBody", FbDbType.VarChar); arParams[4].Direction = ParameterDirection.Input; arParams[4].Value = textBody; arParams[5] = new FbParameter("@CreatedBy", FbDbType.Char, 36); arParams[5].Direction = ParameterDirection.Input; arParams[5].Value = createdBy.ToString(); arParams[6] = new FbParameter("@CreatedUTC", FbDbType.TimeStamp); arParams[6].Direction = ParameterDirection.Input; arParams[6].Value = createdUtc; arParams[7] = new FbParameter("@LastModBy", FbDbType.Char, 36); arParams[7].Direction = ParameterDirection.Input; arParams[7].Value = lastModBy.ToString(); arParams[8] = new FbParameter("@LastModUTC", FbDbType.TimeStamp); arParams[8].Direction = ParameterDirection.Input; arParams[8].Value = lastModUtc; arParams[9] = new FbParameter("@IsApproved", FbDbType.SmallInt); arParams[9].Direction = ParameterDirection.Input; arParams[9].Value = intIsApproved; arParams[10] = new FbParameter("@ApprovedBy", FbDbType.Char, 36); arParams[10].Direction = ParameterDirection.Input; arParams[10].Value = approvedBy.ToString(); StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("INSERT INTO mp_Letter ("); sqlCommand.Append("LetterGuid, "); sqlCommand.Append("LetterInfoGuid, "); sqlCommand.Append("Subject, "); sqlCommand.Append("HtmlBody, "); sqlCommand.Append("TextBody, "); sqlCommand.Append("CreatedBy, "); sqlCommand.Append("CreatedUTC, "); sqlCommand.Append("LastModBy, "); sqlCommand.Append("LastModUTC, "); sqlCommand.Append("IsApproved, "); sqlCommand.Append("ApprovedBy, "); sqlCommand.Append("SendCount "); sqlCommand.Append(") "); sqlCommand.Append(" VALUES ("); sqlCommand.Append("@LetterGuid, "); sqlCommand.Append("@LetterInfoGuid, "); sqlCommand.Append("@Subject, "); sqlCommand.Append("@HtmlBody, "); sqlCommand.Append("@TextBody, "); sqlCommand.Append("@CreatedBy, "); sqlCommand.Append("@CreatedUTC, "); sqlCommand.Append("@LastModBy, "); sqlCommand.Append("@LastModUTC, "); sqlCommand.Append("@IsApproved, "); sqlCommand.Append("@ApprovedBy, "); sqlCommand.Append("0 "); sqlCommand.Append(") "); sqlCommand.Append(";"); int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected); }
/// <summary> /// Inserts a row in the mp_TaskQueue table. Returns rows affected count. /// </summary> /// <param name="guid"> guid </param> /// <param name="siteGuid"> siteGuid </param> /// <param name="queuedBy"> queuedBy </param> /// <param name="taskName"> taskName </param> /// <param name="notifyOnCompletion"> notifyOnCompletion </param> /// <param name="notificationToEmail"> notificationToEmail </param> /// <param name="notificationFromEmail"> notificationFromEmail </param> /// <param name="notificationSubject"> notificationSubject </param> /// <param name="taskCompleteMessage"> taskCompleteMessage </param> /// <param name="canStop"> canStop </param> /// <param name="canResume"> canResume </param> /// <param name="updateFrequency"> updateFrequency </param> /// <param name="queuedUTC"> queuedUTC </param> /// <param name="completeRatio"> completeRatio </param> /// <param name="status"> status </param> /// <param name="serializedTaskObject"> serializedTaskObject </param> /// <param name="serializedTaskType"> serializedTaskType </param> /// <returns>int</returns> public static int Create( Guid guid, Guid siteGuid, Guid queuedBy, string taskName, bool notifyOnCompletion, string notificationToEmail, string notificationFromEmail, string notificationSubject, string taskCompleteMessage, bool canStop, bool canResume, int updateFrequency, DateTime queuedUTC, double completeRatio, string status, string serializedTaskObject, string serializedTaskType) { #region Bit Conversion int intNotifyOnCompletion; if (notifyOnCompletion) { intNotifyOnCompletion = 1; } else { intNotifyOnCompletion = 0; } int intCanStop; if (canStop) { intCanStop = 1; } else { intCanStop = 0; } int intCanResume; if (canResume) { intCanResume = 1; } else { intCanResume = 0; } #endregion FbParameter[] arParams = new FbParameter[17]; arParams[0] = new FbParameter("@Guid", FbDbType.Char, 36); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = guid.ToString(); arParams[1] = new FbParameter("@SiteGuid", FbDbType.Char, 36); arParams[1].Direction = ParameterDirection.Input; arParams[1].Value = siteGuid.ToString(); arParams[2] = new FbParameter("@QueuedBy", FbDbType.Char, 36); arParams[2].Direction = ParameterDirection.Input; arParams[2].Value = queuedBy.ToString(); arParams[3] = new FbParameter("@TaskName", FbDbType.VarChar, 255); arParams[3].Direction = ParameterDirection.Input; arParams[3].Value = taskName; arParams[4] = new FbParameter("@NotifyOnCompletion", FbDbType.SmallInt); arParams[4].Direction = ParameterDirection.Input; arParams[4].Value = intNotifyOnCompletion; arParams[5] = new FbParameter("@NotificationToEmail", FbDbType.VarChar, 255); arParams[5].Direction = ParameterDirection.Input; arParams[5].Value = notificationToEmail; arParams[6] = new FbParameter("@NotificationFromEmail", FbDbType.VarChar, 255); arParams[6].Direction = ParameterDirection.Input; arParams[6].Value = notificationFromEmail; arParams[7] = new FbParameter("@NotificationSubject", FbDbType.VarChar, 255); arParams[7].Direction = ParameterDirection.Input; arParams[7].Value = notificationSubject; arParams[8] = new FbParameter("@TaskCompleteMessage", FbDbType.VarChar); arParams[8].Direction = ParameterDirection.Input; arParams[8].Value = taskCompleteMessage; arParams[9] = new FbParameter("@CanStop", FbDbType.SmallInt); arParams[9].Direction = ParameterDirection.Input; arParams[9].Value = intCanStop; arParams[10] = new FbParameter("@CanResume", FbDbType.SmallInt); arParams[10].Direction = ParameterDirection.Input; arParams[10].Value = intCanResume; arParams[11] = new FbParameter("@UpdateFrequency", FbDbType.Integer); arParams[11].Direction = ParameterDirection.Input; arParams[11].Value = updateFrequency; arParams[12] = new FbParameter("@QueuedUTC", FbDbType.TimeStamp); arParams[12].Direction = ParameterDirection.Input; arParams[12].Value = queuedUTC; arParams[13] = new FbParameter("@CompleteRatio", FbDbType.Float); arParams[13].Direction = ParameterDirection.Input; arParams[13].Value = completeRatio; arParams[14] = new FbParameter("@Status", FbDbType.VarChar, 255); arParams[14].Direction = ParameterDirection.Input; arParams[14].Value = status; arParams[15] = new FbParameter("@SerializedTaskObject", FbDbType.VarChar); arParams[15].Direction = ParameterDirection.Input; arParams[15].Value = serializedTaskObject; arParams[16] = new FbParameter("@SerializedTaskType", FbDbType.VarChar, 255); arParams[16].Direction = ParameterDirection.Input; arParams[16].Value = serializedTaskType; StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("INSERT INTO mp_TaskQueue ("); sqlCommand.Append("Guid, "); sqlCommand.Append("SiteGuid, "); sqlCommand.Append("QueuedBy, "); sqlCommand.Append("TaskName, "); sqlCommand.Append("NotifyOnCompletion, "); sqlCommand.Append("NotificationToEmail, "); sqlCommand.Append("NotificationFromEmail, "); sqlCommand.Append("NotificationSubject, "); sqlCommand.Append("TaskCompleteMessage, "); sqlCommand.Append("CanStop, "); sqlCommand.Append("CanResume, "); sqlCommand.Append("UpdateFrequency, "); sqlCommand.Append("QueuedUTC, "); sqlCommand.Append("CompleteRatio, "); sqlCommand.Append("Status, "); sqlCommand.Append("SerializedTaskObject, "); sqlCommand.Append("SerializedTaskType )"); sqlCommand.Append(" VALUES ("); sqlCommand.Append("@Guid, "); sqlCommand.Append("@SiteGuid, "); sqlCommand.Append("@QueuedBy, "); sqlCommand.Append("@TaskName, "); sqlCommand.Append("@NotifyOnCompletion, "); sqlCommand.Append("@NotificationToEmail, "); sqlCommand.Append("@NotificationFromEmail, "); sqlCommand.Append("@NotificationSubject, "); sqlCommand.Append("@TaskCompleteMessage, "); sqlCommand.Append("@CanStop, "); sqlCommand.Append("@CanResume, "); sqlCommand.Append("@UpdateFrequency, "); sqlCommand.Append("@QueuedUTC, "); sqlCommand.Append("@CompleteRatio, "); sqlCommand.Append("@Status, "); sqlCommand.Append("@SerializedTaskObject, "); sqlCommand.Append("@SerializedTaskType );"); int rowsAffected = FBSqlHelper.ExecuteNonQuery( GetConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected); }