Guest User

Camwarps Random Crap

a guest
Jul 1st, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.09 KB | None | 0 0
  1. //Code sanitized to protect the foolish.
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using System.Reflection;
  6. using System.Web.UI;
  7.  
  8. namespace Mobile.Web.Control
  9. {
  10. /// <summary>
  11. /// Class used to work around Richard being a fucking idiot
  12. /// </summary>
  13. /// <remarks>
  14. /// The point of this is to work around his poor design so that paging will
  15. /// work on a mobile control. The main problem is the BindCompany() method,
  16. /// which he hoped would be able to do everything. I hope he dies.
  17. /// </remarks>
  18. public abstract class RichardIsAFuckingIdiotControl : MobileBaseControl, ICompanyProfileControl
  19. {
  20. protected abstract Pager Pager { get; }
  21.  
  22. public void BindCompany(int companyId) { }
  23.  
  24. public RichardIsAFuckingIdiotControl()
  25. {
  26. MakeSureNobodyAccidentallyGetsBittenByRichardsStupidity();
  27. }
  28.  
  29. private void MakeSureNobodyAccidentallyGetsBittenByRichardsStupidity()
  30. {
  31. // Make sure nobody is actually using that fucking bindcompany method
  32. MethodInfo m = this.GetType().GetMethod("BindCompany", BindingFlags.DeclaredOnly |
  33. BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
  34. if (m != null)
  35. {
  36. throw new RichardIsAFuckingIdiotException("No!! Don't use the fucking BindCompany method!!!");
  37. }
  38. // P.S. this method is a joke ... the rest of the class is fucking serious
  39. }
  40.  
  41. /// <summary>
  42. /// This returns true if this control is supposed to be doing anything
  43. /// at all for this request. Richard thought it was a good idea to load
  44. /// the entire website during every request and have things turn themselves
  45. /// off. He also thought bandanas and aviator sunglasses were "fuckin'
  46. /// gnarly, dude."
  47. /// </summary>
  48. protected bool IsThisTheRightPageImNotSureBecauseRichardIsDumb()
  49. {
  50. return Request.QueryString["Section"] == this.MenuItemKey;
  51. }
  52.  
  53. protected override void OnLoad(EventArgs e)
  54. {
  55. if (IsThisTheRightPageImNotSureBecauseRichardIsDumb())
  56. {
  57. Page.LoadComplete += new EventHandler(Page_LoadComplete);
  58. Pager.RowCount = GetRowCountBecauseRichardIsDumb();
  59. }
  60. base.OnLoad(e);
  61. }
  62.  
  63. protected abstract int GetRowCountBecauseRichardIsDumb();
  64. protected abstract void BindDataBecauseRichardIsDumb();
  65.  
  66. void Page_LoadComplete(object sender, EventArgs e)
  67. {
  68. BindDataBecauseRichardIsDumb();
  69. }
  70.  
  71. // the rest of his reduh-ndant interface members
  72. public abstract string MenuItemName { get; set; }
  73. public abstract string MenuItemKey { get; set; }
  74. public abstract bool IsCapable(CapabilityCheck checker, int companyId);
  75. public abstract bool ShowInMenu { get; }
  76. public virtual Control CreateHeaderControl()
  77. {
  78. return null;
  79. }
  80. }
  81. }
Add Comment
Please, Sign In to add comment