Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. import System
  2. import System.Text
  3. from System import *
  4. from System.Text import *
  5. from System.Collections import *
  6.  
  7. class testscript(object):
  8. def Run(self, m):
  9. days = 7
  10.  
  11. fmt = '<tr><td align="left">{0}</td><td align="left">{1:n0}</td></tr>\r\n'
  12. fmt0 = '<tr><td colspan="2">{0}\r\n'
  13. fmt1 = '<tr><td colspan="2"><H2>{0}\r\n</H2>'
  14. #fmt = '{0,28}:{1,10:n0}\r\n'
  15. #fmt0 = '{0}\r\n'
  16. sb = StringBuilder()
  17.  
  18. sb.AppendLine('<table cellspacing="5" class="grid">')
  19. sb.AppendFormat(fmt1, "Weekly Birthday List", " ")
  20. sb.AppendFormat(fmt0, String.Format("The following people have birthdays in the next {0} days:", days+1))
  21.  
  22. sb.AppendFormat(fmt, " ", '\r\n')
  23. sb.AppendFormat(fmt, " ", '\r\n')
  24.  
  25. people = m.QueryList("testquery")
  26. i=0
  27. for person in people:
  28. i = i+1
  29. sb.AppendFormat(fmt0, String.Format("- {0} - " , i))
  30.  
  31. if person.TitleCode is None:
  32. sb.AppendFormat(fmt, person.Name, " ")
  33. else:
  34. sb.AppendFormat(fmt0, person.TitleCode + " " + person.Name, " ")
  35.  
  36. if person.PrimaryAddress != "" and person.PrimaryAddress is not None:
  37. sb.AppendFormat(fmt, person.PrimaryAddress , person.PrimaryAddress2 )
  38.  
  39. if person.CityStateZip5!= "" and person.CityStateZip5 is not None:
  40. sb.AppendFormat(fmt, person.CityStateZip5, "" )
  41.  
  42. if person.HomePhone != "" and person.HomePhone is not None:
  43. sb.AppendFormat(fmt0, person.HomePhone.ToString() + " (h)", " ")
  44.  
  45. if person.CellPhone != "" and person.CellPhone is not None:
  46. sb.AppendFormat(fmt0, person.CellPhone.ToString() + " (c)", " ")
  47.  
  48. if person.EmailAddress != "" and person.EmailAddress is not None:
  49. sb.AppendFormat(fmt, person.EmailAddress,"" )
  50.  
  51. if person.EmailAddress2 != "" and person.EmailAddress2 is not None:
  52. sb.AppendFormat(fmt, person.EmailAddress2, "" )
  53.  
  54. if person.BirthDate != "" and person.BirthDate is not None:
  55. sb.AppendFormat(fmt, "Birthday: " + person.BirthMonth.ToString() + "/" + person.BirthDay.ToString() , "" )
  56.  
  57. sb.AppendFormat(fmt, " ", '\r\n')
  58.  
  59. sb.AppendLine('</table>')
  60. return sb.ToString()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement