Beispiel #1
0
 /// <summary>
 /// Constructor which copies from existing time object
 /// </summary>
 /// <param name="tm">Existing referenec</param>
 public SmppTime(SmppTime tm)
 {
     this.data2_      = tm.data2_;
     this.data_       = tm.data_;
     this.includeUTC_ = tm.includeUTC_;
     this.isRelative_ = tm.isRelative_;
 }
Beispiel #2
0
        /// <summary>
        /// Override of the object.ToString method.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            StringBuilder sb        = new StringBuilder();
            SmppTime      timeValue = this.Value;

            sb.Append("broadcast_end_time=");
            sb.Append(timeValue.AbsoluteTime);
            sb.AppendFormat(" [{0}]", timeValue.Value);
            return(sb.ToString());
        }
		/// <summary>
		/// Parameterized constructor
		/// </summary>
		/// <param name="tm">Time value</param>
		public schedule_delivery_time(SmppTime tm) : base(tm)
		{
		}
Beispiel #4
0
 /// <summary>
 /// Parameterized constructor
 /// </summary>
 /// <param name="tm">Time value</param>
 public final_date(SmppTime tm) : base(tm)
 {
 }
Beispiel #5
0
 /// <summary>
 /// Parameterized constructor
 /// </summary>
 /// <param name="tm">Time value</param>
 public broadcast_end_time(SmppTime tm) : base(ParameterTags.TAG_BROADCAST_END_TIME)
 {
     this.Value = tm;
 }
Beispiel #6
0
 /// <summary>
 /// Parameterized constructor
 /// </summary>
 /// <param name="tm">Time value</param>
 public validity_period(SmppTime tm) : base(tm)
 {
 }
        /// <summary>
        /// Parameterized constructor - Formatted SMSC delivery receipt
        /// </summary>
        public smsc_delivery_receipt(string msg)
        {
            // Parse out members from message
            // id: sub: dlvrd: submit date: done date: stat: err: text:
            int index = msg.IndexOf("id:");

            if (index != -1)
            {
                originalMessageId_ = msg.Substring(index + 3, 10).Trim();
            }
            index = msg.IndexOf("sub:");
            if (index != -1)
            {
                Int32.TryParse(msg.Substring(index + 4, 3), out numMessagesSubmitted_);
            }
            index = msg.IndexOf("dlvrd:");
            if (index != -1)
            {
                Int32.TryParse(msg.Substring(index + 6, 3), out numMessagesDelivered_);
            }
            index = msg.IndexOf("submit date:");
            if (index != -1)
            {
                MemoryStream memStream = new MemoryStream(System.Text.Encoding.ASCII.GetBytes(msg.Substring(index + 12, 10)));
                SmppReader   reader    = new SmppReader((Stream)memStream);
                submitDateTime_ = new SmppTime();
                submitDateTime_.GetFromStream(reader);
            }
            index = msg.IndexOf("done date:");
            if (index != -1)
            {
                MemoryStream memStream = new MemoryStream(System.Text.Encoding.ASCII.GetBytes(msg.Substring(index + 10, 10)));
                SmppReader   reader    = new SmppReader((Stream)memStream);
                deliveryDateTime_ = new SmppTime();
                deliveryDateTime_.GetFromStream(reader);
            }
            index = msg.IndexOf("stat:");
            if (index != -1)
            {
                string finalStatus = msg.Substring(index + 5, 7).ToUpper().Trim();
                switch (finalStatus)
                {
                case "DELIVRD":
                    finalMessageStatus_ = FinalDeliveryStatus.DELIVERED;
                    break;

                case "EXPIRED":
                    finalMessageStatus_ = FinalDeliveryStatus.EXPIRED;
                    break;

                case "DELETED":
                    finalMessageStatus_ = FinalDeliveryStatus.DELETED;
                    break;

                case "UNDELIV":
                    finalMessageStatus_ = FinalDeliveryStatus.UNDELIVERABLE;
                    break;

                case "ACCEPTD":
                    break;

                case "REJECTD":
                    finalMessageStatus_ = FinalDeliveryStatus.REJECTED;
                    break;

                default:
                case "UNKNOWN":
                    finalMessageStatus_ = FinalDeliveryStatus.UNKNOWN;
                    break;
                }
            }
            index = msg.IndexOf("err:");
            if (index != -1)
            {
                errorCode_ = msg.Substring(index + 4, 3).Trim();
            }
            index = msg.IndexOf("text:");
            if (index != -1)
            {
                messageStart_ = msg.Substring(index + 6).Trim();
            }
        }