Ejemplo n.º 1
0
        public ActionResult Create(GroupMath collection)
        {
            try
            {
                GroupMathDao bdDao = new GroupMathDao();

                UserLogin us = (UserLogin)Session[SystemConsts.USER_SESSION];
                collection.CreateBy     = us.UserName;
                collection.CreateDate   = Hepper.GetDateServer();
                collection.ModifiedBy   = us.UserName;
                collection.ModifiedDate = Hepper.GetDateServer();
                collection.LanguageID   = "vi";
                //collection.CreateBy = us.UserName;
                //collection.ModifiedBy = us.UserName;
                if (bdDao.Insert(collection))
                {
                    SetAlert(@Resources.ResourceAdmin.AdminCreateRecordSuccess, "success");
                    return(RedirectToAction("Index"));
                }
                else
                {
                    SetAlert(@Resources.ResourceAdmin.AdminCreateRecordFailed, "danger");
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                SetAlert(@Resources.ResourceAdmin.AdminCreateRecordFailed, "danger");
                return(View());
            }
        }
Ejemplo n.º 2
0
        private void GroupMathDropDownList(object selectedParent = null)
        {
            GroupMathDao bdDao = new GroupMathDao();
            var          items = bdDao.ToList();

            ViewBag.Parents = new SelectList(items, "GroupMathsID", "Name", selectedParent);
        }
Ejemplo n.º 3
0
        public ActionResult Delete(long id)
        {
            try
            {
                // TODO: Add delete logic here

                GroupMathDao   bdDao    = new GroupMathDao();
                MathStudentDao dbNewDao = new MathStudentDao();


                if (dbNewDao.ToListByGroupID(id).Count > 0)
                {
                    SetAlert("Đang sử dụng không được phép xóa", SystemConsts.ALERT_DANGER);
                    return(RedirectToAction("Index"));
                }
                bdDao.Delete(id);
                // SetAlert("Xóa thành công", "success");
                return(RedirectToAction("Index"));
            }
            catch
            {
                // SetAlert("Không xóa được", "danger");
                return(View());
            }
        }
Ejemplo n.º 4
0
        public ActionResult Edit(GroupMath collection)
        {
            GroupMathDao bdDao = new GroupMathDao();

            try
            {
                UserLogin us = (UserLogin)Session[SystemConsts.USER_SESSION];

                collection.ModifiedBy   = us.UserName;
                collection.ModifiedDate = Hepper.GetDateServer();


                if (bdDao.Update(collection))
                {
                    SetAlert(@Resources.ResourceAdmin.AdminEditRecordSucess, "success");
                    return(RedirectToAction("Index"));
                }
                else
                {
                    SetAlert(@Resources.ResourceAdmin.AdminEditRecordFailed, "danger");
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                SetAlert(@Resources.ResourceAdmin.AdminEditRecordFailed, "danger");
                return(View());
            }
        }
Ejemplo n.º 5
0
        // GET: Admin/GroupMath
        public ActionResult Index()
        {
            GroupMathDao bdDao = new GroupMathDao();

            ViewBag.lstCate = bdDao.ToList();
            //TempData["AlertMessage"] = null;
            return(View(ViewBag.lstCate));
        }
Ejemplo n.º 6
0
        // GET: Admin/MathStudent
        public ActionResult Index()
        {
            GroupMathDao bdDao = new GroupMathDao();

            ViewBag.lstGroupMath = bdDao.ToList();
            MathStudentDao db = new MathStudentDao();

            return(View(db.ToList()));
        }
Ejemplo n.º 7
0
        // GET: Admin/GroupMath/Details/5
        public ActionResult Details(long id)
        {
            GroupMathDao dbDAO = new GroupMathDao();
            GroupMath    cat   = null;

            try
            {
                cat = dbDAO.FindByID(id);
            }
            catch
            {
                ModelState.AddModelError("", Resources.ResourceAdmin.ErrorGetRecordMessage);
            }
            return(View(cat));
        }
Ejemplo n.º 8
0
        public ActionResult Edit(long id)
        {
            GroupMathDao dbDAO = new GroupMathDao();
            GroupMath    cat   = null;

            try
            {
                cat = dbDAO.FindByID(id);

                // ViewBag.GroupID = new SelectList(dbContext..ToList(), "ID", "Name");
            }
            catch
            {
                ModelState.AddModelError("", Resources.ResourceAdmin.ErrorGetRecordMessage);
            }
            return(View(cat));
        }