Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

248 lines
9.4 KiB

  1. using System;
  2. using System.Data;
  3. using System.Data.SqlClient;
  4. using System.Web;
  5. using UDDI;
  6. using UDDI.Diagnostics;
  7. namespace UDDI.Web
  8. {
  9. public class Publisher
  10. {
  11. public string Puid;
  12. public string IsoLangCode;
  13. public string Name;
  14. public string Email;
  15. public string Phone;
  16. public string CompanyName;
  17. public string AltPhone;
  18. public string AddressLine1;
  19. public string AddressLine2;
  20. public string City;
  21. public string StateProvince;
  22. public string PostalCode;
  23. public string Country;
  24. public string SecurityToken;
  25. public bool Validated;
  26. public bool TrackPassport;
  27. public bool Exists;
  28. public int BusinessLimit;
  29. public int BusinessCount;
  30. public int TModelLimit;
  31. public int TModelCount;
  32. public int ServiceLimit;
  33. public int BindingLimit;
  34. public int AssertionLimit;
  35. public int AssertionCount;
  36. public void GetPublisherFromSecurityToken( string securityToken )
  37. {
  38. Debug.Enter();
  39. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor();
  40. sp.ProcedureName = "UI_getPublisherFromSecurityToken";
  41. sp.Parameters.Add( "@securityToken", SqlDbType.UniqueIdentifier );
  42. sp.Parameters.Add( "@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID, ParameterDirection.Output );
  43. sp.Parameters.SetGuidFromString( "@securityToken", securityToken );
  44. sp.ExecuteNonQuery();
  45. Puid = sp.Parameters.GetString( "@PUID" );
  46. Debug.Leave();
  47. }
  48. public void Save()
  49. {
  50. Debug.Enter();
  51. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor();
  52. sp.ProcedureName = "UI_savePublisher";
  53. sp.Parameters.Add( "@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID );
  54. sp.Parameters.Add( "@isoLangCode", SqlDbType.VarChar, UDDI.Constants.Lengths.IsoLangCode );
  55. sp.Parameters.Add( "@name", SqlDbType.NVarChar, UDDI.Constants.Lengths.Name );
  56. sp.Parameters.Add( "@email", SqlDbType.NVarChar, UDDI.Constants.Lengths.Email );
  57. sp.Parameters.Add( "@phone", SqlDbType.NVarChar, UDDI.Constants.Lengths.Phone );
  58. sp.Parameters.Add( "@companyName", SqlDbType.NVarChar, UDDI.Constants.Lengths.CompanyName );
  59. sp.Parameters.Add( "@altphone", SqlDbType.NVarChar, UDDI.Constants.Lengths.Phone );
  60. sp.Parameters.Add( "@addressLine1", SqlDbType.NVarChar, UDDI.Constants.Lengths.AddressLine );
  61. sp.Parameters.Add( "@addressLine2", SqlDbType.NVarChar, UDDI.Constants.Lengths.AddressLine );
  62. sp.Parameters.Add( "@city", SqlDbType.NVarChar, UDDI.Constants.Lengths.City );
  63. sp.Parameters.Add( "@stateProvince", SqlDbType.NVarChar, UDDI.Constants.Lengths.StateProvince );
  64. sp.Parameters.Add( "@postalCode", SqlDbType.NVarChar, UDDI.Constants.Lengths.PostalCode );
  65. sp.Parameters.Add( "@country", SqlDbType.NVarChar, UDDI.Constants.Lengths.Country );
  66. sp.Parameters.Add( "@flag", SqlDbType.Int );
  67. sp.Parameters.Add( "@securityToken", SqlDbType.UniqueIdentifier );
  68. sp.Parameters.Add( "@tier", SqlDbType.NVarChar, UDDI.Constants.Lengths.Tier );
  69. sp.Parameters.SetString( "@PUID", Puid );
  70. sp.Parameters.SetString( "@isoLangCode", IsoLangCode );
  71. sp.Parameters.SetString( "@name", Name );
  72. sp.Parameters.SetString( "@email", Email );
  73. sp.Parameters.SetString( "@phone", Phone );
  74. sp.Parameters.SetString( "@companyName", CompanyName );
  75. sp.Parameters.SetString( "@altphone", AltPhone );
  76. sp.Parameters.SetString( "@addressLine1", AddressLine1 );
  77. sp.Parameters.SetString( "@addressLine2", AddressLine2 );
  78. sp.Parameters.SetString( "@city", City );
  79. sp.Parameters.SetString( "@stateProvince", StateProvince );
  80. sp.Parameters.SetString( "@postalCode", PostalCode );
  81. sp.Parameters.SetString( "@country", Country );
  82. sp.Parameters.SetString( "@tier", Config.GetString( "Publisher.DefaultTier", "2" ) );
  83. int flag = 0;
  84. if( !TrackPassport )
  85. flag = flag | 0x02;
  86. if( Validated )
  87. flag = flag | 0x01;
  88. sp.Parameters.SetInt( "@flag", flag );
  89. sp.Parameters.SetGuidFromString( "@securityToken", SecurityToken );
  90. sp.ExecuteNonQuery();
  91. Debug.Leave();
  92. }
  93. public void Get()
  94. {
  95. Debug.Enter();
  96. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor();
  97. sp.ProcedureName = "UI_getPublisher";
  98. sp.Parameters.Add( "@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID );
  99. sp.Parameters.SetString( "@PUID", Puid );
  100. SqlDataReaderAccessor reader = sp.ExecuteReader();
  101. Exists = false;
  102. try
  103. {
  104. if( reader.Read() )
  105. {
  106. int flag;
  107. IsoLangCode = reader.GetString( 1 );
  108. Name = reader.GetString( 2 );
  109. Email = reader.GetString( 3 );
  110. Phone = reader.GetString( 4 );
  111. CompanyName = reader.GetString( 5 );
  112. AltPhone = reader.GetString( 6 );
  113. AddressLine1 = reader.GetString( 7 );
  114. AddressLine2 = reader.GetString( 8 );
  115. City = reader.GetString( 9 );
  116. StateProvince = reader.GetString( 10 );
  117. PostalCode = reader.GetString( 11 );
  118. Country = reader.GetString( 12 );
  119. flag = reader.GetInt( 13 );
  120. SecurityToken = reader.GetGuidString( 14 );
  121. TrackPassport = ( 0x00 == ( flag & 0x02 ) );
  122. Validated = ( 0x01 == ( flag & 0x01 ) );
  123. Exists = true;
  124. }
  125. }
  126. finally
  127. {
  128. reader.Close();
  129. }
  130. Debug.Leave();
  131. }
  132. public static int Validate( string userid )
  133. {
  134. Debug.Enter();
  135. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor();
  136. sp.ProcedureName = "UI_validatePublisher";
  137. sp.Parameters.Add( "@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID );
  138. sp.Parameters.Add( "@returnValue", SqlDbType.Int, ParameterDirection.ReturnValue );
  139. sp.Parameters.SetString( "@PUID", userid );
  140. sp.ExecuteNonQuery();
  141. int returnValue = sp.Parameters.GetInt( "@returnValue" );
  142. Debug.Leave();
  143. return returnValue;
  144. }
  145. public void Login( string userid, string email )
  146. {
  147. Debug.Enter();
  148. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor();
  149. sp.ProcedureName = "net_publisher_login";
  150. sp.Parameters.Add( "@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID );
  151. sp.Parameters.Add( "@email", SqlDbType.NVarChar, UDDI.Constants.Lengths.Email, ParameterDirection.InputOutput );
  152. sp.Parameters.Add( "@name", SqlDbType.NVarChar, UDDI.Constants.Lengths.Name, ParameterDirection.Output );
  153. sp.Parameters.Add( "@phone", SqlDbType.VarChar, UDDI.Constants.Lengths.Phone, ParameterDirection.Output );
  154. sp.Parameters.Add( "@companyName", SqlDbType.NVarChar, UDDI.Constants.Lengths.CompanyName, ParameterDirection.Output );
  155. sp.Parameters.Add( "@altPhone", SqlDbType.VarChar, UDDI.Constants.Lengths.Phone, ParameterDirection.Output );
  156. sp.Parameters.Add( "@addressLine1", SqlDbType.NVarChar, UDDI.Constants.Lengths.AddressLine, ParameterDirection.Output );
  157. sp.Parameters.Add( "@addressLine2", SqlDbType.NVarChar, UDDI.Constants.Lengths.AddressLine, ParameterDirection.Output );
  158. sp.Parameters.Add( "@city", SqlDbType.NVarChar, UDDI.Constants.Lengths.City, ParameterDirection.Output );
  159. sp.Parameters.Add( "@stateProvince", SqlDbType.NVarChar, UDDI.Constants.Lengths.StateProvince, ParameterDirection.Output );
  160. sp.Parameters.Add( "@postalCode", SqlDbType.NVarChar, UDDI.Constants.Lengths.PostalCode, ParameterDirection.Output );
  161. sp.Parameters.Add( "@country", SqlDbType.NVarChar, UDDI.Constants.Lengths.Country, ParameterDirection.Output );
  162. sp.Parameters.Add( "@isoLangCode", SqlDbType.VarChar, UDDI.Constants.Lengths.IsoLangCode, ParameterDirection.Output );
  163. sp.Parameters.Add( "@businessLimit", SqlDbType.Int, ParameterDirection.Output );
  164. sp.Parameters.Add( "@businessCount", SqlDbType.Int, ParameterDirection.Output );
  165. sp.Parameters.Add( "@tModelLimit", SqlDbType.Int, ParameterDirection.Output );
  166. sp.Parameters.Add( "@tModelCount", SqlDbType.Int, ParameterDirection.Output );
  167. sp.Parameters.Add( "@serviceLimit", SqlDbType.Int, ParameterDirection.Output );
  168. sp.Parameters.Add( "@bindingLimit", SqlDbType.Int, ParameterDirection.Output );
  169. sp.Parameters.Add( "@assertionLimit", SqlDbType.Int, ParameterDirection.Output );
  170. sp.Parameters.Add( "@assertionCount", SqlDbType.Int, ParameterDirection.Output );
  171. sp.Parameters.SetString( "@PUID", userid );
  172. sp.Parameters.SetString( "@email", email );
  173. sp.ExecuteNonQuery();
  174. Email = sp.Parameters.GetString( "@email" );
  175. Name = sp.Parameters.GetString( "@name" );
  176. Phone = sp.Parameters.GetString( "@phone" );
  177. CompanyName = sp.Parameters.GetString( "@companyName" );
  178. AltPhone = sp.Parameters.GetString( "@altPhone" );
  179. AddressLine1 = sp.Parameters.GetString( "@addressLine1" );
  180. AddressLine2 = sp.Parameters.GetString( "@addressLine2" );
  181. City = sp.Parameters.GetString( "@city" );
  182. StateProvince = sp.Parameters.GetString( "@stateProvince" );
  183. PostalCode = sp.Parameters.GetString( "@postalCode" );
  184. Country = sp.Parameters.GetString( "@country" );
  185. IsoLangCode = sp.Parameters.GetString( "@isoLangCode" );
  186. BusinessLimit = sp.Parameters.GetInt( "@businessLimit" );
  187. BusinessCount = sp.Parameters.GetInt( "@businessCount" );
  188. TModelLimit = sp.Parameters.GetInt( "@tModelLimit" );
  189. TModelCount = sp.Parameters.GetInt( "@tModelCount" );
  190. ServiceLimit = sp.Parameters.GetInt( "@serviceLimit" );
  191. BindingLimit = sp.Parameters.GetInt( "@bindingLimit" );
  192. AssertionLimit = sp.Parameters.GetInt( "@assertionLimit" );
  193. AssertionCount = sp.Parameters.GetInt( "@assertionCount" );
  194. Debug.Leave();
  195. }
  196. }
  197. }