Example #1
0
 public string GetEncryptedData(string dealID)
 {
     try
     {
         var configLoader = new ConfigHelper();
         var passPhrase = configLoader.GetAppSettingsStringValue("Phrase");
         return EncryptString.Encrypt(dealID, passPhrase);
     }
     catch (Exception ex)
     {
         lBal.LogMessage(ex.InnerException.Message + "at " + ex.StackTrace, LogMessageTypes.Error);
         return string.Empty;
     }
 }
Example #2
0
        public string SendEmailWithPassword(string userName)
        {
            try
            {
            string registeredEmailAddress = uDal.GetRegisteredEmailAddress(userName);
            string password = uDal.GetPassword(userName);
            var configLoader = new ConfigHelper();
            SmtpClient client = new SmtpClient(configLoader.GetAppSettingsStringValue("MailServer"), int.Parse(configLoader.GetAppSettingsStringValue("MailPort")));
            MailAddress from = new MailAddress(configLoader.GetAppSettingsStringValue("EmailSender"),configLoader.GetAppSettingsStringValue("DisplayNameStart")+(char)0xD8+configLoader.GetAppSettingsStringValue("DisplayNameEnd"),System.Text.Encoding.UTF8);
            MailAddress to = new MailAddress(registeredEmailAddress.Trim());
            MailMessage message = new MailMessage(from, to);
            message.Body = "Your password is : " + password;
            message.BodyEncoding = System.Text.Encoding.UTF8;
            message.Subject = "Your password to access Deals4uindia.com";
            client.Credentials = CredentialCache.DefaultNetworkCredentials;
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.Send(message);
            return registeredEmailAddress;
            }

            catch (Exception ex)
            {
                lBal.LogMessage(ex.InnerException.Message + "at " + ex.StackTrace, LogMessageTypes.Error);
                return ex.InnerException.Message;
            }
        }