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); }
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; } } }
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; } }
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); }
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); }
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); }
private void OnProjectIdChanged() { this.LoadProperty(ProjectProperty, ForeignKeyMapper.FetchProject(this.ProjectId)); this.LoadProperty(ProjectNameProperty, this.Project.Name); }
private void OnCategoryIdChanged() { this.LoadProperty(CategoryProperty, ForeignKeyMapper.FetchCategory(this.CategoryId)); this.LoadProperty(CategoryNameProperty, this.Category.Name); }
private void OnAssignedToChanged() { this.LoadProperty(AssignedToNameProperty, ForeignKeyMapper.FetchUserName(this.AssignedTo)); }
private void OnUserIdChanged() { this.LoadProperty(UserNameProperty, ForeignKeyMapper.FetchUserName(this.UserId)); }