Exemple #1
0
 public virtual void Load(IKeyedDataStore store)
 {
     if (_interiorProvider != null)
     {
         _interiorProvider.Load(store);
     }
 }
Exemple #2
0
        public LibraryClient()
        {
            IDataStoreProvider provider = new TSettingsProvider();

            _settings = new KeyedDataStore(provider);

            if (!_settings.get("EchoServiceEndpoint", ref _echoServiceEndpointName))
            {
                throw new ApplicationException(string.Format("Missing Configuration element ''",
                                                             "EchoServiceEndpoint"));
            }
            Trace.WriteLine(string.Format("EchoServiceEndpoint='{0}'", _echoServiceEndpointName));

            if (!_settings.get("LibraryServiceEndpoint", ref _libraryServiceEndpointName))
            {
                throw new ApplicationException(string.Format("Missing Configuration element ''",
                                                             "LibraryServiceEndpoint"));
            }
            Trace.WriteLine(string.Format("LibraryServiceEndpoint='{0}'", _libraryServiceEndpointName));

            // Resolve streams out of resource fork.
            StreamFactory.Register("res", (path, args) =>
            {
                Assembly assembly   = Assembly.GetExecutingAssembly();
                string resourcePath = string.Format("{0}.{1}",
                                                    assembly.GetName().Name,
                                                    path);
                Trace.WriteLine(string.Format("StreamFactory::Create(res://{0})", resourcePath));
                Stream result = assembly.GetManifestResourceStream(resourcePath);
                return(result);
            });
        }
 public override void Load(IKeyedDataStore store)
 {
     base.Load(store);
     if (RoleEnvironment.IsAvailable)
     {
         string logPath = RoleEnvironment.GetConfigurationSettingValue("LogPath");
         store.Add("LogPath", logPath);
     }
 }
        public override void Save(IKeyedDataStore store)
        {
            KeyValueConfigurationCollection appSettings = _configuration.AppSettings.Settings;

            appSettings.Clear();
            foreach (string key in store.Keys)
            {
                appSettings.Add(key, store[key]);
            }
        }
        public override void Load(IKeyedDataStore store)
        {
            try
            {
                base.Load(store);

                foreach (string key in _configuration.AppSettings.Settings.AllKeys)
                {
                    store[key] = _configuration.AppSettings.Settings[key].Value;
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError(ex.ToString());
                throw;
            }
        }
Exemple #6
0
        private static void initializeTracer()
        {
            IDataStoreProvider provider = ConfigProviderBase.Open();

#if _AZURE
            iconfig = new KeyedDataStore(new CloudSettingsProvider(provider));
#else
            iconfig = new KeyedDataStore(provider);
#endif
            _logPath = (iconfig["LogPath"] as string) ?? @"C:\Logs\HelloIndigo";
#if _AZURE
            // Running in the Cloud; look for the local drive
            if (!Path.IsPathRooted(_logPath) &&
                RoleEnvironment.IsAvailable &&
                !RoleEnvironment.IsEmulated)
            {
                LocalResource localResource = RoleEnvironment.GetLocalResource("LogFiles");
                _logPath = Path.Combine(localResource.RootPath, _logPath);
            }
#endif
            tracer = new AppTraceListener(_logPath);
        }
Exemple #7
0
 public override void Save(IKeyedDataStore store)
 {
 }
Exemple #8
0
 public override void Load(IKeyedDataStore store)
 {
 }
 public KeyedDataStoreTests()
 {
     _store = new KeyedDataStore(new AppConfigProvider());
 }
Exemple #10
0
        private void sendEmailConfirmation(IKeyedDataStore parameters)
        {
#if _WTF
            // Create Confirmation from Template.
            Uri responseURI;
            response = BookSelection.WebApp.Helper.PostRequest(
                out responseURI,
                context.Request,
                "CheckoutEmailTemplate.cshtml?SendEmail=false");
#else
            string emailBody = null;

            MemoryStream stream = new MemoryStream(2048);

            TextWriter writer = new StreamWriter(stream);

            Action <string, string> emitField = ((name, id) =>
            {
                writer.WriteLine("         <label class='{0}' style='{1}'>",
                                 "oe-label", "display:block;margin-top: 5pt;margin-bottom:0pt");
                writer.Write(name.CamelCaseToDelimitted());
                writer.WriteLine("         </label>");                  //                </label>

                writer.WriteLine("         <input type='{0}' name='{1}' id='{2}' style='{3}' value='{4}' readonly />",
                                 "text", name, id, "width:80%;color:Blue", parameters[name]);
            });

            writer.WriteLine("<html>");
            writer.WriteLine("<head>");
            writer.Write("<title>");
            writer.Write("Black River Systems, Inc - Library Checkout");
            writer.Write("</title>");
            writer.WriteLine("</head>");

            writer.WriteLine("   <body>");
            writer.WriteLine("      <div id='oe-mail'>");

            writer.WriteLine("         <h2>{0}</h2>", "Checkout Confirmation");

            writer.WriteLine("         <fieldset style='{0}'>",
                             "margin-left: 27px; margin-right: 27px;");

            emitField("SubscriberName", "name");
            emitField("ISBN", "isbn");
            emitField("Title", "title");
            emitField("CheckoutDate", "checkout-date");

            writer.WriteLine("        </fieldset>");
            writer.WriteLine("      </div>");
            writer.WriteLine("   </body>");
            writer.WriteLine("</html>");

            writer.Flush();

            emailBody = stream.ContentsToString();
#endif
            // Send confirmation Email
            string       emailConnection = GlobalCache.GetResolvedString("EmailService");
            Encryption   encryptor       = new Encryption();
            IEmailClient client          = EmailClientFactory.Create(encryptor.Decrypt(emailConnection));
            client.Send("*****@*****.**",
                        Request.Form.Get("Email"),
                        "Library Checkout Confirmation",
                        emailBody);
        }
Exemple #11
0
 public abstract void Save(IKeyedDataStore store);