Example #1
0
        public ActionResult Create(MathStudent collection)
        {
            GroupMathDropDownList(collection.GroupMathsID);
            try
            {
                MathStudentDao bdDao = new MathStudentDao();

                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());
            }
        }
Example #2
0
        public ActionResult Edit(MathStudent collection)
        {
            MathStudentDao bdDao = new MathStudentDao();

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

                collection.ModifiedBy   = us.UserName;
                collection.ModifiedDate = Hepper.GetDateServer();
                // ConvertExcelToXml convertXML = new ConvertExcelToXml();
                //string xml = convertXML.GetXML(collection.Sources);
                //  int i = 0;
                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());
            }
        }
Example #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());
            }
        }
Example #4
0
        // GET: Admin/MathStudent/Edit/5
        public ActionResult Edit(long id)
        {
            MathStudentDao db          = new MathStudentDao();
            MathStudent    mathStudent = db.FindByID(id);

            GroupMathDropDownList(mathStudent.GroupMathsID);
            return(View(mathStudent));
        }
Example #5
0
        // GET: Admin/MathStudent
        public ActionResult Index()
        {
            GroupMathDao bdDao = new GroupMathDao();

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

            return(View(db.ToList()));
        }
Example #6
0
        public ActionResult Delete(long id)
        {
            try
            {
                // TODO: Add delete logic here

                MathStudentDao bdDao = new MathStudentDao();

                bdDao.Delete(id);
                // SetAlert("Xóa thành công", "success");
                return(RedirectToAction("Index"));
            }
            catch
            {
                // SetAlert("Không xóa được", "danger");
                return(View());
            }
        }
Example #7
0
        // GET: Admin/MathStudent/Details/5
        public ActionResult Details(long id)
        {
            MathStudentDao db = new MathStudentDao();

            return(View(db.FindByID(id)));
        }