protected void ButtonPhone_Click(object sender, EventArgs e) { string message = TextFacebook.InnerText; string accessToken = "EAAMDizLaZCQABAMqAXjW5FsQyRtLnaDlJaszDyep74w6srKfMP6ZC4ASW4KeRoLlmfrosZBXSRfsbRTRpHuM4R4REqtMMlF3TnNbyeMcpPQQV06fuwSnNuOPvdxjCSBpboIlMIZCDXP0UaExAha5dXCUUCkHAZB2H838yIaHmDZBYrk2B4p6w492apZAEHkAtKGsNpKTVVdawZDZD"; var objFacebookClient = new FacebookClient(accessToken); var parameters = new Dictionary <string, object>(); parameters["message"] = message; //////////////////////////////////////////// VIANETT ///////////////////////////////////////// string username = "******"; string password = "******"; string msgsender = "33683821203"; string destinationaddr = string.Concat("33", TextDestination.Text.Remove(0, 1).ToString()); ViaNettSMS s = new ViaNettSMS(username, password); ViaNettSMS.Result result; try { objFacebookClient.Post("feed", parameters); result = s.sendSMS(msgsender, destinationaddr, String.Concat("You post on Facebook : ", message)); LabelResult.ForeColor = System.Drawing.Color.Green; LabelResult.Visible = true; LabelResult.Text = "Message posted on Facebook and sended to " + TextDestination.Text + " !"; } catch (FacebookApiException fbex) { LabelResult.Visible = true; LabelResult.Text = fbex.Message; } }
protected void sendmessage_Click(object sender, EventArgs e) { string destinationaddr = vendor_ph.SelectedValue; string message = sublab.Value + "\n" + messagesend.Value; error.Text = message; ViaNettSMS s = new ViaNettSMS(username, password); // Declare Result object returned by the SendSMS function ViaNettSMS.Result result; try { // Send SMS through HTTP API result = s.sendSMS(msgsender, destinationaddr, message); // Show Send SMS response if (result.Success) { Debug.WriteLine("Message successfully sent"); } else { Debug.WriteLine("Received error: " + result.ErrorCode + " " + result.ErrorMessage); } } catch (System.Net.WebException ex) { //Catch error occurred while connecting to server. Debug.WriteLine(ex.Message); } }
private void btnSend_Click(object sender, EventArgs e) { //using (System.Net.WebClient client = new System.Net.WebClient()) //{ // try // { // string url = " http://smsc.vianett.no/v3/send.ashx?" + // "src=" + txtPhoneNumber.Text + "&" + // "dst=" + txtPhoneNumber.Text + "&" + // "msg=" + System.Web.HttpUtility.UrlEncode(txtmessage.Text,System.Text.Encoding.GetEncoding("ISO-8859-1")) + "" + // "username="******"&" + // "password="******"ok")) // MessageBox.Show("Your Message has been Successfully Sent.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); // else // MessageBox.Show("Message Send Failure.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); // } // catch (Exception ex) // { // MessageBox.Show(ex.Message,"message",MessageBoxButtons.OK,MessageBoxIcon.Error); // } //} //Set parameters string username = "******"; string password = "******"; string msgsender = "966508218155"; string destinationaddr = txtPhoneNumber.Text;; string message = txtmessage.Text; // Create ViaNettSMS object with username and password ViaNettSMS s = new ViaNettSMS(username, password); // Declare Result object returned by the SendSMS function ViaNettSMS.Result result; try { // Send SMS through HTTP API result = s.sendSMS(msgsender, destinationaddr, message); // Show Send SMS response if (result.Success) { MessageBox.Show("Message successfully sent"); } else { MessageBox.Show("Received error: " + result.ErrorCode + " " + result.ErrorMessage); } } catch (System.Net.WebException ex) { //Catch error occurred while connecting to server. MessageBox.Show(ex.Message); } }
private static void SendSms(INotificationRepository repo, IList <UserView> users, Notification notify) { string error = null; string username = "******"; string password = "******"; string msgsender = "4700000000"; // "DEMO374733"; //string destinationaddr = "4560991000"; // Create ViaNettSMS object with username and password ViaNettSMS s = new ViaNettSMS(username, password); // Declare Result object returned by the SendSMS function ViaNettSMS.Result result; foreach (var user in users) { try { // Send SMS through HTTP API result = s.sendSMS(msgsender, user.PhoneNumber, notify.Message); // Show Send SMS response if (result.Success) { error = null; } else { error = "Received error: " + result.ErrorCode + " " + result.ErrorMessage; } error = null; } catch (Exception ex) { error = ex.Message; } repo.Add(new SmsLog { Error = error, NotificatId = notify.Id, Notificat = notify.Id == 0 ? notify : null, SentOk = error == null, SentTime = DateTime.Now, SentToUser = user.Name }); } }
public ActionResult SendSMS() { // ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application."; string username = "******"; string password = "******"; string msgsender = "NCrypted Technologies"; string destinationaddr = "+918866658130"; string message = "Hello Uttam From Jignesh"; ViaNettSMS s = new ViaNettSMS(username, password); ViaNettSMS.Result result; try { result = s.sendSMS(msgsender, destinationaddr, message); if (result.Success) { //response.Write("Message successfully sent"); ViewBag.Message = "Message successfully sent."; } else { //response.Write("Received error:" + result.ErrorCode + " " + result.ErrorMessage); ViewBag.Message = "Received error:" + result.ErrorCode + " " + result.ErrorMessage; } } catch (System.Net.WebException ex) { //Error occurred while connecting to server. //response.Write(ex.Message); ViewBag.Message = ex.Message; } return View(); }
private void btnDeliverySubmit_Click(object sender, EventArgs e) { Company_Information inf = db.Company_Information.FirstOrDefault(c => c.Company_Info_ID == 1); string phrase = txtContact.Text; double number; bool isNumeric = double.TryParse(phrase, out number); if ((phrase.Length == 10) && (isNumeric == true)) { if (Convert.ToInt32(txtContact.Text) > -1) { double VatAmount = 0; DeliveryTable order = new DeliveryTable(); order.ItemName = ""; order.orderTotal = Globals.AmountDue; int contact = Convert.ToInt32(txtContact.Text); if (Globals.ComboItems.Count != 0) { foreach (var item in Globals.ComboItems) { VatAmount = VatAmount + item.OrderItemPrice * inf.VAT_Percentage; } } if (Globals.ComboItems.Count != 0) { foreach (var item in Globals.MenuItems) { VatAmount = VatAmount + item.OrderItemPrice * inf.VAT_Percentage; } } if (Globals.StockItems.Count != 0) { foreach (var item in Globals.StockItems) { VatAmount = VatAmount + item.OrderItemPrice * inf.VAT_Percentage; } } VatAmount = Math.Round(VatAmount, 2); order.orderDatef = DateTime.Now; order.vatTot = VatAmount; order.orderNotesf = richTextBox1.Text; order.orderTotal = Globals.AmountDue; order.totalItemsf = Globals.ComboItems.Count + Globals.MenuItems.Count + Globals.StockItems.Count; Customer cust = db.Customers.FirstOrDefault(c => ((c.Customer_Name == txtCustName.Text) && (c.Customer_Contact_Number == contact))); if (cust == null) { MessageBox.Show("Customer does not exist,Add customer"); using (frmAddCustomer frm = new frmAddCustomer() { }) { if ((frm.ShowDialog() == DialogResult.OK) && (Globals.addCustomer == true)) { var some = db.Customers.ToList(); cust = some.LastOrDefault(); order.customerName = cust.Customer_Name; order.customerContact = cust.Customer_Contact_Number; } else { MessageBox.Show("Something went wrong"); return; } } } else { order.customerName = txtCustName.Text; order.customerContact = Convert.ToInt32(txtContact.Text); } db.DeliveryTables.Add(order); db.SaveChanges(); for (int i = 0; i < Globals.ComboItems.Count; i++) { DeliveryLine item = new DeliveryLine(); item.comboItemId = Globals.ComboItems[i].OrderItemId; item.orderId = order.OrderId; item.comboItemQuantity = Globals.ComboItems[i].OrderQuantity; db.DeliveryLines.Add(item); } for (int i = 0; i < Globals.StockItems.Count; i++) { DeliveryLine item = new DeliveryLine(); item.stockItemId = Globals.StockItems[i].OrderItemId; item.orderId = order.OrderId; item.stockItemQuantity = Globals.StockItems[i].OrderQuantity; db.DeliveryLines.Add(item); } for (int i = 0; i < Globals.MenuItems.Count; i++) { DeliveryLine item = new DeliveryLine(); item.menuItemId = Globals.MenuItems[i].OrderItemId; item.orderId = order.OrderId; item.menuItemQuantity = Globals.MenuItems[i].OrderQuantity; db.DeliveryLines.Add(item); } db.SaveChanges(); this.Close(); Globals.ComboItems.Clear(); Globals.MenuItems.Clear(); Globals.StockItems.Clear(); int id2 = Globals.LogedUser; Employee emp = db.Employees.FirstOrDefault(c => c.Employee_ID == id2); Audit ad = new Audit(); ad.Audit_Name = emp.Employee_Name; ad.Audit_Table = "DeliveryTable"; ad.Audit_Description = "Order Saving"; ad.User_ID = Globals.LogedUser; ad.transactionNumber = order.OrderId; ad.auditDate = DateTime.Now; db.Audits.Add(ad); db.SaveChanges(); MessageBox.Show("Order saved successfully with order number: " + order.OrderId.ToString() + ",customer Address: " + cust.Customer_Address.ToString()); string username = "******"; string password = "******"; string msgsender = "4700000000"; string destinationaddr = "27" + txtContact.Text.Substring(1, 9); string message = "Dear customer,thank you for ordering food with us,your order is being prepared for delivery,your order number is: " + order.OrderId.ToString(); // Create ViaNettSMS object with username and password ViaNettSMS s = new ViaNettSMS(username, password); // Declare Result object returned by the SendSMS function ViaNettSMS.Result result; try { // Send SMS through HTTP API result = s.sendSMS(msgsender, destinationaddr, message); // Show Send SMS response if (result.Success) { MessageBox.Show("Order confirmation message successfully sent to customer"); } else { MessageBox.Show("Error:Network connection not strong enough to send and receive messages:" + result.ErrorCode + " " + result.ErrorMessage); } } catch (System.Net.WebException ex) { //Catch error occurred while connecting to server. MessageBox.Show(ex.Message); } } else { MessageBox.Show("Error: Contact number can't be a negative number"); } } else { MessageBox.Show("Error: Contact number not numeric/valid,please anter a valid number(integer)"); } }