Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void AssignProductSetting(CategoryType catType, int catId, int freeCount)
- {
- this.CustomSettings.Add(new ProductCustomization()
- {
- CategoryID = catId,
- CustomizationType = catType,
- DefaultFreeCount = freeCount,
- ProductID = this.ProductID
- });
- }
- if(CustomeSettings == null) CustomerSettings =
- new Collection<ProductCustomization>();
- var cat = CustomSettings.FirstOrDefault(r=>r.CategoryId == catID &&
- r.CustomizationType == catType);
- if(cat!=null)
- {
- cat.DefaultFreeCount = freeCount;
- cat.ProductID = this.ProductID;
- }
- else
- {
- this.CustomSettings.Add(new ProductCustomization()
- {
- CategoryID = catId,
- CustomizationType = catType,
- DefaultFreeCount = freeCount,
- ProductID = this.ProductID
- });
- }
- if(this.CustomSettings.Any(x=>x.CategoryID == catId))
- {
- //Update
- }
- else
- {
- //Add
- }
- var tempAllocation = new List<Object>();
- if (tempAllocationR.Count > 0 && tempAllocationV.Count > 0)
- {
- foreach (TempAllocation tv in tempAllocationV)
- {
- var rec = tempAllocationR.FirstOrDefault(tr => tr.TERR_ID == tv.TERR_ID && tr.TERR == tv.TERR && tr.Team == tv.Team);
- if (rec != null)
- {
- rec.Vyzulta = tv.Vyzulta;
- }
- else
- {
- tempAllocationR.Add(tv);
- }
- }
- tempAllocation = tempAllocationR;
- }
- else if (tempAllocationV.Count == 0 && tempAllocationR.Count > 0)
- {
- tempAllocation = tempAllocationR;
- }
- else if (tempAllocationR.Count == 0 && tempAllocationV.Count > 0)
- {
- tempAllocation = tempAllocationV;
- }
Add Comment
Please, Sign In to add comment