Ejemplo n.º 1
0
 private void WriteTo(XContainer markupSource, Control targetControl)
 {
     targetControl.Controls.Add(new LiteralControl(markupSource.ToString()));
 }
Ejemplo n.º 2
0
 public static void SaveWithPath(XContainer x, string path)
 {
     SaveWithPath(x.ToString(SaveOptions.OmitDuplicateNamespaces), path);
 }
Ejemplo n.º 3
0
		private static bool RemoveEmptyPropertyElements(IDomainObjectDTORepository dtoRepos, DomainObjectDTO currentDto, XContainer rtElement)
		{
			var propertyElements = (rtElement.Element("CmObject") != null)
											? rtElement.Elements().Elements() // Two levels for old stuff before DM15
											: rtElement.Elements();
			// ToArray is required or Remove will end loop early.
			var emptyPropertyElements = (propertyElements.Where(propertyElement => !propertyElement.HasAttributes && !propertyElement.HasElements)).ToArray();
			foreach (var emptyPropertyElement in emptyPropertyElements)
			{
				emptyPropertyElement.Remove();
			}
			// Notify of update, if it changed.
			var results = false;
			if (emptyPropertyElements.Any())
			{
				UpdateDTO(dtoRepos, currentDto, rtElement.ToString());
				results = true;
			}
			return results;
		}
Ejemplo n.º 4
0
		/// <summary>
		/// Instantiates ViewTransactionResponse class.
		/// </summary>
		/// <param name="xml">
		/// View transaction operation response in XML format.
		/// </param>
		/// <returns>
		/// A <see cref="ViewTransactionResponse"/> object.
		/// </returns>
        public static ViewTransactionResponse FromXml(XContainer xml)
        {
            ViewTransactionResponse response = new ViewTransactionResponse()
            {
                MerchantId = xml.Element(MerchantIdNodeName).Value.Trim()
            };
			string status = xml.Element(StatusNodeName).Value.Trim();
			if (status.Equals(ActionStatus.Success))
			{
	            XElement transactionElement = xml.Element(TransactionNodeName);
	            if (transactionElement != null)
	            	response.TransactionInfo = ParseSuccessTransaction(transactionElement);
	            else
	                throw new LiqPayException(ErrorCode.ResponseIsNotWellFormed, "Transaction element is not found in the response.", xml.ToString());
			}
			else
				response.TransactionInfo = ParseFailureTransaction(xml);

            return response;
        }