Beispiel #1
0
        public virtual ActionResult SendMessage(SendSMSProfileViewModel model)
        {
            try
            {
                string userName  = WebConfigurationManager.AppSettings["UserNameSMS"];
                string password  = WebConfigurationManager.AppSettings["PasswordSMS"];
                string NumberSMS = WebConfigurationManager.AppSettings["NumberSMS"];

                SendSoapClient client = new SendSoapClient();
                string         result = client.SendSimpleSMS2(userName, password, model.Phone, NumberSMS, model.Explain, false);
                return(PartialView(MVC.admin.Shared.Views._alert, new AlertViewModel
                {
                    Alert = AlertOperation.SurveyOperation(StatusOperation.SuccessSend),
                    Status = AlertMode.success
                }));
            }
            catch
            {
                return(PartialView(MVC.admin.Shared.Views._alert, new AlertViewModel
                {
                    Alert = AlertOperation.SurveyOperation(StatusOperation.FailSend),
                    Status = AlertMode.warning
                }));
            }
        }
Beispiel #2
0
        public override void Run()
        {
            if (this.IsShuttingDown || this.Pause)
            {
                return;
            }
            try
            {
                string         userName     = WebConfigurationManager.AppSettings["UserNameSMS"];
                string         password     = WebConfigurationManager.AppSettings["PasswordSMS"];
                string         NumberSMS    = WebConfigurationManager.AppSettings["NumberSMS"];
                string         PhoneManager = WebConfigurationManager.AppSettings["PhoneManager"];
                SendSoapClient client       = new SendSoapClient();

                var resultNotConfirmed = new CalculatedSale().CountNotConfirmed();

                if (resultNotConfirmed > 20)
                {
                    string resultSMS = client.SendSimpleSMS2(userName, password, PhoneManager, NumberSMS, string.Format("فناوران اطلاعات ارم وب / {0} سفارش در سیستم ثبت شده است.", resultNotConfirmed.ToString()), false);
                }
            }
            catch
            {
            }
        }
Beispiel #3
0
        public override void Run()
        {
            if (this.IsShuttingDown || this.Pause)
            {
                return;
            }
            try
            {
                string         userName     = WebConfigurationManager.AppSettings["UserNameSMS"];
                string         password     = WebConfigurationManager.AppSettings["PasswordSMS"];
                string         NumberSMS    = WebConfigurationManager.AppSettings["NumberSMS"];
                string         PhoneManager = WebConfigurationManager.AppSettings["PhoneManager"];
                SendSoapClient client       = new SendSoapClient();

                var address = HostingEnvironment.MapPath("~/App_Data/ErrorsLog/");

                int fxmlCount = Directory.GetFiles(address, @"*.xml",
                                                   SearchOption.TopDirectoryOnly).Length;

                if (fxmlCount > 30)
                {
                    string resultSMS = client.SendSimpleSMS2(userName, password, PhoneManager, NumberSMS, string.Format("فناوران اطلاعات ارم وب / {0} خطا در سیستم ثبت شده است نسبت به رفع آن و حذف خطا اقدام نماید", fxmlCount.ToString()), false);
                }
                else if (fxmlCount > 40)
                {
                    string resultSMS = client.SendSimpleSMS2(userName, password, PhoneManager, NumberSMS, string.Format(" فناوران اطلاعات ارم وب / {0} خطا در سیتم ثبت شده در صورت پاک نکردن خطا ها سیستم با هنگی مواجه می شود", fxmlCount.ToString()), false);
                }
            }
            catch
            {
            }
        }
Beispiel #4
0
        public async virtual Task <ActionResult> ResultConfirmSale(ConfirmSaleViewModel model)
        {
            try
            {
                var user = await _userManager.FindUserById(model.Usder_Id);

                string userName  = WebConfigurationManager.AppSettings["UserNameSMS"];
                string password  = WebConfigurationManager.AppSettings["PasswordSMS"];
                string NumberSMS = WebConfigurationManager.AppSettings["NumberSMS"];


                SendSoapClient client = new SendSoapClient();

                string result = client.SendSimpleSMS2(userName, password, user.Phone, NumberSMS, "کاربر گرامی سفارش شما مورد تائید قرار گرفت بعد از تحویل مرسوله به پست کد رهگیری برای شما ارسال می شود", false);

                var sale = _saleService.GetById(model.Sale_Id);
                sale.StatusUltimate = true;

                _saleService.Update(sale);

                if (_unitOfWork.SaveAllChanges() > 0)
                {
                    return(Json(new { Result = "تائید سفارش با موفقیت صورت گرفت" }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { Result = "عدم موفقیت در تائید سفارش" }, JsonRequestBehavior.AllowGet));
                }
            }
            catch
            {
                return(Json(new { Result = "عدم موفقیت در تائید سفارش" }, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #5
0
        public virtual async Task <ActionResult> ResultAnswerContact(AnswerContactViewModel model)
        {
            try
            {
                var user = await _userManager.FindUserById(model.User_Id);

                string userName  = WebConfigurationManager.AppSettings["UserNameSMS"];
                string password  = WebConfigurationManager.AppSettings["PasswordSMS"];
                string NumberSMS = WebConfigurationManager.AppSettings["NumberSMS"];


                SendSoapClient client = new SendSoapClient();

                string result = client.SendSimpleSMS2(userName, password, user.Phone, NumberSMS, model.Message, false);

                var contact = _contactService.GetById(model.Contact_Id);
                contact.StatusAnswer = true;
                contact.StatusRead   = true;

                _contactService.Update(contact);

                if (_unitOfWork.SaveAllChanges() > 0)
                {
                    return(Json(new { Result = "ارسال  پیام کوتاه با موفقیت صورت گرفت" }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { Result = "عدم موفقیت در ارسال  پیام کوتاه" }, JsonRequestBehavior.AllowGet));
                }
            }
            catch
            {
                return(Json(new { Result = "عدم موفقیت در ارسال پیام کوتاه" }, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #6
0
 protected void onSoapAsyncClick(object sender, EventArgs e)
 {
     const string   username   = "******";
     const string   password   = "******";
     const string   from       = "5000...";
     const string   to         = "09123456789";
     const string   text       = "تست وب سرویس ملی پیامک";
     const bool     isFlash    = false;
     SendSoapClient soapClient = new SendSoapClient();
     var            result     = soapClient.SendSimpleSMS2Async(username, password, to, from, text, isFlash);
 }
Beispiel #7
0
        public virtual ActionResult dataSMSInfoRead(int?page)
        {
            var pageNumber = page ?? 0;
            var result     = new List <InfoSMSViewModel> {
            };

            string userName  = WebConfigurationManager.AppSettings["UserNameSMS"];
            string password  = WebConfigurationManager.AppSettings["PasswordSMS"];
            string NumberSMS = WebConfigurationManager.AppSettings["NumberSMS"];

            SendSoapClient client      = new SendSoapClient();
            var            countUnRead = client.GetInboxCount(userName, password, false);
            var            counRead    = client.GetInboxCount(userName, password, true);

            if (counRead != 0)
            {
                if (countUnRead != 0)
                {
                    var resultSMS = client.getMessages(userName, password, 1, null, ((pageNumber * 30) + countUnRead), 30);
                    if (resultSMS == null || !resultSMS.Any())
                    {
                        return(Content("no-more-info"));
                    }
                    result = resultSMS.Select(x => new InfoSMSViewModel
                    {
                        Id       = x.MsgID.ToString(),
                        Body     = x.Body,
                        DateTime = x.SendDate,
                        Sender   = x.Sender
                    }).ToList();
                    return(PartialView(viewName: MVC.admin.Setting.Views._dataSMS, model: result));
                }
                else
                {
                    var resultSMS = client.getMessages(userName, password, 1, null, (pageNumber * 30), 30);
                    if (resultSMS == null || !resultSMS.Any())
                    {
                        return(Content("no-more-info"));
                    }
                    result = resultSMS.Select(x => new InfoSMSViewModel
                    {
                        Id       = x.MsgID.ToString(),
                        Body     = x.Body,
                        DateTime = x.SendDate,
                        Sender   = x.Sender
                    }).ToList();
                    return(PartialView(viewName: MVC.admin.Setting.Views._dataSMS, model: result));
                }
            }
            else
            {
                return(Content("no-more-info"));
            }
        }
Beispiel #8
0
        public async Task <ActionResult> SoapAsync()
        {
            const string   username   = "******";
            const string   password   = "******";
            const string   from       = "5000...";
            const string   to         = "09123456789";
            const string   text       = "تست وب سرویس ملی پیامک";
            const bool     isFlash    = false;
            SendSoapClient soapClient = new SendSoapClient();
            var            result     = await soapClient.SendSimpleSMS2Async(username, password, to, from, text, isFlash);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #9
0
        public virtual ActionResult GetReadSMS()
        {
            var result = new List <InfoSMSViewModel> {
            };

            string userName  = WebConfigurationManager.AppSettings["UserNameSMS"];
            string password  = WebConfigurationManager.AppSettings["PasswordSMS"];
            string NumberSMS = WebConfigurationManager.AppSettings["NumberSMS"];


            SendSoapClient client      = new SendSoapClient();
            var            countUnRead = client.GetInboxCount(userName, password, false);
            var            counRead    = client.GetInboxCount(userName, password, true);

            if (counRead != 0)
            {
                if (countUnRead != 0)
                {
                    var resultSMS = client.getMessages(userName, password, 1, null, (0 + countUnRead), 30);
                    result = resultSMS.Select(x => new InfoSMSViewModel
                    {
                        Id       = x.MsgID.ToString(),
                        Body     = x.Body,
                        DateTime = x.SendDate,
                        Sender   = x.Sender
                    }).ToList();
                    return(View(result));
                }
                else
                {
                    var resultSMS = client.getMessages(userName, password, 1, null, 0, 30);
                    result = resultSMS.Select(x => new InfoSMSViewModel
                    {
                        Id       = x.MsgID.ToString(),
                        Body     = x.Body,
                        DateTime = x.SendDate,
                        Sender   = x.Sender
                    }).ToList();
                    return(View(result));
                }
            }
            else
            {
                return(View(new List <InfoSMSViewModel> {
                }));
            }
        }
Beispiel #10
0
        public virtual async Task <ActionResult> ResultSendTrackingNumber(ConfirmSaleViewModel model)
        {
            try
            {
                var user = await _userManager.FindUserById(model.Usder_Id);

                string userName  = WebConfigurationManager.AppSettings["UserNameSMS"];
                string password  = WebConfigurationManager.AppSettings["PasswordSMS"];
                string NumberSMS = WebConfigurationManager.AppSettings["NumberSMS"];


                SendSoapClient client = new SendSoapClient();

                string result = client.SendSimpleSMS2(userName, password, user.Phone, NumberSMS, string.Format("شرکت فناوران اطلاعات ارم وب / کد رهگیری پستی / {0} ", model.TrackingNumber.ToString()), false);

                var sale = _saleService.GetById(model.Sale_Id);
                sale.StatusSend     = true;
                sale.TrackingNumber = model.TrackingNumber.ToString();


                _saleService.Update(sale);


                if (_unitOfWork.SaveAllChanges() > 0)
                {
                    return(Json(new { Result = "ارسال و صحیح کردن کد رهگیری با موفقیت صورت گرفت" }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { Result = "عدم موفقیت در ارسال و صحیح کردن کد رهگیری" }, JsonRequestBehavior.AllowGet));
                }
            }
            catch
            {
                return(Json(new { Result = "عدم موفقیت در تائید سفارش" }, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #11
0
        public virtual ActionResult getInfoAccount()
        {
            try
            {
                InfoAccountSMS info     = new InfoAccountSMS();
                var            userName = WebConfigurationManager.AppSettings["UserNameSMS"];
                var            password = WebConfigurationManager.AppSettings["PasswordSMS"];


                SendSoapClient client = new SendSoapClient();

                int countUnReed = client.GetInboxCount(userName, password, false);
                int countReed   = client.GetInboxCount(userName, password, true);

                var creadit     = Math.Round(client.GetCredit(userName, password), 2).ToString();
                var countRecive = (countUnReed + countReed).ToString();
                var countSend   = "120";

                info.CountRead   = countReed.ToString();
                info.CountUnRead = countUnReed.ToString();
                info.CountSend   = countSend;
                info.CountRecive = countRecive;
                info.Creadit     = creadit;

                return(PartialView(viewName: MVC.admin.Setting.Views._DetailsAccountSMS,
                                   model: info));
            }
            catch (Exception ex)
            {
                return(PartialView(MVC.admin.Shared.Views._alert, new AlertViewModel
                {
                    Alert = AlertOperation.SurveyOperation(StatusOperation.ExceptionReciveSMS),
                    Status = AlertMode.warning
                }));
            }
        }
Beispiel #12
0
        public virtual ActionResult SendSimpleSMS2(SndSMSViewModel model)
        {
            try
            {
                string userName  = WebConfigurationManager.AppSettings["UserNameSMS"];
                string password  = WebConfigurationManager.AppSettings["PasswordSMS"];
                string NumberSMS = WebConfigurationManager.AppSettings["NumberSMS"];


                SendSoapClient client = new SendSoapClient();

                string result = client.SendSimpleSMS2(userName, password, model.Phone, NumberSMS, model.Body, false);

                switch (result)
                {
                case "0":
                    return(PartialView(MVC.admin.Shared.Views._alert, new AlertViewModel
                    {
                        Alert = AlertOperationSendSMS.SurveyOperation(StatusOperationSendMessage.InvalidUserNameOrPassword),
                        Status = AlertMode.warning
                    }));

                case "1":
                    return(PartialView(MVC.admin.Shared.Views._alert, new AlertViewModel
                    {
                        Alert = AlertOperationSendSMS.SurveyOperation(StatusOperationSendMessage.SuccessOperation),
                        Status = AlertMode.success
                    }));

                case "2":
                    return(PartialView(MVC.admin.Shared.Views._alert, new AlertViewModel
                    {
                        Alert = AlertOperationSendSMS.SurveyOperation(StatusOperationSendMessage.NotEnoghCreadit),
                        Status = AlertMode.warning
                    }));

                case "3":
                    return(PartialView(MVC.admin.Shared.Views._alert, new AlertViewModel
                    {
                        Alert = AlertOperationSendSMS.SurveyOperation(StatusOperationSendMessage.DailySendLimit),
                        Status = AlertMode.warning
                    }));

                case "4":
                    return(PartialView(MVC.admin.Shared.Views._alert, new AlertViewModel
                    {
                        Alert = AlertOperationSendSMS.SurveyOperation(StatusOperationSendMessage.WightSendLimit),
                        Status = AlertMode.warning
                    }));

                case "5":
                    return(PartialView(MVC.admin.Shared.Views._alert, new AlertViewModel
                    {
                        Alert = AlertOperationSendSMS.SurveyOperation(StatusOperationSendMessage.NotValidNumber),
                        Status = AlertMode.warning
                    }));

                case "6":
                    return(PartialView(MVC.admin.Shared.Views._alert, new AlertViewModel
                    {
                        Alert = AlertOperationSendSMS.SurveyOperation(StatusOperationSendMessage.UpgradeSoftwer),
                        Status = AlertMode.warning
                    }));

                case "7":
                    return(PartialView(MVC.admin.Shared.Views._alert, new AlertViewModel
                    {
                        Alert = AlertOperationSendSMS.SurveyOperation(StatusOperationSendMessage.FilterWord),
                        Status = AlertMode.warning
                    }));

                case "10":
                    return(PartialView(MVC.admin.Shared.Views._alert, new AlertViewModel
                    {
                        Alert = AlertOperationSendSMS.SurveyOperation(StatusOperationSendMessage.NotActiveUser),
                        Status = AlertMode.warning
                    }));

                case "11":
                    return(PartialView(MVC.admin.Shared.Views._alert, new AlertViewModel
                    {
                        Alert = AlertOperationSendSMS.SurveyOperation(StatusOperationSendMessage.NotSend),
                        Status = AlertMode.warning
                    }));

                case "12":
                    return(PartialView(MVC.admin.Shared.Views._alert, new AlertViewModel
                    {
                        Alert = AlertOperationSendSMS.SurveyOperation(StatusOperationSendMessage.NotCompleteRegistrationPaper),
                        Status = AlertMode.warning
                    }));

                default:
                    return(PartialView(MVC.admin.Shared.Views._alert, new AlertViewModel
                    {
                        Alert = AlertOperationSendSMS.SurveyOperation(StatusOperationSendMessage.RecId),
                        Status = AlertMode.success
                    }));
                }
            }
            catch
            {
                return(PartialView(MVC.admin.Shared.Views._alert, new AlertViewModel
                {
                    Alert = AlertOperation.SurveyOperation(StatusOperation.FailSend),
                    Status = AlertMode.warning
                }));
            }
        }