Beispiel #1
0
        public ActionResult Edit(int id)
        {
            var active = siteService.GetActive(id);
            //ViewBag.Account = "disabled";
            var tags = siteService.GetTagJoins(id).ToList();

            return(View(active));
        }
Beispiel #2
0
        public ActionResult Detail(int id, string linkUrl = "")
        {
            var active = siteService.GetActive(id);

            ViewBag.Category   = active.Category.CategoryName;
            ViewBag.CategoryID = active.Category.CategoryID;
            ViewBag.Applies    = active.Applies.Where(m => m.Backup == "N").Take(20).ToList();
            ViewBag.Backup     = active.Applies.Where(m => m.Backup == "Y").Take(20).ToList();
            ViewBag.Volunteer  = active.Applies.Where(m => m.Backup == "V").Take(20).ToList();

            ViewBag.Discuss = voteService.GetDiscusses(id, Activity.Models.Others.DiscussType.Active, linkUrl);
            ViewBag.linkUrl = linkUrl;

            active.PageVisits += 1;
            siteService.Save();

            return(View(active));
        }
Beispiel #3
0
        public ActionResult Edit(int id)
        {
            var active = siteService.GetActive(id);
            var tags   = siteService.GetTagJoins(id).ToList();

            //ViewBag.Picture = active.PictureFile;
            //foreach (var item in tags)
            //{
            //    active.Tags += item.Tag + " ";
            //}

            return(View(active));
        }
Beispiel #4
0
        public ActionResult UserInfo(int?id)
        {
            var user   = membershipService.GetUser(User.Identity.Name);
            var active = new Active();

            if (id != null)
            {
                active = siteService.GetActive((int)id);

                var already = active.Applies.Where(m => m.Backup == "N").Count();

                var status = "";

                if (active.IsVolunteerFirst)
                {
                    if (active.Applies.Where(m => m.Backup == "V").Count() < active.VolunteerCount)
                    {
                        status += "<option value='V'>志愿者报名</option>";
                    }
                    else
                    {
                        if (already >= active.People)
                        {
                            if (active.Applies.Where(m => m.Backup == "Y").Count() < (int)(active.People * 0.15))
                            {
                                status += "<option value='Y'>候选报名</option>";
                            }
                        }
                        else
                        {
                            status += "<option value='N'>活动报名</option>";
                        }
                    }
                }
                else
                {
                    if (already >= active.People)
                    {
                        if (active.Applies.Where(m => m.Backup == "Y").Count() < (int)(active.People * 0.15))
                        {
                            status += "<option value='Y'>候选报名</option>";
                        }
                    }
                    else
                    {
                        status += "<option value='N'>活动报名</option>";
                    }

                    if (active.Applies.Where(m => m.Backup == "V").Count() < active.VolunteerCount)
                    {
                        status += "<option value='V'>志愿者报名</option>";
                    }
                }

                var u = new
                {
                    UserID     = user.UserID,
                    Contact    = user.Contact,
                    Remind     = active.Remind,
                    Option     = status,
                    NeedPeople = "<span style='color: red;'>" + (active.IsVolunteerFirst ? "该活动优先接受志愿者报名. " : "") + "报名情况:</span>活动人员:" + active.People + "人,已报名" + already + "人; 志愿者:" + active.VolunteerCount + "名,已报名" + active.Applies.Where(mbox => mbox.Backup == "V").Count() + "人"
                };

                return(Json(u, JsonRequestBehavior.AllowGet));
            }

            return(null);
        }