Esempio n. 1
0
        public EmailConnection GetConnection()
        {
            EmailConnection retVal = null;

            if (!String.IsNullOrEmpty(this.EmailConnection))
            {
                retVal = CodeTorch.Core.EmailConnection.GetByName(this.EmailConnection);
            }

            return retVal;
        }
Esempio n. 2
0
        public static EmailConnection GetByName(string Name)
        {
            EmailConnection item = Configuration.GetInstance().EmailConnections
                                   .Where(i =>
                                          (
                                              (i.Name.ToLower() == Name.ToLower())
                                          )
                                          )
                                   .SingleOrDefault();

            return(item);
        }
Esempio n. 3
0
        public static void Save(EmailConnection item)
        {
            string ConfigPath = ConfigurationLoader.GetFileConfigurationPath();

            if (!Directory.Exists(String.Format("{0}EmailConnections", ConfigPath)))
            {
                Directory.CreateDirectory(String.Format("{0}EmailConnections", ConfigPath));
            }

            string filePath = String.Format("{0}EmailConnections\\{1}.xml", ConfigPath, item.Name);

            ConfigurationLoader.SerializeObjectToFile(item, filePath);
        }
Esempio n. 4
0
        public static void Load(XDocument doc)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(EmailConnection));
            XmlReader     reader     = doc.CreateReader();

            reader.MoveToContent();

            EmailConnection item = null;

            try
            {
                item = (EmailConnection)serializer.Deserialize(reader);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("Error occurred while processing EmailConnection - {0}", doc.Root.FirstNode.ToString()), ex);
            }

            Configuration.GetInstance().EmailConnections.Add(item);
        }