Exemplo n.º 1
0
        public string SendText(string phone, string firstname, string lastname)
        {
            var tAlert = new TransactionAlert
            {
                PhoneNumber = phone,
                Sender      = "Paytrx",
                Message     = $"Dear {firstname?.ToUpper()} {lastname?.ToUpper()}, {ConfigurationManager.AppSettings["SmsWelcomeMessage"]}"
            };

            var smsResponse = NotificationService.SendSms(tAlert);

            return(smsResponse);
        }
Exemplo n.º 2
0
        public static string SendSms(TransactionAlert tAlert)
        {
            string smsStatus;

            tAlert.BaseUrl  = ConfigurationManager.AppSettings["SmsBaseUrl"];
            tAlert.Username = ConfigurationManager.AppSettings["SmsUserName"];
            tAlert.Password = ConfigurationManager.AppSettings["SmsPassword"];
            tAlert.Sender   = ConfigurationManager.AppSettings["SmsSender"];

            var smsParameters =
                $"username={tAlert.Username}&password={tAlert.Password}&sender={tAlert.Sender}&mobiles={tAlert.PhoneNumber}&recipient={tAlert.PhoneNumber}&message={tAlert.Message}";

            //http://portal.bulksmsnigeria.net/api/[email protected]&password=captain12&message=Sent%20SMS!&sender=Godwin&mobiles=2347057987704

            using (var wc = new WebClient())
            {
                wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
                smsStatus = wc.UploadString(tAlert.BaseUrl, smsParameters);
            }
            return(smsStatus);
        }
Exemplo n.º 3
0
        public void SendEmail(LoanViewModel lvm)
        {
            try
            {
                var tAlert = new TransactionAlert
                {
                    PhoneNumber = lvm.AccountsModel.Phone,
                    Sender      = "PayOrBoro",
                    Message     = $"Dear {lvm.AccountsModel.firstname?.ToUpper()} {lvm.AccountsModel.lastname?.ToUpper()}, {ConfigurationManager.AppSettings["SmsWelcomeMessage"]}"
                };

                // var smsResponse = NotificationService.SendSms(tAlert);

                var bodyTxt = System.IO.File.ReadAllText(Server.MapPath("~/EmailNotifications/WelcomeEmailNotification.html"));
                bodyTxt = bodyTxt.Replace("$MerchantName", $"{lvm.AccountsModel.firstname} {lvm.AccountsModel.lastname}");
                var msgHeader = $"Welcome to PayorBoro";
                var sendMail  = NotificationService.SendMail(msgHeader, bodyTxt, lvm.AccountsModel.Email, null, null);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
            }
        }