Exemplo n.º 1
0
        public FrmTemplates()
        {
            InitializeComponent();

            LoadData();
            ListTemplates.Instance().SetLanguage(Program.LanguageDefault);
        }
Exemplo n.º 2
0
        public void InsertTemplate(string textTemplate)
        {
            AlterTemplate alterTemplate = new AlterTemplate {
                Insert = true
            };
            DialogResult result = alterTemplate.ShowDialog();

            if (!result.Equals(System.Windows.Forms.DialogResult.OK))
            {
                return;
            }

            try
            {
                Template template = new Template
                {
                    Parent = trvTemplates.SelectedNode.Text,
                    Text   = alterTemplate.TextTemplate
                };
                ListTemplates.Instance().Insert(template);
                Telerik.WinControls.RadMessageBox.Show(Program.LanguageDefault.DictionaryMessage["msgTemplateAdded"]);
            }
            catch (Exception ex)
            {
                Telerik.WinControls.RadMessageBox.Show(ex.Message);
                InsertTemplate(alterTemplate.TextTemplate);
            }
        }
Exemplo n.º 3
0
        public ListTemplatesResponse ListTemplates(ListTemplatesRequest request)
        {
            var command = new ListTemplates(_apiKey, _secret, _baseUri, _authenticator, _builder)
            {
                Parameters = request
            };

            return((ListTemplatesResponse)((ICommandExecutor)this).Execute(command));
        }
Exemplo n.º 4
0
        private void BtnRemoveClick(object sender, EventArgs e)
        {
            //Só remove o item se não existir sub-itens.
            if (trvTemplates.SelectedNode.Nodes.Count > 0)
            {
                Telerik.WinControls.RadMessageBox.Show(Program.LanguageDefault.DictionaryMessage["msgNotRootRemove"]);
                return;
            }

            ListTemplates.Instance().Delete(trvTemplates.SelectedNode.Text);
            trvTemplates.SelectedNode.Remove();

            Telerik.WinControls.RadMessageBox.Show(Program.LanguageDefault.DictionaryMessage["msgTemplateDeleted"]);
        }
Exemplo n.º 5
0
        private void BtnOkClick(object sender, EventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(txtTextTemplate.Text))
                {
                    Telerik.WinControls.RadMessageBox.Show(Program.LanguageDefault.DictionaryMessage["msgTemplateEmpty"]);
                }

                if ((!txtTextTemplate.Text.Equals(TextTemplate)) || (DefaultWorkspace != cbxDefault.Checked))
                {
                    if (!Insert)
                    {
                        Template template = new Template
                        {
                            Parent = ParentTemplate,
                            Text   = txtTextTemplate.Text
                        };

                        if (DefaultWorkspace == null)
                        {
                            template.Default = null;
                        }
                        else
                        {
                            template.Default = cbxDefault.Checked;
                        }

                        ListTemplates.Instance().Update(TextTemplate, template, (!txtTextTemplate.Text.Equals(TextTemplate)));
                    }

                    TextTemplate = txtTextTemplate.Text;

                    if ((DefaultWorkspace != null) || (Insert))
                    {
                        DefaultWorkspace = cbxDefault.Checked;
                    }
                }

                DialogResult = DialogResult.OK;
                Close();
            }
            catch (Exception ex)
            {
                Telerik.WinControls.RadMessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 6
0
        public string readtitles(string filename)
        {
            _Application app = new Microsoft.Office.Interop.Word.Application();
            _Document    doc;

            object fileName = filename;
            object unknow   = System.Type.Missing;

            doc = app.Documents.Open(ref fileName,
                                     ref unknow, ref unknow, ref unknow, ref unknow, ref unknow,
                                     ref unknow, ref unknow, ref unknow, ref unknow, ref unknow,
                                     ref unknow, ref unknow, ref unknow, ref unknow, ref unknow); //input a doc
            object         pcount       = doc.Paragraphs.Count;                                   //count the paragraphs
            object         trydocfunc   = doc.Tables.Count;
            object         listnumbers  = doc.Lists.Count;
            object         listpnumbers = doc.ListParagraphs.Count;
            object         listtbumbers = doc.ListTemplates.Count;
            Lists          lists        = doc.Lists;
            ListParagraphs listps       = doc.ListParagraphs;
            ListTemplates  listts       = doc.ListTemplates;
            object         list1        = lists[1];
            object         list2        = lists[2];
            object         list3        = listps[1];
            object         list4        = listts[1];
            string         k            = listps[3].Range.Text.Trim();

            //object level = lists[1].ApplyListTemplateWithLevel
            string[] k3 = new string[3];
            for (int i = 0; i <= 1; i++)
            {
                k3[i] = lists[i + 1].Range.Text.Trim();
            }
            int[] num3 = new int[2];
            for (int i = 0; i <= 1; i++)
            {
                num3[i] = lists[i + 1].Range.Start;
            }
            string[] k4 = new string[3];
            for (int i = 0; i <= 2; i++)
            {
                k3[i] = listps[i + 1].Range.Text.Trim();
            }
            listpnumbers = doc.ListParagraphs.Count;
            app.Documents.Close(ref unknow, ref unknow, ref unknow);
            app.Quit(ref unknow, ref unknow, ref unknow);
            return(null);
        }
Exemplo n.º 7
0
        private void LoadData()
        {
            trvTemplates.Nodes.Clear();

            XmlNodeList nodeList = ListTemplates.Instance().LoadTemplates()[0].SelectNodes("SUPORTE");

            int i = 0;

            foreach (XmlNode nivelSuperior in nodeList)
            {
                AddNode(nivelSuperior, trvTemplates.Nodes.Count > 0 ? trvTemplates.Nodes[i] : null);
                i++;
            }

            //trvTemplates.Nodes[0].Selected = true;
            trvTemplates.ExpandAll();
        }
Exemplo n.º 8
0
        private void Effacer(Template t)
        {
            // Delete all dependencies first
            foreach (TemplatePackage tp in App.Entities.TemplatePackages)
            {
                if (tp.Template.Nom == t.Name)
                {
                    App.Entities.TemplatePackages.Remove(tp);
                }
            }
            foreach (TemplateMeta tp in App.Entities.TemplateMetas)
            {
                if (tp.Template.Nom == t.Name)
                {
                    App.Entities.TemplateMetas.Remove(tp);
                }
            }
            foreach (TemplateMacro tp in App.Entities.TemplateMacroes)
            {
                if (tp.Template.Nom == t.Name)
                {
                    App.Entities.TemplateMacroes.Remove(tp);
                }
            }
            foreach (TemplateEnvironment tp in App.Entities.TemplateEnvironments)
            {
                if (tp.Template.Nom == t.Name)
                {
                    App.Entities.TemplateEnvironments.Remove(tp);
                }
            }

            // Then remove from list
            Template tempToRemove = ListTemplates.FirstOrDefault(a => a.Nom == t.Name);

            ListTemplates.Remove(tempToRemove);
            ManagedList.Remove(tempToRemove);

            // And remove from DB
            App.Entities.Templates.Remove(App.Entities.Templates.FirstOrDefault(a => a.Nom == t.Name));
        }
Exemplo n.º 9
0
        private void Nouveau()
        {
            int    i            = 1;
            string originalName = "";

            switch (CurrentType)
            {
            case DBItemType.Template:
                ManagedItem  = Template.NewTemplate();
                originalName = ManagedItem.Name;
                while (true)
                {
                    if (ListTemplates.Any(t => t.Nom == ManagedItem.Name) || ListTemplates.Any(t => t.Nom == ManagedItem.Name + " (" + i + ")"))
                    {
                        ((Template)ManagedItem).Nom = originalName + " (" + i + ")";
                        i++;
                    }
                    else
                    {
                        break;
                    }
                }
                FirePropertyChanged("ManagedItem");
                ListTemplates.Add((Template)ManagedItem);
                break;

            case DBItemType.Macro:
                ManagedItem  = Macro.newMacro();
                originalName = ManagedItem.Name;
                while (true)
                {
                    if (ListMacros.Any(t => t.Nom == ManagedItem.Name) || ListMacros.Any(t => t.Nom == ManagedItem.Name + " (" + i + ")"))
                    {
                        ((Macro)ManagedItem).Nom = originalName + " (" + i + ")";
                        i++;
                    }
                    else
                    {
                        break;
                    }
                }
                ListMacros.Add((Macro)ManagedItem);
                break;

            case DBItemType.Meta:
                ManagedItem  = Meta.newMeta();
                originalName = ManagedItem.Name;
                while (true)
                {
                    if (ListMetas.Any(t => t.Nom == ManagedItem.Name) || ListMetas.Any(t => t.Nom == ManagedItem.Name + " (" + i + ")"))
                    {
                        ((Meta)ManagedItem).Nom = originalName + " (" + i + ")";
                        i++;
                    }
                    else
                    {
                        break;
                    }
                }
                ListMetas.Add((Meta)ManagedItem);
                break;

            case DBItemType.Environment:
                ManagedItem  = LTG_Entity.Environment.newEnvironment();
                originalName = ManagedItem.Name;
                while (true)
                {
                    if (ListEnvironments.Any(t => t.Nom == ManagedItem.Name) || ListEnvironments.Any(t => t.Nom == ManagedItem.Name + " (" + i + ")"))
                    {
                        ((LTG_Entity.Environment)ManagedItem).Nom = originalName + " (" + i + ")";
                        i++;
                    }
                    else
                    {
                        break;
                    }
                }
                ListEnvironments.Add((LTG_Entity.Environment)ManagedItem);
                break;

            default:
                break;
            }

            ManagedList.Add(ManagedItem);

            try
            {
                SaveDB();
                //_dialogCoordinator.ShowMessageAsync(this, "Information", "les articles ont été sauvés");
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                _dialogCoordinator.ShowMessageAsync(this, "Erreur", "Le nouvel élément n'a pas pu être créé");
            }

            //ArticleCourant = Article.NouvelArticle();
            //ListeArticles.Add(ArticleCourant);
        }
Exemplo n.º 10
0
        /*/// <summary>
         * /// Process the Text template.
         * /// </summary>
         * private void ProcessTextTemplate(string content)
         * {
         *  ActiveUp.Net.Mail.Logger.AddEntry("Processing the TEXT template.", 1);
         *
         *  // Initialize strings to be used later
         *  string line = string.Empty, lineUpper = string.Empty;
         *
         *  // Initialize the StringReader to read line per line
         *  StringReader reader = new StringReader(content);
         *
         *  // Initialize the actual body count
         *  int bodyCount = _bodies.Count, lineNumber = 0;
         *
         *  // Read and parse each line. Append the data in the properties.
         *  while (reader.Peek() > -1)
         *  {
         *      ActiveUp.Net.Mail.Logger.AddEntry("Line parsed. Body count: + " + bodyCount.ToString() + ".", 0);
         *
         *      line = reader.ReadLine();
         *      lineNumber++;
         *      lineUpper = line.ToUpper();
         *
         *      // If a property, then set value
         *      if (lineUpper.StartsWith("TO:"))
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("TO property found: + " + line + " (raw).", 0);
         *          this.Message.To.Add(Parser.ParseAddress(ExtractValue(line)));
         *      }
         *      else if (lineUpper.StartsWith("BCC:"))
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("BCC property found: + " + line + " (raw).", 0);
         *          this.Message.Bcc.Add(Parser.ParseAddress(ExtractValue(line)));
         *      }
         *      else if (lineUpper.StartsWith("CC:"))
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("CC property found: + " + line + " (raw).", 0);
         *          this.Message.Cc.Add(Parser.ParseAddress(ExtractValue(line)));
         *      }
         *      else if (lineUpper.StartsWith("FROM:"))
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("FROM property found: + " + line + " (raw).", 0);
         *          this.Message.From = Parser.ParseAddress(ExtractValue(line));
         *      }
         *      else if (lineUpper.StartsWith("SUBJECT:"))
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("SUBJECT property found: + " + line + " (raw).", 0);
         *          this.Message.Subject += ExtractValue(line);
         *      }
         *      else if (lineUpper.StartsWith("SMTPSERVER:"))
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("SMTPSERVER property found: + " + line + " (raw).", 0);
         *          this.SmtpServers.Add(ExtractValue(line), 25);
         *      }
         *      else if (lineUpper.StartsWith("BODYTEXT:"))
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("BODYTEXT property found: + " + line + " (raw).", 0);
         *          this.Bodies.Add(ExtractValue(line), BodyFormat.Text);
         *          bodyCount++;
         *      }
         *      else if (lineUpper.StartsWith("BODYHTML:"))
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("BODYHTML property found: + " + line + " (raw).", 0);
         *          this.Bodies.Add(ExtractValue(line), BodyFormat.Html);
         *          bodyCount++;
         *      }
         *      else if (lineUpper.StartsWith("FIELDFORMAT:") && lineUpper.IndexOf("=") > -1)
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("FIELDFORMAT property found: + " + line + " (raw).", 0);
         *          this.FieldsFormats.Add(ExtractFormat(line));
         *      }
         *      else if (lineUpper.StartsWith("//"))
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("COMMENT line found: + " + line + " (raw).", 0);
         *          // Line is a comment, so do nothing
         *      }
         *          // If not a property, then it's a message line
         *      else
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("BODY line found: + " + line + " (raw).", 0);
         *          this.Bodies[bodyCount-1].Content += line + "\r\n";
         *      }
         *  }
         * }*/

        /*/// <summary>
         * /// Extract the format options from a text template line.
         * /// </summary>
         * /// <param name="line">The text template line.</param>
         * /// <returns>A FieldFormat object with the options.</returns>
         * private FieldFormat ExtractFormat(string line)
         * {
         *  ActiveUp.Net.Mail.Logger.AddEntry("Extracting FieldFormat from line: + " + line + " (raw).", 0);
         *
         *  FieldFormat fieldFormat = new FieldFormat();
         *  string property, val;
         *
         *  foreach(string format in ExtractValue(line).Split(';'))
         *  {
         *      string[] lineSplit = format.Split('=');
         *
         *      if (lineSplit.Length > 1)
         *      {
         *          property = lineSplit[0];
         *          val = lineSplit[1];
         *
         *          switch (property.ToUpper())
         *          {
         *              case "NAME": fieldFormat.Name = val; break;
         *              case "FORMAT": fieldFormat.Format = val; break;
         *              case "PADDINGDIR":
         *                  if (val.ToUpper() == "LEFT")
         *                      fieldFormat.PaddingDir = PaddingDirection.Left;
         *                  else
         *                      fieldFormat.PaddingDir = PaddingDirection.Right;
         *                  break;
         *              case "TOTALWIDTH":
         *                  try
         *                  {
         *                      fieldFormat.TotalWidth = Convert.ToInt16(val);
         *                  }
         *                  catch
         *                  {
         *                      throw new Exception("Specified Total Width is not a valid number.");
         *                  }
         *                  break;
         *              case "PADDINGCHAR": fieldFormat.PaddingChar = Convert.ToChar(val.Substring(0, 1)); break;
         *          }
         *
         *      }// End if line split length > 1
         *  }
         *
         *  return fieldFormat;
         * }*/

        /// <summary>
        /// Process the Xml template.
        /// </summary>
        private void ProcessXmlTemplate(string content)
        {
            Logger.AddEntry(GetType(), "Processing the XML template.", 1);

            StringReader  stringReader = new StringReader(content);
            XmlTextReader reader       = new XmlTextReader(stringReader);

            string element = string.Empty;

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                    element = reader.Name;
                    Logger.AddEntry(GetType(), "New element found: " + element + ".", 0);
                    switch (element.ToUpper())
                    {
                    case "MESSAGE":
                        if (reader.GetAttribute("PRIORITY") != null && reader.GetAttribute("PRIORITY") != string.Empty)
                        {
                            Message.Priority = (MessagePriority)Enum.Parse(typeof(MessagePriority), reader.GetAttribute("PRIORITY"), true);
                        }
                        else if (reader.GetAttribute("priority") != null && reader.GetAttribute("priority") != string.Empty)
                        {
                            Message.Priority = (MessagePriority)Enum.Parse(typeof(MessagePriority), reader.GetAttribute("priority"), true);
                        }
                        break;

                    case "FIELDFORMAT":
                        if (reader.HasAttributes)
                        {
                            Logger.AddEntry(GetType(), "Element has attributes.", 0);
                            FieldFormat fieldFormat = new FieldFormat();
                            if (reader.GetAttribute("NAME") != null && reader.GetAttribute("NAME") != string.Empty)
                            {
                                fieldFormat.Name = reader.GetAttribute("NAME");
                                Logger.AddEntry(GetType(), "Attribute NAME: " + fieldFormat.Name, 0);
                            }
                            else if (reader.GetAttribute("name") != null && reader.GetAttribute("name") != string.Empty)
                            {
                                fieldFormat.Name = reader.GetAttribute("name");
                                Logger.AddEntry(GetType(), "Attribute name: " + fieldFormat.Name, 0);
                            }
                            if (reader.GetAttribute("FORMAT") != null && reader.GetAttribute("FORMAT") != string.Empty)
                            {
                                fieldFormat.Format = reader.GetAttribute("FORMAT");
                                Logger.AddEntry(GetType(), "Attribute FORMAT: " + fieldFormat.Format, 0);
                            }
                            else if (reader.GetAttribute("format") != null && reader.GetAttribute("format") != string.Empty)
                            {
                                fieldFormat.Format = reader.GetAttribute("format");
                                Logger.AddEntry(GetType(), "Attribute format: " + fieldFormat.Format, 0);
                            }
                            if (reader.GetAttribute("PADDINGDIR") != null && reader.GetAttribute("PADDINGDIR") != string.Empty)
                            {
                                fieldFormat.PaddingDir = reader.GetAttribute("PADDINGDIR").ToUpper() == "LEFT" ? PaddingDirection.Left : PaddingDirection.Right;
                                Logger.AddEntry(GetType(), "Attribute PADDINGDIR: " + reader.GetAttribute("PADDINGDIR"), 0);
                            }
                            else if (reader.GetAttribute("paddingdir") != null && reader.GetAttribute("paddingdir") != string.Empty)
                            {
                                fieldFormat.PaddingDir = reader.GetAttribute("paddingdir").ToUpper() == "left" ? PaddingDirection.Left : PaddingDirection.Right;
                                Logger.AddEntry(GetType(), "Attribute paddingdir: " + reader.GetAttribute("paddingdir"), 0);
                            }
                            if (reader.GetAttribute("TOTALWIDTH") != null && reader.GetAttribute("TOTALWIDTH") != string.Empty)
                            {
                                try
                                {
                                    fieldFormat.TotalWidth = Convert.ToInt16(reader.GetAttribute("TOTALWIDTH"));
                                }
                                catch
                                {
                                    throw new Exception("Specified Total Width is not a valid number.");
                                }
                                Logger.AddEntry(GetType(), "Attribute TOTALWIDTH: " + fieldFormat.TotalWidth.ToString(), 0);
                            }
                            else if (reader.GetAttribute("totalwidth") != null && reader.GetAttribute("totalwidth") != string.Empty)
                            {
                                try
                                {
                                    fieldFormat.TotalWidth = Convert.ToInt16(reader.GetAttribute("totalwidth"));
                                }
                                catch
                                {
                                    throw new Exception("Specified Total Width is not a valid number.");
                                }
                                Logger.AddEntry(GetType(), "Attribute totalwidth: " + fieldFormat.TotalWidth.ToString(), 0);
                            }
                            if (reader.GetAttribute("PADDINGCHAR") != null && reader.GetAttribute("PADDINGCHAR") != string.Empty)
                            {
                                fieldFormat.PaddingChar = Convert.ToChar(reader.GetAttribute("PADDINGCHAR").Substring(0, 1));
                                Logger.AddEntry(GetType(), "Attribute PADDINGCHAR: '" + fieldFormat.PaddingChar + "'", 0);
                            }
                            else if (reader.GetAttribute("paddingchar") != null && reader.GetAttribute("paddingchar") != string.Empty)
                            {
                                fieldFormat.PaddingChar = Convert.ToChar(reader.GetAttribute("paddingchar").Substring(0, 1));
                                Logger.AddEntry(GetType(), "Attribute paddingchar: '" + fieldFormat.PaddingChar + "'", 0);
                            }
                            FieldsFormats.Add(fieldFormat);
                        }
                        break;

                    case "FROM":
                    case "TO":
                    case "CC":
                    case "BCC":
                        if (reader.HasAttributes)
                        {
                            Address address = new Address();
                            if (reader.GetAttribute("NAME") != null && reader.GetAttribute("NAME") != string.Empty)
                            {
                                address.Name = reader.GetAttribute("NAME");
                            }
                            else if (reader.GetAttribute("name") != null && reader.GetAttribute("name") != string.Empty)
                            {
                                address.Name = reader.GetAttribute("name");
                            }
                            if (reader.GetAttribute("EMAIL") != null && reader.GetAttribute("EMAIL") != string.Empty)
                            {
                                address.Email = reader.GetAttribute("EMAIL");
                            }
                            else if (reader.GetAttribute("email") != null && reader.GetAttribute("email") != string.Empty)
                            {
                                address.Email = reader.GetAttribute("email");
                            }
                            if (element.ToUpper() == "FROM")
                            {
                                if (reader.GetAttribute("REPLYNAME") != null && reader.GetAttribute("REPLYNAME") != string.Empty)
                                {
                                    InitReplyTo();
                                    Message.ReplyTo.Name = reader.GetAttribute("REPLYNAME");
                                }
                                else if (reader.GetAttribute("replyname") != null && reader.GetAttribute("replyname") != string.Empty)
                                {
                                    InitReplyTo();
                                    Message.ReplyTo.Name = reader.GetAttribute("replyname");
                                }
                                if (reader.GetAttribute("REPLYEMAIL") != null && reader.GetAttribute("REPLYEMAIL") != string.Empty)
                                {
                                    InitReplyTo();
                                    Message.ReplyTo.Email = reader.GetAttribute("REPLYEMAIL");
                                }
                                else if (reader.GetAttribute("replyemail") != null && reader.GetAttribute("replyemail") != string.Empty)
                                {
                                    InitReplyTo();
                                    Message.ReplyTo.Email = reader.GetAttribute("replyemail");
                                }
                                if (reader.GetAttribute("RECEIPTEMAIL") != null && reader.GetAttribute("RECEIPTEMAIL") != string.Empty)
                                {
                                    Message.ReturnReceipt.Email = reader.GetAttribute("RECEIPTEMAIL");
                                }
                                else if (reader.GetAttribute("receiptemail") != null && reader.GetAttribute("receiptemail") != string.Empty)
                                {
                                    Message.ReturnReceipt.Email = reader.GetAttribute("receiptemail");
                                }
                            }
                            switch (reader.Name.ToUpper())
                            {
                            case "FROM":
                                Message.From = address;
                                break;

                            case "TO":
                                Message.To.Add(address);
                                break;

                            case "CC":
                                Message.Cc.Add(address);
                                break;

                            case "BCC":
                                Message.Bcc.Add(address);
                                break;
                            }
                        }
                        break;

                    case "LISTTEMPLATE":
                        ListTemplate template = new ListTemplate();
                        string       RegionID = string.Empty;
                        string       NullText = string.Empty;
                        if (reader.GetAttribute("REGIONID") != null && reader.GetAttribute("REGIONID") != string.Empty)
                        {
                            RegionID = reader.GetAttribute("REGIONID");
                        }
                        else if (reader.GetAttribute("regionid") != null && reader.GetAttribute("regionid") != string.Empty)
                        {
                            RegionID = reader.GetAttribute("regionid");
                        }

                        if (reader.GetAttribute("NULLTEXT") != null && reader.GetAttribute("NULLTEXT") != string.Empty)
                        {
                            NullText = reader.GetAttribute("NULLTEXT");
                        }
                        else if (reader.GetAttribute("nulltext") != null && reader.GetAttribute("nulltext") != string.Empty)
                        {
                            NullText = reader.GetAttribute("nulltext");
                        }

                        if (reader.HasAttributes && reader.GetAttribute("NAME") != null && reader.GetAttribute("NAME") != string.Empty)
                        {
                            template = new ListTemplate(reader.GetAttribute("NAME"), reader.ReadString());
                        }
                        else if (reader.HasAttributes && reader.GetAttribute("name") != null && reader.GetAttribute("name") != string.Empty)
                        {
                            template = new ListTemplate(reader.GetAttribute("name"), reader.ReadString());
                        }
                        template.RegionID = RegionID;
                        template.NullText = NullText;
                        ListTemplates.Add(template);
                        break;

                    case "SMTPSERVER":
                        Server server = new Server();
                        if (reader.GetAttribute("SERVER") != null && reader.GetAttribute("SERVER") != string.Empty)
                        {
                            server.Host = reader.GetAttribute("SERVER");
                        }
                        else if (reader.GetAttribute("server") != null && reader.GetAttribute("server") != string.Empty)
                        {
                            server.Host = reader.GetAttribute("server");
                        }

                        if (reader.GetAttribute("PORT") != null && reader.GetAttribute("PORT") != string.Empty)
                        {
                            server.Port = int.Parse(reader.GetAttribute("PORT"));
                        }
                        else if (reader.GetAttribute("port") != null && reader.GetAttribute("port") != string.Empty)
                        {
                            server.Port = int.Parse(reader.GetAttribute("port"));
                        }

                        if (reader.GetAttribute("USERNAME") != null && reader.GetAttribute("USERNAME") != string.Empty)
                        {
                            server.Username = reader.GetAttribute("USERNAME");
                        }
                        else if (reader.GetAttribute("username") != null && reader.GetAttribute("username") != string.Empty)
                        {
                            server.Username = reader.GetAttribute("username");
                        }

                        if (reader.GetAttribute("PASSWORD") != null && reader.GetAttribute("PASSWORD") != string.Empty)
                        {
                            server.Password = reader.GetAttribute("PASSWORD");
                        }
                        else if (reader.GetAttribute("password") != null && reader.GetAttribute("password") != string.Empty)
                        {
                            server.Password = reader.GetAttribute("password");
                        }
                        SmtpServers.Add(server);
                        break;

                    case "CONDITION":
                        Condition condition = new Condition();

                        if (reader.GetAttribute("REGIONID") != null && reader.GetAttribute("REGIONID") != string.Empty)
                        {
                            condition.RegionID = reader.GetAttribute("REGIONID");
                        }
                        else if (reader.GetAttribute("regionid") != null && reader.GetAttribute("regionid") != string.Empty)
                        {
                            condition.RegionID = reader.GetAttribute("regionid");
                        }

                        if (reader.GetAttribute("OPERATOR") != null && reader.GetAttribute("OPERATOR") != string.Empty)
                        {
                            condition.Operator = (OperatorType)Enum.Parse(typeof(OperatorType), reader.GetAttribute("OPERATOR"), true);
                        }
                        else if (reader.GetAttribute("operator") != null && reader.GetAttribute("operator") != string.Empty)
                        {
                            condition.Operator = (OperatorType)Enum.Parse(typeof(OperatorType), reader.GetAttribute("operator"), true);
                        }

                        if (reader.GetAttribute("NULLTEXT") != null && reader.GetAttribute("NULLTEXT") != string.Empty)
                        {
                            condition.NullText = reader.GetAttribute("NULLTEXT");
                        }
                        else if (reader.GetAttribute("nulltext") != null && reader.GetAttribute("nulltext") != string.Empty)
                        {
                            condition.NullText = reader.GetAttribute("nulltext");
                        }

                        if (reader.GetAttribute("FIELD") != null && reader.GetAttribute("FIELD") != string.Empty)
                        {
                            condition.Field = reader.GetAttribute("FIELD");
                        }
                        else if (reader.GetAttribute("field") != null && reader.GetAttribute("field") != string.Empty)
                        {
                            condition.Field = reader.GetAttribute("field");
                        }

                        if (reader.GetAttribute("VALUE") != null && reader.GetAttribute("VALUE") != string.Empty)
                        {
                            condition.Value = reader.GetAttribute("VALUE");
                        }
                        else if (reader.GetAttribute("value") != null && reader.GetAttribute("value") != string.Empty)
                        {
                            condition.Value = reader.GetAttribute("value");
                        }

                        if (reader.GetAttribute("CASESENSITIVE") != null && reader.GetAttribute("CASESENSITIVE") != string.Empty)
                        {
                            condition.CaseSensitive = bool.Parse(reader.GetAttribute("CASESENSITIVE"));
                        }
                        else if (reader.GetAttribute("casesensitive") != null && reader.GetAttribute("casesensitive") != string.Empty)
                        {
                            condition.CaseSensitive = bool.Parse(reader.GetAttribute("casesensitive"));
                        }
                        Conditions.Add(condition);
                        break;

                    case "REGION":
                        Region region = new Region();

                        if (reader.GetAttribute("REGIONID") != null && reader.GetAttribute("REGIONID") != string.Empty)
                        {
                            region.RegionID = reader.GetAttribute("REGIONID");
                        }
                        else if (reader.GetAttribute("regionid") != null && reader.GetAttribute("regionid") != string.Empty)
                        {
                            region.RegionID = reader.GetAttribute("regionid");
                        }

                        if (reader.GetAttribute("NULLTEXT") != null && reader.GetAttribute("NULLTEXT") != string.Empty)
                        {
                            region.NullText = reader.GetAttribute("NULLTEXT");
                        }
                        else if (reader.GetAttribute("nulltext") != null && reader.GetAttribute("nulltext") != string.Empty)
                        {
                            region.NullText = reader.GetAttribute("nulltext");
                        }

                        if (reader.GetAttribute("URL") != null && reader.GetAttribute("URL") != string.Empty)
                        {
                            region.URL = reader.GetAttribute("URL");
                        }
                        else if (reader.GetAttribute("url") != null && reader.GetAttribute("url") != string.Empty)
                        {
                            region.URL = reader.GetAttribute("url");
                        }
                        Regions.Add(region);
                        break;
                    }
                    break;

                case XmlNodeType.Text:
                    switch (element.ToUpper())
                    {
                    case "SUBJECT":
                        Message.Subject += reader.Value;
                        break;

                    case "BODYHTML":
                        Message.BodyHtml.Text += reader.Value;
                        break;

                    case "BODYTEXT":
                        Message.BodyText.Text += reader.Value;
                        break;
                    }
                    break;

                case XmlNodeType.EndElement:
                    element = string.Empty;
                    break;
                }
            }
        }