public RequirementsIndexModel(GetRequirementsIndex_Result item)
        {
            this.Id       = item.Tag;
            this.UserName = new UserNameModel(item.UserID);
            this.Modified = item.RevisionDate;
            this.Summary  = item.Title;

            using (var ctx = new Entities())
            {
                int logged = Authentication.GetLoggedUser().UserID;
                this.Published = item.Published;
                this.Rated     = (ctx.RequirementRatings.FirstOrDefault(i => i.RevisionID == item.RevisionID) != null);
                this.Approved  = (ctx.RequirementRatings.FirstOrDefault(i => i.RevisionID == item.RevisionID && i.Approved == true) != null);
                this.Archived  = (ctx.RequirementRevisions.FirstOrDefault(i => i.RevisionID == item.RevisionID && i.Archived == true) != null);

                var bl = (from i in ctx.Baselines orderby i.SetDate descending select i.SetDate).Take(1);

                if (bl != null && bl.Count() == 1)
                {
                    this.LatestBaseline = bl.ToArray()[0];
                }
            }

            if (item.BaselineDate.HasValue)
            {
                this.Status = "Implementado";

                if (this.LatestBaseline.HasValue && this.LatestBaseline.Value >= item.BaselineDate.Value)
                {
                    this.Status = "Baseline";
                }
                else
                {
                    this.Status = "Implementado";
                }
            }
            else if (this.Published == false)
            {
                this.Status = "Em edição";
            }
            else if (this.Rated == false)
            {
                this.Status = "Ag. avaliação";
            }
            else if (this.Approved == false)
            {
                this.Status    = "Reprovado";
                this.Published = false;
            }
            else if (this.Archived)
            {
                this.Status = "Cancelado";
            }
            else
            {
                this.Status = "Aprovado";
            }
        }
예제 #2
0
        public StoriesIndexModel(GetRequirementsIndex_Result item)
        {
            this.Id       = item.Tag;
            this.UserName = new UserNameModel(item.UserID);
            this.Modified = item.RevisionDate;
            this.Summary  = item.Title;

            using (var ctx = new Entities())
            {
                int logged = Authentication.GetLoggedUser().UserID;
                this.Published = item.Published;
                this.Rated     = (ctx.RequirementRatings.FirstOrDefault(i => i.RevisionID == item.RevisionID) != null);
                this.Approved  = (ctx.RequirementRatings.FirstOrDefault(i => i.RevisionID == item.RevisionID && i.Approved == true) != null);
            }

            if (item.BaselineDate.HasValue)
            {
                this.Published = this.Rated = this.Implemented = true;
                this.Status    = "Atendida";
            }
            else if (this.Published == false)
            {
                this.Status = "Em edição";
            }
            else if (this.Rated == false)
            {
                this.Status = "Ag. avaliação";
            }
            else if (this.Approved == false)
            {
                this.Status    = "Reprovada";
                this.Published = false;
            }
            else
            {
                this.Status = "Aprovada";
            }
        }