protected virtual string BuildType(int type, int colspan) { StringBuilder html = new StringBuilder(); html.Append(Resources.TableRowStartTag); html.AppendFormat(Resources.TableCellLabel, string.Empty, GlobalStringResource.Type); html.AppendFormat(Resources.TableCellWithColSpan, string.Empty, colspan, TypesReader.GetDefinitonName(type)); html.Append(Resources.TableRowEndTag); return(html.ToString()); }
public List <Group> FillGroups(List <Components> bom) { Group group = new Group(); TypesReader types = new TypesReader(); types.LoadTypes(); string lastDes = null; string currentDes = null; string[] typeDescribe = null; //размещение элементов по типам foreach (Components c in bom) { // получить designator без чисел (DD вместо DD2) currentDes = DesType(c.GetDesignators()); // если появился новый десигнатор if (!currentDes.Equals(lastDes)) { // add current group if (!group.IsEmpty()) { groups.Add(group); } // create new group and fill fields group = new Group(); typeDescribe = types.FindType(currentDes); if (typeDescribe != null) { group.DesignatorType = typeDescribe[0]; group.TypeDescription = typeDescribe[1]; group.TypeDescriptions = typeDescribe[2]; } } group.Add(c); // add component in the same group lastDes = currentDes; } //add last group if (!group.IsEmpty()) { groups.Add(group); } return(groups); }