本文整理汇总了C#中SqlParameterHelper类的典型用法代码示例。如果您正苦于以下问题:C# SqlParameterHelper类的具体用法?C# SqlParameterHelper怎么用?C# SqlParameterHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SqlParameterHelper类属于命名空间,在下文中一共展示了SqlParameterHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
/// <summary>
/// Inserts a row in the mp_RedirectList table. Returns rows affected count.
/// </summary>
/// <param name="rowGuid"> rowGuid </param>
/// <param name="siteGuid"> siteGuid </param>
/// <param name="siteID"> siteID </param>
/// <param name="oldUrl"> oldUrl </param>
/// <param name="newUrl"> newUrl </param>
/// <param name="createdUtc"> createdUtc </param>
/// <param name="expireUtc"> expireUtc </param>
/// <returns>int</returns>
public int Create(
Guid rowGuid,
Guid siteGuid,
int siteID,
string oldUrl,
string newUrl,
DateTime createdUtc,
DateTime expireUtc)
{
SqlParameterHelper sph = new SqlParameterHelper(
logFactory,
writeConnectionString,
"mp_RedirectList_Insert",
7);
sph.DefineSqlParameter("@RowGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, rowGuid);
sph.DefineSqlParameter("@SiteGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, siteGuid);
sph.DefineSqlParameter("@SiteID", SqlDbType.Int, ParameterDirection.Input, siteID);
sph.DefineSqlParameter("@OldUrl", SqlDbType.NVarChar, 255, ParameterDirection.Input, oldUrl);
sph.DefineSqlParameter("@NewUrl", SqlDbType.NVarChar, 255, ParameterDirection.Input, newUrl);
sph.DefineSqlParameter("@CreatedUtc", SqlDbType.DateTime, ParameterDirection.Input, createdUtc);
sph.DefineSqlParameter("@ExpireUtc", SqlDbType.DateTime, ParameterDirection.Input, expireUtc);
int rowsAffected = sph.ExecuteNonQuery();
return rowsAffected;
}
示例2: Create
/// <summary>
/// Inserts a row in the mp_Currency table. Returns rows affected count.
/// </summary>
/// <param name="guid"> guid </param>
/// <param name="title"> title </param>
/// <param name="code"> code </param>
/// <param name="symbolLeft"> symbolLeft </param>
/// <param name="symbolRight"> symbolRight </param>
/// <param name="decimalPointChar"> decimalPointChar </param>
/// <param name="thousandsPointChar"> thousandsPointChar </param>
/// <param name="decimalPlaces"> decimalPlaces </param>
/// <param name="value"> value </param>
/// <param name="lastModified"> lastModified </param>
/// <param name="created"> created </param>
/// <returns>bool</returns>
public async Task<bool> Create(
Guid guid,
string title,
string code,
string symbolLeft,
string symbolRight,
string decimalPointChar,
string thousandsPointChar,
string decimalPlaces,
decimal value,
DateTime lastModified,
DateTime created)
{
SqlParameterHelper sph = new SqlParameterHelper(
logFactory,
writeConnectionString,
"mp_Currency_Insert",
11);
sph.DefineSqlParameter("@Guid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, guid);
sph.DefineSqlParameter("@Title", SqlDbType.NVarChar, 50, ParameterDirection.Input, title);
sph.DefineSqlParameter("@Code", SqlDbType.NChar, 3, ParameterDirection.Input, code);
sph.DefineSqlParameter("@SymbolLeft", SqlDbType.NVarChar, 15, ParameterDirection.Input, symbolLeft);
sph.DefineSqlParameter("@SymbolRight", SqlDbType.NVarChar, 15, ParameterDirection.Input, symbolRight);
sph.DefineSqlParameter("@DecimalPointChar", SqlDbType.NChar, 1, ParameterDirection.Input, decimalPointChar);
sph.DefineSqlParameter("@ThousandsPointChar", SqlDbType.NChar, 1, ParameterDirection.Input, thousandsPointChar);
sph.DefineSqlParameter("@DecimalPlaces", SqlDbType.NChar, 1, ParameterDirection.Input, decimalPlaces);
sph.DefineSqlParameter("@Value", SqlDbType.Decimal, ParameterDirection.Input, value);
sph.DefineSqlParameter("@LastModified", SqlDbType.DateTime, ParameterDirection.Input, lastModified);
sph.DefineSqlParameter("@Created", SqlDbType.DateTime, ParameterDirection.Input, created);
int rowsAffected = await sph.ExecuteNonQueryAsync();
return rowsAffected > 0;
}
示例3: Create
/// <summary>
/// Inserts a row in the mp_SystemLog table. Returns new integer id.
/// </summary>
/// <param name="logDate"> logDate </param>
/// <param name="ipAddress"> ipAddress </param>
/// <param name="culture"> culture </param>
/// <param name="url"> url </param>
/// <param name="shortUrl"> shortUrl </param>
/// <param name="thread"> thread </param>
/// <param name="logLevel"> logLevel </param>
/// <param name="logger"> logger </param>
/// <param name="message"> message </param>
/// <returns>int</returns>
public int Create(
DateTime logDate,
string ipAddress,
string culture,
string url,
string shortUrl,
string thread,
string logLevel,
string logger,
string message)
{
SqlParameterHelper sph = new SqlParameterHelper(
logFactory,
writeConnectionString,
"mp_SystemLog_Insert",
9);
sph.DefineSqlParameter("@LogDate", SqlDbType.DateTime, ParameterDirection.Input, logDate);
sph.DefineSqlParameter("@IpAddress", SqlDbType.NVarChar, 50, ParameterDirection.Input, ipAddress);
sph.DefineSqlParameter("@Culture", SqlDbType.NVarChar, 10, ParameterDirection.Input, culture);
sph.DefineSqlParameter("@Url", SqlDbType.NVarChar, -1, ParameterDirection.Input, url);
sph.DefineSqlParameter("@ShortUrl", SqlDbType.NVarChar, 255, ParameterDirection.Input, shortUrl);
sph.DefineSqlParameter("@Thread", SqlDbType.NVarChar, 255, ParameterDirection.Input, thread);
sph.DefineSqlParameter("@LogLevel", SqlDbType.NVarChar, 20, ParameterDirection.Input, logLevel);
sph.DefineSqlParameter("@Logger", SqlDbType.NVarChar, 255, ParameterDirection.Input, logger);
sph.DefineSqlParameter("@Message", SqlDbType.NVarChar, -1, ParameterDirection.Input, message);
int newID = Convert.ToInt32(sph.ExecuteScalar());
return newID;
}
示例4: GetSiteSettingsExList
public DbDataReader GetSiteSettingsExList(int siteId)
{
SqlParameterHelper sph = new SqlParameterHelper(
logFactory,
readConnectionString,
"mp_SiteSettingsEx_SelectAll",
1);
sph.DefineSqlParameter("@SiteID", SqlDbType.Int, ParameterDirection.Input, siteId);
return sph.ExecuteReader();
}
示例5: GetUserCountByYearMonth
public DbDataReader GetUserCountByYearMonth(int siteId)
{
SqlParameterHelper sph = new SqlParameterHelper(
logFactory,
readConnectionString,
"mp_Users_GetCountByMonthYear",
1);
sph.DefineSqlParameter("@SiteID", SqlDbType.Int, ParameterDirection.Input, siteId);
return sph.ExecuteReader();
}
示例6: Delete
public async Task<bool> Delete(int roleId)
{
SqlParameterHelper sph = new SqlParameterHelper(
logFactory,
writeConnectionString,
"mp_Roles_Delete",
1);
sph.DefineSqlParameter("@RoleID", SqlDbType.Int, ParameterDirection.Input, roleId);
int rowsAffected = await sph.ExecuteNonQueryAsync();
return (rowsAffected > -1);
}
示例7: Delete
public async Task<bool> Delete(Guid guid)
{
SqlParameterHelper sph = new SqlParameterHelper(
logFactory,
writeConnectionString,
"mp_SiteFolders_Delete",
1);
sph.DefineSqlParameter("@Guid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, guid);
int rowsAffected = await sph.ExecuteNonQueryAsync();
return (rowsAffected > -1);
}
示例8: EmailLookup
//public DbDataReader GetSmartDropDownData(int siteId, string query, int rowsToGet)
//{
// SqlParameterHelper sph = new SqlParameterHelper(
// logFactory,
// readConnectionString,
// "mp_Users_SmartDropDown",
// 3);
// sph.DefineSqlParameter("@SiteID", SqlDbType.Int, ParameterDirection.Input, siteId);
// sph.DefineSqlParameter("@Query", SqlDbType.NVarChar, 50, ParameterDirection.Input, query);
// sph.DefineSqlParameter("@RowsToGet", SqlDbType.Int, ParameterDirection.Input, rowsToGet);
// return sph.ExecuteReader();
//}
public DbDataReader EmailLookup(int siteId, string query, int rowsToGet)
{
SqlParameterHelper sph = new SqlParameterHelper(
logFactory,
readConnectionString,
"mp_Users_EmailLookup",
3);
sph.DefineSqlParameter("@SiteID", SqlDbType.Int, ParameterDirection.Input, siteId);
sph.DefineSqlParameter("@Query", SqlDbType.NVarChar, 50, ParameterDirection.Input, query);
sph.DefineSqlParameter("@RowsToGet", SqlDbType.Int, ParameterDirection.Input, rowsToGet);
return sph.ExecuteReader();
}
示例9: DeleteByUser
public async Task<bool> DeleteByUser(int siteId, string userId)
{
SqlParameterHelper sph = new SqlParameterHelper(
logFactory,
writeConnectionString,
"mp_UserClaims_DeleteByUser",
2);
sph.DefineSqlParameter("@UserId", SqlDbType.NVarChar, 128, ParameterDirection.Input, userId);
sph.DefineSqlParameter("@SiteId", SqlDbType.Int, ParameterDirection.Input, siteId);
int rowsAffected = await sph.ExecuteNonQueryAsync();
return (rowsAffected > 0);
}
示例10: Delete
public async Task<bool> Delete(
int id,
CancellationToken cancellationToken)
{
SqlParameterHelper sph = new SqlParameterHelper(
logFactory,
writeConnectionString,
"mp_UserClaims_Delete",
1);
sph.DefineSqlParameter("@Id", SqlDbType.Int, ParameterDirection.Input, id);
int rowsAffected = await sph.ExecuteNonQueryAsync(cancellationToken);
return (rowsAffected > 0);
}
示例11: Update
public async Task<bool> Update(
int roleId,
string roleName,
CancellationToken cancellationToken)
{
SqlParameterHelper sph = new SqlParameterHelper(
logFactory,
writeConnectionString,
"mp_Roles_Update",
2);
sph.DefineSqlParameter("@RoleID", SqlDbType.Int, ParameterDirection.Input, roleId);
sph.DefineSqlParameter("@RoleName", SqlDbType.NVarChar, 50, ParameterDirection.Input, roleName);
int rowsAffected = await sph.ExecuteNonQueryAsync(cancellationToken);
return (rowsAffected > -1);
}
示例12: Delete
/// <summary>
/// Deletes a row from the mp_UserLogins table. Returns true if row deleted.
/// </summary>
/// <param name="loginProvider"> loginProvider </param>
/// <param name="providerKey"> providerKey </param>
/// <param name="userId"> userId </param>
/// <returns>bool</returns>
public async Task<bool> Delete(int siteId, string loginProvider, string providerKey, string userId)
{
SqlParameterHelper sph = new SqlParameterHelper(
logFactory,
writeConnectionString,
"mp_UserLogins_Delete",
4);
sph.DefineSqlParameter("@LoginProvider", SqlDbType.NVarChar, 128, ParameterDirection.Input, loginProvider);
sph.DefineSqlParameter("@ProviderKey", SqlDbType.NVarChar, 128, ParameterDirection.Input, providerKey);
sph.DefineSqlParameter("@UserId", SqlDbType.NVarChar, 128, ParameterDirection.Input, userId);
sph.DefineSqlParameter("@SiteId", SqlDbType.Int, ParameterDirection.Input, siteId);
int rowsAffected = await sph.ExecuteNonQueryAsync();
return (rowsAffected > 0);
}
示例13: Add
/// <summary>
/// Inserts a row in the mp_BannedIPAddresses table. Returns new integer id.
/// </summary>
/// <param name="bannedIP"> bannedIP </param>
/// <param name="bannedUTC"> bannedUTC </param>
/// <param name="bannedReason"> bannedReason </param>
/// <returns>int</returns>
public int Add(
string bannedIP,
DateTime bannedUtc,
string bannedReason)
{
SqlParameterHelper sph = new SqlParameterHelper(
logFactory,
writeConnectionString,
"mp_BannedIPAddresses_Insert",
3);
sph.DefineSqlParameter("@BannedIP", SqlDbType.NVarChar, 50, ParameterDirection.Input, bannedIP);
sph.DefineSqlParameter("@BannedUTC", SqlDbType.DateTime, ParameterDirection.Input, bannedUtc);
sph.DefineSqlParameter("@BannedReason", SqlDbType.NVarChar, 255, ParameterDirection.Input, bannedReason);
int newID = Convert.ToInt32(sph.ExecuteScalar());
return newID;
}
示例14: Update
public async Task<bool> Update(
Guid guid,
Guid siteGuid,
string folderName)
{
SqlParameterHelper sph = new SqlParameterHelper(
logFactory,
writeConnectionString,
"mp_SiteFolders_Update",
3);
sph.DefineSqlParameter("@Guid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, guid);
sph.DefineSqlParameter("@SiteGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, siteGuid);
sph.DefineSqlParameter("@FolderName", SqlDbType.NVarChar, 255, ParameterDirection.Input, folderName);
int rowsAffected = await sph.ExecuteNonQueryAsync();
return (rowsAffected > -1);
}
示例15: Create
/// <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 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)
{
SqlParameterHelper sph = new SqlParameterHelper(
logFactory,
writeConnectionString,
"mp_UserLocation_Insert",
17);
sph.DefineSqlParameter("@RowID", SqlDbType.UniqueIdentifier, ParameterDirection.Input, rowID);
sph.DefineSqlParameter("@UserGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, userGuid);
sph.DefineSqlParameter("@SiteGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, siteGuid);
sph.DefineSqlParameter("@IPAddress", SqlDbType.NVarChar, 50, ParameterDirection.Input, iPAddress);
sph.DefineSqlParameter("@IPAddressLong", SqlDbType.BigInt, ParameterDirection.Input, iPAddressLong);
sph.DefineSqlParameter("@Hostname", SqlDbType.NVarChar, 255, ParameterDirection.Input, hostname);
sph.DefineSqlParameter("@Longitude", SqlDbType.Float, ParameterDirection.Input, longitude);
sph.DefineSqlParameter("@Latitude", SqlDbType.Float, ParameterDirection.Input, latitude);
sph.DefineSqlParameter("@ISP", SqlDbType.NVarChar, 255, ParameterDirection.Input, iSP);
sph.DefineSqlParameter("@Continent", SqlDbType.NVarChar, 255, ParameterDirection.Input, continent);
sph.DefineSqlParameter("@Country", SqlDbType.NVarChar, 255, ParameterDirection.Input, country);
sph.DefineSqlParameter("@Region", SqlDbType.NVarChar, 255, ParameterDirection.Input, region);
sph.DefineSqlParameter("@City", SqlDbType.NVarChar, 255, ParameterDirection.Input, city);
sph.DefineSqlParameter("@TimeZone", SqlDbType.NVarChar, 255, ParameterDirection.Input, timeZone);
sph.DefineSqlParameter("@CaptureCount", SqlDbType.Int, ParameterDirection.Input, captureCount);
sph.DefineSqlParameter("@FirstCaptureUTC", SqlDbType.DateTime, ParameterDirection.Input, firstCaptureUTC);
sph.DefineSqlParameter("@LastCaptureUTC", SqlDbType.DateTime, ParameterDirection.Input, lastCaptureUTC);
int rowsAffected = sph.ExecuteNonQuery();
return rowsAffected;
}