示例#1
0
        private string GenerateFieldCreateSql(IFieldType field)
        {
            // There is probably a better way to do this but this is how things are currently
            switch (field)
            {
            case BooleanField _:
                return($"{field.Name} boolean {(!field.Nullable ? "not null" : "")}");

            case NumberField _:
                return($"{field.Name} integer" + (!field.Nullable ? "NOT NULL" : ""));

            case PrimaryField _:
                return($"{field.Name} uuid Not Null Primary Key");

            case TextField _:
                TextField castedTextField = (TextField)field;
                return($"{castedTextField.Name} varchar({castedTextField.Length})" + (!castedTextField.Nullable ? "NOT NULL" : ""));

            case LookupField _:
                LookupField castedLookupField = (LookupField)field;
                return($"{field.Name} uuid references {castedLookupField.Target}({castedLookupField.Target}id) {(!field.Nullable ? "not null" : "")}");

            default:
                throw new NotSupportedException($"Field type {field.GetType().Name} is unsupported by this backend");
            }
        }
示例#2
0
        public AutocompleteItem[] GetLookupDisplayNames(int reportTableFieldID, string term)
        {
            List <AutocompleteItem>  result = new List <AutocompleteItem>();
            Dictionary <int, string> values = LookupField.GetValues(TSAuthentication.GetLoginUser(), reportTableFieldID, term, 10);

            result.Add(new AutocompleteItem("Unassigned", "-1"));
            if (values != null)
            {
                foreach (KeyValuePair <int, string> pair in values)
                {
                    bool found = false;
                    foreach (AutocompleteItem item in result)
                    {
                        if (item.label.ToLower().Trim() == pair.Value.ToLower().Trim())
                        {
                            found = true;
                            break;
                        }
                    }

                    if (!found)
                    {
                        result.Add(new AutocompleteItem(pair.Value, pair.Key.ToString()));
                    }
                }
            }
            return(result.ToArray());
        }
示例#3
0
        private bool ParseLookup(Element el)
        {
            LookupField field = new LookupField
            {
                Label                   = el.label,
                LookupArchiveName       = el.lookupRepositoryName,
                LookupArchiveColumnName = el.lookupFieldName == "Oggetto" ? "_subject" : el.lookupFieldName,
                Required                = el.required,
                Searchable              = el.searchable,
                ModifyEnabled           = el.modifyEnable,
                HiddenField             = el.hiddenField,
                ClientId                = el.clientId,
                ColumnName              = Utils.SafeSQLName(el.label),
                ResultVisibility        = el.resultVisibility,
                ResultPosition          = el.resultPosition,
                MultipleValues          = el.multipleValues,
                MultipleValuesSpecified = el.multipleValues,
                Layout                  = new LayoutPosition
                {
                    PanelId   = el.columns.ToString(),
                    ColNumber = el.columns,
                    RowNumber = el.rows
                }
            };

            sections.AddCtrl(field);
            return(true);
        }
示例#4
0
        /// <summary>
        /// Returns lookup field value as an item name instead of item ID.
        /// </summary>
        /// <returns></returns>
        public override string GetValue()
        {
            var lookupField = new LookupField(_field);
            var targetItem  = lookupField.TargetItem;

            return(targetItem != null?targetItem.DisplayName.ToLowerInvariant() : String.Empty);
        }
        protected Item GetWildcardDetailPage(string landingPageTemplateId, ID fieldId, Item currentItem = null)
        {
            Item detailItem = null;

            var context = Context.Item;

            // Handle case where context page is either the wildcard node or landing page
            if (context.Name.StartsWith(Constants.Wildcard.Node) &&
                context.Parent.InheritsTemplate(landingPageTemplateId))
            {
                detailItem = context;
            }
            else if (context.InheritsTemplate(landingPageTemplateId))
            {
                detailItem =
                    context.Children
                    .FirstOrDefault(i => i.Name.StartsWith(Constants.Wildcard.Node));
            }

            if (detailItem == null)
            {
                var settingItem = Sitecore.Context.Database.GetItem(EventConfigSettings.EventCalendarSettingItem);
                if (settingItem != null)
                {
                    var siteLookupField = new LookupField(settingItem.Fields[fieldId]);
                    var selectedPage    = siteLookupField.TargetItem;
                    if (selectedPage != null && selectedPage.Name.StartsWith(EventCalendar.Constants.Wildcard.Node))
                    {
                        detailItem = selectedPage;
                    }
                }
            }

            return(detailItem);
        }
示例#6
0
        public static float CompareFieldTypes(LookupType t1, LookupType t2, LookupModule lookupModel)
        {
            float comparative_score = 1.0f;

            float score_penalty = comparative_score / t1.Fields.Count(f => !f.IsStatic && !f.IsLiteral);

            foreach (var f1 in t1.Fields.Select((Value, Index) => new { Value, Index }))
            {
                LookupField f2 = t2.Fields[f1.Index];
                if (f1.Value.Name == f2.Name)
                {
                    return(1.5f);
                }
                if (!Regex.Match(f1.Value.Name, lookupModel.NamingRegex).Success&& f1.Value.Name != f2.Name)
                {
                    return(0.0f);
                }

                if (f1.Value.IsStatic || f1.Value.IsLiteral)
                {
                    continue;
                }

                if (f1.Value.GetType().Namespace == "System" && f2.GetType().Namespace == "System" && f1.Value.Name == f2.Name)
                {
                    comparative_score -= score_penalty;
                }
            }

            return(comparative_score);
        }
示例#7
0
        public override IRenderingModelBase GetModel()
        {
            HistogramRenderingModel model = new HistogramRenderingModel();

            this.FillBaseProperties(model);
            if (model.DataSourceItem != null)
            {
                LookupField timePeriod = model.DataSourceItem.Fields[Templates.Histogram.Fields.TimePeriod];
                if (timePeriod.TargetItem != null)
                {
                    model.TimePeriod = (TimePeriods)Enum.Parse(typeof(TimePeriods), timePeriod.TargetItem.Fields["Value"].Value); //TODO Pull from Foundation.  And put this in a method.
                }
                model.SetDataUrl(model.DataSourceItem.Fields[Templates.DataVisualization.Fields.Data]);
                model.ShowLabels = !(string.IsNullOrWhiteSpace(this.Rendering.Parameters[Constants.ShowLabels]) ||
                                     this.Rendering.Parameters[Constants.ShowLabels] == "0"); //TODO Clean up
                DateField fromDate = model.DataSourceItem.Fields[Templates.Histogram.Fields.FromDate];
                if (fromDate.DateTime != DateTime.MinValue)
                {
                    model.FromDate = fromDate.DateTime;
                }
                DateField toDate = model.DataSourceItem.Fields[Templates.Histogram.Fields.ToDate];
                if (toDate.DateTime != DateTime.MinValue)
                {
                    model.ToDate = toDate.DateTime;
                }
                TextField dataColumnName = model.DataSourceItem.Fields[Templates.Histogram.Fields.DataColumnName];
                if (!string.IsNullOrWhiteSpace(dataColumnName.Value))
                {
                    model.DateColumnName = dataColumnName.Value;
                }
            }
            return(model);
        }
 public Translation(string obfName, LookupField field)
 {
     ObfName   = obfName;
     CleanName = field.Name;
     _field    = field;
     Type      = TranslationType.FieldTranslation;
 }
示例#9
0
        public void CreatePlanItems(List <PlanEvent> planlist, ID parentid)
        {
            Database db         = Sitecore.Configuration.Factory.GetDatabase("master");
            Item     parentItem = db.GetItem(parentid);

            using (new SecurityDisabler())
            {
                parentItem.Editing.BeginEdit();
                foreach (var plan in planlist)
                {
                    Item child = parentItem.Add(plan.PlanTitleID, new TemplateID(new ID("{50B06575-9906-4B50-8E63-3E8BBEF1F858}")));
                    child.Editing.BeginEdit();
                    LookupField lf = child.Fields["Broadcast Date"];
                    lf.Value = HttpUtility.HtmlDecode(plan.BroadcastDate);

                    lf       = child.Fields["Plan Date"];
                    lf.Value = HttpUtility.HtmlDecode(plan.PlanDate);

                    lf       = child.Fields["Plan Time"];
                    lf.Value = plan.PlanTime;

                    lf       = child.Fields["Plan Duration"];
                    lf.Value = plan.PlanDuration;

                    lf       = child.Fields["Material ID"];
                    lf.Value = plan.MaterialID;

                    lf       = child.Fields["Title Name"];
                    lf.Value = plan.TitleName;

                    lf       = child.Fields["Episode Name"];
                    lf.Value = plan.EpisodeName;

                    lf       = child.Fields["EPG"];
                    lf.Value = plan.EPG;

                    lf       = child.Fields["Title ID"];
                    lf.Value = plan.TitleID;

                    lf       = child.Fields["Episode ID"];
                    lf.Value = plan.EpisodeID;

                    lf       = child.Fields["Plan Title ID"];
                    lf.Value = plan.PlanTitleID;

                    lf       = child.Fields["Day Name"];
                    lf.Value = plan.DayName;

                    lf       = child.Fields["Definition"];
                    lf.Value = plan.Definition;

                    child.Editing.EndEdit();
                }
                parentItem.Editing.EndEdit();
            }
        }
示例#10
0
 /// <summary>
 /// Relinks the branch reference, if present, in the given field
 /// </summary>
 /// <param name="field">The field to relink the reference in</param>
 /// <param name="instanceRoot">Root item of the branch instance</param>
 /// <param name="branchPath">Sitecore path of the branch template</param>
 /// <param name="branchPathLength">Length of the branch template's Sitecore path</param>
 public static void RelinkBranchReferenceInLookupField(LookupField field, Item instanceRoot, string branchPath, int?branchPathLength = null)
 {
     RelinkBranchReferenceInCustomField(
         field,
         lookupField => lookupField.TargetItem?.Paths.FullPath,
         item => item.ID.ToString(),
         instanceRoot,
         branchPath,
         branchPathLength);
 }
示例#11
0
        private static Control CreateLookupFieldControl(SPField field, SPList list, SPListItem item, SPControlMode mode)
        {
            LookupField lf = new LookupField();

            lf.ListId      = list.ID;
            lf.ItemId      = item.ID;
            lf.FieldName   = field.Title;
            lf.ID          = field.Title;
            lf.ControlMode = mode;
            return(lf);
        }
示例#12
0
        public AutocompleteItem[] GetLookupValues(int reportTableFieldID, string term)
        {
            List <AutocompleteItem>  result = new List <AutocompleteItem>();
            Dictionary <int, string> values = LookupField.GetValues(TSAuthentication.GetLoginUser(), reportTableFieldID, term, 10);

            result.Add(new AutocompleteItem("Unassigned", "-1"));
            if (values != null)
            {
                foreach (KeyValuePair <int, string> pair in values)
                {
                    result.Add(new AutocompleteItem(pair.Value, pair.Key.ToString()));
                }
            }
            return(result.ToArray());
        }
示例#13
0
        /// <summary>
        /// Returns lookup field value as an item display name instead of item ID.
        /// </summary>
        /// <returns></returns>
        public override string GetValue()
        {
            var value = String.Empty;

            if (FieldTypeManager.GetField(_field) is LookupField)
            {
                var lookupField = new LookupField(_field);
                value = IdHelper.NormalizeGuid(lookupField.TargetID);
            }
            if (FieldTypeManager.GetField(_field) is ReferenceField)
            {
                var referenceField = new ReferenceField(_field);
                value = IdHelper.NormalizeGuid(referenceField.TargetID);
            }

            return value;
        }
示例#14
0
        /// <summary>
        /// Returns lookup field value as an item display name instead of item ID.
        /// </summary>
        /// <returns></returns>
        public override string GetValue()
        {
            var value = String.Empty;

            if (FieldTypeManager.GetField(_field) is LookupField)
            {
                var lookupField = new LookupField(_field);
                value = IdHelper.NormalizeGuid(lookupField.TargetID);
            }
            if (FieldTypeManager.GetField(_field) is ReferenceField)
            {
                var referenceField = new ReferenceField(_field);
                value = IdHelper.NormalizeGuid(referenceField.TargetID);
            }

            return(value);
        }
        /// <summary>
        /// Actualiza la fila seleccionada del grid grvItemsPedidos
        /// </summary>
        /// <param name="itemId"></param>
        /// <param name="row"></param>
        private void ActualizarItemPedido(int itemId, GridViewRow row)
        {
            NumberField fCantidad = (NumberField)row.FindControl("numCantidad");
            NumberField fPrecioU  = (NumberField)row.FindControl("numPrecioUnitario");
            //LookupField fMoneda = (LookupField)row.FindControl("lufMonedaItem");
            NumberField fPeso            = (NumberField)row.FindControl("numPeso");
            LookupField fUnidadM         = (LookupField)row.FindControl("lufUnidadMedida");
            TextField   fDims            = (TextField)row.FindControl("txtDimensiones");
            LookupField fCliente         = (LookupField)row.FindControl("lufCliente");
            LookupField fClienteAsociado = (LookupField)row.FindControl("lufClienteAsociado");
            LookupField fTipoPedido      = (LookupField)row.FindControl("lufTipoPedido");

            string cantidad = fCantidad.Value.ToString();
            string precioU  = fPrecioU.Value.ToString();
            //string moneda = fMoneda.Value.ToString();
            string peso = "";

            if (fPeso.Value != null)
            {
                peso = fPeso.Value.ToString();
            }
            string unidadM = "";

            if (fUnidadM.Value != null)
            {
                unidadM = fUnidadM.Value.ToString();
            }
            string dims = "";

            if (fDims.Value != null)
            {
                dims = fDims.Value.ToString();
            }
            string cliente         = fCliente.Value.ToString();
            string clienteAsociado = "";

            if (fClienteAsociado.Value != null)
            {
                clienteAsociado = fClienteAsociado.Value.ToString();
            }
            string tipoPedido = fTipoPedido.Value.ToString();

            EjecutorOperacionesSP.ActualizarItemPedido(itemId, cantidad, precioU,
                                                       peso, unidadM, dims, cliente, tipoPedido, clienteAsociado);
        }
示例#16
0
        public static void SetName(this LookupField field, string name, LookupModule module)
        {
            string obfName = field.CSharpName;

            if (!Regex.Match(field.Name, module.NamingRegex).Success)
            {
                return;
            }

            if (field.Il2CppField != null)
            {
                field.Il2CppField.Name = name;
            }
            var translation = new Translation(obfName, field);

            module.Translations.Add(translation);
            field.Translation = translation;
        }
示例#17
0
        private static bool CheckFromUIValue(string fieldName, Enums.Operator op, string value, SPFormContext formContext, string clientID)
        {
            BaseFieldControl field = ValidationInjector.GetFieldControlByName(fieldName, formContext, clientID);

            // to manage the rich field UI text
            if (field is RichTextField)
            {
                string fieldVaue = ((RichTextField)field).HiddenInput.Value;

                switch (op)
                {
                case Enums.Operator.Equal:
                    return(fieldVaue.Equals(value));

                case Enums.Operator.NotEqual:
                    return(!fieldVaue.Equals(value));

                case Enums.Operator.Contains:
                    return(fieldVaue.Contains(value));

                case Enums.Operator.NotContains:
                    return(!fieldVaue.Contains(value));

                default:
                    return(false);
                }
            }
            else
            {
                if (field is LookupField)
                {
                    LookupField l = field as LookupField;
                    String      v = l.Value.ToString();
                }

                return(MatchItemValueBasedOnOperatorAndValueType(op, value, field.Value, field.Field.FieldValueType));
            }
        }
示例#18
0
        public static float CompareFieldOffsets(LookupType t1, LookupType t2, LookupModel lookupModel)
        {
            if (t1.Il2CppType == null || t2.Il2CppType == null)
            {
                return(1.0f);
            }

            float comparative_score = 1.0f;

            float score_penalty = comparative_score / t1.Fields.Count(f => !f.IsStatic && !f.IsLiteral);

            foreach (var f1 in t1.Fields.Select((Value, Index) => new { Value, Index }))
            {
                LookupField f2 = t2.Fields[f1.Index];
                if (f1.Value.Name == f2.Name)
                {
                    return(1.5f);
                }

                if (!Regex.Match(f1.Value.Name, lookupModel.NamingRegex).Success&& f1.Value.Name != f2.Name)
                {
                    return(0.0f);
                }

                if (f1.Value.IsStatic || f1.Value.IsLiteral)
                {
                    continue;
                }

                if (f1.Value.Offset != f2.Offset)
                {
                    comparative_score -= score_penalty;
                }
            }

            return(comparative_score);
        }
示例#19
0
        public static string ToFieldExport(this LookupField field)
        {
            string modifiers = $"[TranslatorFieldOffset(0x{field.Offset:X})]{(field.IsStatic ? " static" : "")}{(field.IsPublic ? " public" : "")}{(field.IsPrivate ? " private" : "")}";
            string fieldType = "";

            if (field.Type.IsArray)
            {
                fieldType = $"{field.Type.ElementType?.ToString() ?? "object"}[]";
            }
            else if (field.Type.IsGenericType && field.Type.GenericTypeParameters.Any())
            {
                fieldType = field.Type.Name.Split("`")[0] + "<";
                foreach (LookupType type in field.Type.GenericTypeParameters)
                {
                    fieldType += type.ToString() + (field.Type.GenericTypeParameters[field.Type.GenericTypeParameters.Count() - 1] != type ? ", " : "");
                }
                fieldType += ">";
            }
            else
            {
                fieldType = field.Type.ToString();
            }
            return($"        {modifiers} {fieldType} {field.Name};");
        }
示例#20
0
 /// <summary>
 /// Returns lookup field value as an item name instead of item ID.
 /// </summary>
 /// <returns></returns>
 public override string GetValue()
 {
     var lookupField = new LookupField(_field);
     var targetItem = lookupField.TargetItem;
     return targetItem != null ? targetItem.DisplayName.ToLowerInvariant() : String.Empty;
 }
示例#21
0
        private static void PrintField(Field field)
        {
            //Get the SystemMandatory of each Field
            Console.WriteLine("Field SystemMandatory: " + field.SystemMandatory);

            //Get the Webhook of each Field
            Console.WriteLine("Field Webhook: " + field.Webhook);

            //Get the JsonType of each Field
            Console.WriteLine("Field JsonType: " + field.JsonType);

            //Get the Object obtained Crypt instance
            Crypt crypt = field.Crypt;

            //Check if crypt is not null
            if (crypt != null)
            {
                //Get the Mode of the Crypt
                Console.WriteLine("Field Crypt Mode: " + crypt.Mode);

                //Get the Column of the Crypt
                Console.WriteLine("Field Crypt Column: " + crypt.Column);

                //Get the Table of the Crypt
                Console.WriteLine("Field Crypt Table: " + crypt.Table);

                //Get the Status of the Crypt
                Console.WriteLine("Field Crypt Status: " + crypt.Status);
            }

            //Get the FieldLabel of each Field
            Console.WriteLine("Field FieldLabel: " + field.FieldLabel);

            //Get the Object obtained ToolTip instance
            ToolTip tooltip = field.Tooltip;

            //Check if tooltip is not null
            if (tooltip != null)
            {
                //Get the Name of the ToolTip
                Console.WriteLine("Field ToolTip Name: " + tooltip.Name);

                //Get the Value of the ToolTip
                Console.WriteLine("Field ToolTip Value: " + tooltip.Value);
            }

            //Get the CreatedSource of each Field
            Console.WriteLine("Field CreatedSource: " + field.CreatedSource);

            //Get the FieldReadOnly of each Field
            Console.WriteLine("Field FieldReadOnly: " + field.FieldReadOnly);

            //Get the DisplayLabel of each Field
            Console.WriteLine("Field DisplayLabel: " + field.DisplayLabel);

            //Get the ReadOnly of each Field
            Console.WriteLine("Field ReadOnly: " + field.ReadOnly);

            //Get the Object obtained AssociationDetails instance
            AssociationDetails associationDetails = field.AssociationDetails;

            //Check if associationDetails is not null
            if (associationDetails != null)
            {
                //Get the Object obtained LookupField instance
                LookupField lookupField = associationDetails.LookupField;

                //Check if lookupField is not null
                if (lookupField != null)
                {
                    //Get the ID of the LookupField
                    Console.WriteLine("Field AssociationDetails LookupField ID: " + lookupField.Id);

                    //Get the Name of the LookupField
                    Console.WriteLine("Field AssociationDetails LookupField Name: " + lookupField.Name);
                }

                //Get the Object obtained LookupField instance
                LookupField relatedField = associationDetails.RelatedField;

                //Check if relatedField is not null
                if (relatedField != null)
                {
                    //Get the ID of the LookupField
                    Console.WriteLine("Field AssociationDetails RelatedField ID: " + relatedField.Id);

                    //Get the Name of the LookupField
                    Console.WriteLine("Field AssociationDetails RelatedField Name: " + relatedField.Name);
                }
            }

            if (field.QuickSequenceNumber != null)
            {
                //Get the QuickSequenceNumber of each Field
                Console.WriteLine("Field QuickSequenceNumber: " + field.QuickSequenceNumber);
            }

            if (field.BusinesscardSupported != null)
            {
                //Get the BusinesscardSupported of each Field
                Console.WriteLine("Field BusinesscardSupported: " + field.BusinesscardSupported);
            }

            //Check if MultiModuleLookup is not null
            if (field.MultiModuleLookup != null)
            {
                //Get the MultiModuleLookup map
                foreach (KeyValuePair <string, object> entry in field.MultiModuleLookup)
                {
                    //Get each value in the map
                    Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                }
            }

            //Get the Object obtained Currency instance
            Currency currency = field.Currency;

            //Check if currency is not null
            if (currency != null)
            {
                //Get the RoundingOption of the Currency
                Console.WriteLine("Field Currency RoundingOption: " + currency.RoundingOption);

                if (currency.Precision != null)
                {
                    //Get the Precision of the Currency
                    Console.WriteLine("Field Currency Precision: " + currency.Precision);
                }
            }

            //Get the ID of each Field
            Console.WriteLine("Field ID: " + field.Id);

            if (field.CustomField != null)
            {
                //Get the CustomField of each Field
                Console.WriteLine("Field CustomField: " + field.CustomField);
            }

            //Get the Object obtained Module instance
            Module lookup = field.Lookup;

            //Check if lookup is not null
            if (lookup != null)
            {
                //Get the Object obtained Layout instance
                Com.Zoho.Crm.API.Layouts.Layout layout = lookup.Layout;

                //Check if layout is not null
                if (layout != null)
                {
                    //Get the ID of the Layout
                    Console.WriteLine("Field ModuleLookup Layout ID: " + layout.Id);

                    //Get the Name of the Layout
                    Console.WriteLine("Field ModuleLookup Layout Name: " + layout.Name);
                }

                //Get the DisplayLabel of the Module
                Console.WriteLine("Field ModuleLookup DisplayLabel: " + lookup.DisplayLabel);

                //Get the APIName of the Module
                Console.WriteLine("Field ModuleLookup APIName: " + lookup.APIName);

                //Get the Module of the Module
                Console.WriteLine("Field ModuleLookup Module: " + lookup.Module_1);

                if (lookup.Id != null)
                {
                    //Get the ID of the Module
                    Console.WriteLine("Field ModuleLookup ID: " + lookup.Id);
                }
            }

            if (field.Visible != null)
            {
                //Get the Visible of each Field
                Console.WriteLine("Field Visible: " + field.Visible);
            }

            if (field.Length != null)
            {
                //Get the Length of each Field
                Console.WriteLine("Field Length: " + field.Length);
            }

            //Get the Object obtained ViewType instance
            ViewType viewType = field.ViewType;

            //Check if viewType is not null
            if (viewType != null)
            {
                //Get the View of the ViewType
                Console.WriteLine("Field ViewType View: " + viewType.View);

                //Get the Edit of the ViewType
                Console.WriteLine("Field ViewType Edit: " + viewType.Edit);

                //Get the Create of the ViewType
                Console.WriteLine("Field ViewType Create: " + viewType.Create);

                //Get the View of the ViewType
                Console.WriteLine("Field ViewType QuickCreate: " + viewType.QuickCreate);
            }

            //Get the Object obtained Module instance
            Module subform = field.Subform;

            //Check if subform is not null
            if (subform != null)
            {
                //Get the Object obtained Layout instance
                Com.Zoho.Crm.API.Layouts.Layout layout = subform.Layout;

                //Check if layout is not null
                if (layout != null)
                {
                    //Get the ID of the Layout
                    Console.WriteLine("Field Subform Layout ID: " + layout.Id);

                    //Get the Name of the Layout
                    Console.WriteLine("Field Subform Layout Name: " + layout.Name);
                }

                //Get the DisplayLabel of the Module
                Console.WriteLine("Field Subform DisplayLabel: " + subform.DisplayLabel);

                //Get the APIName of the Module
                Console.WriteLine("Field Subform APIName: " + subform.APIName);

                //Get the Module of the Module
                Console.WriteLine("Field Subform Module: " + subform.Module_1);

                if (subform.Id != null)
                {
                    //Get the ID of the Module
                    Console.WriteLine("Field Subform ID: " + subform.Id);
                }
            }

            //Get the APIName of each Field
            Console.WriteLine("Field APIName: " + field.APIName);

            //Get the Object obtained Unique instance
            Unique unique = field.Unique;

            //Check if unique is not null
            if (unique != null)
            {
                //Get the Casesensitive of the Unique
                Console.WriteLine("Field Unique Casesensitive in " + unique.Casesensitive);
            }

            if (field.HistoryTracking != null)
            {
                //Get the HistoryTracking of each Field
                Console.WriteLine("Field HistoryTracking: " + field.HistoryTracking);
            }

            //Get the DataType of each Field
            Console.WriteLine("Field DataType: " + field.DataType);

            //Get the Object obtained Formula instance
            Formula formula = field.Formula;

            //Check if formula is not null
            if (formula != null)
            {
                //Get the ReturnType of the Formula
                Console.WriteLine("Field Formula ReturnType:" + formula.ReturnType);

                if (formula.Expression != null)
                {
                    //Get the Expression of the Formula
                    Console.WriteLine("Field Formula Expression:" + formula.Expression);
                }
            }

            if (field.DecimalPlace != null)
            {
                //Get the DecimalPlace of each Field
                Console.WriteLine("Field DecimalPlace: " + field.DecimalPlace);
            }

            if (field.MassUpdate != null)
            {
                //Get the MassUpdate of each Field
                Console.WriteLine("Field MassUpdate: " + field.MassUpdate);
            }

            if (field.BlueprintSupported != null)
            {
                //Get the BlueprintSupported of each Field
                Console.WriteLine("Field BlueprintSupported: " + field.BlueprintSupported);
            }

            //Get all entries from the MultiSelectLookup instance
            MultiSelectLookup multiSelectLookup = field.Multiselectlookup;

            //Check if formula is not null
            if (multiSelectLookup != null)
            {
                //Get the DisplayValue of the MultiSelectLookup
                Console.WriteLine("Field MultiSelectLookup DisplayLabel: " + multiSelectLookup.DisplayLabel);

                //Get the LinkingModule of the MultiSelectLookup
                Console.WriteLine("Field MultiSelectLookup LinkingModule: " + multiSelectLookup.LinkingModule);

                //Get the LookupApiname of the MultiSelectLookup
                Console.WriteLine("Field MultiSelectLookup LookupApiname: " + multiSelectLookup.LookupApiname);

                //Get the APIName of the MultiSelectLookup
                Console.WriteLine("Field MultiSelectLookup APIName: " + multiSelectLookup.APIName);

                //Get the ConnectedlookupApiname of the MultiSelectLookup
                Console.WriteLine("Field MultiSelectLookup ConnectedlookupApiname: " + multiSelectLookup.ConnectedlookupApiname);

                //Get the ID of the MultiSelectLookup
                Console.WriteLine("Field MultiSelectLookup ID: " + multiSelectLookup.Id);
            }

            //Get the PickListValue of each Field
            List <PickListValue> pickListValues = field.PickListValues;

            //Check if formula is not null
            if (pickListValues != null)
            {
                foreach (PickListValue pickListValue in pickListValues)
                {
                    //Get the DisplayValue of each PickListValues
                    Console.WriteLine("Field PickListValue DisplayValue: " + pickListValue.DisplayValue);

                    if (pickListValue.SequenceNumber != null)
                    {
                        //Get the SequenceNumber of each PickListValues
                        Console.WriteLine(" Field PickListValue SequenceNumber: " + pickListValue.SequenceNumber);
                    }

                    //Get the ExpectedDataType of each PickListValues
                    Console.WriteLine("Field PickListValue ExpectedDataType: " + pickListValue.ExpectedDataType);

                    //Get the ActualValue of each PickListValues
                    Console.WriteLine("Field PickListValue ActualValue: " + pickListValue.ActualValue);

                    if (pickListValue.Maps != null)
                    {
                        foreach (Object map in pickListValue.Maps)
                        {
                            //Get each value from the map
                            Console.WriteLine(map);
                        }
                    }

                    //Get the SysRefName of each PickListValues
                    Console.WriteLine("Field PickListValue SysRefName: " + pickListValue.SysRefName);

                    //Get the Type of each PickListValues
                    Console.WriteLine("Field PickListValue Type: " + pickListValue.Type);
                }
            }

            //Get the AutoNumber of each Field
            AutoNumber autoNumber = field.AutoNumber;

            //Check if formula is not null
            if (autoNumber != null)
            {
                //Get the Prefix of the AutoNumber
                Console.WriteLine("Field AutoNumber Prefix: " + autoNumber.Prefix);

                //Get the Suffix of the AutoNumber
                Console.WriteLine("Field AutoNumber Suffix: " + autoNumber.Suffix);

                if (autoNumber.StartNumber != null)
                {
                    //Get the StartNumber of the AutoNumber
                    Console.WriteLine("Field AutoNumber StartNumber: " + autoNumber.StartNumber);
                }
            }

            if (field.DefaultValue != null)
            {
                //Get the DefaultValue of each Field
                Console.WriteLine("Field DefaultValue: " + field.DefaultValue);
            }

            if (field.SectionId != null)
            {
                //Get the SectionId of each Field
                Console.WriteLine("Field SectionId: " + field.SectionId);
            }

            //Check if ValidationRule is not null
            if (field.ValidationRule != null)
            {
                //Get the details map
                foreach (KeyValuePair <string, object> entry in field.ValidationRule)
                {
                    //Get each value in the map
                    Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                }
            }

            //Check if ConvertMapping is not null
            if (field.ConvertMapping != null)
            {
                //Get the details map
                foreach (KeyValuePair <string, object> entry in field.ConvertMapping)
                {
                    //Get each value in the map
                    Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                }
            }
        }
        /// <summary>
        /// Converts the field.
        /// </summary>
        /// <param name="field">The field.</param>
        /// <param name="writer">The writer.</param>
        private static void ConvertField(Field field, XmlTextWriter writer)
        {
            switch (field.Type.ToLower())
            {
                case "lookup":
                    LookupField lookupField = new LookupField(field);
                    if (lookupField.TargetItem != null)
                    {
                        string language = lookupField.TargetItem["Regional Iso Code"];
                        if (string.IsNullOrEmpty(language) || !UseRegionalIsoCodeForEnglish)
                        {
                            language = lookupField.TargetItem["Iso"];
                        }

                        if (!string.IsNullOrEmpty(language))
                        {
                            writer.WriteStartAttribute(field.Name, string.Empty);
                            writer.WriteString(language);
                            writer.WriteEndAttribute();
                        }
                    }

                    break;

                case "link":
                    LinkField link = new LinkField(field);
                    if (link.InternalPath != string.Empty)
                    {
                        writer.WriteStartAttribute(field.Name, string.Empty);
                        writer.WriteString(link.InternalPath);
                        writer.WriteEndAttribute();
                    }

                    break;

                case "checkbox":
                    CheckboxField checkbox = new CheckboxField(field);
                    if (field.Name == "mode")
                    {
                        if (!checkbox.Checked)
                        {
                            writer.WriteStartAttribute(field.Name, string.Empty);
                            writer.WriteString("off");
                            writer.WriteEndAttribute();
                        }
                    }
                    else
                    {
                        if (checkbox.Checked)
                        {
                            writer.WriteStartAttribute(field.Name, string.Empty);
                            writer.WriteString("true");
                            writer.WriteEndAttribute();
                        }
                    }

                    break;

                default:
                    if (field.Value != string.Empty)
                    {
                        writer.WriteStartAttribute(field.Name, string.Empty);
                        writer.WriteString(field.Value);
                        writer.WriteEndAttribute();
                    }

                    break;
            }
        }
示例#23
0
        protected override void CreateChildControls()
        {
            if (Field == null)
            {
                return;
            }
            base.CreateChildControls();
            SPFieldLookupValue fLookValue = (SPFieldLookupValue )this.ItemFieldValue;

            fldAction = (LookupField)TemplateContainer.FindControl("fldAction");

            if (this.ControlMode == SPControlMode.Display)
            {
                lblDisplayText = (Label)TemplateContainer.FindControl("lblDisplayText");

                if (lblDisplayText != null)
                {
                    if (fLookValue != null)
                    {
                        lblDisplayText.Text = fLookValue.LookupValue;// showText.TrimEnd(':');
                    }
                }
            }
            else
            {
                this.DropDownList1 = (DropDownList)TemplateContainer.FindControl("DropDownList1");
                this.ddlDes        = (DropDownList)TemplateContainer.FindControl("ddlDes");
                this.spanDesc      = (HtmlGenericControl )TemplateContainer.FindControl("spanDesc");
                this.spanTxtDesc   = (HtmlGenericControl )TemplateContainer.FindControl("spanTxtDesc");
                this.tblLevel      = (HtmlTable)TemplateContainer.FindControl("tblLevel");

                DropDownList1.AutoPostBack          = true;
                DropDownList1.SelectedIndexChanged += Ddl_SelectedIndexChanged;

                //CustomConcatenatedField field = (CustomConcatenatedField)base.Field;
                //新建或编辑值为空时,进行初始化填充
                if (fLookValue == null)
                {
                    if (ViewState["lastID"] != null)
                    {
                        string lastID = ViewState["lastID"].ToString();

                        InitControls(int.Parse(lastID));
                    }
                    else
                    {
                        InitControls();
                    }
                }
                else
                {
                    int id;//编辑过程中,更改选项
                    if (ViewState["lastID"] != null)
                    {
                        id = int.Parse(ViewState["lastID"].ToString());
                    }
                    else
                    {
                        id = fLookValue.LookupId;
                    }

                    //填充值
                    InitControls(id);
                }
            }
        }
        /// <summary>
        /// Converts the field.
        /// </summary>
        /// <param name="field">The field.</param>
        /// <param name="writer">The writer.</param>
        private static void ConvertField(Field field, XmlTextWriter writer)
        {
            switch (field.Type.ToLower())
            {
            case "lookup":
                LookupField lookupField = new LookupField(field);
                if (lookupField.TargetItem != null)
                {
                    string language = lookupField.TargetItem["Regional Iso Code"];
                    if (string.IsNullOrEmpty(language) || !UseRegionalIsoCodeForEnglish)
                    {
                        language = lookupField.TargetItem["Iso"];
                    }

                    if (!string.IsNullOrEmpty(language))
                    {
                        writer.WriteStartAttribute(field.Name, string.Empty);
                        writer.WriteString(language);
                        writer.WriteEndAttribute();
                    }
                }

                break;

            case "link":
                LinkField link = new LinkField(field);
                if (link.InternalPath != string.Empty)
                {
                    writer.WriteStartAttribute(field.Name, string.Empty);
                    writer.WriteString(link.InternalPath);
                    writer.WriteEndAttribute();
                }

                break;

            case "checkbox":
                CheckboxField checkbox = new CheckboxField(field);
                if (field.Name == "mode")
                {
                    if (!checkbox.Checked)
                    {
                        writer.WriteStartAttribute(field.Name, string.Empty);
                        writer.WriteString("off");
                        writer.WriteEndAttribute();
                    }
                }
                else
                {
                    if (checkbox.Checked)
                    {
                        writer.WriteStartAttribute(field.Name, string.Empty);
                        writer.WriteString("true");
                        writer.WriteEndAttribute();
                    }
                }

                break;

            default:
                if (field.Value != string.Empty)
                {
                    writer.WriteStartAttribute(field.Name, string.Empty);
                    writer.WriteString(field.Value);
                    writer.WriteEndAttribute();
                }

                break;
            }
        }
示例#25
0
 /// <inheritdoc />
 /// <summary>
 /// Initializes a new instance of the <see cref="LookupProperty"/> class.
 /// </summary>
 /// <param name="field">The field to wrap.</param>
 public LookupProperty(Field field)
     : base(field)
 {
     _lookupField = field;
 }
        protected static string getFriendlyFieldValue(string name, Item itemElement, int iMaxLength)
        {
            Field field = itemElement.Fields[name];

            if (field != null)
            {
                switch (field.TypeKey)
                {
                case "date":
                case "datetime":
                    return(formatDateField(itemElement, field.ID));

                case "droplink":
                case "droptree":
                case "reference":
                case "grouped droplink":
                    LookupField lookupFld = (LookupField)field;
                    if (lookupFld != null && lookupFld.TargetItem != null)
                    {
                        return(lookupFld.TargetItem.Name);
                    }
                    break;

                case "checklist":
                case "multilist":
                case "treelist":
                case "treelistex":
                    MultilistField multilistField = (MultilistField)field;
                    if (multilistField != null)
                    {
                        StringBuilder strBuilder = new StringBuilder();
                        foreach (Item item in multilistField.GetItems())
                        {
                            strBuilder.AppendFormat("{0}, ", item.Name);
                        }
                        return(StringUtil.Clip(strBuilder.ToString().TrimEnd(',', ' '), iMaxLength, true));
                    }
                    break;

                case "link":
                case "general link":
                    LinkField lf = new LinkField(field);
                    switch (lf.LinkType)
                    {
                    case "media":
                    case "internal": return(lf.TargetItem.Paths.ContentPath);

                    case "anchor":
                    case "mailto":
                    case "external": return(lf.Url);

                    default:
                        return(lf.Text);
                    }

                default:
                    return(StringUtil.Clip(field.Value, iMaxLength, true));
                }
            }
            return(String.Empty);
        }
示例#27
0
        private Item GetNextItem(Item item)
        {
            LookupField address = (LookupField)item.Fields["Next Question To Point"];

            return(address?.TargetItem);
        }
示例#28
0
    public static void PopulateLookupFields(Field field)
    {
        if (string.IsNullOrEmpty(field.LookupTable))
        {
            return;
        }
        DataProvider provider = DataService.Providers["MyProvider"];

        if (Path.HasExtension(field.LookupTable))
        {
            field.LookupTable = Path.GetExtension(field.LookupTable).Substring(1);
        }
        Query qry = new Query(DataService.GetSchema(field.LookupTable, provider.Name, TableType.Table));

        qry.SelectList = field.LinkField;
        if (field.LinkField != field.DisplayField)
        {
            qry.SelectList += "," + field.DisplayField;
        }
        if (field.UseCategory && !string.IsNullOrEmpty(field.CategoryControlField))
        {
            qry.SelectList += "," + field.CategoryControlField;
        }
        if (!string.IsNullOrEmpty(field.Where))
        {
            qry.WHERE(field.Where);
        }

        if (field.Parent != null && field.Parent.Value != null && !string.IsNullOrEmpty(field.Parent.Value.ToString()))
        {
            qry.WHERE(field.CategoryControlField, field.Parent.Value);
        }

        if (field.Unique)
        {
            qry.DISTINCT();
        }

        if (!string.IsNullOrEmpty(field.OrderBy))
        {
            if (field.Desc)
            {
                qry.OrderBy = SubSonic.OrderBy.Desc(field.OrderBy);
            }
            else
            {
                qry.OrderBy = SubSonic.OrderBy.Asc(field.OrderBy);
            }
        }

        field.LookupFields.Clear();
        string[] values = null;
        if (field.Multiselect)
        {
            if (field.Value != null)
            {
                values = field.Value.ToString().Split(new char[] { ',' });
            }
        }


        IDataReader reader = qry.ExecuteReader();

        while (reader.Read())
        {
            LookupField newField = null;
            object      link     = reader[0] ?? string.Empty;
            if (field.LinkField != field.DisplayField)
            {
                object display = reader[1] ?? string.Empty;
                newField = new LookupField(link.ToString(),
                                           display.ToString());
            }
            else
            {
                newField = new LookupField(link.ToString(),
                                           link.ToString());
            }
            object val = field.Value ?? string.Empty;
            if (field.Multiselect && values != null)
            {
                foreach (string msvalue in values)
                {
                    if (link.ToString() == msvalue)
                    {
                        newField.Selected = true;
                    }
                }
            }
            else
            {
                if (link.ToString() == val.ToString())
                {
                    newField.Selected = true;
                }
            }
            field.LookupFields.Add(newField);
        }
        reader.Close();
    }
		/// <summary>
		/// Initializes a new instance of the <see cref="LookupProperty"/> class.
		/// </summary>
		/// <param name="field">The field to wrap.</param>
		public LookupProperty(Field field)
			: base(field)
		{
			this.lookupField = field;
		}
示例#30
0
        private Element CreateFieldElement(FieldBaseType obj)
        {
            if (obj.GetType() == typeof(EnumField))
            {
                EnumField field     = obj as EnumField;
                Element   enumField = new Element
                {
                    ctrlType           = ctlEnum,
                    label              = field.Label,
                    enumOptions        = field.Options,
                    defaultValue       = field.DefaultValue ?? "",
                    defaultSearchValue = field.DefaultSearchValue ?? "",
                    readOnly           = field.ReadOnly,
                    required           = field.Required,
                    columnName         = field.ColumnName,
                    searchable         = field.Searchable,
                    modifyEnable       = field.ModifyEnabled,
                    hiddenField        = field.HiddenField,
                    clientId           = field.ClientId,
                    resultVisibility   = field.ResultVisibility,
                    resultPosition     = field.ResultPosition,
                    multipleValues     = field.MultipleValues
                };
                if (field.Layout != null)
                {
                    enumField.rows    = field.Layout.RowNumber;
                    enumField.columns = field.Layout.ColNumber;
                }

                return(enumField);
            }

            if (obj.GetType() == typeof(StatusField))
            {
                StatusField field       = obj as StatusField;
                Element     statusField = new Element
                {
                    ctrlType           = ctlStatus,
                    label              = field.Label,
                    statusType         = field.Options,
                    defaultValue       = field.DefaultValue ?? "",
                    defaultSearchValue = field.DefaultSearchValue ?? "",
                    readOnly           = field.ReadOnly,
                    required           = field.Required,
                    columnName         = field.ColumnName,
                    searchable         = field.Searchable,
                    modifyEnable       = field.ModifyEnabled,
                    hiddenField        = field.HiddenField,
                    clientId           = field.ClientId,
                    resultVisibility   = field.ResultVisibility,
                    resultPosition     = field.ResultPosition
                };
                if (field.Layout != null)
                {
                    statusField.rows    = field.Layout.RowNumber;
                    statusField.columns = field.Layout.ColNumber;
                }

                return(statusField);
            }

            if (obj.GetType() == typeof(TextField))
            {
                TextField field     = obj as TextField;
                Element   textField = new Element
                {
                    ctrlType           = ctlText,
                    label              = field.Label,
                    multiLine          = field.Multiline,
                    HTMLEnable         = field.HTMLEnable,
                    defaultValue       = field.DefaultValue ?? "",
                    defaultSearchValue = field.DefaultSearchValue ?? "",
                    readOnly           = field.ReadOnly,
                    required           = field.Required,
                    columnName         = field.ColumnName,
                    searchable         = field.Searchable,
                    modifyEnable       = field.ModifyEnabled,
                    hiddenField        = field.HiddenField,
                    clientId           = field.ClientId,
                    resultVisibility   = field.ResultVisibility,
                    resultPosition     = field.ResultPosition
                };
                if (field.Layout != null)
                {
                    textField.rows    = field.Layout.RowNumber;
                    textField.columns = field.Layout.ColNumber;
                }

                return(textField);
            }

            if (obj.GetType() == typeof(DateField))
            {
                DateField field   = obj as DateField;
                Element   element = new Element
                {
                    ctrlType           = ctlDate,
                    label              = field.Label,
                    defaultSearchValue = field.DefaultSearchValue.ToString("dd/MM/yyyy") ?? "",
                    restrictedYear     = field.RestrictedYear,
                    enableDefaultDate  = field.DefaultTodayEnabled,
                    readOnly           = field.ReadOnly,
                    required           = field.Required,
                    columnName         = field.ColumnName,
                    searchable         = field.Searchable,
                    modifyEnable       = field.ModifyEnabled,
                    hiddenField        = field.HiddenField,
                    clientId           = field.ClientId,
                    resultVisibility   = field.ResultVisibility,
                    resultPosition     = field.ResultPosition
                };

                element.defaultValue = "";
                if (field.DefaultValueSpecified && field.DefaultValue != DateTime.MinValue)
                {
                    element.defaultValue = field.DefaultValue.ToString("dd/MM/yyyy");
                }

                if (field.Layout != null)
                {
                    element.rows    = field.Layout.RowNumber;
                    element.columns = field.Layout.ColNumber;
                }

                return(element);
            }

            if (obj.GetType() == typeof(NumberField))
            {
                NumberField field       = obj as NumberField;
                Element     numberField = new Element
                {
                    ctrlType     = ctlNumber,
                    label        = field.Label,
                    defaultValue = field.DefaultValueSpecified == true?field.DefaultValue.ToString() : "",
                                       readOnly         = field.ReadOnly,
                                       required         = field.Required,
                                       columnName       = field.ColumnName,
                                       searchable       = field.Searchable,
                                       modifyEnable     = field.ModifyEnabled,
                                       hiddenField      = field.HiddenField,
                                       clientId         = field.ClientId,
                                       resultVisibility = field.ResultVisibility,
                                       resultPosition   = field.ResultPosition,
                                       format           = field.Format
                };
                if (field.MinValueSpecified)
                {
                    numberField.minValue = field.MinValue;
                }
                if (field.MaxValueSpecified)
                {
                    numberField.maxValue = field.MaxValue;
                }
                if (field.Layout != null)
                {
                    numberField.rows    = field.Layout.RowNumber;
                    numberField.columns = field.Layout.ColNumber;
                }
                return(numberField);
            }

            if (obj.GetType() == typeof(BoolField))
            {
                BoolField field     = obj as BoolField;
                Element   boolField = new Element
                {
                    ctrlType         = ctlCheckbox,
                    label            = field.Label,
                    defaultValue     = field.DefaultValue == true && field.DefaultValueSpecified ? "True" : "",
                    readOnly         = field.ReadOnly,
                    required         = field.Required,
                    columnName       = field.ColumnName,
                    searchable       = field.Searchable,
                    modifyEnable     = field.ModifyEnabled,
                    hiddenField      = field.HiddenField,
                    clientId         = field.ClientId,
                    resultVisibility = field.ResultVisibility,
                    resultPosition   = field.ResultPosition
                };
                if (field.Layout != null)
                {
                    boolField.rows    = field.Layout.RowNumber;
                    boolField.columns = field.Layout.ColNumber;
                }
                return(boolField);
            }

            if (obj.GetType() == typeof(LookupField))
            {
                LookupField field  = obj as LookupField;
                Element     lookup = new Element
                {
                    ctrlType             = ctlLookup,
                    label                = field.Label,
                    required             = field.Required,
                    columnName           = field.ColumnName,
                    lookupRepositoryName = field.LookupArchiveName,
                    lookupFieldName      = field.LookupArchiveColumnName == "_subject" ? "Oggetto" : field.LookupArchiveColumnName,
                    searchable           = field.Searchable,
                    modifyEnable         = field.ModifyEnabled,
                    hiddenField          = field.HiddenField,
                    clientId             = field.ClientId,
                    resultVisibility     = field.ResultVisibility,
                    resultPosition       = field.ResultPosition,
                    multipleValues       = field.MultipleValues
                };
                if (field.Layout != null)
                {
                    lookup.rows    = field.Layout.RowNumber;
                    lookup.columns = field.Layout.ColNumber;
                }
                return(lookup);
            }

            return(null);
        }
        private static string GetEnumFieldValue(LookupField field)
        {
            var enumItem = field?.TargetItem;

            return(enumItem?.Fields[Sitecore.XA.Foundation.Common.Templates.Enum.Fields.Value].Value);
        }
 /// <summary>
 /// </summary>
 /// <returns>
 /// </returns>
 public override string GetValue()
 {
     var targetItem = new LookupField(_field).TargetItem;
     return targetItem.IsNotNull() ? targetItem.Name.ToLowerInvariant() : string.Empty;
 }
        public static string GetUDSValue(FieldBaseType field)
        {
            string ret = string.Empty;

            if (field is StatusField)
            {
                StatusField rField = field as StatusField;
                if (!string.IsNullOrEmpty(rField.Value))
                {
                    ret = rField.Value;
                }
                return(ret);
            }
            if (field is LookupField)
            {
                LookupField rField = field as LookupField;
                if (!string.IsNullOrEmpty(rField.Value))
                {
                    ret = string.Join(", ", JsonConvert.DeserializeObject <string[]>(rField.Value));
                }
                return(ret);
            }
            if (field is EnumField)
            {
                EnumField rField = field as EnumField;
                if (!string.IsNullOrEmpty(rField.Value))
                {
                    ret = string.Join(", ", JsonConvert.DeserializeObject <string[]>(rField.Value));
                }
                return(ret);
            }
            if (field is NumberField)
            {
                NumberField rField = field as NumberField;
                if (rField.Value != double.MinValue)
                {
                    ret = rField.Value.ToString(rField.Format);
                }
                return(ret);
            }
            if (field is BoolField)
            {
                BoolField rField = field as BoolField;
                ret = rField.Value ? "vero" : "falso";
                return(ret);
            }
            if (field is DateField)
            {
                DateField rField = field as DateField;
                if (rField.Value != DateTime.MinValue)
                {
                    ret = rField.Value.ToLongDateString();
                    if (rField.RestrictedYear)
                    {
                        ret = rField.Value.Year.ToString();
                    }
                }
                return(ret);
            }
            if (field is TextField)
            {
                TextField rField = field as TextField;
                ret = rField.Value;
            }
            return(ret);
        }
 /// <summary>
 /// </summary>
 /// <returns>
 /// </returns>
 public override string GetValue()
 {
     var targetItem = new LookupField(_field).TargetItem;
     return targetItem.IsNotNull() ? targetItem.Name.ToLowerInvariant() : string.Empty;
 }