Ejemplo n.º 1
0
 public ActionResult ExecAdd()
 {
     try
     {
         //判断是否具有同名社团
         var bll = new BLL.newClub();
         if (bll.Exist(p => p.name == Request.QueryString["name"]))
         {
             ViewBag.Success = false;
             return(View("Add"));
         }
         var model = new Model.newclub();
         model.describe = Request.QueryString["des"];
         model.logo     = Request.QueryString["logo"];
         model.name     = Request.QueryString["name"];
         model.state    = 0;
         model.userID   = Common.User.GetUserID(Session["Username"].ToString());
         bll.Add(model);
         ViewBag.Success = true;
         return(View("Add"));
     }
     catch (Exception)
     {
         ViewBag.Success = false;
         return(View("Add"));
     }
 }
Ejemplo n.º 2
0
        // GET: teacher/NewClub
        public ActionResult Index()
        {
            //获取所有社团数据
            var list = new BLL.newClub().GetModels(p => p.state == 0).ToList();

            return(View(list));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 所有未读的申请
        /// </summary>
        /// <returns></returns>
        public List <Model.newclub> NoneRead()
        {
            int userID = Common.User.GetUserID(Session["Username"].ToString());
            List <Model.newclub> list = new BLL.newClub().GetModels(p => p.userID == userID & p.state != 0 & p.state != 3).ToList();

            ViewBag.ClubApplyResult = list.Count;
            return(list);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 申请中的所有活动
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            int userID = Common.User.GetUserID(Session["Username"].ToString());
            List <Model.newclub> list = new BLL.newClub().GetModels(p => p.userID == userID & p.state == 0).ToList();

            ViewBag.ClubApply = list.Count;
            return(View(list));
        }
Ejemplo n.º 5
0
        public ActionResult Read(int id)
        {
            var bll   = new BLL.newClub();
            var model = bll.GetModel(p => p.id == id);

            model.state = 3;
            //更新未读消息个数

            return(View("Result", NoneRead()));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 执行申请状态更新
        /// </summary>
        /// <param name="id"></param>
        /// <param name="state"></param>
        public void Update(int id, int state)
        {
            var bll   = new BLL.newClub();
            var model = bll.GetModel(p => p.id == id);

            model.state = state;
            bll.Update(model, new[] { "id", "state" });
            //更新申请个数
            ViewBag.ClubApply = new BLL.newClub().GetRecordCount(p => p.state == 0);
        }
Ejemplo n.º 7
0
        public void Allow(int id)
        {
            Update(id, 1);
            //社团表中加入新的社团
            var bll       = new BLL.newClub();
            var model     = bll.GetModel(p => p.id == id);
            var clubBLL   = new BLL.ClubBLL();
            var clubModel = new Model.club();

            clubModel.date = DateTime.Now;
            clubModel.logo = model.logo;
            clubModel.name = model.name;
            clubBLL.Add(clubModel);
            //申请人设置为管理员
            var manager = new Model.clubmanager();

            manager.cludID = clubModel.id;
            manager.userID = new BLL.newClub().GetModel(p => p.id == id).userID;
            new BLL.clubManager().Add(manager);
            Response.Redirect("/teacher/NewClub/");
        }