예제 #1
0
        public static string FetchSourceName(SourceType sourceType, int sourceId)
        {
            var result = string.Empty;

            switch (sourceType)
            {
            case SourceType.Task:
                result = sourceId.ToString();
                break;

            case SourceType.Project:
                result = ForeignKeyMapper.FetchProjectName(sourceId);
                break;

            case SourceType.Invoice:
                result = ForeignKeyMapper.FetchInvoiceNumber(sourceId);
                break;

            case SourceType.User:
                result = ForeignKeyMapper.FetchUserName(sourceId);
                break;

            default:
                break;
            }

            return(result);
        }
예제 #2
0
        private void OnStatusIdChanged()
        {
            this.LoadProperty(StatusProperty, ForeignKeyMapper.FetchStatus(this.StatusId));
            this.LoadProperty(StatusNameProperty, this.Status.Name);

            if (this.StatusId == 0)
            {
                return;
            }

            if (this.Status.IsStarted)
            {
                this.StartDate     = DateTime.Now.Date;
                this.CompletedDate = DateTime.MaxValue.Date;
            }

            if (this.Status.IsCompleted)
            {
                this.CompletedDate = DateTime.Now.Date;
                if (this.EstimatedCompletedDate == DateTime.MaxValue.Date)
                {
                    this.EstimatedCompletedDate = this.CompletedDate;
                }
            }
        }
예제 #3
0
        private void OnTaskIdChanged()
        {
            if (this.TaskId == 0)
            {
                this.ProjectId   = 0;
                this.ProjectName = string.Empty;
            }
            else
            {
                var task = ForeignKeyMapper.FetchTask(this.TaskId);

                this.ProjectId   = task.ProjectId;
                this.ProjectName = task.ProjectName;
                this.Description = task.Description;
            }
        }
예제 #4
0
        public static Feed FeedAdd(string action, Label label)
        {
            var feed = FeedService.FeedNew();

            feed.Type = "Label";
            feed.Data = string.Format(
                "Action={0}|Name={1}|SourceType={2}|SourceId={3}|SourceName={4}",
                action,
                label.Name,
                (int)label.SourceType,
                label.SourceId,
                ForeignKeyMapper.FetchSourceName(label.SourceType, label.SourceId));

            feed = FeedService.FeedSave(feed);

            return(feed);
        }
예제 #5
0
        public static Feed FeedAdd(string action, Note note)
        {
            var feed = FeedService.FeedNew();

            feed.Type = "Note";
            feed.Data = string.Format(
                "Action={0}|NoteId={1}|SourceType={2}|SourceId={3}|SourceName={4}|Text={5}",
                action,
                note.NoteId,
                (int)note.SourceType,
                note.SourceId,
                ForeignKeyMapper.FetchSourceName(note.SourceType, note.SourceId),
                note.Body);

            feed = FeedService.FeedSave(feed);

            return(feed);
        }
예제 #6
0
        public static Feed FeedAdd(string action, Attachment attachment)
        {
            var feed = FeedService.FeedNew();

            feed.Type = "Attachment";
            feed.Data = string.Format(
                "Action={0}|AttachmentId={1}|SourceType={2}|SourceId={3}|SourceName={4}|Text={5}",
                action,
                attachment.AttachmentId,
                (int)attachment.SourceType,
                attachment.SourceId,
                ForeignKeyMapper.FetchSourceName(attachment.SourceType, attachment.SourceId),
                attachment.Name);

            feed = FeedService.FeedSave(feed);

            return(feed);
        }
예제 #7
0
 private void OnProjectIdChanged()
 {
     this.LoadProperty(ProjectProperty, ForeignKeyMapper.FetchProject(this.ProjectId));
     this.LoadProperty(ProjectNameProperty, this.Project.Name);
 }
예제 #8
0
 private void OnCategoryIdChanged()
 {
     this.LoadProperty(CategoryProperty, ForeignKeyMapper.FetchCategory(this.CategoryId));
     this.LoadProperty(CategoryNameProperty, this.Category.Name);
 }
예제 #9
0
 private void OnAssignedToChanged()
 {
     this.LoadProperty(AssignedToNameProperty, ForeignKeyMapper.FetchUserName(this.AssignedTo));
 }
예제 #10
0
 private void OnUserIdChanged()
 {
     this.LoadProperty(UserNameProperty, ForeignKeyMapper.FetchUserName(this.UserId));
 }