Алексей Колесов 2 rokov pred
rodič
commit
895fc6ccf4
1 zmenil súbory, kde vykonal 78 pridanie a 3 odobranie
  1. 78 3
      WSUniversalLib/Calculation.cs

+ 78 - 3
WSUniversalLib/Calculation.cs

@@ -8,13 +8,88 @@ namespace WSUniversalLib
 {
     public class Calculation
     {
-
+        /// <summary>
+        /// Метот расчета приоритета агента 
+        /// </summary>
+        /// <param name="agentType"> Тип агента</param>
+        /// <param name="age"> Возраст агента</param>
+        /// <param name="experience"> Опыт агента</param>
+        /// <returns>Новый приоритет агента</returns>
         public int GetPriorityForAgent(int agentType, float age, float experience)
-
         {
+            
+
+            int NewPriority = 0;
+            double coeff;
+            if (agentType <= 0 || age <= 0 || experience <= 0)
+            {
+                return -1;
+            }
+            switch (agentType)
+            {
+                case 1:
+                    coeff = 1.8;
+                    break;
+
+                case 2:
+                    coeff = 3.2;
+                    break;
+
+                case 3:
+                    coeff = 4.1;
+                    break;
+                default:
+                    coeff = 0;
+                    break;
+            }
+            if (experience > 10)
+            {
+                coeff*= 0.5;
+
+            }
+            else if (experience > 20)
+            {
+                coeff *= 0.7;
+
+            }
+
+            else if (experience > 40)
+            {
+                coeff *= 0.9;
+
+            }
+            else
+            {
+                coeff *= 0;
+            }
+
+            if (age <= 25 && experience < 3)
+            {
+                switch (agentType)
+                {
+                    case 1:
+                        coeff += 0.1;
+                        break;
+
+                    case 2:
+                        coeff += 0.17;
+                        break;
+
+                    case 3:
+                        coeff += 0.26;
+                        break;
+                    default:
+                        coeff = 0;
+                        break;
+                }
+            }
+
+
+            NewPriority = Convert.ToInt32(Math.Ceiling(experience * coeff));
+
 
 
-            rerurn 
+            return NewPriority;
         }
 
     }