This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static DateTime Truncate(this DateTime dateTime, TimeSpan timeSpan) | |
{ | |
if (timeSpan == TimeSpan.Zero) return dateTime; // Or could throw an ArgumentException | |
return dateTime.AddTicks(-(dateTime.Ticks % timeSpan.Ticks)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private X509Certificate2 RsaCertificate | |
{ | |
get | |
{ | |
var store = new X509Store(StoreName.My, StoreLocation.LocalMachine); | |
store.Open(OpenFlags.ReadOnly); | |
var certs = store.Certificates.Find(X509FindType.FindBySubjectDistinguishedName, ConfigurationManager.AppSettings.Get("CertificateSubjectName"), false); | |
store.Close(); | |
return certs[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static bool HasColumn(this IDataRecord dr, string columnName) | |
{ | |
for (int i = 0; i < dr.FieldCount; i++) | |
{ | |
if (dr.GetName(i).Equals(columnName, StringComparison.InvariantCultureIgnoreCase)) return true; | |
} | |
return false; | |
} |