コード例 #1
0
        public void LineTest()
        {
            var line = new List <string>(19)
            {
                "1", "Title", "Text", "Sector", "Customer", "Focus", "Services", "Technology", "Application", "Tools", "15.10.2011", "text", "text", "Filename", "text", "text", "text", "text", "text"
            };
            ProjectNote target = new ProjectNote();

            target.Line = line;
            Assert.AreEqual(Convert.ToInt32(line[0]), target.Id);
            Assert.AreEqual(line[1], target.Title);
            Assert.AreEqual(line[2], target.Text);
            Assert.AreEqual(line[3], target.Sector);
            Assert.AreEqual(line[4], target.Customer);
            Assert.AreEqual(line[5], target.Focus[0]);
            Assert.AreEqual(line[6], target.Services[0]);
            Assert.AreEqual(line[7], target.Technologies[0]);
            Assert.AreEqual(line[8], target.Applications[0]);
            Assert.AreEqual(line[9], target.Tools[0]);
            Assert.AreEqual(Convert.ToDateTime(line[10]), target.Published);
            Assert.AreEqual(line[13], target.Filename);
            Assert.AreEqual((ProjectNote.FilepathFolder + @"\Pdf\" + line[13]), target.FilepathPdf);
            Assert.AreEqual((ProjectNote.FilepathFolder + @"\Xps\" + line[13]), target.FilepathXps);
            Assert.AreEqual((ProjectNote.FilepathFolder + @"\Images\" + line[13]), target.FilepathImage);
        }
コード例 #2
0
            public static ProjectNote Create()
            {
                var project     = TestProject.Create();
                var projectNote = ProjectNote.CreateNewBlank(project);

                projectNote.Note       = MakeTestProjectNoteString();
                projectNote.CreateDate = DateTime.Now;
                return(projectNote);
            }
コード例 #3
0
            public static ProjectNote Create(DatabaseEntities dbContext)
            {
                var project     = TestProject.Create(dbContext);
                var projectNote = ProjectNote.CreateNewBlank(project);

                projectNote.Note       = MakeTestProjectNoteString();
                projectNote.CreateDate = DateTime.Now;
                dbContext.ProjectNotes.Add(projectNote);
                return(projectNote);
            }
コード例 #4
0
        public ProjectNote ConvertToDomain(ProjectNoteViewModel model)
        {
            ProjectNote note = new ProjectNote();

            note.ProjectId   = model.ProjectId;
            note.Note        = model.Note;
            note.CreatedDate = model.CreatedDate;
            note.CreatedBy   = model.CreatedBy;

            return(note);
        }
コード例 #5
0
        private PartialViewResult ViewDeleteProjectNote(ProjectNote projectNote, ConfirmDialogFormViewModel viewModel)
        {
            var canDelete      = !projectNote.HasDependentObjects();
            var confirmMessage = canDelete
                ? $"Are you sure you want to delete this note for {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} '{projectNote.Project.GetDisplayName()}'?"
                : ConfirmDialogFormViewData.GetStandardCannotDeleteMessage($"{FieldDefinitionEnum.ProjectNote.ToType().GetFieldDefinitionLabel()}");

            var viewData = new ConfirmDialogFormViewData(confirmMessage, canDelete);

            return(RazorPartialView <ConfirmDialogForm, ConfirmDialogFormViewData, ConfirmDialogFormViewModel>(viewData, viewModel));
        }
コード例 #6
0
        public ProjectNoteViewModel ConvertToView(ProjectNote note)
        {
            ProjectNoteViewModel model = new ProjectNoteViewModel();

            model.ProjectNoteId = note.ProjectNoteId;
            model.ProjectId     = note.ProjectId;
            model.Note          = (!string.IsNullOrEmpty(note.Note)) ? note.Note : "N/A";
            model.CreatedDate   = (note.CreatedDate != null) ? note.CreatedDate : DateTime.MinValue;
            model.CreatedBy     = (!string.IsNullOrEmpty(note.CreatedBy)) ? note.CreatedBy : "N/A";

            return(model);
        }
コード例 #7
0
        public ActionResult New(ProjectPrimaryKey projectPrimaryKey, EditNoteViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(ViewEdit(viewModel));
            }
            var project     = projectPrimaryKey.EntityObject;
            var projectNote = ProjectNote.CreateNewBlank(project);

            viewModel.UpdateModel(projectNote, CurrentFirmaSession);
            HttpRequestStorage.DatabaseEntities.AllProjectNotes.Add(projectNote);
            return(new ModalDialogFormJsonResult());
        }
コード例 #8
0
 public void UpdateModel(ProjectNote projectNote, Person currentPerson)
 {
     projectNote.Note = Note;
     if (!ModelObjectHelpers.IsRealPrimaryKeyValue(projectNote.ProjectNoteID))
     {
         projectNote.CreateDate   = DateTime.Now;
         projectNote.CreatePerson = currentPerson;
     }
     else
     {
         projectNote.UpdateDate   = DateTime.Now;
         projectNote.UpdatePerson = currentPerson;
     }
 }
コード例 #9
0
        /// <summary>
        /// get project note by id
        /// </summary>
        /// <param name="projectNoteId"></param>
        /// <returns></returns>
        public ProjectNote GetProjectNote(Guid projectNoteId)
        {
            var projectNote = new ProjectNote();

            try
            {
                projectNote = _db.ProjectNote.FirstOrDefault(x => x.ProjectNoteId == projectNoteId);
            }
            catch (Exception ex)
            {
                logger.ErrorFormat("Error getting project note: {0} ", ex.ToString());
            }

            return(projectNote);
        }
コード例 #10
0
ファイル: ProjectNotes.ascx.cs プロジェクト: hazdik/bdomm
    protected void rptProjectNotesList_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
        {
            ProjectNote note        = e.Item.DataItem as ProjectNote;
            User        user        = _DataContext.Users.SingleOrDefault(U => U.ID == note.CreatedBy);
            Literal     ltrUserName = e.Item.FindControl("ltrUserName") as Literal;
            ltrUserName.Text = user == null ? "Annonymus" : user.UserName; //user.UserNameWeb;
            //String noteDate = note.CreatedDate.ToString(AppConstants.ValueOf.DATE_FROMAT_DISPLAY);
            ltrUserName.Text = String.Format("{0}<div class='NoteDate'>{1}</div>", ltrUserName.Text, note.CreatedDate.ToString(AppConstants.ValueOf.DATE_FROMAT_DISPLAY_WITH_TIME));

            Literal ltrDetails = e.Item.FindControl("ltrDetails") as Literal;
            ltrDetails.Text = FormatNoteText(note.Details, note.ID);
        }
    }
コード例 #11
0
        public async Task <ActionResult> Create(ProjectNote note, int projectid)
        {
            ProjectNote projectnote = new ProjectNote
            {
                NoteContent = note.NoteContent,
                CreatedOn   = DateTime.Now,
                CreatedBy   = Constants.HardCodedSignedInUser,
                Project     = await _projectDataService.GetProjectById(projectid)
            };


            await _projectNoteDataService.AddProjectNoteAsync(projectnote);

            return(RedirectToAction("Details", "Projects", new { id = projectid }));
        }
コード例 #12
0
        /// <summary>
        /// Add or update the note for the specified 'type' on the 'project'.
        /// Presently only one note of each type is supported.
        /// </summary>
        /// <param name="project"></param>
        /// <param name="type"></param>
        /// <param name="text"></param>
        /// <returns></returns>
        public static ProjectNote AddOrUpdateNote(this Project project, NoteTypes type, string text)
        {
            var note = project.GetNote(type);

            if (note == null)
            {
                note = new ProjectNote(project, type, text);
                project.Notes.Add(note);
            }
            else
            {
                note.Note = text;
            }

            return(note);
        }
コード例 #13
0
        public void LineTest()
        {
            const string filename = "Filename";
            var          line     = new List <string>(19)
            {
                "1", "Title", "Text", "Sector", "Customer", "Focus", "Services", "Technology", "Application",
                "Tools", "15.10.2011", "text", "text", filename + ".pdf", "text", "text", "text", "text",
                "text"
            };
            var aggregator = new AggregatorMock();
            var target     = new ProjectNote {
                Aggregator = aggregator, Line = line
            };

            Assert.AreEqual(Convert.ToInt32(line[0]), target.Id);
            Assert.AreEqual(line[1], target.Title);
            Assert.AreEqual(line[2], target.Text);
            Assert.AreEqual(line[3], target.Metadata[MetadataType.Get("Sector")].ToList()[0].Description);
            Assert.AreEqual(line[4], target.Metadata[MetadataType.Get("Customer")].ToList()[0].Description);
            Assert.AreEqual(line[5], target.Metadata[MetadataType.Get("Focus")].ToList()[0].Description);
            Assert.AreEqual(line[6], target.Metadata[MetadataType.Get("Services")].ToList()[0].Description);
            Assert.AreEqual(line[7], target.Metadata[MetadataType.Get("Technologies")].ToList()[0].Description);
            Assert.AreEqual(line[8], target.Metadata[MetadataType.Get("Applications")].ToList()[0].Description);
            Assert.AreEqual(line[9], target.Metadata[MetadataType.Get("Tools")].ToList()[0].Description);
            Assert.AreEqual(Convert.ToDateTime(line[10]), target.Published);
            Assert.AreEqual(line[13], target.Filename);
            Assert.AreEqual((ProjectNote.FilepathFolder + @"\Pdf\" + line[13]), target.FilepathPdf);
            Assert.AreEqual((ProjectNote.FilepathFolder + @"\Xps\" + filename + ".xps"), target.FilepathXps);
            Assert.AreEqual((ProjectNote.FilepathFolder + @"\Images\" + filename + ".bmp"), target.FilepathImage);

            Assert.AreSame(Metadata.Get(MetadataType.Get("Sector"), line[3]),
                           target.Metadata[MetadataType.Get("Sector")].ToList()[0]);
            Assert.AreSame(Metadata.Get(MetadataType.Get("Customer"), line[4]),
                           target.Metadata[MetadataType.Get("Customer")].ToList()[0]);
            Assert.AreSame(Metadata.Get(MetadataType.Get("Focus"), line[5]),
                           target.Metadata[MetadataType.Get("Focus")].ToList()[0]);
            Assert.AreSame(Metadata.Get(MetadataType.Get("Services"), line[6]),
                           target.Metadata[MetadataType.Get("Services")].ToList()[0]);
            Assert.AreSame(Metadata.Get(MetadataType.Get("Technologies"), line[7]),
                           target.Metadata[MetadataType.Get("Technologies")].ToList()[0]);
            Assert.AreSame(Metadata.Get(MetadataType.Get("Applications"), line[8]),
                           target.Metadata[MetadataType.Get("Applications")].ToList()[0]);
            Assert.AreSame(Metadata.Get(MetadataType.Get("Tools"), line[9]),
                           target.Metadata[MetadataType.Get("Tools")].ToList()[0]);
        }
コード例 #14
0
    protected void BindNoteDetails()
    {
        OMMDataContext context = new OMMDataContext();
        ProjectNote    note    = context.ProjectNotes.SingleOrDefault(P => P.ID == _NoteID);

        if (note == null)
        {
            ShowErrorMessage();
        }
        else
        {
            ltrProjectName.Text = String.Format("<b>Project Number: </b>{0}<br /><b>Project Name: </b>{1}", note.Project.Number, note.Project.Name.HtmlEncode());
            User user = context.Users.SingleOrDefault(U => U.ID == note.CreatedBy);
            ltrUserName.Text = user == null ? "Annonymus" : user.UserName;//user.UserNameWeb;
            ltrUserName.Text = String.Format("{0}<div class='NoteDate'>{1}</div>", ltrUserName.Text, note.CreatedDate.ToString(AppConstants.ValueOf.DATE_FROMAT_DISPLAY_WITH_TIME));

            ltrDetails.Text = WebUtil.FormatText(note.Details);
        }
    }
コード例 #15
0
    public long SaveProjectNote(App.CustomModels.CustomProjectNote customNote)
    {
        OMMDataContext context = new OMMDataContext();
        ProjectNote    note    = null;

        if (customNote.ID > 0)
        {
            note = context.ProjectNotes.SingleOrDefault(P => P.ID == customNote.ID);
        }
        else
        {
            note = new ProjectNote();
            context.ProjectNotes.InsertOnSubmit(note);
        }
        note.ProjectID   = customNote.ProjectID;
        note.Details     = customNote.Details;
        note.CreatedBy   = SessionCache.CurrentUser.ID;
        note.CreatedDate = DateTime.Now;
        context.SubmitChanges();
        return(note.ID);
    }
コード例 #16
0
        public async Task <IActionResult> Transform(int id)
        {
            WorkItem item = await _workItemDataService.GetWorkItemByIdAsync(id);

            Project project = new Project
            {
                Title       = item.Title,
                AssignedTo  = item.AssignedTo,
                CreatedBy   = item.CreatedBy,
                CreatedOn   = item.CreatedOn,
                Description = item.Description,
                DueDate     = item.DueDate,
                LastUpdated = item.LastUpdated,
                Active      = true
            };
            //add the project
            await _projectDataService.AddProject(project);

            //move notes to the new project
            foreach (var note in item.Notes)
            {
                ProjectNote projectNote = new ProjectNote
                {
                    CreatedBy   = note.CreatedBy,
                    CreatedOn   = note.CreatedOn,
                    NoteContent = note.NoteContent,
                    Project     = project
                };
                //add the project note
                await _projectNoteDataService.AddProjectNoteAsync(projectNote);
            }

            //deactivate the old work item
            await _workItemDataService.SetInactive(item);

            //go to the project detail page
            return(RedirectToAction("Details", "Projects", new { id = project.ProjectId }));
        }
コード例 #17
0
        public IHttpActionResult AddNotesToRecord(NoteType noteType, int recordId, NoteModel model)
        {
            if (string.IsNullOrWhiteSpace(model.Note))
            {
                return(BadRequest("Note text is required."));
            }

            var projectNote = new ProjectNote
            {
                NoteTypeId      = (int)noteType,
                Note            = model.Note,
                ParentId        = recordId,
                CreatedByUserId = base.UserId
            };
            var newNoteId = _repoFactory.Notes.CreateNote(projectNote);

            if (newNoteId.HasValue)
            {
                projectNote.NoteId = newNoteId.Value;
                return(Created($"/api/notes/type/{(int)noteType}/of/{recordId}/note/{newNoteId}", projectNote));
            }
            return(BadRequest("Note could not be saved."));
        }
コード例 #18
0
        /// <summary>
        /// save project note
        /// </summary>
        /// <param name="newProjectNote"></param>
        /// <returns></returns>
        public OperationResult SaveProjectNote(ProjectNote newProjectNote)
        {
            var operationResult = new OperationResult();

            try
            {
                logger.Debug("ProjectNote is being created...");

                _db.ProjectNote.Add(newProjectNote);

                _db.SaveChanges();

                operationResult.Success = true;
                operationResult.Message = "Success";
            }
            catch (Exception ex)
            {
                operationResult.Success = false;
                operationResult.Message = "Error";
                logger.ErrorFormat("Error saving new project note: {0} ", ex.ToString());
            }

            return(operationResult);
        }
コード例 #19
0
        public async Task AddProjectNoteAsync(ProjectNote note)
        {
            await _context.ProjectNotes.AddAsync(note);

            await _context.SaveChangesAsync();
        }
コード例 #20
0
        //
        public ProjectNote AddNote(int projectId, string text)
        {
            var user = _usersService.LoggedUser();
            var project = _projectsRepository.Single(projectId);

            if (project.Owner.Id != user.Id)
                return null;

            if (text == null)
                return null;

            var note = new ProjectNote
            {
                ProjectId = projectId,
                content = text
            };
            _db.ProjectsNotes.Add(note);
            _db.SaveChanges();
            return note;
        }