Guest User

Untitled

a guest
Jul 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. public void AssignProductSetting(CategoryType catType, int catId, int freeCount)
  2. {
  3. this.CustomSettings.Add(new ProductCustomization()
  4. {
  5. CategoryID = catId,
  6. CustomizationType = catType,
  7. DefaultFreeCount = freeCount,
  8. ProductID = this.ProductID
  9. });
  10. }
  11.  
  12. if(CustomeSettings == null) CustomerSettings =
  13. new Collection<ProductCustomization>();
  14.  
  15. var cat = CustomSettings.FirstOrDefault(r=>r.CategoryId == catID &&
  16. r.CustomizationType == catType);
  17. if(cat!=null)
  18. {
  19. cat.DefaultFreeCount = freeCount;
  20. cat.ProductID = this.ProductID;
  21. }
  22. else
  23. {
  24. this.CustomSettings.Add(new ProductCustomization()
  25. {
  26. CategoryID = catId,
  27. CustomizationType = catType,
  28. DefaultFreeCount = freeCount,
  29. ProductID = this.ProductID
  30. });
  31. }
  32.  
  33. if(this.CustomSettings.Any(x=>x.CategoryID == catId))
  34. {
  35. //Update
  36. }
  37. else
  38. {
  39. //Add
  40. }
  41.  
  42. var tempAllocation = new List<Object>();
  43. if (tempAllocationR.Count > 0 && tempAllocationV.Count > 0)
  44. {
  45. foreach (TempAllocation tv in tempAllocationV)
  46. {
  47. var rec = tempAllocationR.FirstOrDefault(tr => tr.TERR_ID == tv.TERR_ID && tr.TERR == tv.TERR && tr.Team == tv.Team);
  48. if (rec != null)
  49. {
  50. rec.Vyzulta = tv.Vyzulta;
  51. }
  52. else
  53. {
  54. tempAllocationR.Add(tv);
  55. }
  56.  
  57. }
  58. tempAllocation = tempAllocationR;
  59. }
  60. else if (tempAllocationV.Count == 0 && tempAllocationR.Count > 0)
  61. {
  62. tempAllocation = tempAllocationR;
  63. }
  64. else if (tempAllocationR.Count == 0 && tempAllocationV.Count > 0)
  65. {
  66. tempAllocation = tempAllocationV;
  67. }
Add Comment
Please, Sign In to add comment