Beispiel #1
0
        private void LoadAccount()
        {
            frmAccountSelect acsel = new frmAccountSelect();

            if (acsel.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    m_account = new SMSAccount(acsel.SelectedAccount);
                    string err;
                    err = m_account.LoadKey(null);
                    if (string.IsNullOrEmpty(err) == false)
                    {
                        throw new Exception(err);
                    }
                    Text = string.Format("{0} - {1}", m_wndTitle, acsel.SelectedAccount);
                    err  = m_account.LoadMessagesHistory();
                    if (string.IsNullOrEmpty(err) == false)
                    {
                        throw new Exception(err);
                    }
                    Connect();
                }
                catch (Exception exp)
                {
                    MessageBox.Show(exp.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    m_account = null;
                }
            }
            acsel.Dispose();
        }
Beispiel #2
0
 protected override void btnOk_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(tbAddress.Text) == false)
     {
         if (m_Acc != null)
         {
             if (tbName.Text == m_Acc.ToString())
             {
                 if (m_Acc != null)
                 {
                     m_accName = m_Acc.ToString();
                     m_Acc.SaveKey(null);
                     m_Acc = null;
                 }
                 DialogResult = DialogResult.OK;
                 Close();
             }
             else
             {
                 MessageBox.Show("Name is invalid. You should regenerate address", Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         else
         {
             DialogResult = DialogResult.Cancel;
             Close();
         }
     }
     else
     {
         MessageBox.Show("Address is empty", Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Beispiel #3
0
 protected override void btnRefresh_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(tbName.Text) == false)
     {
         m_Acc          = new SMSAccount(tbName.Text);
         tbAddress.Text = m_Acc.GenerateKey();
     }
     else
     {
         MessageBox.Show("Name is empty", Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Beispiel #4
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            mke             = new SMSAccount("ALICE");
            mke.AddressBook = addressbook;
            string err = mke.LoadKey(null);

            if (string.IsNullOrEmpty(err) == false)
            {
                mke.GenerateKey();
                err = mke.SaveKey(null);
            }
            if (string.IsNullOrEmpty(err) == false)
            {
                MessageBox.Show(err);
            }



            client = new SMSNet(mke);
            client.Connect("127.0.0.1", 5555);
        }
Beispiel #5
0
        /// <summary>
        /// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        /// EXAMPLE
        /// </summary>
        /// <param name="apiPhoneNumber"></param>

        public JsonResult CollectPhoneStatus(string apiPhoneNumber, int organizationID)
        {
            // These values dont reside in the function in the service but are here to support the example
            string apiCompany = "notify";
            //string apiUsername = "******";
            //string apiPassword = "******";

            SMSAccount  sms   = db.GetSMSAccount(organizationID);
            ClientPhone Phone = null;

            if (apiPhoneNumber.Length != 10)
            {
                return(Json(Phone, JsonRequestBehavior.AllowGet));
            }

            HttpClient  apiReq         = new HttpClient();
            XmlDocument apiResponseXML = new XmlDocument();

            string apiURL = "https://api.data24-7.com/v/2.0";

            apiURL += "?compcode=" + apiCompany + "&user="******"&pass="******"&api=T&p1=" + apiPhoneNumber;

            //https://api.data24-7.com/v/2.0?compcode=notify&user=notifyhealth_cpc001&pass=6U7gQ458wGUNKm2tS6&api=T&p1=7194257147
            try
            {
                apiResponseXML.Load(apiURL);
            }
            catch (Exception e)
            {
                e.Message.ToString();
            }

            XmlElement  root  = apiResponseXML.DocumentElement;
            XmlNodeList nodes = root.SelectNodes("/response/results/result");

            //D247_INVALID_PHONE1234567891

            foreach (XmlNode node in nodes)
            {
                Phone = new ClientPhone
                {
                    Number         = apiPhoneNumber,
                    PhoneCarrier   = node["carrier_name"].InnerText,
                    MessageAddress = node["sms_address"].InnerText,
                    Wireless       = node["wless"].InnerText,
                    Status         = node["status"].InnerText
                };
            }

            if (Phone.Status == "OK")
            {
                Phone.PStatusId = 2;
            }
            else
            {
                Phone.PStatusId = 1;
            }

            if (Phone.Wireless == "y")
            {
                if (string.IsNullOrEmpty(Phone.MessageAddress))
                {
                    Phone.ParticipationId    = 11;
                    TempData["alertMessage"] = "Popup warning that given phone number CANNOT BE USED to send messages but client will be saved.";
                    Phone.Warning            = "Popup warning that given phone number CANNOT BE USED to send messages but client will be saved.";
                }
                //  Submit button creates client account or updates user record but DO NOT INSERT into queue table
                else
                {
                    Phone.ParticipationId    = 12;
                    TempData["alertMessage"] = "Submit button inserts new record into Queue table and adds record to clients table";
                    Phone.Warning            = "Submit button inserts new record into Queue table and adds record to clients table";
                }
                //

                // ASK FOR TEST DATA API TEST
            }
            else
            {
                Phone.ParticipationId    = 8;
                TempData["alertMessage"] = "Popup warning that given phone number is NOT A WIRELESS PHONE NUMBER AND CANNOT BE USED to send messages but client will be saved";
                Phone.Warning            = "Popup warning that given phone number is NOT A WIRELESS PHONE NUMBER AND CANNOT BE USED to send messages but client will be saved";

                //Submit button creates client account or updates user record but DO NOT INSERT into queue table
            }

            apiReq.Dispose();
            return(Json(Phone, JsonRequestBehavior.AllowGet));
        }