GenerateModelEntries

 List<ModelEntry> temp = new List<ModelEntry>();

            foreach(var group in groupRules)

            {

                if (group[0] == info.ModelPrefix)

                {

                    var split = group[1].Split('[');

                    string codeCategory = split[0];

                    string[] sub = split[1].Split(']')[0].Split(',');

                    Collection<int> groups = new Collection<int>();

                    foreach (var ch in sub)

                    {

                        groups.Add(Convert.ToInt32(ch));

                    }


                    foreach (var model in models)

                    {

                        int i = 0;

                        string name = string.Empty;

                        string suffix = string.Empty;

                        ModelType modelType = ModelType.HostDT;

                        bool isEntryInInfo = groups.Contains(model[CodeSets.ToList().FindIndex(a => a.Title == codeCategory)]);

                        if (isEntryInInfo)

                        {

                            foreach (var code in CodeSets)

                            {

                                if (code.Title == codeCategory && groups.Contains(model[i]))

                                {

                                    isEntryInInfo = true;

                                }


                                string tmp = code.ModelClassifictions.FirstOrDefault(a => a.Value == model[i])?.Name.ToString();

                                string str = tmp == "None" ? "" : tmp;

                                name += str;

                                i++;


                                if (code.CodeFunction == CodeFunction.Customer)

                                {

                                    suffix = str;

                                }


                                if (code.CodeFunction == CodeFunction.IdentifyModelType)

                                {

                                }

                            }


                            info.ModelDetails.FirstOrDefault().ModelEntries.Add(new ModelEntry() { ModelName = name, ModelSuffix = suffix, ModelType = modelType });

                        }

                    }

                }

            }

留言