コード例 #1
0
        public void SearchTextChanged(string searchTxt)
        {
            StoriesFilter model = StoriesFilterSession;

            model.SearchText     = searchTxt;
            StoriesFilterSession = model;
        }
コード例 #2
0
        public void OrderedByNameChecked()
        {
            StoriesFilter model = StoriesFilterSession;

            model.OrderedByName  = !StoriesFilterSession.OrderedByName;
            StoriesFilterSession = model;
        }
コード例 #3
0
        public void ReviewedChecked()
        {
            StoriesFilter model = StoriesFilterSession;

            model.Reviewed       = !StoriesFilterSession.Reviewed;
            StoriesFilterSession = model;
        }
コード例 #4
0
 public ActionResult Edit(Story model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             StoriesLogic.UpdateStory(model);
             StoriesFilter story = StoriesFilterSession;
             story.AllStories     = StoriesLogic.GetStoriesList(model.ProjectId);
             StoriesFilterSession = story;
             string URL = "/Stories/Index?ProjectId=" + model.ProjectId;
             return(PartialView("JavascriptRedirect", new JavascriptRedirectModel(URL)));
         }
         catch (Exception e)
         {
             LogsLogic.InsertLog(new Log()
             {
                 Message    = e.Message,
                 StackTrace = e.StackTrace,
                 StoryName  = "ManagementProject/Stories/Edit(Post)",
                 Parameters = new JavaScriptSerializer().Serialize(model)
             });
         }
     }
     return(PartialView("EditPartial", model));
 }
コード例 #5
0
        public ActionResult Index(int projectId)
        {
            StoriesIndexModel model = new StoriesIndexModel();

            try
            {
                if (StoriesFilterSession == null)
                {
                    StoriesFilter story = new StoriesFilter()
                    {
                        AllStories = StoriesLogic.GetStoriesList(projectId),
                        projectId  = projectId,
                        sprintId   = SprintsLogic.GetCurrentSprint(projectId)
                    };

                    StoriesFilterSession = story;
                }

                model = StoriesLogic.GetStoriesIndexModel(StoriesFilterSession, projectId);
            }
            catch (Exception e)
            {
                LogsLogic.InsertLog(new Log()
                {
                    Message    = e.Message,
                    StackTrace = e.StackTrace,
                    StoryName  = "ManagementProject/Stories/Index",
                    Parameters = "projectId= " + projectId
                });
                return(RedirectToAction("GeneralError", "Error", new { ErrorMessage = Error.ServerNotRespond }));
            }

            return(View(model));
        }
コード例 #6
0
        public static List <StoriesDetails> GetFilteredStoriesList(StoriesFilter storiesFilter)
        {
            List <StoriesDetails> storiesList = new List <StoriesDetails>();
            bool selectAnyFilterOption        = false;

            if (storiesFilter.sprintId != 0)
            {
                selectAnyFilterOption = true;
                storiesList           = storiesFilter.AllStories.Where(t => t.Sprints.Any(s => s.Id == storiesFilter.sprintId)).ToList();
            }
            if (!selectAnyFilterOption)
            {
                storiesList = storiesFilter.AllStories;
            }
            if (!string.IsNullOrEmpty(storiesFilter.SearchText))
            {
                storiesList = storiesList.Where(s => s.Name.ToLower().Contains(storiesFilter.SearchText.ToLower())).ToList();
            }
            if (storiesFilter.OrderedByName)
            {
                storiesList = storiesList.OrderBy(s => s.Name).ToList();
            }


            return(storiesList);
        }
コード例 #7
0
        public ActionResult Create(StoryCreateModel storyModel, FormCollection collection)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    Story model = new Story()
                    {
                        ProjectId = storyModel.ProjectId,
                        Exist     = false,
                        sprintId  = StoriesFilterSession.sprintId
                    };

                    if (storyModel.selectedType == 1)
                    {
                        model.Exist = true;
                        model.Name  = collection["search"].ToString();
                    }
                    else
                    {
                        model.Name = collection["NewStory"].ToString();
                    }
                    model.CreatorId  = SessionData.UserId;
                    model.CreateDate = DateTimeHelper.Today();

                    StoriesDetails newStory = StoriesLogic.InsertNewStory(model);
                    if (newStory != null)
                    {
                        StoriesFilter story = StoriesFilterSession;
                        story.AllStories.Add(newStory);
                        StoriesFilterSession = story;
                    }
                    if (newStory == null && storyModel.selectedType == 2)
                    {
                        // return pop up to set option for create with the same name
                    }
                }
                catch (Exception e)
                {
                    LogsLogic.InsertLog(new Log()
                    {
                        Message    = e.Message,
                        StackTrace = e.StackTrace,
                        StoryName  = "ManagementProject/Stories/Create(Post)",
                        Parameters = new JavaScriptSerializer().Serialize(storyModel)
                    });
                }
            }
            return(RedirectToAction("StoriesList", new { projectId = storyModel.ProjectId }));
        }
コード例 #8
0
        public static StoriesIndexModel GetStoriesIndexModel(StoriesFilter storiesFilter, int projectId)
        {
            Project           project = new Project();
            StoriesIndexModel model   = new StoriesIndexModel
            {
                projectId     = projectId,
                OrderedByName = storiesFilter.OrderedByName,
                Reviewed      = storiesFilter.Reviewed,
                SearchText    = storiesFilter.SearchText
            };

            if (projectId != 0)
            {
                project           = ProjectsRepositories.GetProjectById(projectId);
                model.projectName = project.Name;
            }
            return(model);
        }
コード例 #9
0
        public void SprintChecked(int sprintId)
        {
            StoriesFilter model = StoriesFilterSession;

            try
            {
                model.sprintId       = sprintId;
                StoriesFilterSession = model;
            }
            catch (Exception e)
            {
                LogsLogic.InsertLog(new Log()
                {
                    Message    = e.Message,
                    StackTrace = e.StackTrace,
                    StoryName  = "ManagementProject/Stories/SprintChecked",
                    Parameters = "sprintId= " + sprintId
                });
            }
        }
コード例 #10
0
 public ActionResult Delete(int id, int projectId)
 {
     try
     {
         StoriesLogic.DeleteStory(id);
         StoriesFilter story = StoriesFilterSession;
         story.AllStories     = StoriesLogic.GetStoriesList(projectId);
         StoriesFilterSession = story;
     }
     catch (Exception e)
     {
         LogsLogic.InsertLog(new Log()
         {
             Message    = e.Message,
             StackTrace = e.StackTrace,
             StoryName  = "ManagementProject/Stories/Delete",
             Parameters = "id= " + id + "& projectId= " + projectId
         });
     }
     return(RedirectToAction("Index", new { ProjectId = projectId }));
 }
コード例 #11
0
        public ActionResult Index(int?sprintId)
        {
            List <Sprint> sprints = SprintsLogic.GetAllSprints();

            if (sprintId == null && StoriesFilterSession == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            if (StoriesFilterSession == null && sprints.Count > 0)
            {
                StoriesFilterSession         = new StoriesFilter();
                StoriesFilterSession.Sprints = new SprintModel()
                {
                    Current  = sprints.Find(a => a.CurrentSprint),
                    Future   = sprints.FindAll(a => a.FutureSprint),
                    Previous = sprints.FindAll(a => a.PreviousSprint)
                };
            }
            StoriesFilterSession.sprintId = sprintId.Value;

            return(View(StoriesFilterSession));
        }
コード例 #12
0
 public ActionResult DeleteAll(int projectId)
 {
     try
     {
         StoriesFilter         story   = StoriesFilterSession;
         List <StoriesDetails> stories = new List <StoriesDetails>();
         stories = StoriesLogic.GetFilteredStoriesList(StoriesFilterSession);
         StoriesLogic.DeleteStoriesList(stories);
         story.AllStories     = StoriesLogic.GetStoriesList(projectId);
         StoriesFilterSession = story;
     }
     catch (Exception e)
     {
         LogsLogic.InsertLog(new Log()
         {
             Message    = e.Message,
             StackTrace = e.StackTrace,
             StoryName  = "ManagementProject/Stories/Delete",
             Parameters = "projectId= " + projectId
         });
     }
     return(RedirectToAction("Index", new { ProjectId = projectId }));
 }