Source


The following code is the source for file /About/Default.aspx.cs. The code is provided under the GPLv2 and a commercial license.

For more information about our source code please visit our Open Source page.

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Weavver.Vendors.Digium.Asterisk;

public partial class About_Default : SkeletonPage
{
//-------------------------------------------------------------------------------------------
     protected void Page_Load(object sender, EventArgs e)
     {
          HasHeader = true;
          IsPublic = true;
          Call.Attributes.Add("OnClick", 
          string.Format("this.disabled = true; this.value = 'Trying..'; {0};",
          ClientScript.GetPostBackEventReference(Call, null)));

          Weavver.Company.Common.Company company = db.GetDocument(CompanyGuid.ToString());
          if (company != null)
          {
               Bio.Text = company.Bio;
          }
          else
          {
               Bio.Text = String.Format("Please visit the Organization details page to edit this description.", CompanyGuid.ToString());
          }
     }
//-------------------------------------------------------------------------------------------
     public void PopUp_Click(object sender, EventArgs e)
     {
          Mod.Show();
     }
//-------------------------------------------------------------------------------------------
     public void Submit_Click(object sender, EventArgs e)
     {
          string phnumber = YourPhoneNumber.Text;
          phnumber = phnumber.Replace("-", "").Replace(".", "");
          if (phnumber.Length == 11 && phnumber.StartsWith("1"))
          {
               Weavver.Company.InformationTechnology.AsteriskPhoneSystem callserver = db.GetDocument("8ecbd493-3cdf-4c56-9013-a2a9e740e6ec");
               AsteriskConnection phonesystem = new AsteriskConnection();
               phonesystem.Connect(callserver.ManagerUsername, callserver.ManagerPassword, callserver.Host);
               AsteriskPackets asteriskPacket = new AsteriskPackets();
               string packet = AsteriskPackets.OriginatePacket("DAHDI/g1/" + phnumber, "5920", "weavver", "17148725920");
               phonesystem.SendPacket(packet);
               phonesystem.Disconnect();

               Connecting.Text = "We are connecting your call. Please wait a moment while the system connects to your phone.";
               Connecting.ForeColor = System.Drawing.Color.Green;
               Connecting.Visible = true;
               Call.Text = "Retry";
          }
          else
          {
               Connecting.Text = "Please enter an eleven digit phone number in the United States!";
               Connecting.ForeColor = System.Drawing.Color.Red;
               Connecting.Visible = true;
          }
     }
//-------------------------------------------------------------------------------------------
     public void Subscribe_Click(object sender, EventArgs e)
     {
          Weavver.Company.Marketing.MailingList ml = new Weavver.Company.Marketing.MailingList();


          //Weavver.Company.Common.EmailAddress address = new Weavver.Company.Common.EmailAddress();
          //address.ParentId = Guid.NewGuid();
          //adresss. MailingList.Text;
     }
//-------------------------------------------------------------------------------------------
     public void Cancel_Click(object sender, EventArgs e)
     {
          Mod.Hide();
     }
//-------------------------------------------------------------------------------------------
}