示例#1
0
        public ActionResult Index()
        {
            var dao   = new general_rule_dao();
            var model = dao.GetRule();

            return(View(model));
        }
        public ActionResult Create(footballer footballer)
        {
            if (ModelState.IsValid)
            {
                var dao       = new footballer_dao();
                var info_rule = new general_rule_dao().GetRule();

                int result = dao.Insert(footballer);
                if (result == 1)
                {
                    SetAlert(StaticResources.Resources.Pub_InsertSuccess, "success");
                    return(RedirectToAction("Index", "Footballer", new { club_id = footballer.footballClub_id }));
                }
                else if (result == -2)
                {
                    ModelState.AddModelError("", "Tuổi không hợp lệ (" + info_rule.min_age + " -> " + info_rule.max_age + ")");
                }
                else if (result == -3)
                {
                    ModelState.AddModelError("", "Số lượng cầu thủ trong đội đã đủ (" + info_rule.max_footballer + ")");
                }
                else if (result == -4)
                {
                    ModelState.AddModelError("", "Số lượng cầu thủ ngoại trong đội đã đủ (" + info_rule.max_foreign_footballer + ")");
                }
                else
                {
                    ModelState.AddModelError("", StaticResources.Resources.InsertFootballerFailed);
                }
            }
            SetListFootballClub(footballer.footballClub_id);
            SetListFootballerType(footballer.footballer_type_id);
            return(View());
        }
示例#3
0
        public ActionResult Create(match_goal match_goal)
        {
            if (ModelState.IsValid)
            {
                var dao       = new match_goal_dao();
                var info_rule = new general_rule_dao().GetRule();

                var result = dao.Insert(match_goal);
                if (result == 1)
                {
                    SetAlert(StaticResources.Resources.Pub_InsertSuccess, "success");
                    return(RedirectToAction("Index", "MatchGoal", new { match_id = match_goal.match_id }));
                }
                else if (result == -2)
                {
                    ModelState.AddModelError("", "Thởi điểm ghi bàn không hợp lệ (từ 0 -> " + info_rule.max_time_goal + ")");
                }
                else
                {
                    ModelState.AddModelError("", StaticResources.Resources.InsertMatchGoalFailed);
                }
            }
            SetListGoalType(match_goal.goal_type_id);
            SetListFootballer(match_goal.match_id, match_goal.footballer_id);
            ViewBag.CurrentMatchID = match_goal.match_id;
            return(View());
        }
示例#4
0
 public ActionResult DeleteAllChecked(string ids)
 {
     if (ids != "" && ids != null)
     {
         string[] array_id = ids.Split(',');
         var      dao      = new general_rule_dao();
         foreach (var id in array_id)
         {
             dao.Delete(int.Parse(id));
         }
     }
     return(RedirectToAction("Index"));
 }
示例#5
0
        public ActionResult Create(general_rule rule)
        {
            if (ModelState.IsValid)
            {
                var dao = new general_rule_dao();

                bool result = dao.Insert(rule);
                if (result)
                {
                    SetAlert(StaticResources.Resources.Pub_InsertSuccess, "success");
                    return(RedirectToAction("Index", "Rule"));
                }
                else
                {
                    ModelState.AddModelError("", StaticResources.Resources.InsertRuleFailed);
                }
            }
            return(View());
        }
示例#6
0
        public ActionResult EditSortRule(string sort_type1, string sort_type2, string sort_type3, string sort_type4)
        {
            if (ModelState.IsValid)
            {
                var dao = new general_rule_dao();

                //tạo chuỗi dk sắp xếp BXH phân cách bởi dấu ","
                string str_sortRule = sort_type1 + "," + sort_type2 + "," + sort_type3 + "," + sort_type4;
                var    result       = dao.UpdateSortRule(str_sortRule);

                if (result)
                {
                    SetAlert(StaticResources.Resources.Pub_UpdateSucess, "success");
                    return(RedirectToAction("Index", "Rank"));
                }
                else
                {
                    ModelState.AddModelError("", StaticResources.Resources.UpdateRuleFailed);
                }
            }
            return(RedirectToAction("Index", "Rank"));
        }
示例#7
0
        public ActionResult Edit(general_rule rule)
        {
            if (ModelState.IsValid)
            {
                var dao = new general_rule_dao();

                var result = dao.Update(rule);
                if (result == 1)
                {
                    SetAlert(StaticResources.Resources.Pub_UpdateSucess, "success");
                    return(RedirectToAction("Index", "Rank"));
                }
                else if (result == -2)
                {
                    ModelState.AddModelError("", "Sai điều lệ: Điểm Thắng > Hòa > Thua");
                }
                else
                {
                    ModelState.AddModelError("", StaticResources.Resources.UpdateRuleFailed);
                }
            }
            return(View("Index"));
        }
示例#8
0
        public ActionResult Edit(int id)
        {
            var model = new general_rule_dao().Get_By_Id(id);

            return(View(model));
        }