private List <lm.Comol.Core.Dss.Domain.Templates.dtoItemWeightBase> GetAvailableWeights(Boolean fuzzyWeights, Boolean orderedWeights, dtoCommittee committee) { Dictionary <long, String> weights = new Dictionary <long, string>(); //if (orderedWeights == committee.MethodSettings.UseOrderedWeights || fuzzyWeights == committee.MethodSettings.IsFuzzyMethod) //{ // weights = committee.GetFuzzyMeItems(); // if (!fuzzyWeights) // weights.Values.Where(v => v.Contains(";")).ToList().ForEach(v => v = ""); //} //else // weights = new Dictionary<long, string>(); List <lm.Comol.Core.Dss.Domain.Templates.dtoItemWeightBase> items = null; if (orderedWeights) { if (committee.Criteria.Count() > 1) { if (committee.Criteria.Count() == weights.Count) { items = (from int i in Enumerable.Range(1, committee.Criteria.Count()) select i).ToList().Select(i => new lm.Comol.Core.Dss.Domain.Templates.dtoItemWeightBase() { IdObject = (long)i, IsFuzzyValue = fuzzyWeights, OrderedItem = true, Name = i.ToString(), Value = (weights.ContainsKey((long)i) ? weights[(long)i] : "") }).ToList(); } else { Int32 index = 1; items = (from int i in Enumerable.Range(1, committee.Criteria.Count()) select i).ToList().Select(i => new lm.Comol.Core.Dss.Domain.Templates.dtoItemWeightBase() { IdObject = (long)i, IsFuzzyValue = fuzzyWeights, OrderedItem = true, Name = i.ToString(), Value = "" }).ToList(); List <String> values = weights.Values.ToList(); if (values.Any()) { items[0].Value = values[0]; switch (values.Count) { case 0: case 1: break; case 2: items.Last().Value = values.Last(); break; default: items.Last().Value = values.Last(); foreach (String v in values.Skip(1).Take(values.Count - 1)) { items[index++].Value = v; } break; } } } } } else { items = committee.Criteria.Select(c => c.ToWeightItem(weights, fuzzyWeights)).ToList(); } return(items); }
public List <lm.Comol.Core.Dss.Domain.Templates.dtoItemWeightBase> RequireCommitteeWeight(long idCall, Boolean fuzzyWeights, Boolean orderedWeights, dtoCommittee committee) { return(GetAvailableWeights(fuzzyWeights, orderedWeights, committee)); }