private void SendSmes(EPUser user, IEnumerable <Sms> smsList) { if (smsList.Count() > 0) { SmsModule smsModule = new SmsModule(user.EmailUsername, user.EmailPassword); foreach (var sms in smsList) { bool smsSuccess = smsModule.SendSMS(sms.ToNumber, sms.Content); sms.StatusId = smsSuccess ? (int)MessageStatus.Send : (int)MessageStatus.Failed; sms.StatusDate = DateTime.Now; smsCount += 1; } campaignService.UpdateCampaignSmses(smsList); } }
public bool SendTestCampaign(int campaignId, string recepient) { CampaignService campaignService = new CampaignService(); var campaign = campaignService.GetCampaign(campaignId); var user = new UserService().GetUser(campaign.CreatedBy); bool response = false; if (campaign.TypeId == (int)CampaignType.SMS) { SmsModule smsModule = new SmsModule(user.SmsUsername, user.SmsPassword); response = smsModule.SendSMS(recepient, campaign.ContentTemplate); } else { EmailModule emailModule = new EmailModule(user.EmailUsername, user.EmailPassword); response = emailModule.SendEmail(user.Name, recepient, "", "", campaign.SubjectTemplate, campaign.ContentTemplate); } return(response); }
protected void Page_Load(object sender, EventArgs e) { String hour = DateTime.Now.ToString("HH"); if (Convert.ToInt32(hour) > 12 && Convert.ToInt32(hour) <= 24) { hour = Convert.ToString(Convert.ToInt32(hour) - 12); } String min = DateTime.Now.ToString("mm"); try { if (!IsPostBack) { if (Session["UserName"] == null) { Response.Redirect("FrmLogin.aspx"); } txtFromCustNo.Visible = false; txtFromCustName.Visible = false; txtToCustNo.Visible = false; txtToCustName.Visible = false; txtMin.Text = Convert.ToString(Convert.ToUInt32(min) + 2); txtHr.Text = Convert.ToString(Convert.ToUInt32(hour)); SMS = new SmsModule(Convert.ToString(Session["BankName"]), Convert.ToString(Session["BranchName"]).Trim()); txtBalMessage.Text = SmsModule.MessageFormat; SMS.GlCodeBind(ddlPrdType); SMS.GlCodeBindForBal(ddlBalPrdType); } } catch (Exception Ex) { ExceptionLogging.SendErrorToText(Ex); } }
public Startup(IHostingEnvironment env) { var simpleIdServerModule = new SimpleIdentityServerHostModule(); var shellModule = new ShellModule(); var loginPasswordModule = new LoginPasswordModule(); var smsModule = new SmsModule(); var userManagementModule = new UserManagementModule(); simpleIdServerModule.Init(null); shellModule.Init(null); loginPasswordModule.Init(new Dictionary <string, string> { { "IsEditCredentialEnabled", "true" } }); smsModule.Init(new Dictionary <string, string> { { "IsSelfProvisioningEnabled", "true" } }); userManagementModule.Init(new Dictionary <string, string> { { "CanUpdateTwoFactorAuthentication", "true" } }); }
public string Send_SMSALL(string CustNo, string Message, string MobileNo, string messageType = "0") { SmsModule SMS = new SmsModule(); System.Net.WebRequest WebReq; System.Net.WebResponse WebRes; string mno = ""; string Server = ""; string UserName = ""; string Password = ""; string source = ""; string URL = ""; string responce = ""; string responcestatus = ""; string SMSClient = ""; string WebResponseString = ""; string BKCD = ""; int K = 0; try { sql = "Select BANKCD From BankName Where BRCD = '" + Session["BRCD"].ToString() + "'"; BKCD = con.sExecuteScalar(sql); DataTable dtPara = new DataTable(); sql = "Select ListField, ListValue From PARAMETER Where ListField = 'SMSUID' Union Select ListField, ListValue From PARAMETER Where ListField='SMSPWD' Union Select ListField, ListValue From PARAMETER Where ListField='SMSSENDER' Union Select ListField, ListValue From PARAMETER Where ListField='SMSLINK' Union Select ListField, ListValue From PARAMETER Where ListField='SMSClient'"; dtPara = con.GetDatatable(sql); WebReq = null; WebRes = null; for (int a = 0; a < dtPara.Rows.Count; a++) { if (dtPara.Rows[a]["ListField"].ToString() == "SMSUID") { UserName = dtPara.Rows[a]["ListValue"].ToString(); } if (dtPara.Rows[a]["ListField"].ToString() == "SMSPWD") { Password = dtPara.Rows[a]["ListValue"].ToString(); } if (dtPara.Rows[a]["ListField"].ToString() == "SMSSENDER") { source = dtPara.Rows[a]["ListValue"].ToString(); } if (dtPara.Rows[a]["ListField"].ToString() == "SMSLINK") { Server = dtPara.Rows[a]["ListValue"].ToString(); } if (dtPara.Rows[a]["ListField"].ToString() == "SMSClient") { SMSClient = dtPara.Rows[a]["ListValue"].ToString(); } } WebResponseString = ""; if (SMSClient == "Palghar") { MobileNo = DT.Rows[K]["Mobile"].ToString(); // MobileNo="8485058488"; URL = Server + "user="******"&key=" + Password + "&mobile=" + MobileNo + "&message=" + Message.ToString() + "&senderid=" + source + "&accusage=1"; } else if (SMSClient == "RouteSms") { if (messageType.Equals("2")) { URL = Server + "destination=" + MobileNo + "&source=" + source + "&message=" + SMS.ConvertToUnicode(Message) + "&username="******"&password="******"&type=" + messageType; } else { URL = Server + "destination=" + MobileNo + "&source=" + source + "&message=" + Message.ToString() + "&username="******"&password="******"&type=" + messageType; } } if (SMSClient == "Business") { // MobileNo = DT.Rows[K]["Mobile"].ToString(); URL = Server + "ID=" + UserName + "&Pwd=" + Password + "&PhNo=" + MobileNo + "&Text=" + Message.ToString() + ""; } else if (SMSClient == "AdMark") { MobileNo = DT.Rows[K]["Mobile"].ToString(); // MobileNo = "8485058488"; URL = Server + "clientid=" + UserName + "&apikey=" + Password + "&msisdn=" + MobileNo + "&sid=YSHPAT&msg=" + Message.ToString() + "&fl=0&gwid=2"; } else if (SMSClient == "TubeLight") { MobileNo = DT.Rows[K]["Mobile"].ToString(); // MobileNo = "8485058488"; URL = Server + "username="******"&password="******"&type=Text&sender=" + source + "&mobile=" + MobileNo + "&message=" + Message.ToString(); } WebReq = System.Net.HttpWebRequest.Create(URL); WebReq.Timeout = 25000; //Code for getting response from web WebRequest myreq = (WebRequest)WebRequest.Create(URL); WebResponse myres = (WebResponse)myreq.GetResponse(); System.IO.StreamReader reader = new System.IO.StreamReader(myres.GetResponseStream()); WebResponseString = reader.ReadToEnd(); myres.Close(); //Display Response. responce = WebResponseString.ToString(); // responce = "0"; if (BKCD != "1002") //For AVS Link { responcestatus = responce.Substring(0, 4); } else { //For YASHOMANDIR Link responcestatus = responce.Substring(14, 3); } } catch (Exception ex) { ExceptionLogging.SendErrorToText(ex); return(null); } return(responcestatus); }