Ejemplo n.º 1
0
        private void SaveCustTagChange(out string msg)
        {
            msg = "";
            if (CustId == "" || UserId == "")
            {
                msg = "参数传递出现异常!";
            }
            else
            {
                string[] straTagID = TagIds.Split(',');

                StringBuilder strXmlObject = new StringBuilder();
                strXmlObject.Append("<ItemRoot>");
                for (int i = 0; i < straTagID.Length; i++)
                {
                    strXmlObject.Append("<Item>");
                    strXmlObject.Append("<TagID>" + straTagID[i] + "</TagID>");
                    strXmlObject.Append("<CustID>" + CustId + "</CustID>");
                    strXmlObject.Append("</Item>");
                }
                strXmlObject.Append("</ItemRoot>");

                int outvalue = BitAuto.YanFa.Crm2009.BLL.CustTag.Instance.SetCustTagMapping(strXmlObject.ToString(), CustId, int.Parse(UserId));
                if (outvalue == -1)
                {
                    msg = "数据保存失败!";
                }
                else
                {
                    msg = "数据保存成功!";
                }
            }
        }
Ejemplo n.º 2
0
 public Builder SetTagIds(IEnumerable <long> tagIds)
 {
     if (tagIds == null)
     {
         return(this);
     }
     TagIds.Clear();
     TagIds.AddRange(tagIds);
     return(this);
 }
Ejemplo n.º 3
0
        public bool Equals(Suggestion other)
        {
            if (other is null)
            {
                return(false);
            }

            return(Description == other.Description &&
                   ProjectId == other.ProjectId &&
                   TaskId == other.TaskId &&
                   WorkspaceId == other.WorkspaceId &&
                   StartTime == other.StartTime &&
                   Duration == other.Duration &&
                   IsBillable == other.IsBillable &&
                   TagIds.SetEquals(other.TagIds));
        }
Ejemplo n.º 4
0
        public bool RemoveSpecificTag(string tagName)
        {
            var tag = db.Tags.FirstOrDefault(t => t.Name == tagName);

            if (tagName == null)
            {
                return(false);
            }
            int tagId  = tag.Id;
            var tagIds = TagIds.ToList();

            if (!tagIds.Remove(tagId))
            {
                return(false);
            }
            this.TagIds = tagIds.ToArray();
            return(true);
        }
Ejemplo n.º 5
0
        public TimeEntryViewModel(IThreadSafeTimeEntry timeEntry, DurationFormat durationFormat)
        {
            Ensure.Argument.IsNotNull(timeEntry, nameof(timeEntry));

            if (timeEntry.IsRunning())
            {
                throw new InvalidOperationException("It is not possible to show a running time entry in the log.");
            }

            DurationFormat = durationFormat;

            Id             = timeEntry.Id;
            WorkspaceId    = timeEntry.WorkspaceId;
            StartTime      = timeEntry.Start;
            IsBillable     = timeEntry.Billable;
            TagIds         = timeEntry.TagIds.ToArray();
            HasTags        = TagIds.Count() > 0;
            Description    = timeEntry.Description;
            HasProject     = timeEntry.Project != null;
            Duration       = TimeSpan.FromSeconds(timeEntry.Duration.Value);
            HasDescription = !string.IsNullOrEmpty(timeEntry.Description);

            CanSync   = timeEntry.SyncStatus != SyncStatus.SyncFailed;
            NeedsSync = timeEntry.SyncStatus == SyncStatus.SyncNeeded;

            IsGhost = timeEntry.IsGhost;

            if (!HasProject)
            {
                return;
            }

            ProjectId    = timeEntry.Project.Id;
            ProjectName  = timeEntry.Project.DisplayName();
            ProjectColor = timeEntry.Project.DisplayColor();

            TaskId   = timeEntry.TaskId;
            TaskName = timeEntry.Task?.Name ?? "";

            ClientName = timeEntry.Project.Client?.Name ?? "";
        }
Ejemplo n.º 6
0
        private void UpdateTags()
        {
            var existingTagPosts      = Context.TagPosts.Where(x => x.PostId.Equals(Id));
            var existingTagPostIds    = existingTagPosts.Select(x => x.TagId);
            var tagPostIdsToBeDeleted = existingTagPostIds.Except(TagIds);
            var tagPostsToBeDeleted   = Context.TagPosts.Where(x => x.PostId.Equals(Id) &&
                                                               tagPostIdsToBeDeleted.Contains(x.TagId));

            Context.RemoveRange(tagPostsToBeDeleted);

            var tagPostIdsToBeAdded = TagIds.Except(existingTagPostIds);

            foreach (int tagId in tagPostIdsToBeAdded)
            {
                Context.Add(new TagPost
                {
                    TagId  = tagId,
                    PostId = Id
                });
            }
        }
Ejemplo n.º 7
0
 public void Delete(TagIds tagIds)
 {
     Repository.DeleteByIds(tagIds.Ids);
 }
Ejemplo n.º 8
0
 public bool HasTag(TagIds tagId) => Tags.Any(tag => tag.TagId == tagId);
Ejemplo n.º 9
0
 public void Delete(TagIds tagIds)
 {
     Repository.DeleteByIds(tagIds.Ids);
 }
Ejemplo n.º 10
0
 public Tag(TagIds tagId)
 {
     TagId = tagId;
 }