Ejemplo n.º 1
0
        public static int ForSms(Sms sms)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(sms.Address);
            sb.Append(sms.Body);
            sb.Append(sms.ContactName);
            sb.Append(sms.Date.ToString());
            sb.Append(sms.DateSent.ToString());
            sb.Append(sms.Locked);
            sb.Append(sms.Protocol);
            sb.Append(sms.Read);
            sb.Append(sms.ReadableDate);
            sb.Append(sms.ScToa);
            sb.Append(sms.ServiceCenter);
            sb.Append(sms.Status);
            sb.Append(sms.Subject);
            sb.Append(sms.Toa);
            sb.Append(sms.Type);

            return sb.ToString().GetHashCode();
        }
Ejemplo n.º 2
0
        private Sms SmsFromXelement(XElement elm)
        {
            Sms res = new Sms();

            res.Address = elm.Attribute("address").Value;
            res.Body = elm.Attribute("body").Value;
            res.ContactName = elm.Attribute("contact_name").Value;
            res.Date = this.DateTimeFromString(elm.Attribute("date").Value);
            res.DateSent = this.DateTimeFromString(elm.Attribute("date_sent").Value);
            res.Locked = elm.Attribute("locked").Value;
            res.Protocol = elm.Attribute("protocol").Value;
            res.Read = elm.Attribute("read").Value;
            res.ReadableDate = elm.Attribute("readable_date").Value;
            res.ScToa = elm.Attribute("sc_toa").Value;
            res.ServiceCenter = elm.Attribute("service_center").Value;
            res.Status = elm.Attribute("status").Value;
            res.Subject = elm.Attribute("subject").Value;
            res.Toa = elm.Attribute("toa").Value;
            res.Type = elm.Attribute("type").Value;

            return res;
        }
Ejemplo n.º 3
0
        private string SmsToHtml(Sms sms, string template)
        {
            string res = template;
            string tmp;

            //
            // to/from
            //
            tmp = "From";
            if (sms.Type.Equals(XmlConstants.TypeSent))
            {
                tmp = "To";
            }
            res = res.Replace(MessageToFrom, tmp);

            //
            // number
            //
            tmp = sms.Address;
            if (!sms.ContactName.Equals(XmlConstants.UnknownContact))
            {
                tmp = String.Format("{0} ({1})", tmp, HttpUtility.HtmlEncode(sms.ContactName));
            }
            res = res.Replace(MessageToFromNumber, tmp);

            //
            // timestamp
            //
            res = res.Replace(MessageTimestamp, HttpUtility.HtmlEncode(sms.Date.ToString()));

            //
            // body
            //
            res = res.Replace(MessageBody, HttpUtility.HtmlEncode(sms.Body));

            return res;
        }