private RowSpec AddNote(List <RowSpec> partRows, string note, string designators) { RowSpec row = partRows.Last(); // split long string into several short // example - "DA1, DA5, DA6, DA8" -> "DA1, DA5", "DA6, DA8" string[] desArray = SplitNote(designators); // if necessary, add new rows int noteRowsCount = 0; if (!String.IsNullOrEmpty(note)) { noteRowsCount = 1; } while (partRows.Count < desArray.Length + noteRowsCount) { partRows.Add(new RowSpec()); } int j = partRows.Count - desArray.Length; for (int i = 0; i < desArray.Length; i++) { partRows[j + i].Note = desArray[i]; } if (!String.IsNullOrEmpty(note)) { partRows[j - 1].Note = note; } return(partRows.Last()); }
private void PrintHeader(Components c, GroupHeader header) { RowSpec row = new RowSpec(); string note = ""; row.Name = header.TypeDescription + " " + header.Manufacturer; if (header.NoteNumber > 0 || header.NoteNumber1 > 0) { note = "Примеч. " + (header.NoteNumber > 0 ? header.NoteNumber.ToString() : "") + (header.NoteNumber1 > 0 ? ", " + header.NoteNumber1.ToString() : ""); row.Note = note; } Others.Add(row); }
private RowSpec AddNoteRow(List <RowSpec> notesRows, string noteRow) { RowSpec row; // split long string into several short string[] notesArray = SplitNoteRow(noteRow); for (int i = 0; i < notesArray.Length; i++) { row = new RowSpec(); row.Designation = notesArray[i]; notesRows.Add(row); } return(notesRows.Last()); }
protected override void GenerateNotes() { RowSpec row = new RowSpec(); // generating notes NotesRows.Add(new RowSpec("", "", "", "Примечания - ", "", 0, "")); NotesRows.Add(new RowSpec("", "", "", "Допускается замена - ", "", 0, "")); row = new RowSpec(); NotesRows.Add(row); for (int noteNumber = 0; noteNumber < notes.Count; noteNumber++) { string noteRow = (noteNumber + 1) + " " + notes[noteNumber]; row = AddNoteRow(NotesRows, noteRow); } }
protected override void FillDocumentRows(List <SWComponents> group, String section) { List <RowSpec> partRows; RowSpec row = new RowSpec(); row.Name = section; specRows.Add(row); specRows.Add(new RowSpec()); string note = ""; foreach (SWComponents c in group) { partRows = new List <RowSpec>(); row = new RowSpec(); partRows.Add(row); note = ""; row.Position = positionNumber.ToString(); positionNumber += positionInc; if (c.ReplacementNumber > 0) { note = "Примеч. " + c.ReplacementNumber.ToString(); } if (!String.IsNullOrEmpty(note) && !String.IsNullOrEmpty(c.Note)) { note += ", "; } row.Designation = c.Designation; row.Name = c.Name; //row = AddName(partRows, c.Name); row = AddNote(partRows, note, c.Note); row.Quantity = c.Quantity; specRows.AddRange(partRows); specRows.Add(new RowSpec()); } // empty row within groups specRows.Add(new RowSpec()); }
private RowSpec AddName(List <RowSpec> partRows, string name) { RowSpec row = partRows.Last(); if (!String.IsNullOrEmpty(name)) { if ((row.Name.Length + name.Length) < maxNameLength) { if (!String.IsNullOrEmpty(row.Name)) { row.Name += " "; } row.Name += name; } else { row = new RowSpec(); row.Name = name; partRows.Add(row); } } return(row); }
protected override void FillDocumentRows() { Others = new List <RowSpec>(); List <RowSpec> partRows; RowSpec row = new RowSpec(); row.Name = "Прочие изделия"; Others.Add(row); Others.Add(new RowSpec()); string note = ""; foreach (Model.Group group in componentList.Groups) { group.CountManufactures(settings.GroupLimitSpec); Components previous = new Components(); foreach (Components c in group) { partRows = new List <RowSpec>(); row = new RowSpec(); partRows.Add(row); note = ""; row.Position = positionNumber.ToString(); positionNumber += positionInc; string designators = DesignatorShortener.Short(c.GetDesignatorsList()); if (c.NoteNumber > 0 || c.NoteNumber1 > 0) { note = "Примеч. " + (c.NoteNumber > 0 ? c.NoteNumber.ToString() : "") + (c.NoteNumber1 > 0 ? ", " + c.NoteNumber1.ToString() : ""); //row.Note = note; } if (!String.IsNullOrEmpty(note)) { note += ", "; } if (!String.IsNullOrEmpty(c.Part.Description)) { c.Part.Description = "(" + c.Part.Description + ")"; } // print header for subgroup and print Name and Note if (group.IsInHeaders(c)) { if (!c.IsEqualHeader(previous)) { // empty row within groups Others.Add(new RowSpec()); PrintHeader(c, group.GetHeader(c)); } row = AddName(partRows, c.Part.ManufacturerPartNumber); row = AddName(partRows, c.Part.Description); row = AddNote(partRows, note, designators); } // print Name and Note without header else { if (group.IsInHeaders(previous)) { // empty row within groups Others.Add(new RowSpec()); } row = AddName(partRows, c.Part.Type); row = AddName(partRows, c.Part.ManufacturerPartNumber); row = AddName(partRows, c.Part.Description); row = AddName(partRows, c.Part.Manufacturer); row = AddNote(partRows, note, designators); } row.Quantity = c.Quantity; Others.AddRange(partRows); previous = c; Others.Add(new RowSpec()); } // empty row within groups Others.Add(new RowSpec()); } // generating notes NotesRows.Add(new RowSpec("", "", "", "Примечания - ", "", 0, "")); NotesRows.Add(new RowSpec("", "", "", "Допускается замена - ", "", 0, "")); row = new RowSpec(); NotesRows.Add(row); for (int noteNumber = 0; noteNumber < notes.Count; noteNumber++) { string noteRow = (noteNumber + 1) + " " + notes[noteNumber]; row = AddNoteRow(NotesRows, noteRow); } }