示例#1
0
        private static void CreateTestProject(PROGRESSTRACKERContext context)
        {
            Ptproject project = new Ptproject
            {
                Name        = "Test Project",
                Description = "This is a test project",
                Ptuser      = context.Ptuser.First(),
                Status      = ProjectStatus.None.ToString(),
                Active      = true
            };

            context.Ptproject.Add(project);
            context.SaveChanges();

            Pttask task = new Pttask
            {
                Description = "First Task",
                PtprojectId = project.Id,
                Completed   = false,
                Active      = true
            };

            context.Pttask.Add(task);
            context.SaveChanges();
        }
示例#2
0
 public TopNavbarViewModel(string title, bool isAuthenticated = false, string returnUrl = null, string addUrl = null, string editUrl = null, string deleteUrl = null, Ptproject project = null)
 {
     Title           = title;
     ReturnUrl       = returnUrl;
     AddUrl          = addUrl;
     EditUrl         = editUrl;
     DeleteUrl       = deleteUrl;
     IsAuthenticated = isAuthenticated;
     Project         = project;
 }
示例#3
0
        private void SetProgress(Ptproject project)
        {
            decimal progress = -1;

            try
            {
                int total     = project.Pttask.Count;
                int completed = project.Pttask.Count(o => o.Completed);
                progress = total != 0 ? (decimal)completed / total : 0;
                Progress = progress >= 0 && progress <= 1 ? progress : Progress;
                if (total == 0)
                {
                    Progress = 0;
                }
                UnresolvedCount = total - completed;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#4
0
 public ProjectViewModel(Ptproject project)
 {
     Project = project;
     SetProgress(project);
     SetStatus();
 }