void PredicateTypeDropDownList_SelectedIndexChanged(object sender, EventArgs e) { DestinationCheckBoxList.Items.Clear(); SourceCheckBoxList.Items.Clear(); if (DestinationList != null) { DestinationList.Clear(); } if (SourceList != null) { SourceList.Clear(); } SourceListSizeDropDown.Items.Clear(); SourceListSizeDropDown.Visible = false; SourceListSizeLabel.Visible = false; //Set DataTextField for Source and Destination list box. if (_predicateDropDownList.SelectedItem.Text.Equals(_predicateTags)) { ObjectDataTextField = _predicateDataTextField; } else { ObjectDataTextField = _resourceObjectTypeDataTextField; } RefreshObjectTypeDropDown(); }
public override string ToString() { string s = "\nRoute: "; foreach (Address a in DestinationList) { s += a.Name + "->"; } s += DestinationList.ElementAt(0).Name; s += ", distance= " + GetDistance(); return(s); }
private void LoadAddresses(string path) { string addressesRaw = TxtFileHelper.LoadText(path); string[] addressesString = addressesRaw.Split(this.addressSeparator); foreach (string address in addressesString) { if (address.Length > 0) { //kreiraj objekt klase Address sa paremetrom naziva Address a = new Address(address.Trim()); //dodaj novokreirani objekt u listu adresa if (DestinationList.Contains(a) == false) { this.DestinationList.Add(a); } } } }
public override void Normalize() { if (!String.IsNullOrEmpty(SenderName)) { SenderName = SenderName.Substring(0, Math.Min(SenderName.Length, 10)); } if (!String.IsNullOrEmpty(DestinationList)) { DestinationList = DestinationList.Substring(0, Math.Min(DestinationList.Length, 109)); } if (!String.IsNullOrEmpty(Subject)) { Subject = Subject.Substring(0, Math.Min(Subject.Length, 78)); } if (!String.IsNullOrEmpty(Body)) { Body = Body.Substring(0, Math.Min(Body.Length, 512)); } }
}/// <summary> /// handles copying of list items /// </summary> protected virtual void UpdateListItem(int destinationItemID) { SPListItem destItem = DestinationList.GetItemById(destinationItemID); CopyFieldValues(SourceItem, destItem, _options.LinkToOriginal); // attachment routine if (SourceList.EnableAttachments && DestinationList.EnableAttachments) { if (_options.IncludeAttachments) { AttachmentHelper.DeleteAllAttachments(destItem); AttachmentInfo[] attachments = AttachmentHelper.GetListItemAttachments(SourceItem); foreach (AttachmentInfo ai in attachments) { destItem.Attachments.Add(ai.FileName, AttachmentHelper.ReadFully(ai.Stream, Convert.ToInt32(ai.Stream.Length))); } } } destItem.SystemUpdate(); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpAssignmentInstruction"/> class. /// </summary> /// <param name="context">The creation context.</param> /// <param name="parentFeature">The parent feature.</param> /// <param name="source">The Easly instruction from which the C# instruction is created.</param> protected CSharpAssignmentInstruction(ICSharpContext context, ICSharpFeature parentFeature, IAssignmentInstruction source) : base(context, parentFeature, source) { SourceExpression = CSharpExpression.Create(context, (IExpression)Source.Source); foreach (IQualifiedName Destination in source.DestinationList) { ICompiledFeature SourceFeature = source.FinalFeatureTable[Destination]; ICSharpFeature FinalFeature; if (SourceFeature is IScopeAttributeFeature AsScopeAttributeFeature) { FinalFeature = CSharpScopeAttributeFeature.Create(null, AsScopeAttributeFeature); } else { FinalFeature = context.GetFeature(SourceFeature); } ICSharpQualifiedName NewDestination = CSharpQualifiedName.Create(context, Destination, FinalFeature, null, false); DestinationList.Add(NewDestination); } }
public int GetDistance() { int totalDistance = 0; //dodaj udaljenost za svaku sljedecu adresu for (int i = 0; i < DestinationList.Count; i++) { Address currentDestination = DestinationList.ElementAt(i); int priorDestinationIndex; if (i == 0) { //povezi ishodiste i posljednju destinaciju priorDestinationIndex = DestinationList.Count - 1; } else { //sve destinacije (osim ishodisne) povezi sa njihovim prethodnicima priorDestinationIndex = i - 1; } Address priorDestination = DestinationList.ElementAt(priorDestinationIndex); totalDistance += currentDestination.GetDistance(priorDestination); } return(totalDistance); }
public void AddDestination(Address destination) { DestinationList.Add(destination); }