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.

105 lines
3.1 KiB

  1. using System;
  2. using System.Data;
  3. using System.Web.UI;
  4. using System.Web.UI.WebControls;
  5. using UDDI;
  6. using UDDI.API;
  7. using UDDI.API.Business;
  8. using UDDI.API.Service;
  9. using UDDI.API.ServiceType;
  10. using UDDI.API.Binding;
  11. using UDDI.Diagnostics;
  12. namespace UDDI.Web
  13. {
  14. public class BindingControl : UddiControl
  15. {
  16. protected BindingTemplateCollection bindings;
  17. protected BusinessService parent;
  18. protected bool frames;
  19. protected DataGrid grid;
  20. public void Initialize( BindingTemplateCollection bindings )
  21. {
  22. this.bindings = bindings;
  23. this.parent = null;
  24. grid.Columns[ 0 ].Visible = false;
  25. grid.Columns[ 1 ].Visible = false;
  26. grid.Columns[ 2 ].Visible = true;
  27. }
  28. public void Initialize( BindingTemplateCollection bindings, BusinessService parent )
  29. {
  30. this.bindings = bindings;
  31. this.parent = parent;
  32. grid.Columns[ 0 ].Visible = true;
  33. grid.Columns[ 1 ].Visible = true;
  34. grid.Columns[ 2 ].Visible = false;
  35. }
  36. protected void Page_Load( object sender, EventArgs e )
  37. {
  38. frames = ( "true" == Request[ "frames" ] );
  39. PopulateDataGrid();
  40. }
  41. void PopulateDataGrid()
  42. {
  43. grid.DataSource = bindings;
  44. grid.DataBind();
  45. }
  46. protected void Binding_Edit( object sender, DataGridCommandEventArgs e )
  47. {
  48. string key = bindings[ e.Item.ItemIndex ].BindingKey;
  49. if( frames )
  50. {
  51. Response.Write(
  52. ClientScripts.ReloadExplorerAndViewPanes( "editbinding.aspx?frames=true&key=" + key, key ) );
  53. Response.End();
  54. }
  55. else
  56. {
  57. Response.Redirect( "editbinding.aspx?frames=false&key=" + key );
  58. Response.End();
  59. }
  60. }
  61. protected void Binding_Delete( object sender, DataGridCommandEventArgs e )
  62. {
  63. BindingTemplate binding = bindings[ e.Item.ItemIndex ];
  64. string name;
  65. if( null != binding.AccessPoint )
  66. name = binding.AccessPoint.Value;
  67. else
  68. name = Localization.GetString( "HEADING_BINDING" );
  69. string key = binding.BindingKey;
  70. //
  71. // The user has not yet confirmed the delete operation, so display
  72. // a confirmation dialog.
  73. //
  74. string message = String.Format(
  75. Localization.GetString( "TEXT_DELETE_CONFIRMATION" ),
  76. name );
  77. Page.RegisterStartupScript(
  78. "Confirm",
  79. ClientScripts.Confirm(
  80. message,
  81. "editbinding.aspx?frames=" + ( frames ? "true" : "false" ) + "&key=" + key + "&mode=delete&confirm=true&tab=1" ) );
  82. }
  83. protected void Binding_Add( object sender, EventArgs e )
  84. {
  85. Response.Redirect( "editbinding.aspx?frames=" + ( frames ? "true" : "false" ) + "&key=" + parent.ServiceKey + "&mode=add" );
  86. }
  87. }
  88. }