Class1.cs 859 B

1234567891011121314151617181920212223242526
  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 static int GetQuantityForProduct(int productType, int materialType, int count, float width, float length)
  11. {
  12. float coef;
  13. if (productType == 1) { coef = 1.1f; }
  14. else if (productType == 2) { coef = 2.5f; }
  15. else if (productType == 3) { coef = 8.43f; }
  16. else { return -1; }
  17. float square = width * length;
  18. float rez = square * coef;
  19. if (materialType == 1) { rez += rez * 0.003f; }
  20. else if (materialType == 2) { rez += rez * 0.0012f; }
  21. else { return -1; }
  22. return (int)Math.Round(Convert.ToDouble(rez) * count);
  23. }
  24. }
  25. }