Exemplo n.º 1
0
        public MainApplication()
        {
            InitializeComponent();
            this.ResultPath = @"D:\Sentresult.txt";
            var container = new WindsorContainer();

            container.Register(
                Component.For <ISMSProvider>().ImplementedBy <AtiehSMSProvider>());
            container.Register(
                Component.For <ISMSConfiguration>().ImplementedBy <AtiehSMSConfiguration>());
            container.Register(
                Component.For <IResultRegistrar>().ImplementedBy <FileResultRegistrar>());
            container.Register(
                Component.For <BulkMessageSender>().ImplementedBy <BulkMessageSender>());
            container.Register(
                Component.For <IFileReader>().ImplementedBy <CSVReader>());
            bulkMessageSender = container.Resolve <BulkMessageSender>();
            reader            = container.Resolve <IFileReader>();
            config            = container.Resolve <ISMSConfiguration>();
            config.ChangeConfig(Properties.Settings.Default.Username,
                                Properties.Settings.Default.Password,
                                Properties.Settings.Default.SourceNumber,
                                Properties.Settings.Default.UrlAddress
                                );
            bulkMessageSender.OneSendHandled += BulkMessageSender_OneSMSSent;
        }
Exemplo n.º 2
0
 public AtiehSMSProvider(ISMSConfiguration config)
 {
     Config        = config;
     serviceClient = new JaxRpcMessagingServiceClient();
     serviceClient.Endpoint.Address =
         new EndpointAddress(
             string.Format("http://{0}/services/MessagingService?wsdl", Config.Address));
 }
Exemplo n.º 3
0
 public SMSTemplateAppService(ISMSTemplateManager smsTemplateManager,
                              ISMSConfiguration smsConfiguration,
                              ICacheManager cacheManager)
 {
     this._smsTemplateManager = smsTemplateManager;
     this._smsConfiguration   = smsConfiguration;
     this._cacheManager       = cacheManager;
 }
Exemplo n.º 4
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            services.AddMvc();
            services.AddHangfire(x => x.UseSqlServerStorage(Configuration.GetConnectionString("DefaultConnection")));

            //initialize configuration, then inject as a singleton
            ISMSConfiguration config = InitSMSManager();

            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterInstance(config).SingleInstance().As <ISMSConfiguration>();
            containerBuilder.RegisterType <MessageBox>().As <IMessageBox>();
            containerBuilder.RegisterType <SMSManager>().As <ISMSManager>();
            containerBuilder.Populate(services);
            this.ApplicationContainer = containerBuilder.Build();

            return(new AutofacServiceProvider(this.ApplicationContainer));
        }
Exemplo n.º 5
0
 private void InitConfig()
 {
     config            = new SMSConfiguration();
     config.ShortCode  = Configuration["SMS.AttApi:ShortCode"];
     config.UrlSendSMS = Configuration["SMS.AttApi:UrlSendSMS"]
                         .Replace("{{shortcode}}", config.ShortCode);
     config.UrlGetSMSDeliveryStatus = Configuration["SMS.AttApi:UrlGetSMSDeliveryStatus"];
     config.UrlReceiveSMS           = Configuration["SMS.AttApi:UrlReceiveSMS"]
                                      .Replace("{{shortcode}}", config.ShortCode);
     config.UrlGetAccessToken           = Configuration["SMS.AttApi:UrlGetAccessToken"];
     config.AppScope                    = Configuration["SMS.AttApi:AppScope"];
     config.AppKey                      = Configuration["SMS.AttApi:AppKey"];
     config.AppSecret                   = Configuration["SMS.AttApi:AppSecret"];
     config.VerifyMessageDeliveryStatus =
         Convert.ToBoolean(Configuration["SMS.AttApi:VerifyMessageDeliveryStatus"]);
     config.DeliverySuccessCode = Configuration["SMS.AttApi:DeliverySuccessCode"];
     config.DeliveryFailureCode = Configuration["SMS.AttApi:DeliveryFailureCode"];
     config.BaseUrlMessageApi   = Configuration["SMS.AttApi:BaseUrlMessageApi"];
 }
 public PayamtakSmsService(ISMSConfiguration config, ILogger logger, IExceptionLogger exceptionLogger)
 {
     _config         = config;
     Logger          = logger;
     ExceptionLogger = exceptionLogger;
 }
 public FarapayamakSmsService(ISMSConfiguration config)
 {
     _config = config;
 }
Exemplo n.º 8
0
 public MessageBox(ISMSConfiguration config)
 {
     m_config = config;
 }
Exemplo n.º 9
0
 public SMSManager(ISMSConfiguration config, IMessageBox msgBox)
 {
     m_config = config;
     m_msgBox = msgBox;
 }