Calculation.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 quantity = 0f;
  13. switch(productType)
  14. {
  15. case 1:
  16. quantity = width * length * count * 1.1f;
  17. break;
  18. case 2:
  19. quantity = width * length * count * 2.5f;
  20. break;
  21. case 3:
  22. quantity = width * length * count * 8.43f;
  23. break;
  24. default:
  25. return -1;
  26. break;
  27. }
  28. switch(materialType)
  29. {
  30. case 1:
  31. quantity = quantity * 1.003f;
  32. break;
  33. case 2:
  34. quantity = quantity * 1.0012f;
  35. break;
  36. default:
  37. return -1;
  38. break;
  39. }
  40. return Convert.ToInt32(quantity);
  41. }
  42. }
  43. }