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.

88 lines
2.7 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 ContactControl : UddiControl
  13. {
  14. protected ContactCollection contacts;
  15. protected BusinessEntity parent;
  16. protected bool frames;
  17. protected DataGrid grid;
  18. public void Initialize( ContactCollection contacts, BusinessEntity parent, bool allowEdit )
  19. {
  20. this.contacts = contacts;
  21. this.parent = parent;
  22. grid.Columns[ 0 ].Visible = allowEdit;
  23. grid.Columns[ 1 ].Visible = allowEdit;
  24. grid.Columns[ 2 ].Visible = !allowEdit;
  25. }
  26. protected void Page_Load( object sender, EventArgs e )
  27. {
  28. frames = ( "true" == Request[ "frames" ] );
  29. PopulateDataGrid();
  30. }
  31. void PopulateDataGrid()
  32. {
  33. grid.DataSource = contacts;
  34. grid.DataBind();
  35. }
  36. protected void Contact_Edit( object sender, DataGridCommandEventArgs e )
  37. {
  38. int index = e.Item.ItemIndex;
  39. if( frames )
  40. {
  41. Response.Write(
  42. ClientScripts.ReloadExplorerAndViewPanes( "editcontact.aspx?frames=true&key=" + parent.BusinessKey + "&index=" + index, parent.BusinessKey + ":" + index ) );
  43. Response.End();
  44. }
  45. else
  46. {
  47. Response.Redirect( "editcontact.aspx?frames=false&key=" + parent.BusinessKey + "&index=" + index );
  48. Response.End();
  49. }
  50. }
  51. protected void Contact_Delete( object sender, DataGridCommandEventArgs e )
  52. {
  53. int index = e.Item.ItemIndex;
  54. string name = contacts[ index ].PersonName;
  55. string key = parent.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. "editcontact.aspx?frames=" + ( frames ? "true" : "false" ) + "&key=" + key + "&index=" + index + "&mode=delete&confirm=true&tab=2" ) );
  68. }
  69. protected void Contact_Add( object sender, EventArgs e )
  70. {
  71. Response.Redirect( "editcontact.aspx?frames=" + ( frames ? "true" : "false" ) + "&key=" + parent.BusinessKey + "&mode=add" );
  72. }
  73. }
  74. }