Beispiel #1
0
 private void btnMoney_Click(object sender, EventArgs e)
 {
     try
     {
         lblMoney.Text = "";
         PARSGREEN.API.SMS.Profile.ProfileService p = new PARSGREEN.API.SMS.Profile.ProfileService();
         double creidet = p.GetCredit(txtSignature.Text);
         lblMoney.Text = creidet.ToString();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #2
0
        public static string Send_Sms(string text, string phone, string emza, string smsNumber, double warning)
        {
            PARSGREEN.API.SMS.Profile.ProfileService p = new PARSGREEN.API.SMS.Profile.ProfileService();
            double creidet = p.GetCredit(emza);

            if (creidet == -64) // chek kardane dorost boodane emza digital
            {
                MessageBox.Show("امضا دیجیتال اشتباه است", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return("-64");
            }
            string pattern = "http://login.parsgreen.com/UrlService/sendSMS.ashx?from=" + smsNumber + "&to=" + phone + "&text=" + text + "&signature=" + emza;

            //MessageBox.Show(pattern);
            System.IO.Stream       st = null;
            System.IO.StreamReader sr = null;

            HttpWebRequest req    = (HttpWebRequest)WebRequest.Create(pattern);
            Encoding       encode = System.Text.Encoding.UTF8;

            //MessageBox.Show(message2.Length.ToString());
            System.Net.WebResponse resp = req.GetResponse();

            st = resp.GetResponseStream();
            sr = new System.IO.StreamReader(st, Encoding.UTF8);
            string result = sr.ReadToEnd().Substring(12, 1);

            //MessageBox.Show(sr.ReadToEnd()); //Get_Return_Message_Sms(int.Parse(result);
            //lblError.Text = Get_Return_Message_Sms(int.Parse(result));
            sr.Close();
            resp.Close();
            //---------


            if (creidet < warning)
            {
                MessageBox.Show("اعتبار پنل پیامک کمتر از" + warning + " ریال است", "پنل پیامک", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            //-------
            if (result == "0")
            {
                MessageBox.Show(text, "پیام ارسال شده");
                return("0");
            }
            return(result);
        }
Beispiel #3
0
        private void btnMoney_Click(object sender, EventArgs e)
        {
            try
            {
                txtMoney.Text = "";
                PARSGREEN.API.SMS.Profile.ProfileService p = new PARSGREEN.API.SMS.Profile.ProfileService();
                double creidet = p.GetCredit(txtSignature.Text);
                if (creidet == -64)
                {
                    MessageBox.Show("امضا دیجیتال اشتباه است", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                txtMoney.Text = creidet.ToString();
                //long cadir2 = Int64.Parse(txtMoney.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }