示例#1
0
        public TaskFormViewModel(Task task , Sprint sprint , User user, Code  code, Story story)
        {
            TimeforingRepository repo = new TimeforingRepository();
            Task = task;

            Sprint = SelectListMaker.SprintsWithSelected(Task);
            User = SelectListMaker.UsersWithSelected(Task);
            Code = SelectListMaker.CodesWithSelected(Task);
            Story = SelectListMaker.StoriesWithSelected(Task);
        }
示例#2
0
        public static List<SelectListItem> SprintsWithSelected(Task t)
        {
            var items = _repo.FindAllSprints().Where(s => s.Archived != true).Select(s => s); ;

            List<SelectListItem> list = new List<SelectListItem>();
            foreach (var item in items)
            {
                SelectListItem i = new SelectListItem { Value = item.SprintID.ToString(), Text = item.Name, Selected = t.SprintID == item.SprintID };
                list.Add(i);
            }
            return list;
        }
示例#3
0
        public static List<SelectListItem> CodesWithSelected(Task t)
        {
            var items = _repo.FindAllCodes();

            List<SelectListItem> list = new List<SelectListItem>();
            foreach (var item in items)
            {
                SelectListItem i = new SelectListItem
                {
                    Value = item.CodeID.ToString(),
                    Text = item.ProjectID + "/" + item.CodeNumber + " - " + item.Name,
                    Selected = t.CodeID == item.CodeID
                };
                list.Add(i);
            }
            return list;
        }
示例#4
0
        public ActionResult Create(string command, FormCollection collection)
        {
            Task t = new Task();
            TaskFormViewModel tm = new TaskFormViewModel(t);
            try
            {
                UpdateModel(t);
                repo.AddTask(t);
                repo.Save();
                if (command == "save")
                    return RedirectToAction("Index");
                TaskFormViewModel tmNew = new TaskFormViewModel(new Task(), t.Sprint , t.User, t.Code, t.Story);
                ResetTextValues();

                return View(tmNew);

            }
            catch
            {
                ModelState.AddRuleViolations(t.GetRuleViolations());
                return View(new TaskFormViewModel(t));
            }
        }
示例#5
0
        public static List<SelectListItem> UsersWithSelected(Task t)
        {
            var items = _repo.FindAllUsers();

            List<SelectListItem> list = new List<SelectListItem>();
            foreach (var item in items)
            {
                SelectListItem i;
                i = new SelectListItem { Value = item.UserID.ToString(), Text = item.Name, Selected = t.UserID == item.UserID };
                list.Add(i);
            }
            return list;
        }
示例#6
0
        public static List<SelectListItem> StoriesWithSelected(Task task)
        {
            var items = from s in _repo.FindAllStories()
                        select s;
            List<SelectListItem> list = new List<SelectListItem>();
            foreach (var item in items)
            {
                SelectListItem i;

                i = new SelectListItem { Value = item.StoryID.ToString(), Text = item.Name, Selected = task.StoryID == item.StoryID };

                list.Add(i);
            }
            return list;
        }
示例#7
0
 partial void DeleteTask(Task instance);
示例#8
0
		private void detach_Tasks(Task entity)
		{
			this.SendPropertyChanging();
			entity.User = null;
		}
示例#9
0
 partial void UpdateTask(Task instance);
示例#10
0
		private void attach_Tasks(Task entity)
		{
			this.SendPropertyChanging();
			entity.User = this;
		}
示例#11
0
 partial void InsertTask(Task instance);