public void CreateItemWithShowInMenuTrueShouldReturnItemNavigationTitle() { FieldList stubFieldList = new FieldList(); Item stub = new ContentItem(stubFieldList); string navigationTitle = ResultFactory.Create(stub); Assert.AreEqual("NavigationTitle", navigationTitle); }
public void WhenReferencedProcessIsVersioningEnabled_VerionDateAndVersionNumberFieldsShouldBeAdded_CR() { // Arrange. var done = false; var fieldList = new FieldList { IsVersioningEnabled = true }; var vm = CreateReverseCrossRefDisplayFieldViewModel(); Mock.Arrange(() => FieldList.BeginGetCrossReferenceSubfields(ReferencedProcessName, FieldName, Arg.IsAny<EventHandler<DataPortalResult<FieldList>>>())) .DoInstead<string, string, EventHandler<DataPortalResult<FieldList>>>((process, field, action) => action(null, new DataPortalResult<FieldList>(fieldList, null, null))); // Act. vm.LoadSubFields(() => { done = true; }); // Assert. EnqueueConditional(() => done); EnqueueCallback( () => { Assert.IsTrue(vm.Subfields.Any(f => f.SystemName == Constants.VersionNumber)); Assert.IsTrue(vm.Subfields.Any(f => f.SystemName == Constants.VersionDate)); }); EnqueueTestComplete(); }
public TestItem(FieldList fieldList, string itemName = "dummy") : base(new ID(new Guid()), new ItemData(new ItemDefinition(new ID(new Guid()), itemName, new ID(new Guid()), new ID(new Guid())), Language.Invariant, new Sitecore.Data.Version(1), fieldList), TestDatabaseFactory.Create()) { }
public static BoolList BuildFromFieldList(FieldList param) { if (param == null) return null; else return new BoolList(param.Escape, BuildFromFieldList(param.Tail)); }
public void ProcessShouldSetAreaControllerRendererIfDescendantOfAreaControllerTemplate() { // Arrange var builder = new Template.Builder("Area Controller Template", Constants.Templates.AreaController, new TemplateCollection()); var fieldList = new FieldList { {Constants.Fields.Controller.Action, "Index"}, {Constants.Fields.Controller.Name, "HelloWorld"}, {Constants.Fields.Controller.Area, "MyArea"}, {Constants.Fields.Controller.UseChildActionBehavior, "1"} }; var innerItem = new TestItem(fieldList); var rendering = new Rendering { RenderingItem = new RenderingItem(innerItem)}; _args.Rendering = rendering; _args.RenderingTemplate = builder.Template; _controller.ControllerRunner = new Mock<IControllerRunner>().Object; // Act _controller.Process(_args); // Assert Assert.That(_args.Result, Is.InstanceOf<AreaControllerRenderer>(), "Rendering should be an AreaControllerRenderer"); }
public ColumnInfo( ObjectMap objectMap, string[] columnNames ) { this.columnNames = columnNames; columnComboHashCode = ObjectConstructor.GetFieldComboHashCode( columnNames ); fields = new FieldList(); for( int i = 0; i < columnNames.Length; i++ ) { string columnName = columnNames[ i ]; FieldMap fm = objectMap.GetFieldMapFromColumn( columnName ); if( fm == null ) { // check for column names with table name prefixes int pos = columnName.IndexOf( '.' ); if( pos > 0 ) { columnName = columnName.Substring( pos + 1, columnName.Length - pos - 1 ); fm = objectMap.GetFieldMapFromColumn( columnName ); if( fm != null ) { columnNames[ i ] = columnName; } } if( fm == null ) // no corresponding member could be found - assume column is calculated { columnCalculatedMask |= 1 << i; } } fields.Add( fm ); // intentionally add null entries to preserve column order } }
public FieldList(Position pos, Symbol name, Symbol type, FieldList tail) { Pos = pos; Name = name; Type = type; Tail = tail; }
public void FakeItemAddFieldShouldReturnField(FieldList fieldList,string fieldValue) { var fieldId = ID.NewID; fieldList.Add(fieldId,fieldValue); var fake = new FakeItem(fieldList); fake[fieldId].ShouldBeEquivalentTo(fieldValue); }
public void CreateItemWithShowInMenuFalseShouldReturnEmptyString() { FieldList stubFieldList = new FieldList(); Item stub = new ContentItem(stubFieldList); string navigationTitle = ResultFactory.Create(stub); Assert.IsNotNull(navigationTitle); }
public virtual void Process(GetItemFieldsArgs args) { Assert.ArgumentNotNull(args, "args"); Assert.ArgumentNotNull(args.ItemDefinition, "args.ItemDefinition"); Assert.ArgumentNotNull(args.Context, "args.Context"); var itemId = args.ItemDefinition.ID; var fields = new FieldList(); var owner = typeof(ContactFacetDataProvider).Name; fields.Add(Sitecore.FieldIDs.CreatedBy, owner); fields.Add(Sitecore.FieldIDs.Owner, owner); if (IDTableHelper.IsFacetItem(itemId)) { var facetName = IDTableHelper.GetFacetName(itemId); fields.Add(Sitecore.FieldIDs.DisplayName, facetName); fields.Add(Sitecore.Strategy.Contacts.DataProviders.FieldIDs.ContactFacetName, facetName); var contractType = ContactFacetHelper.GetContractTypeForFacet(facetName); if (contractType != null) { fields.Add(Sitecore.Strategy.Contacts.DataProviders.FieldIDs.ContactFacetContract, contractType.AssemblyQualifiedName); if (ContactFacetHelper.ContactFacetImplementations.ContainsKey(contractType)) { var implType = ContactFacetHelper.ContactFacetImplementations[contractType]; if (implType != null) { fields.Add(Sitecore.Strategy.Contacts.DataProviders.FieldIDs.ContactFacetImplementation, implType.AssemblyQualifiedName); } } } } if (IDTableHelper.IsFacetMemberItem(itemId)) { var memberName = IDTableHelper.GetFacetMemberName(itemId); fields.Add(Sitecore.FieldIDs.DisplayName, memberName); fields.Add(Sitecore.Strategy.Contacts.DataProviders.FieldIDs.ContactFacetMemberName, memberName); var facetId = IDTableHelper.GetFacetMemberParentId(itemId); var facetName = IDTableHelper.GetFacetName(facetId); var memberType = ContactFacetHelper.GetFacetMemberType(facetName, memberName); if (memberType != null) { fields.Add(Sitecore.Strategy.Contacts.DataProviders.FieldIDs.ContactFacetMemberType, memberType.AssemblyQualifiedName); } } if (IDTableHelper.IsFacetMemberValueItem(itemId)) { var value = IDTableHelper.GetFacetMemberValue(itemId); if (!string.IsNullOrEmpty(value)) { fields.Add(Sitecore.Strategy.Contacts.DataProviders.FieldIDs.ContactFacetMemberValueValue, value); } var description = IDTableHelper.GetFacetMemberValueDescription(itemId); if (!string.IsNullOrEmpty(description)) { fields.Add(Sitecore.FieldIDs.DisplayName, description); fields.Add(Sitecore.Strategy.Contacts.DataProviders.FieldIDs.ContactFacetMemberValueDescription, description); } } args.FieldList = fields; }
public FakeItem(FieldList fieldList, ID itemid, ID templateId, string itemName = DefaultitemName, string databaseName = DefaultDatabaseName) : base(itemid, new ItemData(new ItemDefinition(ID.NewID, itemName, templateId, ID.NewID), Globalization.Language.Invariant, new Data.Version(1), fieldList), new Database(databaseName)) { FakeChildren = new ItemList(); }
public Resolve(string name, params string[] shows) { Name = name; Show = new FieldList(); foreach (var show in shows) { Show.Add(show); } }
public FunctionDeclaration(Position pos, Symbol name, FieldList param, NameType result, Expression body, FunctionDeclaration next) { Pos = pos; Name = name; Param = param; Result = result; Body = body; Next = next; }
public void FakeItemGetFieldFromIdShoudlReturnFieldValue(string fieldValue, FieldList fieldList) { var fieldId = ID.NewID; fieldList.Add(fieldId, fieldValue); var fake = new FakeItem(fieldList); fake[fieldId].ShouldAllBeEquivalentTo(fieldValue); }
public void FakeItemAddMultipleFieldShouldReturnField(FieldList fieldList, string fieldValue) { var fieldIdOne = ID.NewID; var fieldIdTwo = ID.NewID; fieldList.Add(fieldIdOne, fieldValue); fieldList.Add(fieldIdTwo, fieldValue); var fake = new FakeItem(fieldList); fake.Fields.Should().HaveCount(2); }
public DataRequest() { Verb = "get"; Start = -1; Limit = 0; Parameters = new ParameterList(); Resolves = new ResolveList(); Joins = new List<Join>(); Show = new FieldList(); Hide = new FieldList(); Sort = new FieldList(); }
public static Item CreateInstance(string itemName, ID itemId, ID templateId, FieldList fields, Database database, Language language, Version version) { Assert.ArgumentNotNullOrEmpty(itemName, "itemName"); Assert.ArgumentNotNull(itemId, "itemId"); Assert.ArgumentNotNull(templateId, "templateId"); Assert.ArgumentNotNull(fields, "fields"); Assert.ArgumentNotNull(database, "database"); Assert.ArgumentNotNull(language, "language"); Assert.ArgumentNotNull(version, "version"); return new ItemWrapper(itemId, new ItemData(new ItemDefinition(itemId, itemName, templateId, ID.Null), language, version, fields), database); }
public void Return_null_if_analysis_overview_information_is_missing() { var requestData = new RequestData(); var fieldList = new FieldList(); fieldList.AddField("Foo", "Bar"); requestData.Add(DataKey.Item, fieldList); _requestDataProvider.Setup(x => x.GetData()).Returns(requestData); var data = _sut.GetData(null); Assert.Null(data); }
public static void MakeHeader(FieldList fields, StringBuilder sb) { for (int i = 0; i < fields.Count; i++) { Field f = fields[i]; f.RenderTo(sb, f.Title, ";"); if ((i + 1) < fields.Count) { sb.Append(";"); } } sb.AppendLine(""); }
public void ItemTest() { var demo = new Demo(); var fieldId = demo.FieldName; const string fieldValue = "demoText"; var stubList = new FieldList {{fieldId, fieldValue}}; var fakeItem = new FakeItem(stubList); var item = fakeItem; demo.GetField(item).ShouldAllBeEquivalentTo(fieldValue); }
public static void AddRow(FieldList fields, StringBuilder sb, Dictionary<String, String> dic) { for (int i = 0; i < fields.Count; i++) { Field f = fields[i]; f.AppendValueTo(sb, dic); if ((i + 1) < fields.Count) { sb.Append(";"); } } sb.AppendLine(""); }
private static FieldList GetPageMode() { var data = new FieldList(); data.AddField("IsDebugging", Context.PageMode.IsDebugging); data.AddField("IsNormal", Context.PageMode.IsNormal); data.AddField("IsPageEditor", Context.PageMode.IsPageEditor); data.AddField("IsPageEditorEditing", Context.PageMode.IsPageEditorEditing); data.AddField("IsPreview", Context.PageMode.IsPreview); data.AddField("IsProfiling", Context.PageMode.IsProfiling); data.AddField("IsSimulatedDevicePreviewing", Context.PageMode.IsSimulatedDevicePreviewing); return data; }
private void AddProductPriceFieldsForPriceGroups(Product product, FieldList list) { var priceGroups = PriceGroup.Find(x => !x.Deleted).ToList(); var productPriceRepository = ObjectFactory.Instance.Resolve <IRepository <ProductPrice> >(); var userServie = ObjectFactory.Instance.Resolve <IUserService>(); var productPrices = productPriceRepository.Select(x => x.Product == product && x.MinimumQuantity == 1); foreach (var priceGroup in priceGroups) { var singlePriceForProductAndPriceGroup = productPrices.FirstOrDefault(x => x.Price.PriceGroup == priceGroup); AddProductPriceFieldAndValue(singlePriceForProductAndPriceGroup, list, userServie.GetCurrentUserCulture().NumberFormat); } }
/// <summary> /// Get a list of all the item's fields and their values. /// </summary> /// <param name="itemDefinition">Used to identify the particular item</param> /// <param name="versionUri">The language and version of the item to get field values for</param> /// <param name="context"></param> /// <returns></returns> public override FieldList GetItemFields(ItemDefinition itemDefinition, VersionUri versionUri, CallContext context) { Item result = Items.FindOneById(itemDefinition.ID.ToGuid()); if (result != null && result.FieldValues != null) { FieldList fields = new FieldList(); foreach (KeyValuePair <FieldValueId, string> fieldValue in result.FieldValues.Where(fv => fv.Key.Matches(versionUri))) { fields.Add(new ID(fieldValue.Key.FieldId), fieldValue.Value); } return(fields); } return(null); }
public FieldList GetFieldList(string language, int version, bool force) { string fieldListKey = this.GetFieldListKey(language, version); FieldList list = this._fieldLists[fieldListKey]; if (list != null) { return(list); } if (!force) { return(null); } return(this.AddFieldList(language, version)); }
private static FieldList GetItemVisualization() { var itemVisualization = Context.Item.Visualization; var device = Context.Device; var layoutItem = itemVisualization.GetLayout(device); var renderings = itemVisualization.GetRenderings(device, true); var data = new FieldList(); data.AddField("Layout", GetLayout(layoutItem).Fields); data.AddField("Renderings", GetRenderings(renderings)); return(data); }
public override void RemoveTrailingDelimiters(RemoveDelimitersOptions options) { foreach (var field in FieldList) { field.RemoveTrailingDelimiters(options); } if (options.Fields) { while (FieldList.Count > 1 && FieldList[FieldList.Count - 1].SerializeValue() == string.Empty) { FieldList.RemoveAt(FieldList.Count - 1); } } }
private static FieldList GetCulture(CultureInfo culture) { var data = new FieldList(); data.AddField("Name", culture.Name); data.AddField("Parent", culture.Parent); data.AddField("Display Name", culture.DisplayName); data.AddField("English Name", culture.EnglishName); data.AddField("Native Name", culture.NativeName); data.AddField("Two Letter ISO Language Name", culture.TwoLetterISOLanguageName); data.AddField("Three Letter Windows Language Name", culture.ThreeLetterWindowsLanguageName); data.AddField("Three Letter ISO Language Name", culture.ThreeLetterISOLanguageName); return(data); }
public void FieldAddingLinkFieldWithLinkFromOneItemToAnotherTargetItemShouldReturnLinkedToItem() { var linkedToItem = new FakeItem(); var fakeLinkField = new FakeInternalLinkField(linkedToItem); var fieldId = ID.NewID; var fieldCollection = new FieldList(); fieldCollection.Add(fieldId,fakeLinkField.ToString()); var itemToLinkFrom = new FakeItem(fieldCollection); var sitecoreLinkField = (LinkField) itemToLinkFrom.Fields[fieldId]; sitecoreLinkField.TargetItem.ID.ShouldBeEquivalentTo(linkedToItem.ID); }
public void AddAllNumberBlockCondition(int toNumber, int xFrom, int xTo, int yFrom, int yTo) { Fields ConditionFields = new Fields(); for (int x = xFrom; x <= xTo; x++) { for (int y = yFrom; y <= yTo; y++) { ConditionFields.Add(FieldList.At(x, y)); } } AllNumberCondition cnd = new AllNumberCondition(toNumber, ConditionFields); Conditions.Add(cnd); }
protected override IDictionary <string, object> GetFilter() { NodeViewModel node = GetOperationNode(); int indexFiled = FieldList.IndexOf(SelectedFiled); var dicFilter = new Dictionary <string, object> { { "SearchField", indexFiled == -1 ? 1 : indexFiled }, { "SearchValue", SelectedFiledValue }, { "pageIndex", PageIndex }, { "pageSize", PageSize }, { "orgid", node.OrgId } }; return(dicFilter); }
public void Unpack(FieldList source) { if (source == null) { return; } UnpackDefinitionID(source); // loading actions Events.Load(source, DefAgentFieldID.ApplicationEventActionSet); // done IsUnpacked = true; }
public void AddSumBlockCondition(int Sum, int xFrom, int xTo, int yFrom, int yTo) { Fields ConditionFields = new Fields(); for (int x = xFrom; x <= xTo; x++) { for (int y = yFrom; y <= yTo; y++) { ConditionFields.Add(FieldList.At(x, y)); } } SumCondition cnd = new SumCondition(Sum, ConditionFields); Conditions.Add(cnd); }
/// <summary> /// This call lists the fields defined in a pipeline. Remember, this is only the definition of the fields - to change the value of the field for a specific box, use the edit field for box endpoint. /// </summary> /// <param name="pipelineKey">The key of the pipeline</param> /// <returns></returns> /// <exception cref="ArgumentNullException">Please specify a pipeline key!</exception> public FieldList ListFieldsInPipeline(string pipelineKey) { if (string.IsNullOrEmpty(pipelineKey)) { throw new ArgumentNullException(nameof(pipelineKey), "Please specify a pipeline key!"); } var fieldList = new FieldList { RawApiResponse = _rawFieldServices.ListFieldsInPipeline(pipelineKey) }; fieldList.Fields = JsonConvert.DeserializeObject <List <Field> >(fieldList.RawApiResponse.Json); fieldList.RawApiResponse = GetRawApiResponseOrNull(fieldList.RawApiResponse); return(fieldList); }
public XElement GetQueryXml(WorkItemContext context, FieldList fields) { var parser = new LexalParser(this.QueryText); var nodes = parser.ProcessWherePart(); nodes.Optimize(); nodes.ExtractOperatorForward(); nodes.FixFields(fields); nodes.FillFieldTypes(fields); var manager = new ParameterManager(context); manager.EvalParameters(nodes); var xmlTransformer = new NodesToXml(nodes); return XElement.Parse(xmlTransformer.WriteXml()); }
public bool Equals(FieldList other) { if (other == null || this.Count != other.Count) { return(false); } for (int i = this.Count - 1; i >= 0; i--) { if (!this[i].Equals(other[i])) { return(false); } } return(true); }
public virtual FieldList GetFieldList(ID templateId, string itemName) { Assert.ArgumentCondition(!ID.IsNullOrEmpty(templateId), "templateId", "Value cannot be null."); var template = this.GetFakeTemplate(templateId); Assert.IsNotNull(template, "Template '{0}' not found.", templateId); var fields = new FieldList(); foreach (var field in template.Fields) { fields.Add(field.ID, string.Empty); } return fields; }
public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false) { if (rootNode == null) { return; } _xDoc = xDoc; XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this); XmlNodeList fields = XmlGetter.Children(rootNode, "Field"); int count = 0; foreach (XmlNode field in fields) { XmlCommandField xField = new XmlCommandField(null); xField.LoadXml(xDoc, field, refLoad); FieldList.Add(xField.Name, xField); if (xField.FieldType == FieldTypes.DataSize) { _dataSizeField = xField; } else if (xField.Name.ToLower().Equals("id")) { _idField = xField; } else if (xField.Name.ToLower().Equals("tag")) { _tagField = xField; } addItem(count++, xField.DataSize, true); } setBuffSize(); int offset = 0; foreach (XmlCommandField field in FieldList.Values) { field.SetTargetBuffer(this.buffer, offset); field.Data = field.Data; offset += field.DataSize; } /* * XmlCommandFields xmlFields = new XmlCommandFields(null); * xmlFields.LoadXml(xDoc, fields, refLoad); */ }
public PaintStyle(FieldList source, Enum sourceID) : this() { if ((source != null) && (sourceID != null)) { PaletteEntryType pst = (PaletteEntryType)(source[sourceID].AsByte() ?? (byte)PaletteEntryType.Inherited); switch (pst) { case PaletteEntryType.Inherited: default: StyleType = PaletteEntryType.Inherited; break; case PaletteEntryType.DoNotPaint: StyleType = PaletteEntryType.DoNotPaint; break; case PaletteEntryType.Colour: { StyleType = PaletteEntryType.Colour; Int32Field field = source.GetNextItemAfter <Int32Field>(sourceID, DefAgentFieldID.PaintStyleData); if (field != null) { Data = field.Data; } break; } case PaletteEntryType.PaletteReference: { StyleType = PaletteEntryType.PaletteReference; Int32Field field = source.GetNextItemAfter <Int32Field>(sourceID, DefAgentFieldID.PaintStyleData); if (field != null) { Data = field.Data; } break; } } } }
private void Unpack(FieldList source) { // content reference ID ContentID = source[MessageOutFieldID.ContentReferenceID].AsByteArray(); // media primitive type MediaType = (MediaPrimitiveType)(source[MessageOutFieldID.MediaPrimitiveType].AsShort() ?? (short)MediaPrimitiveType.Image); // media type format: we just need it for the vector layout VectorMediaFormat = (MediaFormat)(source[MessageOutFieldID.MediaTypeFormat].AsShort() ?? (short)MediaFormat.Unspecified); // delivery method Delivery = (MediaDelivery)(source[MessageOutFieldID.DeliveryMethod].AsShort() ?? (short)MediaDelivery.AutoDownload); switch (Delivery) { case MediaDelivery.ResidentOnHandset: FileName = source[MessageOutFieldID.Filename].AsText(); break; case MediaDelivery.BackgroundDownload: case MediaDelivery.BulkRequestDownload: case MediaDelivery.ViaHTTP: case MediaDelivery.ViaHTTPBackground: DownloadSize = source[MessageOutFieldID.DownloadSize].AsInteger() ?? 0; DownloadURL = source[MessageOutFieldID.HTTPDeliveryURL].AsText(); break; } // presentational bits switch (MediaType) { case MediaPrimitiveType.ImageStrip: ImageStripIndex = source[MessageOutFieldID.ImageStripIndex].AsShort() ?? 0; ImageStripTotal = source[MessageOutFieldID.ImageStripTotal].AsShort() ?? 0; goto case MediaPrimitiveType.Image; case MediaPrimitiveType.Image: case MediaPrimitiveType.Video: case MediaPrimitiveType.WVG: MediaWidth = source[MessageOutFieldID.MediaActualWidth].AsShort() ?? 0; MediaHeight = source[MessageOutFieldID.MediaActualHeight].AsShort() ?? 0; break; } // device group DeviceGroup = (DeviceGroup)(source[NaviAgentFieldID.DeviceProfileGroup].AsShort() ?? (short)SystemAgent.DefaultDeviceGroup); }
/// <summary> /// Recursively adds an HTML snippet for each item in <paramref name="fields"/>, and for each /// sub field. /// </summary> /// <param name="fields">The list of fields for the collection.</param> /// <param name="fieldTemplate">The HTML snippet template.</param> /// <param name="fieldsHtmlBuilder">The HTML string to append to.</param> /// <param name="nestingFactor">The recursion nesting factor.</param> private void AddFieldsToDetailPage(FieldList fields, string fieldTemplate, StringBuilder fieldsHtmlBuilder, int nestingFactor = 0) { foreach (Field field in fields) { fieldsHtmlBuilder.Append(fieldTemplate .Replace("{%FIELD_NAME%}", field.Name) .Replace("{%FIELD_TYPE%}", field.Type.ToString()) .Replace("{%FIELD_DESCRIPTION%}", field.Description) .Replace("{%NESTING_FACTOR%}", nestingFactor.ToString())); if (field.HasSubFields) { this.AddFieldsToDetailPage(field.Fields, fieldTemplate, fieldsHtmlBuilder, nestingFactor + 1); } } }
public void Show_Item_Path_and_Template_as_first_row_of_tab_data() { var requestData = new RequestData(); var fieldList = new FieldList(); fieldList.AddField("Full Path", "/sitecore/content/foo"); fieldList.AddField("Template Name", "Bar"); requestData.Add(DataKey.Item, fieldList); _requestDataProvider.Setup(x => x.GetData()).Returns(requestData); dynamic data = _sut.GetData(null); string summaryRow = data.Rows[0].Columns[1].Data; Assert.Contains("/sitecore/content/foo", summaryRow); Assert.Contains("Bar", summaryRow); }
void PrintFieldlist(FieldList f, int d) { Indent(d); SayLn("Fieldlist("); if (f != null) { SayLn(""); Indent(d + 1); Say(f.Name.ToString()); SayLn(""); Indent(d + 1); Say(f.Type.ToString()); SayLn(","); Indent(d + 1); Say(f.Escape); SayLn(","); PrintFieldlist(f.Tail, d + 1); } Say(")"); }
public override ControllerRequest View(object model) { Console.Clear(); Console.CursorVisible = false; ViewTools.Txt(top: 2, left: 3, text: "Вы хотите выйти из программы?"); ViewTools.Txt(top: 3, left: 3, text: "--------------------------------------------"); FieldList fieldList = new FieldList(); fieldList.Add(new WaitOkField(top: 5, left: 3, name: "Ok", text: "[ Ok ]")); eViewStatus viewStatus = fieldList.Input(); return(new ControllerRequest <AskToExitController>(viewStatus, fieldList.ToResultValueList())); }
public AnkiItem CreateAnkiItem(params string[] properties) { FieldList list = null; IDictionaryEnumerator myEnumerator = _infoPerMid.GetEnumerator(); while (myEnumerator.MoveNext()) { if (IsRightFieldList((myEnumerator.Value as Info).Item3, properties)) { list = (myEnumerator.Value as Info).Item3; break; } } return(new AnkiItem(list, properties)); }
public HandToFieldAnim(TableManager table, HandListItem item, FieldList field, int index) { _item = item; _startPosition = item.Card.rectTransform.position; _timer = new Timer() { duration = table.handToFieldCurve.keys.Last().time }; field.addChild(table.ui.ServantPlaceHolder.rectTransform); field.defaultItem.rectTransform.SetAsFirstSibling(); table.ui.ServantPlaceHolder.rectTransform.SetSiblingIndex(index + 1); table.ui.ServantPlaceHolder.display(); _startPosition = _item.Card.rectTransform.position; _timer.start(); }
public NFSObjectSpikestripWeapon(MemoryManager memManager) : base(memManager, "073c76e4864aec065409eff77d578b2c") { //foxSpikeWeap FieldList.Add("Classification", new NFSFieldInt(this, "100")); FieldList.Add("ConeLength-Low", new NFSFieldFloat(this, "1C0")); FieldList.Add("ConeLength-High", new NFSFieldFloat(this, "1C4")); FieldList.Add("ConeWidth-Low", new NFSFieldFloat(this, "1C8")); FieldList.Add("ConeWidth-High", new NFSFieldFloat(this, "1CC")); FieldList.Add("MinimumTriggerDistance-Low", new NFSFieldFloat(this, "1D0")); FieldList.Add("MinimumTriggerDistance-High", new NFSFieldFloat(this, "1D4")); FieldList.Add("Projectile-EX0", new NFSFieldPointer(this, "7A0")); FieldList.Add("Projectile-EX1", new NFSFieldPointer(this, "7F8")); FieldList.Add("Projectile-EX2", new NFSFieldPointer(this, "850")); FieldList.Add("Projectile-EX3", new NFSFieldPointer(this, "8A8")); }
public override ControllerRequest View(object model) { Console.Clear(); Console.CursorVisible = false; IPerson currentUser = ApplicationData.CurrentData.CurrentPerson; int left = 3; int top = 2; ViewTools.Txt(top: top++, left: left, text: "Список работников"); ViewTools.Txt(top: top++, left: left, text: $"Пользователь: {currentUser.FirstName}, {currentUser.LastName}"); ViewTools.Txt(top: top++, left: left, text: "--------------------------------------------"); top++; ViewTools.Txt(top: top++, left: left, text: "+------+------------------+------------------+-------------+"); ViewTools.Txt(top: top++, left: left, text: "| Id | Имя | Фамилия | Должность |"); ViewTools.Txt(top: top++, left: left, text: "+------+------------------+------------------+-------------+"); IPerson[] persons = (IPerson[])model; foreach (var person in persons.OrderBy(p => p.Role).ThenBy(p => p.LastName)) { string role = person.Role switch { Role.Worker => "Работник", Role.Manager => "Менеджер", Role.Freelancer => "Фриланстер", _ => throw new ArgumentOutOfRangeException() }; ViewTools.Txt(top: top++, left: left, text: $"| {person.Id,4} | {person.FirstName,-16} | {person.LastName,-16} | {role, -11} |"); } ViewTools.Txt(top: top++, left: left, text: "+------+------------------+------------------+-------------+"); FieldList fields = new FieldList(); top++; fields.Add(new WaitOkField(top: top++, left: left, name: "Ok", text: "[ Ok ]")); eViewStatus viewStatus = fields.Input(); return(new ControllerRequest <ManagerMainController>()); } }
public void PrepareCurrentNode() { if (_fields != null) { TreeViewX tv = this.TreeView as TreeViewX; if (tv != null) { int level = this.Level + 1; //for query loading the next level DataQuery dq = tv.GetDataQuery(level); if (dq != null) { FieldList fs = dq.Fields; if (fs != null) { for (int i = 0; i < _fields.Count; i++) { EPField f = fs[_fields[i].Name]; if (f != null) { f.Value = _fields[i].Value; } } } } } if (_template != null) { FieldList fs = _template.Fields; if (fs != null) { for (int i = 0; i < _fields.Count; i++) { EPField f = fs[_fields[i].Name]; if (f != null) { f.Value = _fields[i].Value; } } } } TreeNodeX tx = this.Parent as TreeNodeX; if (tx != null) { tx.PrepareCurrentNode(); } } }
public override FieldList GetItemFields(ItemDefinition itemDefinition, VersionUri versionUri, CallContext context) { var item = GetItem(itemDefinition.ID); if (item == null) { return(base.GetItemFields(itemDefinition, versionUri, context)); } var template = TemplateManager.GetTemplate(item.TemplateId, Factory.GetDatabase("master")); var fields = template.GetFields(); var resultFields = new FieldList(); var itemFields = new List <FieldModel>(); // shared fields itemFields.AddRange(item.Fields); var language = item.GetLanguage(versionUri.Language.ToString()); if (language != null) { itemFields.AddRange(language.Fields); var version = language.GetVersion(versionUri.Version.Number); if (version != null) { itemFields.AddRange(version.Fields); } } foreach (var field in fields) { var itemField = itemFields.FirstOrDefault(f => f.Id == field.ID.ToString()); if (itemField != null) { resultFields.Add(field.ID, itemField.Value); } else { resultFields.Add(field.ID, field.DefaultValue); } } context.Abort(); return(resultFields); }
public void Verify_TryGetValue_will_return_field() { var fields = new FieldList(); fields.Add(Field.Builder <Primitive>().Id("field1").DataType(SchemaDataType.Primitive).IsNullable().Build()); fields.Add(Field.Builder <Primitive>().Id("field2").DataType(SchemaDataType.Primitive).IsNullable().Build()); fields.Add(Field.Builder <Primitive>().Id("field3").DataType(SchemaDataType.Primitive).IsNullable().Build()); fields.Add(Field.Builder <Primitive>().Id("field4").DataType(SchemaDataType.Primitive).IsNullable().Build()); fields.Add(Field.Builder <Primitive>().Id("field5").DataType(SchemaDataType.Primitive).IsNullable().Build()); IReadOnlyFieldList temp = fields; Assert.IsTrue(temp.TryGetValue(3, out PrimitiveField field)); Assert.IsNotNull(field); Assert.AreEqual("field4", field.Id); Assert.AreEqual(SchemaDataType.Primitive, field.DataType); }
public void Verify_TryGetValue_will_not_throw_when_index_greater_than_count() { var fields = new FieldList(); fields.Add(Field.Builder <Primitive>().Id("field1").DataType(SchemaDataType.Primitive).IsNullable().Build()); fields.Add(Field.Builder <Primitive>().Id("field2").DataType(SchemaDataType.Primitive).IsNullable().Build()); fields.Add(Field.Builder <Primitive>().Id("field3").DataType(SchemaDataType.Primitive).IsNullable().Build()); fields.Add(Field.Builder <Primitive>().Id("field4").DataType(SchemaDataType.Primitive).IsNullable().Build()); fields.Add(Field.Builder <Primitive>().Id("field5").DataType(SchemaDataType.Primitive).IsNullable().Build()); IReadOnlyFieldList temp = fields; int count = temp.Count; Assert.IsFalse(temp.TryGetValue(count + 1, out PrimitiveField field)); Assert.IsNotNull(field); }
private static FieldList GetDatabase() { var database = Context.Database; var data = new FieldList(); data.AddField("Name", database.Name); data.AddField("Connection String Name", database.ConnectionStringName); data.AddField("Read Only", database.ReadOnly); data.AddField("Protected", database.Protected); data.AddField("Security Enabled", database.SecurityEnabled); data.AddField("Proxies Enabled", database.ProxiesEnabled); data.AddField("Publish Virtual Items", database.PublishVirtualItems); data.AddField("HasContentItem", database.HasContentItem); return(data); }
private static FieldList GetUser() { var user = Context.User; var data = new FieldList(); data.AddField("Name", user.Name); data.AddField("DisplayName", user.DisplayName); data.AddField("Roles", user.Roles.Select(r => r.Name)); data.AddField("Description", user.Description); data.AddField("Domain Name", user.GetDomainName()); data.AddField("IsAdministrator", user.IsAdministrator); data.AddField("IsAuthenticated", user.IsAuthenticated); data.AddField("LocalName", user.LocalName); return(data); }
private static FieldList GetLanguage() { var language = Context.Language; var data = new FieldList(); data.AddField("Name", language.Name); data.AddField("DisplayName", language.GetDisplayName()); data.AddField("CultureInfo", GetCulture(language.CultureInfo).Fields); if (language.Origin != null && language.Origin.ItemId != (Data.ID)null) { data.AddField("Origin Item Id", language.Origin.ItemId.Guid); } return(data); }
private void btOK_Click(object sender, System.EventArgs e) { string s; StringCollection scGroup = new StringCollection(); FieldList flds = new FieldList(); qry.GroupBy = ""; FieldList fl = qry.Fields; for (int i = 0; i < fl.Count; i++) { s = listView1.Items[i].SubItems[1].Text.Trim(); if (!string.IsNullOrEmpty(s)) { if (string.Compare(s, "Group by", StringComparison.OrdinalIgnoreCase) == 0) { scGroup.Add(fl[i].GetFieldTextAsValue(qry.NameDelimiterBegin, qry.NameDelimiterEnd)); flds.Add(fl[i]); } else { EPField f = (EPField)fl[i].Clone(); f.FieldText = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}({1}) AS {2}{3}{4}", s, f.GetFieldTextAsValue(qry.NameDelimiterBegin, qry.NameDelimiterEnd), qry.NameDelimiterBegin, f.Name, qry.NameDelimiterEnd); flds.Add(f); } } } if (scGroup.Count == 0) { MessageBox.Show(this, Resource1.Err_group_field, this.Text, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Stop); } else { StringBuilder sg = new StringBuilder(scGroup[0]); for (int i = 1; i < scGroup.Count; i++) { sg.Append(","); sg.Append(scGroup[i]); } qry.GroupBy = sg.ToString(); qry.Fields = flds; this.DialogResult = System.Windows.Forms.DialogResult.OK; Close(); } }
public override FieldList GetItemFields(ItemDefinition itemDefinition, VersionUri version, CallContext context) { var fields = new FieldList(); var idTableEntries = InMemoryIdTable.GetKeys(IdTablePrefix, itemDefinition.ID); if (idTableEntries.Any()) { if (context.DataManager.DataSource.ItemExists(itemDefinition.ID)) { ReflectionUtil.CallMethod(typeof(ItemCache), CacheManager.GetItemCache(context.DataManager.Database), "RemoveItem", true, true, new object[] { itemDefinition.ID }); } var template = TemplateManager.GetTemplate(ItemTemplateId, Factory.GetDatabase(TargetDatabaseName)); if (template != null) { var externalItemId = GetExternalItemIdFromIdTable(itemDefinition.ID); if (!string.IsNullOrEmpty(externalItemId)) { var journal = ExternalItems.FirstOrDefault(o => o.Id == externalItemId); if (journal != null) { foreach (var field in GetDataFields(template)) { //try { fields.Add(field.ID, GetFieldValue(field, journal)); } //catch (Exception e) { //Log.Error("Dataprovider error:" + field.Name ,e, this); } } } } } } return(fields); }
private static FieldList CreateFieldList(string filepath, string alt, string width, string height, string title, string keywords, string extension, string mimetype, string size) { var fieldList = new FieldList { {MediaStandardFields.FilePathId, filepath}, {MediaStandardFields.AltId, alt}, {MediaStandardFields.WidthId, width}, {MediaStandardFields.HeightId, height}, {MediaStandardFields.TitleId, title}, {MediaStandardFields.KeywordsId, keywords}, {MediaStandardFields.ExtensionId, extension}, {MediaStandardFields.MimetypeId, mimetype}, {MediaStandardFields.SizeId, size} }; return fieldList; }
public void ShouldUpdateExistingItemInDataStorage(SaveItemCommand sut, ID itemId, ID templateId, ID fieldId) { // arrange var originalItem = new DbItem("original item", itemId) { new DbField("Title", fieldId) { Value = "original title" } }; sut.DataStorage.GetFakeItem(itemId).Returns(originalItem); sut.DataStorage.GetFakeTemplate(null).ReturnsForAnyArgs(new DbTemplate("Sample", templateId)); var fields = new FieldList { { fieldId, "updated title" } }; var updatedItem = ItemHelper.CreateInstance(sut.Database, "updated item", itemId, ID.NewID, ID.Null, fields); sut.Initialize(updatedItem); // act ReflectionUtil.CallMethod(sut, "DoExecute"); // assert originalItem.Name.Should().Be("updated item"); originalItem.Fields[fieldId].Value.Should().Be("updated title"); }
public void ShouldUpdateExistingItemInDataStorage() { // arrange var originalItem = new DbItem("original item", this.itemId) { new DbField("Title", this.fieldId) { Value = "original title" } }; this.dataStorage.GetFakeItem(this.itemId).Returns(originalItem); this.dataStorage.FakeItems.Add(this.itemId, originalItem); var fields = new FieldList { { this.fieldId, "updated title" } }; var updatedItem = ItemHelper.CreateInstance(database, "updated item", this.itemId, ID.NewID, ID.Null, fields); this.command.Initialize(updatedItem); // act this.command.DoExecute(); // assert dataStorage.FakeItems[this.itemId].Name.Should().Be("updated item"); dataStorage.FakeItems[this.itemId].Fields[this.fieldId].Value.Should().Be("updated title"); }