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 virtual string CreatePasswordHash(string password, string saltkey, string passwordFormat = "SHA1") | |
{ | |
if (String.IsNullOrEmpty(passwordFormat)) | |
passwordFormat = "SHA1"; | |
string saltAndPassword = String.Concat(password, saltkey); | |
var algorithm = HashAlgorithm.Create(passwordFormat); | |
if (algorithm == null) | |
throw new ArgumentException("Unrecognized hash name", "hashName"); | |
var hashByteArray = algorithm.ComputeHash(Encoding.UTF8.GetBytes(saltAndPassword)); |
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 string CreateSaltKey(int size) | |
{ | |
var rng = new RNGCryptoServiceProvider(); | |
var buff = new byte[size]; | |
rng.GetBytes(buff); | |
return Convert.ToBase64String(buff); | |
} |
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 string[] CreateImportDefinition(string fileName, string destinationKey, int destinationId) | |
{ | |
var key = Guid.NewGuid().ToString(); | |
var definition = new ExactTargetApi.ImportDefinition | |
{ | |
Name = key, | |
CustomerKey = key, | |
Description = string.Format("This import definition was created through the API. On {0}", DateTime.Now.ToShortDateString()), | |
AllowErrors = true, | |
AllowErrorsSpecified = true, |
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 void ClearTextBoxes() | |
{ | |
Action<Control.ControlCollection> func = null; | |
func = (controls) => | |
{ | |
foreach (Control control in controls) | |
if (control is TextBox) | |
(control as TextBox).Clear(); | |
else |