public ActionResult CreateNewTopic() { UserAuth(); var employlist = new List <string>(); employlist.AddRange(CoTopicVM.GetNewPeopleList()); employlist.AddRange(CfgUtility.GetEmployeeList(this)); ViewBag.EmployeeList = Newtonsoft.Json.JsonConvert.SerializeObject(employlist.ToArray()); var pjlist = new List <string>(); pjlist.AddRange(CoTopicVM.GetNewPJList()); pjlist.AddRange(CfgUtility.GetPJList(this)); ViewBag.PJList = Newtonsoft.Json.JsonConvert.SerializeObject(pjlist.ToArray()); ViewBag.TopicId = CoTopicVM.GetUniqKey(); var tempnavlist = new List <string>(); tempnavlist.AddRange(new string[] { TopicBelongType.ICreate, TopicBelongType.IAssign, TopicBelongType.IRelated, TopicBelongType.Completed }); ViewBag.NavList = tempnavlist; return(View()); }
// GET: CoWork public ActionResult Home(string activenavitem, string topicid, string searchkey) { UserAuth(); if (string.Compare(ViewBag.username, ViewBag.compName) == 0) { return(RedirectToAction("Welcome")); } var employlist = new List <string>(); employlist.AddRange(CoTopicVM.GetNewPeopleList()); employlist.AddRange(CfgUtility.GetEmployeeList(this)); ViewBag.EmployeeList = Newtonsoft.Json.JsonConvert.SerializeObject(employlist.ToArray()); var pjlist = new List <string>(); pjlist.AddRange(CoTopicVM.GetNewPJList()); pjlist.AddRange(CfgUtility.GetPJList(this)); ViewBag.PJList = Newtonsoft.Json.JsonConvert.SerializeObject(pjlist.ToArray()); //nav list var tempnavlist = new List <string>(); tempnavlist.AddRange(new string[] { TopicBelongType.IAssign, TopicBelongType.IRelated, TopicBelongType.Completed }); ViewBag.NavList = tempnavlist; if (!string.IsNullOrEmpty(topicid)) { ViewBag.ActiveTopicid = topicid; List <CoTopicVM> CurrentTopic1 = CoTopicVM.RetrieveTopic(ViewBag.ActiveTopicid); ViewBag.CurrentTopic = CurrentTopic1; //query string only contains topicid if (string.IsNullOrEmpty(activenavitem)) { //base on topic status decide the active nav if (string.Compare(CurrentTopic1[0].status, TopicStatus.Working) == 0) { if (CoTopicVM.IsTopicOwner(topicid, ViewBag.username)) { ViewBag.ActiveNav = TopicBelongType.IAssign; } else { ViewBag.ActiveNav = TopicBelongType.IRelated; } } else { ViewBag.ActiveNav = TopicBelongType.Completed; } } else { ViewBag.ActiveNav = activenavitem; } if (string.Compare(ViewBag.ActiveNav, TopicBelongType.Completed) == 0) { ViewBag.topiclist = CoTopicVM.RetrieveCompleteTopic4List(ViewBag.username, searchkey); } else { ViewBag.topiclist = CoTopicVM.RetrieveTopic4List(ViewBag.username, ViewBag.ActiveNav, TopicStatus.Working, searchkey); } } else { if (string.IsNullOrEmpty(activenavitem)) { ViewBag.ActiveNav = tempnavlist[0]; } else { ViewBag.ActiveNav = activenavitem; } if (string.Compare(ViewBag.ActiveNav, TopicBelongType.Completed) == 0) { ViewBag.topiclist = CoTopicVM.RetrieveCompleteTopic4List(ViewBag.username, searchkey); } else { ViewBag.topiclist = CoTopicVM.RetrieveTopic4List(ViewBag.username, ViewBag.ActiveNav, TopicStatus.Working, searchkey); } //choose a default topic if (ViewBag.topiclist.Count > 0) { ViewBag.ActiveTopicid = ViewBag.topiclist[0].topicid; ViewBag.CurrentTopic = CoTopicVM.RetrieveTopic(ViewBag.ActiveTopicid); } } if (!string.IsNullOrEmpty(ViewBag.ActiveTopicid)) { CoTopicVM.UpdateTopicIsRead(ViewBag.ActiveTopicid, ViewBag.username, true); } return(View()); }