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.

90 lines
2.8 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 InstanceInfoControl : UddiControl
  15. {
  16. protected TModelInstanceInfoCollection instanceInfos;
  17. protected BindingTemplate parent;
  18. protected bool frames;
  19. protected DataGrid grid;
  20. public void Initialize( TModelInstanceInfoCollection instanceInfos, BindingTemplate parent, bool allowEdit )
  21. {
  22. this.instanceInfos = instanceInfos;
  23. this.parent = parent;
  24. grid.Columns[ 0 ].Visible = allowEdit;
  25. grid.Columns[ 1 ].Visible = allowEdit;
  26. grid.Columns[ 2 ].Visible = !allowEdit;
  27. }
  28. protected void Page_Load( object sender, EventArgs e )
  29. {
  30. frames = ( "true" == Request[ "frames" ] );
  31. PopulateDataGrid();
  32. }
  33. void PopulateDataGrid()
  34. {
  35. grid.DataSource = instanceInfos;
  36. grid.DataBind();
  37. }
  38. protected void InstanceInfo_Edit( object sender, DataGridCommandEventArgs e )
  39. {
  40. int index = e.Item.ItemIndex;
  41. if( frames )
  42. {
  43. Response.Write(
  44. ClientScripts.ReloadExplorerAndViewPanes( "editinstanceinfo.aspx?frames=true&key=" + parent.BindingKey + "&index=" + index, parent.BindingKey + ":" + index ) );
  45. Response.End();
  46. }
  47. else
  48. {
  49. Response.Redirect( "editinstanceinfo.aspx?frames=false&key=" + parent.BindingKey + "&index=" + index );
  50. Response.End();
  51. }
  52. }
  53. protected void InstanceInfo_Delete( object sender, DataGridCommandEventArgs e )
  54. {
  55. int index = e.Item.ItemIndex;
  56. string name = Lookup.TModelName( instanceInfos[ index ].TModelKey );
  57. string key = parent.BindingKey;
  58. //
  59. // The user has not yet confirmed the delete operation, so display
  60. // a confirmation dialog.
  61. //
  62. string message = String.Format(
  63. Localization.GetString( "TEXT_DELETE_CONFIRMATION" ),
  64. name );
  65. Page.RegisterStartupScript(
  66. "Confirm",
  67. ClientScripts.Confirm(
  68. message,
  69. "editinstanceinfo.aspx?frames=" + ( frames ? "true" : "false" ) + "&key=" + key + "&index=" + index + "&mode=delete&confirm=true&tab=1" ) );
  70. }
  71. protected void InstanceInfo_Add( object sender, EventArgs e )
  72. {
  73. Response.Redirect( "editinstanceinfo.aspx?frames=" + ( frames ? "true" : "false" ) + "&key=" + parent.BindingKey + "&mode=add" );
  74. }
  75. }
  76. }