Calculation.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace WSUniversalLib
  7. {
  8. public class Calculation
  9. {
  10. public int GetPriorityForAgent(int agentType, float experience, float age)
  11. {
  12. int priority = -1;
  13. float agentNum = -1;
  14. switch (agentType)
  15. {
  16. case 1:
  17. agentNum = 1.8f;
  18. break;
  19. case 2:
  20. agentNum = 3.2f;
  21. break;
  22. case 3:
  23. agentNum = 4.1f;
  24. break;
  25. default:
  26. break;
  27. }
  28. if(experience > 10 && agentNum != -1)
  29. {
  30. agentNum+= 0.5f;
  31. }
  32. else if (experience > 20 && agentNum != -1)
  33. {
  34. agentNum += 0.7f;
  35. }
  36. else if (experience > 40 && agentNum != -1)
  37. {
  38. agentNum += 0.9f;
  39. }
  40. else
  41. {
  42. agentNum += 0;
  43. }
  44. if(age <= 25 && agentNum != -1)
  45. {
  46. switch (agentType)
  47. {
  48. case 1:
  49. agentNum += 0.1f;
  50. break;
  51. case 2:
  52. agentNum += 0.17f;
  53. break;
  54. case 3:
  55. agentNum += 0.26f;
  56. break;
  57. default:
  58. break;
  59. }
  60. }
  61. if(agentNum != -1 && experience > 0 && age > 18 && (age - experience) > 18)
  62. {
  63. priority = Convert.ToInt32(agentNum * experience);
  64. }
  65. return priority;
  66. }
  67. }
  68. }