Example #1
0
        public override IEnumerable <Guid> GetIdsForAncestorQuery()
        {
            var list = new List <Guid>();

            if (!DisplayParentId.Equals(Guid.Empty))
            {
                list.Add(DisplayParentId);
            }
            else if (!ParentId.Equals(Guid.Empty))
            {
                list.Add(ParentId);
            }
            else
            {
                list.Add(Id);
            }

            return(list);
        }
Example #2
0
        public void AssertValid()
        {
            Id.ErrorIdAssertValid();
            TraceId.TraceIdAssertValid();
            TransactionId.TransactionIdAssertValid();
            ParentId.ParentIdAssertValid();
            Transaction.AssertValid();
            Context?.AssertValid();
            Culprit.NonEmptyAssertValid();
            Exception.AssertValid();

            if (Transaction.IsSampled)
            {
                Context.Should().NotBeNull();
            }
            else
            {
                Context.Should().BeNull();
            }
        }
Example #3
0
        public override SensorItem GetTestItem()
        {
            if (Id == -1)
            {
                throw new InvalidOperationException("Id was not initialized");
            }

            if (ParentId == -1)
            {
                throw new InvalidOperationException("ParentId was not initialized");
            }

            return(new SensorItem(
                       probe: GetProbe(this).Name,
                       group: GetGroup(this).Name,
                       name: Name,
                       objid: Id.ToString(),
                       parentId: ParentId.ToString()
                       ));
        }
Example #4
0
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                _stopwatch.Stop();

                if (NuGetTelemetryService != null && TelemetryEvent != null)
                {
                    var endTime = DateTime.UtcNow;
                    TelemetryEvent["StartTime"] = _startTime.ToString("O");
                    TelemetryEvent["EndTime"]   = endTime.ToString("O");
                    TelemetryEvent["Duration"]  = _stopwatch.Elapsed.TotalSeconds;

                    if (ParentId != Guid.Empty)
                    {
                        TelemetryEvent[nameof(ParentId)] = ParentId.ToString();
                    }

                    if (OperationId != Guid.Empty)
                    {
                        TelemetryEvent[nameof(OperationId)] = OperationId.ToString();
                    }

                    foreach (var interval in _intervalList)
                    {
                        TelemetryEvent[interval.Item1] = interval.Item2.TotalSeconds;
                    }

                    NuGetTelemetryService.EmitTelemetryEvent(TelemetryEvent);
                }

                _telemetryActivity?.Dispose();
            }

            _disposed = true;
        }
Example #5
0
        public override int SimilarityScore(PostBase post)
        {
            var otherPost       = (GelbooruPost)post;
            int similarityScore = 0;

            if (FileUrl.Contains(".gif") || FileUrl.Contains(".webm"))
            {
                return(-10);
            }

            List <string> thisTags = new List <string>(GetTags().Split(' ').Where(w => w != "#tagme" && w != "" && w != "#solo"));
            List <string> postTags = new List <string>(otherPost.GetTags().Split(' ').Where(w => w != "#tagme" && w != "" && w != "#solo"));

            foreach (var tag in thisTags.Intersect(postTags))
            {
                if (ImportantTags.Contains(tag))
                {
                    similarityScore += 100;
                }
                else
                {
                    similarityScore += 1;
                }
            }
            //similarityScore += thisTags.Intersect(postTags).Count();

            if (!GetPostAuthor().Equals("danbooru") && GetPostAuthor().Equals(otherPost.GetPostAuthor()))
            {
                similarityScore += 100;
            }

            if (ParentId != null && otherPost.ParentId != null)
            {
                if (ParentId.Equals(otherPost.ParentId))
                {
                    similarityScore += 100;
                }
            }

            return(similarityScore);
        }
Example #6
0
        public override DeviceItem GetTestItem()
        {
            if (Id == -1)
            {
                throw new InvalidOperationException("Id was not initialized");
            }

            if (ParentId == -1)
            {
                throw new InvalidOperationException("ParentId was not initialized");
            }

            return(new DeviceItem(
                       group: Parent.Name,
                       probe: GetProbe(this).Name,
                       totalsens: TotalSensors.ToString(),
                       totalsensRaw: TotalSensors.ToString(),
                       name: Name,
                       objid: Id.ToString(),
                       parentId: ParentId.ToString()
                       ));
        }
Example #7
0
        public void AssertValid()
        {
            Timestamp.TimestampAssertValid();
            Id.TransactionIdAssertValid();
            TraceId.TraceIdAssertValid();
            ParentId?.ParentIdAssertValid();
            SpanCount.AssertValid();
            Context?.AssertValid();
            Duration.DurationAssertValid();
            Name?.NameAssertValid();
            Result?.AssertValid();
            Type?.AssertValid();

            if (IsSampled)
            {
                Context.Should().NotBeNull();
            }
            else
            {
                Context.Should().BeNull();
            }
        }
Example #8
0
        public virtual void WriteYaml(YamlWriter writer)
        {
            writer.WriteMap("ID", Id.ToString("D"));
            writer.WriteMap("Parent", ParentId.ToString("D"));
            writer.WriteMap("Template", TemplateId.ToString("D"));
            writer.WriteMap("Path", Path);
            writer.WriteMap("DB", DatabaseName);

            if (BranchId != default(Guid))
            {
                writer.WriteMap("BranchID", BranchId.ToString());
            }

            if (SharedFields.Any())
            {
                writer.WriteMap("SharedFields");
                writer.IncreaseIndent();

                foreach (var field in SharedFields)
                {
                    field.WriteYaml(writer);
                }

                writer.DecreaseIndent();
            }

            if (Languages.Any())
            {
                writer.WriteMap("Languages");
                writer.IncreaseIndent();

                foreach (var language in Languages)
                {
                    language.WriteYaml(writer);
                }

                writer.DecreaseIndent();
            }
        }
Example #9
0
        /// <summary>
        /// Uploaded content of object
        /// </summary>
        /// <param name="file">Object content</param>
        /// <param name="append">When true download content and append new content at the end of current content, else overwrite current content by new content</param>
        public virtual void UpdateContent(ref Stream file, bool append)
        {
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }
            if (append)
            {
                string f = Path.GetTempFileName();
                using (FileStream fs = new FileStream(f, FileMode.Create))
                {
                    Download(fs, null);
                    file.CopyTo(fs);
                }
                file = new FileStream(f, FileMode.Open);
            }
            string usrid = User.Get("").Id;

            try
            {
                if (string.IsNullOrEmpty(ParentId))
                {
                    T        obj = Get(Id);
                    string[] lid = (obj as AFiles <T>).ParentId.Split('.');
                    UploadContent(file, usrid, Name, lid[lid.Length - 1], 0, null, null, null);
                }
                else
                {
                    string[] lid = ParentId.Split('.');
                    UploadContent(file, usrid, Name, lid[lid.Length - 1], 0, null, null, null);
                }
            }
            catch
            {
                throw;
            }
        }
Example #10
0
        protected override Expression <Func <ProductDetail, bool> > GetExpression()
        {
            if (!string.IsNullOrWhiteSpace(Keyword))
            {
                ExpressionObj = x =>
                                x.ProductCategory.Name.ToLower().Contains(Keyword) ||
                                x.Name.ToLower().Contains(Keyword) ||
                                x.Model.ToLower().Contains(Keyword) ||
                                x.BarCode.ToLower().Contains(Keyword) ||
                                x.ProductCode.ToLower().Contains(Keyword);
            }

            if (IsProductActive)
            {
                ExpressionObj = ExpressionObj.And(x => x.IsActive == IsProductActive);
            }

            if (IsRawProduct)
            {
                ExpressionObj = ExpressionObj.And(x => x.IsRawProduct == IsRawProduct);
            }

            if (ParentId.IdIsOk())
            {
                ExpressionObj = ExpressionObj.And(x => x.ProductCategoryId == ParentId);
            }

            if (OnHand > 0)
            {
                ExpressionObj = ExpressionObj.And(x => x.OnHand <= OnHand);
            }

            ExpressionObj = ExpressionObj.And(x => x.ShopId == ShopId);
            ExpressionObj = ExpressionObj.And(GenerateBaseEntityExpression());
            return(ExpressionObj);
        }
Example #11
0
 public ChannelHandler(ChannelName name, int id, ParentId parentid)
 {
     ChannelName = name;
     Id = id;
     ParentId = parentid;
 }
Example #12
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Instrument != null)
         {
             hashCode = hashCode * 59 + Instrument.GetHashCode();
         }
         if (Qty != null)
         {
             hashCode = hashCode * 59 + Qty.GetHashCode();
         }
         if (Side != null)
         {
             hashCode = hashCode * 59 + Side.GetHashCode();
         }
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (FilledQty != null)
         {
             hashCode = hashCode * 59 + FilledQty.GetHashCode();
         }
         if (AvgPrice != null)
         {
             hashCode = hashCode * 59 + AvgPrice.GetHashCode();
         }
         if (LimitPrice != null)
         {
             hashCode = hashCode * 59 + LimitPrice.GetHashCode();
         }
         if (StopPrice != null)
         {
             hashCode = hashCode * 59 + StopPrice.GetHashCode();
         }
         if (ParentId != null)
         {
             hashCode = hashCode * 59 + ParentId.GetHashCode();
         }
         if (ParentType != null)
         {
             hashCode = hashCode * 59 + ParentType.GetHashCode();
         }
         if (Duration != null)
         {
             hashCode = hashCode * 59 + Duration.GetHashCode();
         }
         if (Status != null)
         {
             hashCode = hashCode * 59 + Status.GetHashCode();
         }
         return(hashCode);
     }
 }
Example #13
0
        /// <summary>
        /// Returns true if Order instances are equal
        /// </summary>
        /// <param name="other">Instance of Order to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Order other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Instrument == other.Instrument ||
                     Instrument != null &&
                     Instrument.Equals(other.Instrument)
                 ) &&
                 (
                     Qty == other.Qty ||
                     Qty != null &&
                     Qty.Equals(other.Qty)
                 ) &&
                 (
                     Side == other.Side ||
                     Side != null &&
                     Side.Equals(other.Side)
                 ) &&
                 (
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                 ) &&
                 (
                     FilledQty == other.FilledQty ||
                     FilledQty != null &&
                     FilledQty.Equals(other.FilledQty)
                 ) &&
                 (
                     AvgPrice == other.AvgPrice ||
                     AvgPrice != null &&
                     AvgPrice.Equals(other.AvgPrice)
                 ) &&
                 (
                     LimitPrice == other.LimitPrice ||
                     LimitPrice != null &&
                     LimitPrice.Equals(other.LimitPrice)
                 ) &&
                 (
                     StopPrice == other.StopPrice ||
                     StopPrice != null &&
                     StopPrice.Equals(other.StopPrice)
                 ) &&
                 (
                     ParentId == other.ParentId ||
                     ParentId != null &&
                     ParentId.Equals(other.ParentId)
                 ) &&
                 (
                     ParentType == other.ParentType ||
                     ParentType != null &&
                     ParentType.Equals(other.ParentType)
                 ) &&
                 (
                     Duration == other.Duration ||
                     Duration != null &&
                     Duration.Equals(other.Duration)
                 ) &&
                 (
                     Status == other.Status ||
                     Status != null &&
                     Status.Equals(other.Status)
                 ));
        }
 /// <summary>
 /// Saves the <see cref="Couchbase.Lite.UnsavedRevision"/>.
 /// This will fail if its parent is not the current <see cref="Couchbase.Lite.Revision"/>
 /// of the associated <see cref="Couchbase.Lite.Document"/>.
 /// </summary>
 /// <exception cref="Couchbase.Lite.CouchbaseLiteException">
 /// Thrown if an issue occurs while saving the <see cref="Couchbase.Lite.UnsavedRevision"/>.
 /// </exception>
 public SavedRevision Save()
 {
     return(Document.PutProperties(Properties, ParentId.AsRevID(), false));
 }
Example #15
0
 /// <summary>
 /// 获取哈希码。
 /// </summary>
 /// <returns>返回 32 位整数。</returns>
 public override int GetHashCode()
 => ParentId.GetHashCode() ^ Name.CompatibleGetHashCode();
Example #16
0
        public IEnumerable <Tuple <SerializedNotification, string> > GetNotifications(EntityState entityState)
        {
            if (ReadAccess == FileAccess.Nobody)
            {
                yield break;
            }

            var info = GetInfo();
            var type = entityState.ToChangeType();

            string?parent = ParentId != null?ParentId.ToString() : "root";

            switch (ReadAccess)
            {
            case FileAccess.Public:
                yield return(new Tuple <SerializedNotification, string>(new FolderContentsUpdated()
                {
                    Type = type,
                    Item = info
                }, NotificationGroups.FolderContentsUpdatedPublicPrefix + parent));

                break;

            case FileAccess.RestrictedUser:
                yield return(new Tuple <SerializedNotification, string>(new FolderContentsUpdated()
                {
                    Type = type,
                    Item = info
                }, NotificationGroups.FolderContentsUpdatedRestrictedUserPrefix + parent));

                break;

            case FileAccess.User:
                yield return(new Tuple <SerializedNotification, string>(new FolderContentsUpdated()
                {
                    Type = type,
                    Item = info
                }, NotificationGroups.FolderContentsUpdatedUserPrefix + parent));

                break;

            case FileAccess.Developer:
                yield return(new Tuple <SerializedNotification, string>(new FolderContentsUpdated()
                {
                    Type = type,
                    Item = info
                }, NotificationGroups.FolderContentsUpdatedDeveloperPrefix + parent));

                break;

            case FileAccess.OwnerOrAdmin:
                yield return(new Tuple <SerializedNotification, string>(new FolderContentsUpdated()
                {
                    Type = type,
                    Item = info
                }, NotificationGroups.FolderContentsUpdatedOwnerPrefix + parent));

                break;
            }

            yield return(new Tuple <SerializedNotification, string>(new StorageItemUpdated()
            {
                Item = GetDTO()
            }, NotificationGroups.StorageItemUpdatedPrefix + Id));
        }
Example #17
0
        public string getInsertSQL()
        {
            String sqlString = "INSERT into board_param (name,controltype,linkkind,linkindex,locationx,locationy,text,basecolor,visible,editable,level,parentid)" +
                               "VALUES('{0}', '{1}', '{2}', {3}, {4}, {5}, '{6}', '{7}', '{8}', '{9}', {10}, {11}) ";

            return(String.Format(sqlString, ControlName, ControlType, LinkKind, LinkIndex.ToString(), LocationX.ToString(), LocationY.ToString(), ShowText, BaseColor, Visible, Editable, level.ToString(), ParentId.ToString()));
        }
 public override int GetHashCode()
 {
     return(ParentId != null ? ParentId.GetHashCode() : 0);
 }
Example #19
0
        public string GetProperty(string propertyName, string format, CultureInfo formatProvider, UserInfo accessingUser, Scope currentScope, ref bool propertyNotFound)
        {
            string outputFormat = string.Empty;

            if (format == string.Empty)
            {
                outputFormat = "g";
            }

            string lowerPropertyName = propertyName.ToLower();

            if (currentScope == Scope.NoSettings)
            {
                propertyNotFound = true;
                return(PropertyAccess.ContentLocked);
            }
            propertyNotFound = true;

            string result   = string.Empty;
            bool   isPublic = true;

            switch (lowerPropertyName)
            {
            case "tabid":
                propertyNotFound = false;
                result           = (TabID.ToString(outputFormat, formatProvider));
                break;

            case "taborder":
                isPublic         = false;
                propertyNotFound = false;
                result           = (TabOrder.ToString(outputFormat, formatProvider));
                break;

            case "portalid":
                propertyNotFound = false;
                result           = (PortalID.ToString(outputFormat, formatProvider));
                break;

            case "tabname":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(LocalizedTabName, format);
                break;

            case "isvisible":
                isPublic         = false;
                propertyNotFound = false;
                result           = (PropertyAccess.Boolean2LocalizedYesNo(IsVisible, formatProvider));
                break;

            case "parentid":
                isPublic         = false;
                propertyNotFound = false;
                result           = (ParentId.ToString(outputFormat, formatProvider));
                break;

            case "level":
                isPublic         = false;
                propertyNotFound = false;
                result           = (Level.ToString(outputFormat, formatProvider));
                break;

            case "iconfile":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(IconFile, format);
                break;

            case "iconfilelarge":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(IconFileLarge, format);
                break;

            case "disablelink":
                isPublic         = false;
                propertyNotFound = false;
                result           = (PropertyAccess.Boolean2LocalizedYesNo(DisableLink, formatProvider));
                break;

            case "title":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(Title, format);
                break;

            case "description":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(Description, format);
                break;

            case "keywords":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(KeyWords, format);
                break;

            case "isdeleted":
                isPublic         = false;
                propertyNotFound = false;
                result           = (PropertyAccess.Boolean2LocalizedYesNo(IsDeleted, formatProvider));
                break;

            case "url":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(Url, format);
                break;

            case "skinsrc":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(SkinSrc, format);
                break;

            case "containersrc":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(ContainerSrc, format);
                break;

            case "tabpath":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(TabPath, format);
                break;

            case "startdate":
                isPublic         = false;
                propertyNotFound = false;
                result           = (StartDate.ToString(outputFormat, formatProvider));
                break;

            case "enddate":
                isPublic         = false;
                propertyNotFound = false;
                result           = (EndDate.ToString(outputFormat, formatProvider));
                break;

            case "haschildren":
                isPublic         = false;
                propertyNotFound = false;
                result           = (PropertyAccess.Boolean2LocalizedYesNo(HasChildren, formatProvider));
                break;

            case "refreshinterval":
                isPublic         = false;
                propertyNotFound = false;
                result           = (RefreshInterval.ToString(outputFormat, formatProvider));
                break;

            case "pageheadtext":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(PageHeadText, format);
                break;

            case "skinpath":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(SkinPath, format);
                break;

            case "skindoctype":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(SkinDoctype, format);
                break;

            case "containerpath":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(ContainerPath, format);
                break;

            case "issupertab":
                isPublic         = false;
                propertyNotFound = false;
                result           = (PropertyAccess.Boolean2LocalizedYesNo(IsSuperTab, formatProvider));
                break;

            case "fullurl":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(FullUrl, format);
                break;

            case "sitemappriority":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(SiteMapPriority.ToString(), format);
                break;
            }
            if (!isPublic && currentScope != Scope.Debug)
            {
                propertyNotFound = true;
                result           = PropertyAccess.ContentLocked;
            }
            return(result);
        }
Example #20
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (TraceId != null)
         {
             hashCode = hashCode * 59 + TraceId.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (ParentId != null)
         {
             hashCode = hashCode * 59 + ParentId.GetHashCode();
         }
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Kind != null)
         {
             hashCode = hashCode * 59 + Kind.GetHashCode();
         }
         if (Timestamp != null)
         {
             hashCode = hashCode * 59 + Timestamp.GetHashCode();
         }
         if (Duration != null)
         {
             hashCode = hashCode * 59 + Duration.GetHashCode();
         }
         if (Debug != null)
         {
             hashCode = hashCode * 59 + Debug.GetHashCode();
         }
         if (Shared != null)
         {
             hashCode = hashCode * 59 + Shared.GetHashCode();
         }
         if (LocalEndpoint != null)
         {
             hashCode = hashCode * 59 + LocalEndpoint.GetHashCode();
         }
         if (RemoteEndpoint != null)
         {
             hashCode = hashCode * 59 + RemoteEndpoint.GetHashCode();
         }
         if (Annotations != null)
         {
             hashCode = hashCode * 59 + Annotations.GetHashCode();
         }
         if (Tags != null)
         {
             hashCode = hashCode * 59 + Tags.GetHashCode();
         }
         return(hashCode);
     }
 }
Example #21
0
        /// <summary>
        /// Returns true if Span instances are equal
        /// </summary>
        /// <param name="other">Instance of Span to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Span other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     TraceId == other.TraceId ||
                     TraceId != null &&
                     TraceId.Equals(other.TraceId)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     ParentId == other.ParentId ||
                     ParentId != null &&
                     ParentId.Equals(other.ParentId)
                 ) &&
                 (
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                 ) &&
                 (
                     Kind == other.Kind ||
                     Kind != null &&
                     Kind.Equals(other.Kind)
                 ) &&
                 (
                     Timestamp == other.Timestamp ||
                     Timestamp != null &&
                     Timestamp.Equals(other.Timestamp)
                 ) &&
                 (
                     Duration == other.Duration ||
                     Duration != null &&
                     Duration.Equals(other.Duration)
                 ) &&
                 (
                     Debug == other.Debug ||
                     Debug != null &&
                     Debug.Equals(other.Debug)
                 ) &&
                 (
                     Shared == other.Shared ||
                     Shared != null &&
                     Shared.Equals(other.Shared)
                 ) &&
                 (
                     LocalEndpoint == other.LocalEndpoint ||
                     LocalEndpoint != null &&
                     LocalEndpoint.Equals(other.LocalEndpoint)
                 ) &&
                 (
                     RemoteEndpoint == other.RemoteEndpoint ||
                     RemoteEndpoint != null &&
                     RemoteEndpoint.Equals(other.RemoteEndpoint)
                 ) &&
                 (
                     Annotations == other.Annotations ||
                     Annotations != null &&
                     Annotations.SequenceEqual(other.Annotations)
                 ) &&
                 (
                     Tags == other.Tags ||
                     Tags != null &&
                     Tags.Equals(other.Tags)
                 ));
        }
 /// <summary>
 /// Saves the <see cref="Couchbase.Lite.UnsavedRevision"/>, optionally allowing
 /// the save when there is a conflict.
 /// </summary>
 /// <param name="allowConflict">
 /// Whether or not to allow saving when there is a conflict.
 /// </param>
 /// <exception cref="Couchbase.Lite.CouchbaseLiteException">
 /// Thrown if an issue occurs while saving the <see cref="Couchbase.Lite.UnsavedRevision"/>.
 /// </exception>
 public SavedRevision Save(bool allowConflict)
 {
     return(Document.PutProperties(Properties, ParentId.AsRevID(), allowConflict));
 }
Example #23
0
 /// <nodoc/>
 public override string ToString()
 {
     return
         ($"{Id}\t{ParentId?.ToString() ?? string.Empty}\t{EvaluationPassDescription ?? string.Empty}\t{File ?? string.Empty}\t{Line?.ToString() ?? string.Empty}\t{ElementName ?? string.Empty}\tDescription:{ElementDescription}\t{this.EvaluationPassDescription}");
 }
Example #24
0
    // Get population from MYSQL database
    public static IEnumerator GetPopulation(int numLSystems, Action <LSystemWrapper[]> done)
    {
Request:
        UnityWebRequest request = new UnityWebRequest(getPopulationURL + "?Algorithm=" + algorithm.ToString() + "&NumLSystems=" + numLSystems +
                                                      (ParentId != null ? "&ParentId=" + ParentId?.ToString() : "") +
                                                      ((ParentId.HasValue && ParentId.Value == PopulationId) || (!ParentId.HasValue && PopulationId != null) ? "&PopulationId=" + PopulationId : ""));

        request.downloadHandler = new DownloadHandlerBuffer();
        Debug.Log("Retreiving Population: " + request.url);
        yield return(request.SendWebRequest());

        LSystemWrapper[] retreivedLSystems = null;
        if (request.error != null)
        {
            Debug.LogError("There was an error retreiving the population: " + request.error);
        }
        else
        {
            try
            {
                string response = request.downloadHandler.text;
                Debug.Log(response);
                var JSONObj = JsonUtility.FromJson <PostLSystemHelper>(response);
                if (JSONObj == null)
                {
                    goto Request;
                }
                PopulationId = JSONObj.PopulationId;
                hash         = JSONObj.Hash;

                //if (numLSystems > 0 && (JSONObj.LSystems == null || JSONObj.LSystems.Length != numLSystems))
                //{
                //    goto Request;
                //}
                retreivedLSystems = JSONObj.LSystems;
            }
            catch
            {
                goto Request;
            }
        }

        done(retreivedLSystems);
    }
Example #25
0
 public override int GetHashCode()
 {
     return(Id.GetHashCode() ^ ParentId.GetHashCode() ^ OwnerId.GetHashCode());
 }
Example #26
0
 public virtual bool Equals(ContentCategory <TIncremId, TCreatedBy> other)
 => other.IsNotNull() && ParentId.Equals(other.ParentId) && Name == other.Name;
Example #27
0
        public override bool Rename(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            Drive.ValidateName(name);

            if (string.Compare(name, Name, StringComparison.OrdinalIgnoreCase) == 0)
            {
                return(false);
            }

            if (FullPath == null || !Directory.Exists(FullPath))
            {
                return(false);
            }

            Directory.Move(FullPath, Path.Combine(Path.GetDirectoryName(FullPath), Id.ToString("N") + "." + ParentId.ToString("N") + "." + name));
            return(true);
        }
Example #28
0
        public XmlNode ToXml(XmlDocument xmlDocument)
        {
            XmlNode topicXml = xmlDocument.CreateElement("topic");

            topicXml.AppendChild(umbraco.xmlHelper.addTextNode(xmlDocument, "title", Title));
            topicXml.AppendChild(umbraco.xmlHelper.addCDataNode(xmlDocument, "body", Body));

            topicXml.AppendChild(umbraco.xmlHelper.addTextNode(xmlDocument, "urlname", UrlName));

            // tags
            XmlNode tags = umbraco.xmlHelper.addTextNode(xmlDocument, "tags", "");

            foreach (var tag in Tags)
            {
                var tagNode = umbraco.xmlHelper.addTextNode(xmlDocument, "tag", tag.Name);
                tagNode.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "id", tag.Id.ToString()));
                tagNode.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "weight", tag.Weight.ToString()));
                tags.AppendChild(tagNode);
                tags.AppendChild(tagNode);
            }
            topicXml.AppendChild(tags);

            if (topicXml.Attributes != null)
            {
                topicXml.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "id", Id.ToString(CultureInfo.InvariantCulture)));
                topicXml.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "parentId", ParentId.ToString(CultureInfo.InvariantCulture)));
                topicXml.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "memberId", MemberId.ToString(CultureInfo.InvariantCulture)));

                topicXml.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "latestReplyAuthor", LatestReplyAuthor.ToString(CultureInfo.InvariantCulture)));

                topicXml.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "created", Created.ToString(CultureInfo.InvariantCulture)));
                topicXml.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "updated", Updated.ToString(CultureInfo.InvariantCulture)));

                topicXml.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "locked", Locked.ToString()));
                topicXml.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "replies", Replies.ToString(CultureInfo.InvariantCulture)));

                topicXml.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "answer", Answer.ToString()));
                topicXml.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "score", Score.ToString()));
            }

            return(topicXml);
        }
Example #29
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return(GetType().Name + " |Activity Id: " + Id.ToString() + " |ParentActivityId:" + ParentId.ToString());
 }
Example #30
0
        /// <summary>
        /// Create the native .net child controls for this control
        /// </summary>
        protected override void CreateChildControls()
        {
            // Create the panel surround
            Panel = new Panel
            {
                ID       = "FolderBrowser",
                CssClass = "umbFolderBrowser"
            };

            Panel.Attributes.Add("data-parentid", ParentId.ToString());

            var sb = new StringBuilder();

            // Create the breadcrumb
            var breadCrumb = new List <global::umbraco.cms.businesslogic.media.Media> {
                ParentNode
            };

            var parent = ParentNode;

            while (parent.Id != -1)
            {
                parent = new global::umbraco.cms.businesslogic.media.Media(parent.ParentId);
                breadCrumb.Add(parent);
            }

            breadCrumb.Reverse();

            sb.Append("<ul class='breadcrumb'><li><strong>You are here:</strong></li>");
            foreach (var media in breadCrumb)
            {
                if (media.Id == ParentId)
                {
                    if (media.Id == -1)
                    {
                        sb.AppendFormat("<li>Media</li>");
                    }
                    else
                    {
                        sb.AppendFormat("<li>{0}</li>", media.Text);
                    }
                }
                else
                if (media.Id == -1)
                {
                    sb.AppendFormat("<li><a href='dashboard.aspx?app=media'>Media</a></li>");
                }
                else
                {
                    sb.AppendFormat("<li><a href='editMedia.aspx?id={1}'>{0}</a></li>", media.Text, media.Id);
                }
            }
            sb.Append("</ul>");

            // Path for tree refresh
            Panel.Attributes.Add("data-nodepath", ParentNode.Path);

            // Create size changer
            sb.Append("<div class='thumb-sizer'>" +
                      "<input type='radio' name='thumb_size' id='thumb_size_small' value='small' data-bind='checked: thumbSize' />" +
                      "<label for='thumb_size_small'><img src='images/thumbs_smll.png' alt='Small thumbnails' /></label>" +
                      "<input type='radio' name='thumb_size' id='thumb_size_medium' value='medium' data-bind='checked: thumbSize' />" +
                      "<label for='thumb_size_medium'><img src='images/thumbs_med.png' alt='Medium thumbnails' /></label>" +
                      "<input type='radio' name='thumb_size' id='thumb_size_large' value='large' data-bind='checked: thumbSize' />" +
                      "<label for='thumb_size_large'><img src='images/thumbs_lrg.png' alt='Large thumbnails' /></label>" +
                      "</div>");

            // Create the filter input
            sb.Append("<div class='filter'>Filter: <input type='text' data-bind=\"value: filterTerm, valueUpdate: 'afterkeydown'\" id='filterTerm'/></div>");

            // Create throbber to display whilst loading items
            sb.Append("<img src='images/throbber.gif' alt='' class='throbber' data-bind=\"visible: filtered().length == 0\" />");

            // Create thumbnails container
            sb.Append("<ul class='items' data-bind='foreach: filtered'>" +
                      "<li data-bind=\"attr: { 'data-id': Id, 'data-order': $index() }, css: { selected: selected() }, event: { mousedown: toggleSelected, contextmenu: toggleSelected, dblclick: edit }\"><div><span class='img'><img data-bind='attr: { src: ThumbnailUrl }' /></span><span data-bind='text: Name'></span></div></li>" +
                      "</ul>");

            Panel.Controls.Add(new LiteralControl(sb.ToString()));

            Controls.Add(Panel);

            Page.ClientScript.RegisterStartupScript(typeof(FolderBrowser),
                                                    "RegisterFolderBrowsers",
                                                    string.Format("$(function () {{ $(\".umbFolderBrowser\").folderBrowser({{ umbracoPath : '{0}', basePath : '{1}' }}); " +
                                                                  "$(\".umbFolderBrowser #filterTerm\").keypress(function(event) {{ return event.keyCode != 13; }});}});",
                                                                  IOHelper.ResolveUrl(SystemDirectories.Umbraco),
                                                                  IOHelper.ResolveUrl(SystemDirectories.Base)),
                                                    true);
        }