Exemplo n.º 1
0
 public string SendMessage(string Message, string MobileNumber, string MessageType, string Key)
 {
     if (Key == "KABA94ASBHSU14DBA3U")
     {
         if (Message.Length > 1)
         {
             if (MobileNumber.Length == 10)
             {
                 if (System.Text.RegularExpressions.Regex.IsMatch(MobileNumber, @"^\d+$"))
                 {
                     SendSMS SM = new SendSMS();
                     return(SM.sendSMS(MobileNumber, Message, 2, MessageType));
                 }
                 else
                 {
                     return("Invalid Mobile Number");
                 }
             }
             else
             {
                 return("Invalid Mobile Number");
             }
         }
         else
         {
             return("Invalid Message");
         }
     }
     else
     {
         return("Invalid Key");
     }
 }
Exemplo n.º 2
0
        private void btn_nhacNho_Click(object sender, EventArgs e)
        {
            QuanLyTreEmBLL treEmBLL = new QuanLyTreEmBLL();
            SendSMS        sms      = new SendSMS();

            foreach (DataGridViewRow x in dtg_danhSach.Rows)
            {
                if (x.Cells["DaDiHoc"].Value.ToString().ToLower() == "false")
                {
                    try
                    {
                        string sdt = treEmBLL.LaySoDienThoai(x.Cells["MaTre"].Value.ToString());
                        //x.Cells["MaTre"]
                        sms.send(sdt, "i kill u!");
                        //c++;
                    }
                    catch (Exception ee)
                    {
                        MessageBox.Show(ee.Message);
                    }
                }
            }

            MessageBox.Show("Đã Nhắc Nhở!");
        }
Exemplo n.º 3
0
 public ActionResult ztest()
 {
     SendSMS.Send(SendSMS.Templates.SUCCESSFUL_REGISTER, "8058758011", "", "", "himanshu", "", "");
     //message = message.Replace("OTP", "123456");
     //Utility.SendMsg(mobile, message);
     return(Ok());
 }
Exemplo n.º 4
0
    /**Method Name: OnGUI
     * Parameters: N/A
     * Returns: N/A
     *
     * A built-in unity function.
     * Used for rendering and handling GUI events.
     * */
    void OnGUI()
    {
        style.fontSize         = 50;
        style.normal.textColor = Color.white;
        style.alignment        = TextAnchor.MiddleCenter;
        //prints the current score and the game instructions
        GUI.Label(new Rect(100, 150, 600, 600), "SCORE: " + score + "", style);

        if (count >= 15)
        {
            if (score >= 9)
            {
                GUI.Label((new Rect(100, 50, 600, 600)), "YOU PASS!", style);
            }
            else if (!StartGame.Practice())
            {
                SendSMS.Send("Hello!");
                count = 0;
                score = 0;
            }
            //this is to avoid multiple calls of EndGame
            if (!ended)
            {
                //flips bit so that it wont enter this conditional again
                ended = !ended;
                //calls EndGame after 3 seconds
                Invoke("EndGame", 3);
            }
        }
    }
Exemplo n.º 5
0
 public SMSView()
 {
     SendSMS      = new SendSMS();
     ReadSMS      = new ReadSMS();
     DeleteAllSMS = new DeleteAllSMS();
     DeleteSMS    = new DeleteSMS();
 }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            // Depends on Condition, we can Perform the different Actions for sending Email, SMS, and Writing Log File

            string actionRequired = ""; // Assign Value to string according to Requirement.

            Watcher watcher = null;

            switch (actionRequired)
            {
            case "LogFile":
                WriteLogFile writeLog = new WriteLogFile();
                watcher = new Watcher(writeLog);
                watcher.Notify("Write in log File");
                break;

            case "SendEmail":
                SendEmail email = new SendEmail();
                watcher = new Watcher(email);
                watcher.Notify("Send Email");
                break;

            case "SendSms":
                SendSMS sms = new SendSMS();
                watcher = new Watcher(sms);
                watcher.Notify("Send SMS");
                break;

            default:
                Console.WriteLine("No Watcher Selected");
                break;
            }

            Console.ReadKey();
        }
Exemplo n.º 7
0
    /**Method Name: OnGUI
     * Parameters: N/A
     * Returns: N/A
     *
     * A built-in unity function.
     * Used for rendering and handling GUI events.
     * */
    void OnGUI()
    {
        style.fontSize         = 30;
        style.normal.textColor = Color.white;
        //GUI.Label(new Rect(10, 10, 100, 100), "Try to Finish the Maze",style);

        if (wall_is_touched)
        {
            //GUI.Label(new Rect(10, 80, 100, 100), "You failed -_-");
            if (!StartGame.Practice())
            {
                SendSMS.Send("Sadt..");
                wall_is_touched = false;
                reached_end     = false;
            }

            // prevents multiple cals of EndGame
            if (!ended)
            {
                ended = !ended;
                Invoke("EndGame", 3);
            }
        }
        else if (reached_end && (!wall_is_touched))
        {
            GUI.Label(new Rect(10, 30, 100, 100), "DONE!!!!!!!!", style);

            if (!ended)
            {
                ended = !ended;
                Invoke("EndGame", 3);
            }
        }
    }
        public JsonResult SendSMS(Data controlData)
        {
            var data = _db.members.SingleOrDefault(x => x.username == controlData.username);

            var projects = _db.projects.Where(x => x.statuId == 1 && x.memberId == data.memberId).Select(x => new
            {
                projectName    = x.projectName,
                percentStatu   = x.percentStatu,
                exceptedFinish = x.exceptedFinish,
            }
                                                                                                         );
            string ba = "";

            foreach (var x in projects)
            {
                ba = ba + " Proje Ismi:" + x.projectName + " Yüzde:" + x.percentStatu + " Tahmini Bitiş:" + x.exceptedFinish;
            }
            SendSMS a = new SendSMS();

            a.ana(ba, data.number);
            Data sendNull = new Data();

            sendNull.username = "******";
            sendNull.password = "******";
            return(Json(sendNull, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 9
0
        private string AddPromocode(Log log, Campaigns campaigns, SendSMS sendSMS)
        {
            var db = new WebSMSEntities1();

            if (!campaigns.MessageText.Contains('#'))
            {
                return("Ok");
            }
            if (
                db.PromoCodes.Any(
                    x => x.IdCampaign == campaigns.IdCampaign && x.IdClient == campaigns.IdClient && !x.IsUsed))
            {
                var promoCodeRecord =
                    db.PromoCodes.First(
                        x => x.IdCampaign == campaigns.IdCampaign && x.IdClient == campaigns.IdClient && !x.IsUsed);
                if (promoCodeRecord.PromoCode.Length != campaigns.MessageText.Count(x => x == '#'))
                {
                    log.Status = 16;
                    db.Log.Add(log);
                    db.SaveChanges();
                    return("Wrong promocode");
                }
                promoCodeRecord.IsUsed = true;
                string hash = new string('#', promoCodeRecord.PromoCode.Length);
                sendSMS.MessageText = campaigns.MessageText.Replace(hash, promoCodeRecord.PromoCode);
                db.SaveChanges();
                return("Ok");
            }
            log.Status = 17;
            db.Log.Add(log);
            db.SaveChanges();
            return("Promocodes have ended");
        }
Exemplo n.º 10
0
        private string RemovePromocode(Log log, Campaigns campaigns, SendSMS sendSMS)
        {
            var db = new WebSMSEntities1();

            if (!campaigns.MessageText.Contains('#'))
            {
                return("Ok");
            }
            int    length    = campaigns.MessageText.Count(x => x == '#');
            string promocode = sendSMS.MessageText.Substring(campaigns.MessageText.IndexOf('#'), length);

            if (db.PromoCodes.Any(
                    x =>
                    x.IdCampaign == campaigns.IdCampaign && x.IdClient == campaigns.IdClient &&
                    x.PromoCode == promocode && x.IsUsed))
            {
                var promoCodeRecord =
                    db.PromoCodes.First(
                        x =>
                        x.IdCampaign == campaigns.IdCampaign && x.IdClient == campaigns.IdClient &&
                        x.PromoCode == promocode && x.IsUsed);

                promoCodeRecord.IsUsed = false;
                db.SaveChanges();
                return("Ok");
            }
            return("Ok");
        }
Exemplo n.º 11
0
    /**Method Name: OnGUI
     * Parameters: N/A
     * Returns: N/A
     *
     * A built-in unity function.
     * Used for rendering and handling GUI events.
     * */
    void OnGUI()
    {
        style.fontSize  = 100;
        style.alignment = TextAnchor.MiddleCenter;
        //prints the current score and the game instructions
        GUI.Label(new Rect(100, (Screen.height / 2) - 70, 600, 600), "SCORE: " + score + "", style);


        //check if game count is not max
        if (count >= 15)
        {
            //check if user has passing score
            if (score >= 9)
            {
                GUI.Label((new Rect(100, (Screen.height / 2), 600, 600)), "YOU PASS!", style);
            }
            else if (!StartGame.Practice())
            {
                SendSMS.Send("Hello!");
                Debug.Log("LOSE");
                GUI.Label((new Rect(100, (Screen.height / 2), 600, 600)), "YOU FAIL!", style);
                count = 0;
                score = 0;
            }
            //this is to avoid multiple calls of EndGame
            if (!ended)
            {
                //flips bit so that it wont enter this conditional again
                ended = !ended;
                //calls EndGame after 3 seconds
                Invoke("EndGame", 3);
            }
        }
    }
Exemplo n.º 12
0
        public void ConsumeMessage([FromBody] StockRespons stock)
        {
            _stockServer.AddStock(stock);
            SendSMS send = new SendSMS();

            send.InitializeSMS();
            send.sendSMS("ADDED", stock.Name.ToString());
        }
Exemplo n.º 13
0
        private void btnSendSMS_Click(object sender, RoutedEventArgs e)
        {
            SendSMS DialogPage = new SendSMS();

            DialogPage.Dialog = Window.ShowDialog(ECCentral.Portal.UI.Customer.Resources.ResSMSQuery.PopTitle_SendSMS, DialogPage, (obj, args) =>
            {
            });
        }
        public Task SendSmsAsync(string number, string message)
        {
            // Plug in your SMS service here to send a text message.
            SendSMS sendSMS = new SendSMS();

            sendSMS.SendMsg(number, message);
            return(Task.FromResult(0));
        }
Exemplo n.º 15
0
        public void ConsumeMessage([FromBody] StockRespons stock)
        {
            _stockServer.UpdateStock(stock);
            SendSMS send = new SendSMS();

            send.InitializeSMS();
            send.sendSMS("PATCHED", stock.Name.ToString(), stock.Price.ToString());
        }
Exemplo n.º 16
0
        public async Task <IActionResult> ResendUserPass(string PhoneNumber)
        {
            SendSMS   sendSMS = new SendSMS();
            var       select  = _context.Users.Where(x => x.PhoneNumber == PhoneNumber).FirstOrDefault();
            Utilities ut      = new Utilities();
            string    NewPass = ut.Random(100000, 999999).ToString();

            //Reset PassWord//
            String userId = select.Id;

            UserStore <ApplicationUser> store = new UserStore <ApplicationUser>(_context);

            ApplicationUser cUser = await store.FindByIdAsync(userId);

            String newPassword = NewPass;

            String hashedNewPassword = _userManager.PasswordHasher.HashPassword(cUser, newPassword);


            await store.SetPasswordHashAsync(cUser, hashedNewPassword);

            await store.UpdateAsync(cUser);

            //Reset PassWord//

            //Resend User and Pass
            bool send = await sendSMS.SendAsync((int)SMSTypes.ResendUserPass, PhoneNumber, select.UserName, NewPass);

            if (send)
            {
                TempData["ResenUserPass_Seccecful"] = "اطلاعات حساب کاربری با موفقیت ارسال گردید";

                var selec555t = _context.Cars.ToList();

                ViewBag.Cars = selec555t;

                var select222 = _context.Categories.ToList();

                ViewBag.Categories = select222;

                return(View("Login"));
            }
            else
            {
                TempData["SMSNotSend"] = "ارسال پیامک با خطا مواجه شد.لطفا مجددا سعی نمایید";

                var selec555t = _context.Cars.ToList();

                ViewBag.Cars = selec555t;

                var select222 = _context.Categories.ToList();

                ViewBag.Categories = select222;

                return(View("GetNumber"));
            }
            //Resend User and Pass
        }
Exemplo n.º 17
0
        private void ReadyToPay(Student std)
        {
            string         amount = string.Empty, Payment_For = string.Empty;
            int            payment_type_id = 1;
            Specialization spec            = db.Specializations.Find(std.Student_Specialization_Id);

            if (std.Student_Status_Id == 6)
            {
                amount          = spec.Specialization_Registeration_Payment.ToString();
                Payment_For     = "Registration";
                payment_type_id = 1;
            }
            else
            {
                amount          = spec.Specialization_Study_Payment.ToString();
                Payment_For     = "Study";
                payment_type_id = 2;
            }

            int    student_id  = std.Student_Id;
            string entityId    = "";
            string currency    = "SAR";
            string paymentType = "DB";

            Payment_Process payment = db.Payment_Process.Create();

            payment.Student_Id          = student_id;
            payment.Send_Amount         = float.Parse(amount);
            payment.Send_Currency       = currency;
            payment.Send_EntityId       = entityId;
            payment.Send_PaymentType    = paymentType;
            payment.Payment_IsPaid      = false;
            payment.Payment_Type_Id     = payment_type_id;
            payment.DateCreation        = DateTime.Now;
            payment.Comment             = Payment_For + " Fees";
            payment.Payment_Trackingkey = StringCipher.RandomString(5) + student_id + StringCipher.RandomString(3) + DateTime.Now.GetHashCode() + StringCipher.RandomString(5);
            payment.Payment_URL_IsValid = true;
            db.Payment_Process.Add(payment);
            db.SaveChanges();

            //Send Email
            send_ReadyToPay(std, payment, Payment_For);

            // Send SMS
            SendSMS send_sms   = new SendSMS();
            string  sever_name = Request.Url.Authority.ToString();
            string  URL        = sever_name + "/Payment/PaymentProcessDetails.aspx?Trackingkey=" + payment.Payment_Trackingkey;

            if (URL.Substring(0, 4).ToLower() != "http".ToLower())
            {
                URL = "http://" + URL;
            }

            string Text          = "Dear " + std.Student_Name_En + "\nNow you can pay the fees of " + Payment_For + "\nPlease use this link: " + URL;
            string number_Phone  = std.Student_Phone;
            string reslt_message = send_sms.SendMessage(Text, number_Phone);
        }
Exemplo n.º 18
0
        protected override void OnStart(string[] args)
        {
            // TODO: Add code here to start your service.
            smsClass  = new SendSMS();
            autoEvent = new AutoResetEvent(false);
            long timePeriod = string.IsNullOrEmpty(ConfigurationSettings.AppSettings["timerDuration"]) ? 10000 : Convert.ToInt64(ConfigurationSettings.AppSettings["timerDuration"]);

            timerCallBack = new TimerCallback(sendSMS);
            timerThread   = new Timer(timerCallBack, autoEvent, 0, timePeriod);
        }
Exemplo n.º 19
0
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        LiveReportingDAL.UploadVideoClass upl = new LiveReportingDAL.UploadVideoClass();
        if (Session["USERNAME"] != null)
        {
            upl.UploadTitle            = txtname.Text;
            upl.UploadTypeID           = 1;
            upl.UserID                 = int.Parse(MyLogic.GetUserID);
            upl.UserType               = 3;
            upl.KeyWordForSearch       = txtkeyword.Text;
            upl.IncidentCategoryIDF    = int.Parse(ddincategory.SelectedValue);
            upl.IncidentSubCategoryIDF = int.Parse(ddSubincategory.SelectedValue);
            upl.IncidentCityIDF        = int.Parse(ddcity.SelectedValue);
            upl.IncidentDate           = txtincidentdate.Text + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second;
            upl.AreaOfCity             = txtAreaOfCity.Text;
            upl.IncidentDescription    = txtincidentdesc.Text;
            upl.KeyWordForSearch       = txtkeyword.Text;
            upl.AreaID                 = 0;
            upl.IncidentStateIDF       = int.Parse(ddstate.SelectedValue);
            upl.Flag = "ADD";
            MEMBERS.SQLReturnValue M;
            M = LiveReportingDAL.UploadVideoClass.Insert_Update_UploadVideo(upl);
            if (M.ValueFromSQL > 0)
            {
                if (fileVideoUpload.PostedFile != null)
                {
                    string RandomStr = AdminSettingClass.RandomDigit();
                    string filename  = Path.GetFileName(fileVideoUpload.PostedFile.FileName);
                    fileVideoUpload.SaveAs(Server.MapPath("/VideoALL/" + filename));
                    string filepath = "/VideoALL/" + filename;

                    upl.UploadedVideoIDP       = M.ValueFromSQL;
                    upl.video_path             = filename;
                    upl.IncidentSubCategoryIDF = int.Parse(ddSubincategory.SelectedValue);
                    upl.IncidentCategoryIDF    = int.Parse(ddincategory.SelectedValue);
                    upl.thumbpath = "NA";
                    int outsaveVideo = UploadVideoClass.Save_Video_Path(upl).ValueFromSQL;

                    SendSMS SMS = new SendSMS();
                    SMS.MySendSMS("Video has been uploaded in " + ddincategory.SelectedItem.Text + " on " + DateTime.Now.ToString("dd/MM/yyyy hh:mm") + " by  " + MyLogic.GetUserName + "", "9769501341");
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "noti", "setMessage('Thanks for sharing your Video, it Will be LIVE soon!!',1);", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "noti", "setMessage('Video File Required!!',1);", true);
                }
            }
            ClearCaching.ClearControls(pnlvideo);
        }
        else
        {
            Response.Redirect("SignIn.aspx");
        }
    }
Exemplo n.º 20
0
        public async Task <ActionResult> SMSTest_Partial(Model model)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView(model));
            }
            SendSMS sendSMS = new SendSMS();
            await sendSMS.SendMessageAsync(model.PhoneNumber, model.Text);

            return(FormProcessed(model, this.__ResStr("ok", "SMS sent")));
        }
    protected void btSave_Click(object sender, EventArgs e)
    {
        sms.sms_api    = txtSMS.Text;
        sms.sms_status = 1;
        int outsave = SendSMS.InsertSms_APi(sms).ValueFromSQL;

        if (outsave == 1)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "noti", "setMessage('sms api successfully saved.',1);", true);
        }
        ClearCaching.ClearControls(smspanel);
    }
Exemplo n.º 22
0
        /// <summary>
        /// Processes all URLs at the specified interval and sends SMS notifications if a site is found down (or back up).
        /// </summary>
        /// <returns></returns>
        public async Task Process()
        {
            bool[] LastFailures = new bool[Settings.URLs.Count];
            for (int i = 0; i < LastFailures.Length; ++i)
            {
                LastFailures[i] = false;
            }

            for (;;)
            {
                bool[] failures = new bool[Settings.URLs.Count];

                int index = 0;
                foreach (string page in Settings.URLs)
                {
                    string site = page.TruncateStart("http://").TruncateStart("https://");
                    failures[index] = false;

                    string msg = null;

                    int status = RetrievePage(page);
                    if (status != 200)
                    {
                        failures[index] = true;
                        if (LastFailures[index] != failures[index])
                        {
                            msg = $"Site {site} is DOWN!";
                        }
                    }
                    else
                    {
                        failures[index] = false;
                        if (LastFailures[index] != failures[index])
                        {
                            msg = $"Site {site} is back UP";
                        }
                    }
                    LastFailures[index] = failures[index];
                    index++;

                    if (!string.IsNullOrWhiteSpace(msg))
                    {
                        Console.WriteLine(msg);
                        SendSMS sendSMS = new SendSMS();
                        foreach (string smsNotify in Settings.SMSNotify)
                        {
                            await sendSMS.SendMessageAsync(smsNotify, msg);
                        }
                    }
                }
                Thread.Sleep(Settings.Interval * 1000);
            }
        }
Exemplo n.º 23
0
 public static string SendMessage(string idNodes, string message)
 {
     if (message == "")
     {
         return("Vui lòng nhập nội dung tin nhắn");
     }
     else
     {
         if (message.Length > 450)
         {
             return("Tin nhắn quá dài!");
         }
         else
         {
             if (idNodes == "")
             {
                 return("Vui lòng chọn khách hàng cần nhắn tin");
             }
             else
             {
                 string[] nodes = idNodes.Split(',');
                 string   tem   = "";
                 for (int i = 0; i < nodes.Length; i++)
                 {
                     int index = nodes[i].IndexOf("_KH");
                     if (index != -1)
                     {
                         string           node = nodes[i].Remove(index, 3);
                         List <KhachHang> lskh = objbn.GetKhachHang(int.Parse(node));
                         string           sdt  = lskh[0].DienThoai;
                         sdt = "84" + sdt.Remove(0, 1);
                         string[] param = new string[1];
                         //param[0] = UnicodeUtility.UnicodeToKoDau(message.Trim());
                         //param[0] = message.Trim();
                         int idDoanhnghiep       = int.Parse(lskh[0].DoanhNghiepID.ToString());
                         List <Doanhnghiep> lsdn = objbn.GetDoanhNghiep(lsdv[0].ID, idDoanhnghiep, true);
                         if (lsdn[0].NhanTinCoDau == true)
                         {
                             param[0] = message.Trim();
                         }
                         else
                         {
                             param[0] = UnicodeUtility.UnicodeToKoDau(message.Trim());
                         }
                         tem = SendSMS.sendByList("111", lsdn[0].LABELID, lsdn[0].TEMPLATEID, "0", "1", "", sdt, lsdv[0].AGENTID, lsdn[0].APIUSER, lsdn[0].APIPASS, "QB_CS", lsdn[0].CONTRACTID, param);
                         GhiLog(LayNoiDungLog("", sdt, param[0], AppSessionInfo.CurrentUser.TenDangNhap, Xuly(tem), idDoanhnghiep));
                     }
                 }
                 return("Send message success!!!");
             }
         }
     }
 }
Exemplo n.º 24
0
        public bool SendSMS(int CaseNo, Employee Emp)
        {
            SendSMS send_sms = new SendSMS();

            string MessageTextEn = string.Empty;
            string MessageTextAr = string.Empty;

            try
            {
                switch (CaseNo)
                {
                case 1:    // CreateNewAcount
                    MessageTextEn = "Create Account for user" + Emp.Employee_Name_Ar + "\n The password is" + Emp.Employee_Password;
                    MessageTextAr = "Create Account for user" + Emp.Employee_Name_Ar;
                    send_sms.SendMessage(MessageTextAr + "\n" + MessageTextEn, Emp.Employee_Phone);
                    break;

                case 2:    // ResetPassword
                    MessageTextEn = "";
                    MessageTextAr = "";
                    send_sms.SendMessage(MessageTextAr + "\n" + MessageTextEn, Emp.Employee_Phone);
                    break;

                case 3:    // NewTreatment
                    MessageTextEn = "";
                    MessageTextAr = "";
                    send_sms.SendMessage(MessageTextAr + "\n" + MessageTextEn, Emp.Employee_Phone);
                    break;

                case 4:    // Meeting
                    MessageTextEn = "";
                    MessageTextAr = "";
                    send_sms.SendMessage(MessageTextAr + "\n" + MessageTextEn, Emp.Employee_Phone);
                    break;

                case 5:    // vote
                    MessageTextEn = "";
                    MessageTextAr = "";
                    send_sms.SendMessage(MessageTextAr + "\n" + MessageTextEn, Emp.Employee_Phone);
                    break;

                default:     // code block

                    break;
                }
            }
            catch
            {
                return(false);
            }
            return(true);
        }
        public ActionResult SendMessage(SendSMS sms1)
        {
            WebClient client = new WebClient();
            Stream    data   = client.OpenRead(string.Format("https://platform.clickatell.com/messages/http/send?apiKey=-8poEXXZR9iM4l3nSopj_A==&to={0}&content={1}", sms1.To, sms1.Body));

            StreamReader reader = new StreamReader(data);
            string       result = reader.ReadToEnd();

            //var to = sms1.To;
            //var Body = sms1.Body;
            ViewBag.Result = result;
            return(View(sms1));
        }
        public JsonResult SendPass(Data controlData)
        {
            var data = _db.members.SingleOrDefault(x => x.username == controlData.username);

            SendSMS a = new SendSMS();

            a.ana("Şifreniz:" + data.password, data.number);
            Data sendNull = new Data();

            sendNull.username = "******";
            sendNull.password = "******";
            return(Json(sendNull, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Send(SendSMS sms)
        {
            WebClient client = new WebClient();
            //Stream s = client.OpenRead(string.Format("https://platform.clickatell.com/messages/http/send?apiKey=InS1ggfLSQm16xet4WVLnQ==&to{0}=&content={1}", sms.To, sms.Body));
            Stream s = client.OpenRead(string.Format("https://platform.clickatell.com/messages/http/send?apiKey=-8poEXXZR9iM4l3nSopj_A==&to=919620432531&content=hiiiii"));


            StreamReader reader = new StreamReader(s);
            string       result = reader.ReadToEnd();

            ViewBag.Message = result;
            return(View());
        }
Exemplo n.º 28
0
        public IActionResult VerifyPayment(string Authority, string Status)
        {
            try
            {
                var orderpeymnt = _repository.CustomerOrderPayment.FindByCondition(c => c.TraceNo == Authority)
                                  .FirstOrDefault();
                var CustomerOrderId = orderpeymnt.CustomerOrderId;
                if (orderpeymnt == null)
                {
                    return(NotFound());
                }

                ZarinPalVerifyRequest zarinPalVerifyRequest = new ZarinPalVerifyRequest();
                zarinPalVerifyRequest.authority = Authority;
                zarinPalVerifyRequest.amount    = (int)orderpeymnt.TransactionPrice.Value;

                Tools.ZarinPal.ZarinPal zarinPal = new Tools.ZarinPal.ZarinPal();
                var result = zarinPal.VerifyPayment(zarinPalVerifyRequest);
                if (result.code == 100 || result.code == 101)
                {
                    orderpeymnt.FinalStatusId   = 100;
                    orderpeymnt.RefNum          = result.ref_id.ToString();
                    orderpeymnt.TransactionDate = timeTick;
                    orderpeymnt.CardPan         = result.card_pan;
                    _repository.CustomerOrderPayment.Update(orderpeymnt);
                    _repository.Save();
                    SendSMS sendSMS = new SendSMS();

                    var mobileNo = User.Claims.Where(c => c.Type == "mobile").Select(x => x.Value).SingleOrDefault();
                    sendSMS.SendSuccessOrderPayment(mobileNo, orderpeymnt.OrderNo, CustomerOrderId.Value);
                    SendEmail sendEmail = new SendEmail();
                    var       email     = User.Claims.Where(c => c.Type == ClaimTypes.Name).Select(x => x.Value).SingleOrDefault();
                    sendEmail.SendSuccessOrderPayment(email, orderpeymnt.OrderNo, CustomerOrderId.Value);
                    return(Ok("success"));
                }
                else
                {
                    orderpeymnt.FinalStatusId   = result.code;
                    orderpeymnt.TransactionDate = timeTick;
                    _repository.CustomerOrderPayment.Update(orderpeymnt);
                    _repository.Save();
                    return(Ok("error"));
                }
            }
            catch (Exception e)
            {
                _logger.LogError($"Something went wrong inside GetCustomerOrderListByCustomerId: {e.Message}");
                return(BadRequest("Internal server error"));
            }
        }
Exemplo n.º 29
0
        static void Main(string[] args)
        {
            SendDataMessage serviceMessage;

            serviceMessage = new SendMail();
            serviceMessage.BridgeMessageService = new GMailService();
            serviceMessage.Send("Message from Bridge Test", "*****@*****.**");

            serviceMessage = new SendSMS();
            serviceMessage.BridgeMessageService = new TwilioService();
            serviceMessage.Send("Message from Bridge Test", "4491091867");

            Console.ReadKey();
        }
Exemplo n.º 30
0
        public static void Perform()
        {
            SendData sendData = new SendEmail(new WebService());

            sendData.Send();
            sendData.BridgeComponents = new ThirdPartyAPI();
            sendData.Send();

            sendData = new SendSMS(new WebService());
            sendData.Send();
            sendData.BridgeComponents = new ThirdPartyAPI();
            sendData.Send();

            Console.WriteLine();
        }