当前位置: 首页>>代码示例>>C#>>正文


C# ISmsSender.SendSms方法代码示例

本文整理汇总了C#中ISmsSender.SendSms方法的典型用法代码示例。如果您正苦于以下问题:C# ISmsSender.SendSms方法的具体用法?C# ISmsSender.SendSms怎么用?C# ISmsSender.SendSms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISmsSender的用法示例。


在下文中一共展示了ISmsSender.SendSms方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddNewClients

 private void AddNewClients(List<Client> clients, bool isSendWelcomeSms)
 {
     try
     {
         //add new clients to db
         foreach (var client in clients)
         {
             _unitOfWork.ClientRepository.Add(client);
         }
         _unitOfWork.ClientRepository.Save();
         FileLoadHelper.AddImportLogClientCreate(clients);
         if (clients.Any())
         {
             //send sms
             _smsSender = new WelcomeSmsSender();
             _smsSender.SendSms(isSendWelcomeSms, clients, new Guid(), string.Empty);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
开发者ID:DenysGranevych,项目名称:Denys-library,代码行数:23,代码来源:ClientsController.cs

示例2: SentSmsMultipleClient

        public JsonResult SentSmsMultipleClient(string[] clientsId, string templateId, bool isSend, SmsSenderType smsSenderType)
        {
            var clients = GetClientsToSendSms(smsSenderType, clientsId);

            if (string.IsNullOrEmpty(templateId)) return Json(false, JsonRequestBehavior.AllowGet);
            // sent standard sms
            _smsSender = new DefaultSmsSender();
            _smsSender.SendSms(isSend, clients, new Guid(templateId), string.Empty);

            return Json(true, JsonRequestBehavior.AllowGet);
        }
开发者ID:DenysGranevych,项目名称:Denys-library,代码行数:11,代码来源:ClientsController.cs

示例3: SendCustomSMSMultipleClient

        public JsonResult SendCustomSMSMultipleClient(string[] clientsId, string smsText, bool isSend, SmsSenderType smsSenderType)
        {
            var clients = GetClientsToSendSms(smsSenderType, clientsId);

            // sent custom sms selected clients
            _smsSender = new CustomSmsSender();
            _smsSender.SendSms(isSend, clients, new Guid(), smsText);

            return Json(true, JsonRequestBehavior.AllowGet);
        }
开发者ID:DenysGranevych,项目名称:Denys-library,代码行数:10,代码来源:ClientsController.cs

示例4: SentSmsClient

        public JsonResult SentSmsClient(string clientId, string templateId, bool isSend)
        {
            if (!string.IsNullOrEmpty(clientId) && !string.IsNullOrEmpty(templateId))
            {
                var baseClient = _unitOfWork.ClientRepository.FindBy(t => t.Id == new Guid(clientId)).FirstOrDefault();

                if (baseClient != null)
                {

                    // sent standard sms
                    //create clients list
                    var clients = new List<Client>();
                    clients.Add(baseClient);
                    //send sms
                    _smsSender = new DefaultSmsSender();
                    _smsSender.SendSms(isSend, clients, new Guid(templateId), string.Empty);

                    return Json(true, JsonRequestBehavior.AllowGet);
                }
            }

            return Json(false, JsonRequestBehavior.AllowGet);
        }
开发者ID:DenysGranevych,项目名称:Denys-library,代码行数:23,代码来源:ClientsController.cs

示例5: LoadClients

        public ActionResult LoadClients()
        {
            var clientToDelete = new List<ClientTableModel>();
            try
            {
                //create import log
              var importLogId =  FileLoadHelper.AddImportLog();//??
                foreach (string upload in Request.Files)
                {
                    //upload file
                    if (!Request.Files[upload].HasFile()) continue;

                    string path = AppDomain.CurrentDomain.BaseDirectory;
                    string filename = Path.GetFileName(Request.Files[upload].FileName);
                    Request.Files[upload].SaveAs(Path.Combine(path, filename));

                    //add importLogFile
                    FileLoadHelper.AddImportLogFile(importLogId, Path.Combine(path, filename));

                    //get filtering constants
                    var clientSheetName =
                        _unitOfWork.SystemConstantsRepository.GetConstantByName<string>(Resource.ClientSheetName);
                    var clientPhoneStartWith =
                        _unitOfWork.SystemConstantsRepository.GetConstantByName<string>(Resource.ClientPhoneStartWith);
                    var defaultCountry =
                        _unitOfWork.SystemConstantsRepository.GetConstantByName<string>(Resource.DefaultCountry);
                    var clientPhoneLength =
                        _unitOfWork.SystemConstantsRepository.GetConstantByName<string>(Resource.ClientPhoneLength);

                    //read clients info from file
                    var excel = new ExcelQueryFactory();
                    excel.FileName = path + filename;

                    var allClients = from client in excel.Worksheet<ClientExcelModel>(clientSheetName)
                        where client.country == defaultCountry
                              && client.phone != null && client.phone.StartsWith(clientPhoneStartWith)
                        select client;

                    var clientsList = allClients.ToList();
                    var resultClientList = new List<Client>();

                    //add clients to resultList (filtering clients)
                    foreach (var client in clientsList)
                    {
                        if (Regex.IsMatch(client.phone, @"^\d{" + clientPhoneLength + "}$") &&
                            !resultClientList.Where(t => t.UserName == client.username && t.Phone == client.phone).Any())
                        {
                            var newClient = new Client
                            {
                                Id = Guid.NewGuid(),
                                UserName = client.username,
                                FirstName = FileLoadHelper.FirstCharToUpper(client.first_name),
                                LastName = FileLoadHelper.FirstCharToUpper(client.last_name),
                                Country = client.country,
                                RegistrationDate = client.registration_date,
                                Phone = client.phone,
                                Dreams = client.number_dreams,
                                Email = client.email,
                                UpdatedDate = DateTime.UtcNow,
                                LoadedDate = DateTime.UtcNow,
                                IsSentReminderSms = false
                            };
                            resultClientList.Add(newClient);
                        }
                    }

                    // add client to DB and update
                    var updatedClients = FileLoadHelper.UpdateClients(resultClientList, importLogId);

                    var isSMSSendingEnabled = Convert.ToBoolean(Session["isSMSSendingEnabled"]);

                    // add new client
                    AddNewClients(updatedClients.NewClients, isSMSSendingEnabled);
                    //update client with changed UserName
                    UpdateClients(updatedClients.UpdatedClients);
                    //send first dreams sms
                    if (updatedClients.FirstDreamClients.Any())
                    {
                        //send sms
                        _smsSender = new FirstDreamsSMSSender();
                        _smsSender.SendSms(isSMSSendingEnabled, updatedClients.FirstDreamClients, new Guid(), string.Empty);
                    }

                    foreach (var client in updatedClients.DeletedClients)
                    {
                        var convertedClient = ClientTableModel.ClientViewModelConverter(client);
                        clientToDelete.Add(convertedClient);
                    }

                    TempData["ClientToDelete"] = clientToDelete;
                    TempData["ClientsWithIncrementedDreams"] = updatedClients.ClientsWithIncrementedDreams;
                }
            }
            catch (Exception exception)
            {

                throw;
            }
            return RedirectToAction("Clients");
        }
开发者ID:DenysGranevych,项目名称:Denys-library,代码行数:100,代码来源:ClientsController.cs


注:本文中的ISmsSender.SendSms方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。