/// <summary> /// return groups data from page /// </summary> /// <param name="creator"></param> /// <param name="pageParams"></param> /// <param name="pageID"></param> /// <returns></returns> internal static CCGroup[] GroupsFromPage(CCreator creator, ITisPageParams pageParams, String pageID) { List <CCGroup> ccGrps = new List <CCGroup>(); try { List <ITisFieldGroupParams> fldGroupParams = new List <ITisFieldGroupParams>(); List <String> groupNames = new List <String>(); if (!String.IsNullOrEmpty(pageID)) { ITisEFIParams efi = pageParams.get_LinkedEFI(pageID); foreach (ITisROIParams roi in efi.ROIs) { if (roi.Miscellaneous.OrderInField <= 1) { ITisFieldParams fp = pageParams.get_LinkedField(roi.Miscellaneous.FieldName); if (fp != null) { if (fp.ParentFieldGroupExists) { if (groupNames.Contains(fp.ParentFieldGroup.Name.ToUpper())) { continue; } groupNames.Add(fp.ParentFieldGroup.Name.ToUpper()); ccGrps.Add(new CCGroup(creator, fp.ParentFieldGroup)); } else if (fp.ParentFieldTableExists) { if (groupNames.Contains(fp.ParentFieldGroup.Name.ToUpper())) { continue; } groupNames.Add(fp.ParentFieldTable.ParentFieldGroup.Name.ToUpper()); ccGrps.Add(new CCGroup(creator, fp.ParentFieldTable.ParentFieldGroup)); } } } } } else { foreach (ITisFieldParams fldParams in pageParams.LinkedFields) { if (fldParams.ParentFieldGroupExists) { if (!fldGroupParams.Contains(fldParams.ParentFieldGroup)) { fldGroupParams.Add(fldParams.ParentFieldGroup); } } else if (fldParams.ParentFieldTableExists && fldParams.ParentFieldTable.ParentFieldGroupExists) { if (!fldGroupParams.Contains(fldParams.ParentFieldTable.ParentFieldGroup)) { fldGroupParams.Add(fldParams.ParentFieldTable.ParentFieldGroup); } } } } foreach (ITisFieldGroupParams fldGrp in fldGroupParams) { ccGrps.Add(new CCGroup(creator, fldGrp)); } } catch (Exception ex) { ILog.LogError(ex); } return(ccGrps.ToArray()); }
public CCPage(CCreator parent, ITisPageParams page, String page_id) #endif : base(parent, page != null? page.Name:String.Empty, null, null) { try { if (groups == null) { groups = new List <CCGroup>(); } else { groups.Clear(); } this.EflowOwner = page; this.PageID = page_id; this.NamedParent = page.ParentForm.Name; bool hasEfi = false; CCGroup grp = null; List <CCTable> tables = new List <CCTable>(); if (!String.IsNullOrEmpty(page_id)) { //-- Get matched EFI --\\ ITisEFIParams efi = page.get_LinkedEFI(page_id); hasEfi = efi != null; if (hasEfi) { //-- Get all fields and field-groups that has ROIs --\\ foreach (ITisROIParams roi in efi.ROIs) { if (roi.Miscellaneous.OrderInField == 1) { ITisFieldParams fp = page.get_LinkedField(roi.Miscellaneous.FieldName); if (fp != null) { if (fp.ParentFieldGroupExists) { //-- A standard field --\\ grp = GetGroup(fp.ParentFieldGroup.Name); if (grp == null) { grp = new CCGroup(parent, fp.ParentFieldGroup, false); groups.Add(grp); } CCField cf = grp.GetField(fp.Name); //-- Create field and join sll ROIs --\\ if (cf == null) { cf = grp.AddField(fp.Name, String.Empty, 0, CCUtils.MergerRoisRect(CCUtils.GetLinkedRois(efi, fp.Name))); } else { cf.Rect = new FieldRect(CCUtils.MergerRoisRect(CCUtils.GetLinkedRois(efi, fp.Name))); } grp.AddField(cf); } else if (fp.ParentFieldTableExists) { //-- A table field --\\ grp = AddGroup(fp.ParentFieldTable.ParentFieldGroup.Name); CCTable tbl = grp.AddTable(fp.ParentFieldTable.Name); if (!tables.Contains(tbl)) { tables.Add(tbl); } CCFieldArray fldArr = tbl.AddFieldArray(fp.Name); fldArr.AddField(fp, CCUtils.MergerRoisRect(CCUtils.GetLinkedRois(efi, fp.Name))); //CCField cf = fldArr.AddField(fldArr.fp.Name); ////-- Create field and join sll ROIs --\\ //if (cf == null) cf = grp.AddField(fp.Name, String.Empty, 0, CCUtils.MergerRoisRect(CCUtils.GetLinkedRois(efi, fp.Name))); //else cf.Rect = new FieldRect(CCUtils.MergerRoisRect(CCUtils.GetLinkedRois(efi, fp.Name))); //CCFieldArray cfAr = tbl.AddFieldArray(fp.Name); //cfAr.AddField(cf); } } } } //-- Add rows if KeepEmptyRows is marked --\\ if (tables != null && tables.Count > 0) { foreach (CCTable tbl in tables) { ITisFieldTableParams efTable = page.get_LinkedFieldTable(tbl.Name); if (efTable != null && efTable.Table.KeepEmptyRows && efTable.Table.NumberOfRows > tbl.NumberOfRows) { tbl.AddRow(); } } } } } if (!hasEfi) { foreach (ITisFieldParams fld in page.LinkedFields) { if (fld.ParentFieldGroupExists) { grp = GetGroup(fld.ParentFieldGroup.Name); if (grp == null) { grp = new CCGroup(parent, fld.ParentFieldGroup, false); groups.Add(grp); } } else if (fld.ParentFieldTableExists) { grp = GetGroup(fld.ParentFieldTable.ParentFieldGroup.Name); if (grp == null) { grp = new CCGroup(parent, fld.ParentFieldTable.ParentFieldGroup, false); groups.Add(grp); } } } foreach (ITisFieldTableParams fldTbl in page.LinkedFieldTables) { grp = GetGroup(fldTbl.ParentFieldGroup.Name); if (grp == null) { grp = new CCGroup(parent, fldTbl.ParentFieldGroup, false); groups.Add(grp); } } } } catch (Exception ex) { ILog.LogError(ex); } }