Exemplo n.º 1
0
        /// <summary>
        /// Get the Name for the Enum Value
        /// </summary>
        /// <returns></returns>
        public string GetSerializedDisposition()
        {
            Type      t  = Disposition.GetType();
            FieldInfo fi = t.GetField(Disposition.ToString());

            return(EnumSerilizedNameAttribute.GetValue(fi));
        }
Exemplo n.º 2
0
        public void EnumSerilizedNameTests()
        {
            //make sure the value is string.Empty
            EnumSerilizedNameAttribute val = new EnumSerilizedNameAttribute();

            Assert.AreEqual(val.Value, string.Empty);

            //get a member info to ourself
            Type t = typeof(EncodeHelperTests);

            System.Reflection.MemberInfo mi = t.GetMember("EnumSerilizedNameTests")[0];
            Assert.AreEqual(string.Empty, EnumSerilizedNameAttribute.GetValue(mi));
        }
        /// <summary>
        /// Get the Xml for the message
        /// </summary>
        /// <returns></returns>
        public override byte[] GetXml()
        {
            AutoGen.NotificationHistoryRequest retVal
                = new GCheckout.AutoGen.NotificationHistoryRequest();

            if (!string.IsNullOrEmpty(_nextPageToken))
            {
                retVal.nextpagetoken = _nextPageToken;
            }
            else
            {
                if (_startTime > DateTime.MinValue)
                {
                    retVal.starttime          = _startTime;
                    retVal.starttimeSpecified = true;
                    retVal.endtime            = _endTime;
                    retVal.endtimeSpecified   = true;
                }
                if (_orderNumbers != null && _orderNumbers.Count > 0)
                {
                    retVal.ordernumbers = _orderNumbers.ToArray();
                }
                if (_notificationTypes != null && _notificationTypes.Count > 0)
                {
                    //we need to convert the list
                    List <string> nt = new List <string>();
                    Type          t  = typeof(NotificationTypes);
                    foreach (NotificationTypes item in _notificationTypes)
                    {
                        FieldInfo fi = t.GetField(item.ToString());
                        nt.Add(EnumSerilizedNameAttribute.GetValue(fi));
                    }
                }
                if (_serialNumber != null &&
                    !string.IsNullOrEmpty(_serialNumber.SerialNumber))
                {
                    retVal.serialnumber = _serialNumber.SerialNumber;
                }
            }
            return(EncodeHelper.Serialize(retVal));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Get the Name for the Enum Value
        /// </summary>
        /// <param name="shippingType">The ShippingType Value</param>
        /// <returns></returns>
        public static string GetSerializedName(ShippingType shippingType)
        {
            FieldInfo fi = t.GetField(shippingType.ToString());

            return(EnumSerilizedNameAttribute.GetValue(fi));
        }