Esempio n. 1
0
        public CCEflowBaseObject FromEflowObject(CCreator creator, ITisDataLayerTreeNode eflowObject)
#endif
        {
            try
            {
                if (eflowObject is ITisFieldData)
                {
                    return(new CCCollection.CCField(creator, eflowObject as ITisFieldData));
                }
                else if (eflowObject is ITisFieldParams)
                {
                    return(new CCCollection.CCField(creator, eflowObject as ITisFieldParams));
                }
                else if (eflowObject is ITisFieldGroupData)
                {
                    return(new CCCollection.CCGroup(creator, eflowObject as ITisFieldGroupData));
                }
                else if (eflowObject is ITisFieldGroupParams)
                {
                    return(new CCCollection.CCGroup(creator, eflowObject as ITisFieldGroupParams));
                }
                else if (eflowObject is ITisFieldTableData)
                {
                    return(new CCCollection.CCTable(creator, eflowObject as ITisFieldTableData));
                }
                else if (eflowObject is ITisFieldTableParams)
                {
                    return(new CCCollection.CCTable(creator, eflowObject as ITisFieldTableParams));
                }
                else if (eflowObject is ITisFieldArrayData)
                {
                    return(new CCCollection.CCFieldArray(creator, eflowObject as ITisFieldArrayData));
                }
                else if (eflowObject is ITisPageData)
                {
                    return(new CCCollection.CCPage(creator, eflowObject as ITisPageData));
                }
                else if (eflowObject is ITisPageParams)
                {
                    ITisPageParams pg = eflowObject as ITisPageParams;
                    return(new CCCollection.CCPage(creator, pg, pg.NumberOfLinkedEFIs == 1 ? pg.get_LinkedEFIByIndex(0).Name : pg.ParentForm.ParentFlow.Process.DefaultEFI ?? String.Empty));
                }
                else if (eflowObject is ITisFormData)
                {
                    return(new CCCollection.CCForm(creator, eflowObject as ITisFormData));
                }
                else if (eflowObject is ITisFormParams)
                {
                    return(new CCCollection.CCForm(creator, eflowObject as ITisFormParams));
                }
            }
            catch (Exception ex)
            {
                ILog.LogError(ex);
            }
            return(null);
        }
Esempio n. 2
0
            /// <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());
            }
Esempio n. 3
0
            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);
                }
            }
Esempio n. 4
0
 internal CCPage(CCreator parent, ITisPageParams page, String page_id)
Esempio n. 5
0
 public CCPage(ITisPageParams page, String page_id)
     : this(null, page, page_id ?? String.Empty)
 {
 }