예제 #1
0
        public JsonResult NewTopicPeople()
        {
            UserAuth();
            var topicid   = Request.Form["topicid"];
            var pps       = Request.Form["pps"];
            var splitstrs = pps.Split(new string[] { " @" }, StringSplitOptions.RemoveEmptyEntries);
            var pplist    = new List <string>();

            foreach (var PP in splitstrs)
            {
                if (PP.Trim().ToUpper().Contains(ViewBag.username.ToUpper()))
                {
                    continue;
                }

                pplist.Add(PP.Replace("@", "").Trim());
            }

            CoTopicVM.UpdateTopicPeople(topicid, pplist, this);

            var ret = new JsonResult();

            ret.Data = new { sucess = true };
            return(ret);
        }
예제 #2
0
        public JsonResult RemoveTopic()
        {
            var topicid = Request.Form["topicid"];

            CoTopicVM.RemoveTopic(topicid);
            var ret = new JsonResult();

            ret.Data = new { sucess = true };
            return(ret);
        }
예제 #3
0
        public JsonResult CompleteTopic()
        {
            var topicid = Request.Form["topicid"];

            CoTopicVM.UpdateTopicStatus(topicid, TopicStatus.Done);
            TopicProject.updateeventstatus(topicid, TopicPJStatus.Done);
            var ret = new JsonResult();

            ret.Data = new { sucess = true };
            return(ret);
        }
예제 #4
0
        public JsonResult NewTopicDueDate()
        {
            var topicid      = Request.Form["topicid"];
            var duedate      = Request.Form["duedate"];
            var warningclock = Request.Form["warningclock"];

            CoTopicVM.UpdateTopicDueDate(topicid, duedate, warningclock);

            var ret = new JsonResult();

            ret.Data = new { sucess = true };
            return(ret);
        }
예제 #5
0
        public ActionResult ModifyTopic(string activenavitem, string topicid, string commentid)
        {
            UserAuth();
            var tempnavlist = new List <string>();

            tempnavlist.AddRange(new string[] { TopicBelongType.IModify, TopicBelongType.IAssign, TopicBelongType.IRelated, TopicBelongType.Completed });
            ViewBag.NavList = tempnavlist;

            if (!string.IsNullOrEmpty(topicid) && !string.IsNullOrEmpty(commentid))
            {
                ViewBag.activenavitem = activenavitem;
                ViewBag.topicid       = topicid;
                ViewBag.commentid     = commentid;
                var commentlist = TopicCommentVM.RetrieveComment(topicid, commentid);
                if (commentlist.Count > 0)
                {
                    ViewBag.tcontent = commentlist[0].commentcontent;
                }
                else
                {
                    return(RedirectToAction("Home", "CoWork"));
                }
            }
            else if (!string.IsNullOrEmpty(topicid))
            {
                ViewBag.activenavitem = activenavitem;
                ViewBag.topicid       = topicid;
                ViewBag.commentid     = "";
                var topiclist = CoTopicVM.RetrieveTopic(topicid);
                if (topiclist.Count > 0)
                {
                    ViewBag.tcontent = topiclist[0].topiccontent;
                }
                else
                {
                    return(RedirectToAction("Home", "CoWork"));
                }
            }
            else
            {
                return(RedirectToAction("Home", "CoWork"));
            }

            return(View());
        }
예제 #6
0
        public JsonResult TopicByID()
        {
            var topicid = Request.Form["topicid"];
            var tempvm  = CoTopicVM.RetrieveTopic(topicid);
            var ret     = new JsonResult();

            if (tempvm.Count > 0)
            {
                ret.Data = new { sucess = true
                                 , data = tempvm[0] };
            }
            else
            {
                ret.Data = new { sucess = false };
            }

            return(ret);
        }
예제 #7
0
        public ActionResult NewTopic()
        {
            UserAuth();

            var topicid = Request.Form["topicid"];

            if (!string.IsNullOrEmpty(Request.Form["JobTopicEditor"]))
            {
                var topiccontent = SeverHtmlDecode.Decode(this, Request.Form["JobTopicEditor"]);

                var subject = Request.Form["subject"];
                CoTopicVM.AddNewTopic(topicid, subject, topiccontent, ViewBag.username, ViewBag.compName);
                CoTopicVM.UpdateTopicIsRead(topicid, false);

                var plist = CoTopicVM.RetrieveTopicPeoPleEmail(topicid);
                SendAnURLEmail("<p>New topic: " + subject + "is created by " + ViewBag.username + "</p>" + topiccontent
                               , "/CoWork/Home?topicid=" + topicid
                               , plist);
            }

            return(RedirectToAction("Home", "CoWork"));
        }
예제 #8
0
        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());
        }
예제 #9
0
        public ActionResult ModifyTopicPost()
        {
            var activenavitem = Request.Form["navid"];
            var activetopicid = Request.Form["topicid"];
            var commentid     = Request.Form["commentid"];
            var tcontent      = SeverHtmlDecode.Decode(this, Request.Form["JobTopicEditor"]);

            if (!string.IsNullOrEmpty(activetopicid) && !string.IsNullOrEmpty(commentid))
            {
                TopicCommentVM.UpdateComment(commentid, tcontent);
            }
            else
            {
                CoTopicVM.UpdateTopic(activetopicid, tcontent);
            }

            CoTopicVM.UpdateTopicIsRead(activetopicid, false);

            var routedict = new RouteValueDictionary();

            routedict.Add("activenavitem", activenavitem);
            routedict.Add("topicid", activetopicid);
            return(RedirectToAction("Home", "CoWork", routedict));
        }
예제 #10
0
        public ActionResult NewTopicComment()
        {
            UserAuth();
            var activetopicid  = Request.Form["activetopicid"];
            var activenavitem  = Request.Form["activenav"];
            var commentcontent = SeverHtmlDecode.Decode(this, Request.Form["CommentEditor"]);

            if (!string.IsNullOrEmpty(commentcontent))
            {
                var commenttime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                var commentid   = CoTopicVM.GetUniqKey();

                TopicCommentVM.AddComment(activetopicid, commentid, commentcontent, ViewBag.username, commenttime);
                CoTopicVM.UpdateTopicIsRead(activetopicid, false);
            }



            var routedict = new RouteValueDictionary();

            routedict.Add("activenavitem", activenavitem);
            routedict.Add("topicid", activetopicid);
            return(RedirectToAction("Home", "CoWork", routedict));
        }
예제 #11
0
        // 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());
        }