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.

86 lines
2.5 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.ServiceType;
  9. using UDDI.Diagnostics;
  10. namespace UDDI.Web
  11. {
  12. public class BusinessControl : UddiControl
  13. {
  14. protected BusinessInfoCollection businessInfos;
  15. protected bool frames;
  16. protected DataGrid grid;
  17. public void Initialize( BusinessInfoCollection businessInfos, bool allowEdit )
  18. {
  19. this.businessInfos = businessInfos;
  20. grid.Columns[ 0 ].Visible = allowEdit;
  21. grid.Columns[ 1 ].Visible = allowEdit;
  22. grid.Columns[ 2 ].Visible = !allowEdit;
  23. }
  24. protected void Page_Load( object sender, EventArgs e )
  25. {
  26. frames = ( "true" == Request[ "frames" ] );
  27. PopulateDataGrid();
  28. }
  29. void PopulateDataGrid()
  30. {
  31. grid.DataSource = businessInfos;
  32. grid.DataBind();
  33. }
  34. protected void Business_Edit( object sender, DataGridCommandEventArgs e )
  35. {
  36. string key = businessInfos[ e.Item.ItemIndex ].BusinessKey;
  37. if( frames )
  38. {
  39. //
  40. // Reload explorer and view panes.
  41. //
  42. Response.Write(
  43. ClientScripts.ReloadExplorerAndViewPanes( "editbusiness.aspx?frames=true&key=" + key, key ) );
  44. Response.End();
  45. }
  46. else
  47. {
  48. Response.Redirect( "editbusiness.aspx?frames=false&key=" + key );
  49. Response.End();
  50. }
  51. }
  52. protected void Business_Delete( object sender, DataGridCommandEventArgs e )
  53. {
  54. string name = businessInfos[ e.Item.ItemIndex ].Names[ 0 ].Value;
  55. string key = businessInfos[ e.Item.ItemIndex ].BusinessKey;
  56. //
  57. // The user has not yet confirmed the delete operation, so display
  58. // a confirmation dialog.
  59. //
  60. string message = String.Format(
  61. Localization.GetString( "TEXT_DELETE_CONFIRMATION" ),
  62. name );
  63. Page.RegisterStartupScript(
  64. "Confirm",
  65. ClientScripts.Confirm(
  66. message,
  67. "editbusiness.aspx?frames=" + ( frames ? "true" : "false" ) + "&key=" + key + "&mode=delete&confirm=true&tab=1" ) );
  68. }
  69. protected void Business_Add( object sender, EventArgs e )
  70. {
  71. Response.Redirect( "editbusiness.aspx?frames=" + ( frames ? "true" : "false" ) + "&mode=add" );
  72. }
  73. }
  74. }