Ejemplo n.º 1
0
        /// <summary>
        /// Gets the values of from cmsDataTypePreValues table by id and puts them into a CDATA section
        /// </summary>
        /// <param name="xmlDocument"></param>
        /// <returns></returns>		
        public override System.Xml.XmlNode ToXMl(System.Xml.XmlDocument xmlDocument)
        {
            var value = string.Empty;
            try
            {
                // Don't query if there's nothing to query for..
                if (string.IsNullOrWhiteSpace(Value.ToString()) == false)
                {
                    var dr = SqlHelper.ExecuteReader(string.Format("Select [value] from cmsDataTypeprevalues where id in ({0})", SqlHelper.EscapeString(Value.ToString())));

                    while (dr.Read())
                    {
                        value += value.Length == 0
                            ? dr.GetString("value")
                            : string.Format(",{0}", dr.GetString("value"));
                    }

                    dr.Close();
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error<DefaultDataKeyValue>("An exception occurred converting the property data to XML", ex);
            }

            return xmlDocument.CreateCDataSection(value);
        }
Ejemplo n.º 2
0
		/// <summary>
		/// Ov
		/// </summary>
		/// <param name="d"></param>
		/// <returns></returns>
		
		public override System.Xml.XmlNode ToXMl(System.Xml.XmlDocument d)
		{
			// Get the value from 
			string v = "";
			try 
			{
                IRecordsReader dr = SqlHelper.ExecuteReader("Select [value] from cmsDataTypeprevalues where id in (" + SqlHelper.EscapeString(Value.ToString()) + ")");

				while (dr.Read()) {
					if (v.Length == 0)
						v += dr.GetString("value");
					else
						v += "," + dr.GetString("value");
				}
				dr.Close();
			} 
			catch {}
			return d.CreateCDataSection(v);
		}
		/// <summary>
		/// Ov
		/// </summary>
		/// <param Name="d"></param>
		/// <returns></returns>
		
		public override System.Xml.XmlNode ToXMl(System.Xml.XmlDocument d)
		{
			// Get the value from 
			string v = "";
			try 
			{
				SqlDataReader dr = Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(
					umbraco.GlobalSettings.DbDSN,
					CommandType.Text,
					"Select [value] from cmsDataTypeprevalues where id in (" + Value.ToString() +")");

				while (dr.Read()) {
					if (v.Length == 0)
						v += dr["value"].ToString();
					else
						v += "," + dr["value"].ToString();
				}
				dr.Close();
			} 
			catch {}
			return d.CreateCDataSection(v);
		}
Ejemplo n.º 4
0
		public virtual System.Xml.XmlNode ToXMl(System.Xml.XmlDocument d)
		{
			if (this._dataType.DBType == DBTypes.Ntext) 
				return d.CreateCDataSection(this.Value.ToString());
			return d.CreateTextNode(Value.ToString());
		}
Ejemplo n.º 5
0
        public System.Xml.XmlElement CreateXmlElement(System.Xml.XmlDocument document)
        {
            System.Xml.XmlElement templateElement = document.CreateElement("EmailTemplate");

            System.Xml.XmlElement smtpElement = document.CreateElement("Smtp");
            smtpElement.SetAttribute("host", this.Smtp.Host);
            smtpElement.SetAttribute("port", this.Smtp.Port.ToString());
            smtpElement.SetAttribute("enableSSL", this.Smtp.EnableSsl.ToString());
            smtpElement.SetAttribute("deliveryMethod", this.Smtp.DeliveryMethod.ToString());
            smtpElement.SetAttribute("username", ((System.Net.NetworkCredential)this.Smtp.Credentials).UserName);
            smtpElement.SetAttribute("password", ((System.Net.NetworkCredential)this.Smtp.Credentials).Password);
            templateElement.AppendChild(smtpElement);

            System.Xml.XmlElement subjectElement = document.CreateElement("Subject");
            subjectElement.AppendChild(document.CreateCDataSection(this.Subject));
            templateElement.AppendChild(subjectElement);

            System.Xml.XmlElement bodyElement = document.CreateElement("Body");
            bodyElement.AppendChild(document.CreateCDataSection(this.Body));
            bodyElement.SetAttribute("isHtml", this.BodyIsHtml.ToString());

            templateElement.AppendChild(bodyElement);

            if (this.Sender != null)
            {
                System.Xml.XmlElement senderElement = document.CreateElement("Sender");
                senderElement.SetAttribute("address", this.Sender.Address);
                senderElement.SetAttribute("displayName", this.Sender.DisplayName);
                templateElement.AppendChild(senderElement);
            }

            if (this.From != null)
            {
                System.Xml.XmlElement fromElement = document.CreateElement("From");
                fromElement.SetAttribute("address", this.From.Address);
                fromElement.SetAttribute("displayName", this.From.DisplayName);
                templateElement.AppendChild(fromElement);
            }

            if (this.ReplyTo != null)
            {
                System.Xml.XmlElement replyToElement = document.CreateElement("ReplyTo");
                replyToElement.SetAttribute("address", this.ReplyTo.Address);
                replyToElement.SetAttribute("displayName", this.ReplyTo.DisplayName);
                templateElement.AppendChild(replyToElement);
            }

            return templateElement;
        }