Пример #1
0
            /// <summary>
            /// Add a field to the List of fields of the field array.
            /// </summary>
            /// <param name="field">The Field settings to create a CCField from.</param>
            /// <returns>A CCField when successfull, null when failed.</returns>
            public virtual CCField AddField(ITisFieldParams field, TIS_RECT fieldRect)
            {
                try
                {
                    if (fields == null)
                    {
                        fields = new List <CCField>();
                    }

                    //-- Add a new field --\\
                    foreach (CCField cf in fields)
                    {
                        if (String.Compare(cf.Name, field.Name, true) == 0)
                        {
                            return(cf);
                        }
                    }

                    fields.Add(new CCField(this.ParentCreator, field.Name, String.Empty, 0, fieldRect, null, null, null));

                    this.SetParents();
                    return(fields[fields.Count - 1]);
                }
                catch (Exception ex)
                {
                    ILog.LogError(ex, false);
                    throw ex;
                }
            }
Пример #2
0
            public CCField(CCreator parent, ITisFieldParams field) :
#endif
                this(parent, field != null? field.Name:String.Empty, String.Empty, 0, new TIS_RECT(), null, null, null)
            {
                this.EflowOwner = field;
                if (field.ParentFieldTableExists)
                {
                    this.NamedParent = field.ParentFieldTable.Name;
                }
                else if (field.ParentFieldGroupExists)
                {
                    this.NamedParent = field.ParentFieldGroup.Name;
                }
            }
Пример #3
0
            /// <summary>
            /// Add a field to the groups' List of fields.
            /// </summary>
            /// <param name="fieldName">The name of the Field to create.</param>
            /// <returns>A CCField when successfull, null when failed.</returns>
            public virtual CCField AddField(ITisFieldParams field, TIS_RECT fieldRect)
            {
                try
                {
                    if (fields == null)
                    {
                        fields = new List <CCField>();
                    }

                    //-- Add a new field --\\
                    foreach (CCField cf in fields)
                    {
                        if (String.Compare(cf.Name, field.Name, true) == 0)
                        {
                            return(cf);
                        }
                    }

                    if (field.ParentFieldTableExists)
                    {
                        // TODO: finish testing here.
                        //\\ bool createTable = true;
                        // CCTable = this.tables.IndexOf(
                        foreach (CCTable tbl in this.tables)
                        {
                            if (String.Compare(tbl.Name, field.ParentFieldTable.Name, true) == 0)
                            {
                                CCFieldArray cfa = tbl.AddFieldArray(field.Name);
                                cfa.AddField(field, fieldRect);
                            }
                        }
                    }
                    else
                    {
                        fields.Add(new CCField(this.ParentCreator, field.Name, String.Empty, 0, fieldRect, null, null, null));
                    }

                    fields[fields.Count - 1].CCParent = this;

                    this.SetParents();
                    return(fields[fields.Count - 1]);
                }
                catch (Exception ex)
                {
                    ILog.LogError(ex, false);
                    throw ex;
                }
            }
Пример #4
0
            public CCFieldArray(CCreator parent, ITisFieldParams fieldParent, bool createSubFields)
#endif
                : this(parent, fieldParent != null? fieldParent.Name:String.Empty, new Dictionary <String, String>(), null, null)
            {
                this.EflowOwner  = fieldParent;
                this.NamedParent = fieldParent.ParentFieldTableExists ? fieldParent.ParentFieldTable.Name : String.Empty;

                if (fields == null)
                {
                    fields = new List <CCField>();
                }
                else
                {
                    fields.Clear();
                }

                if (createSubFields)
                {
                    fields.Add(new CCField(this.ParentCreator, fieldParent));
                }
            }
Пример #5
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());
            }
Пример #6
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);
                }
            }
Пример #7
0
 internal CCFieldArray(CCreator parent, ITisFieldParams fieldParent, bool createSubFields)
Пример #8
0
 public CCFieldArray(ITisFieldParams fieldParent, bool createSubFields)
     : this(null, fieldParent, createSubFields)
 {
 }
Пример #9
0
            public CCFieldArray(CCreator parent, ITisFieldParams fieldParent)
#endif
                : this(parent, fieldParent, true)
            {
            }
Пример #10
0
 internal CCFieldArray(CCreator parent, ITisFieldParams fieldParent)
Пример #11
0
 public CCFieldArray(ITisFieldParams fieldParent)
     : this(null, fieldParent)
 {
 }
Пример #12
0
 internal CCField(CCreator parent, ITisFieldParams field) :
Пример #13
0
 public CCField(ITisFieldParams field) :
     this(null, field)
 {
 }