public string SenderSMSMexico(int empID, string _strMsg, string _phone, double CurrentGmt) { // string strXML1 = "Appname=Port2SMS&prgname=HTTP_SimpleSMS1&AccountID=1037&UserID=10130&UserPass=1037&Phone=0506447976&Text=Test"; string strXML = "Appname=Port2SMS&prgname=HTTP_SimpleSMS1&AccountID=1037&UserID=10130&UserPass=1037&Phone=" + _phone + "&Text=" + _strMsg; string result = PostDataToURL("http://ign-sms.com/Scripts/mgrqispi.dll?", strXML); ////one time get result empty(check )!!!!!! int Status; if (result.Contains("OK")) { Status = 1; } else { Status = -1; } //add and save row to DB EmployeeSmsSend emp_sms = new EmployeeSmsSend(); emp_sms.EmployeeId = empID; emp_sms.SmsCreatDate = DateTime.Now.AddHours(CurrentGmt); emp_sms.SmsMsg = _strMsg; emp_sms.SmsCount = 1; emp_sms.SmsStatus = Convert.ToInt32(Status); using (ISEEEntities context = new ISEEEntities()) { context.EmployeeSmsSends.Add(emp_sms); context.SaveChanges(); } return(result); }
public string SendSMSClickatell(int empID, string _strMsg, string _phone, string _PhoneAreaCode, double CurrentGmt) { string result = "1"; if (_strMsg.Length < 70) // is limited to 70 characters per message(Clickatell) for unicode { // string phone = _PhoneAreaCode + _phone; //972545500378 string phone = _PhoneAreaCode + "505774499"; WebClient client = new WebClient(); // Add a user agent header in case the requested URI contains a query. client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); client.QueryString.Add("user", "Dshabi"); client.QueryString.Add("password", "shabi101827"); client.QueryString.Add("api_id", "3349639"); client.QueryString.Add("to", phone); client.QueryString.Add("from", "regionSEE"); client.QueryString.Add("text", ToUnicode(_strMsg)); client.QueryString.Add("unicode", "1"); string baseurl = "http://api.clickatell.com/http/sendmsg"; Stream data = client.OpenRead(baseurl); StreamReader reader = new StreamReader(data); string s = reader.ReadToEnd(); data.Close(); reader.Close(); } else { result = "-1"; } //add and save row to DB EmployeeSmsSend emp_sms = new EmployeeSmsSend(); emp_sms.EmployeeId = empID; emp_sms.SmsCreatDate = DateTime.Now.AddHours(CurrentGmt); emp_sms.SmsMsg = _strMsg; emp_sms.SmsCount = 1; emp_sms.SmsStatus = Convert.ToInt32(result); using (ISEEEntities context = new ISEEEntities()) { context.EmployeeSmsSends.Add(emp_sms); context.SaveChanges(); } return(result); }
public string SendSms(string _strMsg, string phoneNumber, int employeeId) { string sss = SessionManagement.PhoneAreaCode; // string _strMsg = ""; string UserName = "******"; string Password = "******"; string msg = System.Security.SecurityElement.Escape(_strMsg); string senderName = "regionSEE"; string senderNumber = "5632455"; //set phone numbers "0545500378;0545500379;" string phonesList = SessionManagement.PhoneAreaCode + "0505774499"; //create XML StringBuilder cbXml = new StringBuilder(); cbXml.Append("<Inforu>"); cbXml.Append("<User>"); cbXml.Append("<Username>" + UserName + "</Username>"); cbXml.Append("<Password>" + Password + "</Password>"); cbXml.Append("</User>"); cbXml.Append("<Content Type=\"sms\">"); cbXml.Append("<Message>" + msg + "</Message>"); cbXml.Append("</Content>"); cbXml.Append("<Recipients>"); cbXml.Append("<PhoneNumber>" + phonesList + "</PhoneNumber>"); cbXml.Append("</Recipients>"); cbXml.Append("<Settings>"); cbXml.Append("<SenderName>" + senderName + "</SenderName>"); cbXml.Append("<SenderNumber>" + senderNumber + "</SenderNumber>"); cbXml.Append("</Settings>"); cbXml.Append("</Inforu>"); string strXML = HttpUtility.UrlEncode(cbXml.ToString(), System.Text.Encoding.UTF8); string result = PostDataToURL("http://api.inforu.co.il/SendMessageXml.ashx", "InforuXML=" + strXML); //one time get result empty(check )!!!!!! int Status = 1; if (!string.IsNullOrEmpty(result)) { XmlDocument xmlRez = new XmlDocument(); xmlRez.LoadXml(result); XmlNode xnNote = xmlRez.SelectSingleNode("Result"); Status = Convert.ToInt32(xnNote["Status"].InnerText); } //add and save row to DB EmployeeSmsSend emp_sms = new EmployeeSmsSend(); emp_sms.EmployeeId = employeeId; emp_sms.SmsCreatDate = DateTime.Now.AddHours(SessionManagement.CurrentGmt); emp_sms.SmsMsg = _strMsg; emp_sms.SmsCount = 1; emp_sms.SmsStatus = Convert.ToInt32(Status); using (ISEEEntities context = new ISEEEntities()) { context.EmployeeSmsSends.Add(emp_sms); context.SaveChanges(); } //this.ObjectContext.EmployeeSmsSend.AddObject(emp_sms); //this.ObjectContext.SaveChanges(); return(result); }