Guest User

Untitled

a guest
Dec 6th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. public interface ISendLogic<T> where T : NarcoticsResult
  2. {
  3. ChangeType Change_New();
  4. ChangeType Change_Cancel();
  5.  
  6. PurchaseType Purchase_New();
  7. PurchaseType Purchase_Cancel();
  8. }
  9.  
  10. public class SendLogic<T> : ISendLogic<T> where T : NarcoticsResult
  11. {
  12. private eReportType _type;
  13.  
  14. private bool Send_Change()
  15. {
  16. // Send to server by xml file
  17. }
  18.  
  19. private bool Send_Purchase()
  20. {
  21. // Send to server by xml file
  22. }
  23.  
  24. public ChangeType Change_New()
  25. {
  26. _type = change_new;
  27. Send_Change();
  28. }
  29.  
  30. public ChangeType Change_Cancel()
  31. {
  32. _type = change_cancel;
  33. Send_Change();
  34. }
  35.  
  36. public PurchaseType Purchase_New()
  37. {
  38. _type = purchase_new;
  39. Send_Purchase();
  40. }
  41.  
  42. public PurchaseType Purchase_Cancel()
  43. {
  44. _type = purchase_cancel;
  45. Send_Purchase();
  46. }
  47. }
  48.  
  49. // this class can only be used when someone wants to use change function
  50. var logic = SendLogic<ChangeType >();
  51. logic.Change_New();
  52. logic.Change_Cancel();
  53.  
  54. var logic = SendLogic<ChangeType>();
  55. logic.Change_New(); // OK
  56. logic.Purchase_New(); // You should make this class like SendLogic<PurchaseType>()
Add Comment
Please, Sign In to add comment