Esempio n. 1
0
        public ActionResult Edit(Competitor collection)
        {
            try
            {
                // TODO: Add update logic here
                if (ModelState.IsValid)
                {
                    // TODO: Add insert logic here

                    CompetitorDao bdDao = new CompetitorDao();
                    UserLogin     us    = (UserLogin)Session[CommonConstant.USER_SESSION];

                    collection.ModifiedDate = Hepper.GetDateServer();

                    collection.ModifiedBy = us.UserName;
                    if (bdDao.Update(collection) > 0)
                    {
                        SetAlert("Sửa thành công", "success");
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        SetAlert("Không sửa được", "danger");
                    }
                }
                return(View());
            }
            catch
            {
                SetAlert("Không sửa được", "danger");
                return(View());
            }
        }
Esempio n. 2
0
        public ActionResult Create(Competitor collection)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    // TODO: Add insert logic here

                    CompetitorDao bdDao = new CompetitorDao();
                    UserLogin     us    = (UserLogin)Session[CommonConstant.USER_SESSION];
                    collection.CreateDate   = Hepper.GetDateServer();
                    collection.ModifiedDate = Hepper.GetDateServer();
                    collection.CompetitorID = bdDao.GenaraCode("H", 3);
                    collection.CreateBy     = us.UserName;
                    collection.ModifiedBy   = us.UserName;
                    if (bdDao.Insert(collection) > 0)
                    {
                        SetAlert("Thêm thành công", "success");
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        SetAlert("Không thêm được", "danger");
                    }
                }
                return(View());
            }
            catch
            {
                SetAlert("Không thêm được", "danger");
                return(View());
            }
        }
Esempio n. 3
0
 public ActionResult Delete(long id)
 {
     try
     {  // TODO: Add delete logic here
         CompetitorDao bdDao = new CompetitorDao();
         ProjectDao    prDao = new ProjectDao();
         if (prDao.FindByCompetitor(id).Count > 0)
         {
             SetAlert("Đang sử dụng không được phép xóa", Common.CommonConstant.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());
     }
 }
Esempio n. 4
0
        // GET: Competitor/Edit/5
        public ActionResult Edit(long id)
        {
            CompetitorDao bdDao = new CompetitorDao();

            return(View(bdDao.FindByID(id)));
        }
Esempio n. 5
0
        // GET: Competitor
        public ActionResult Index()
        {
            CompetitorDao bdDao = new CompetitorDao();

            return(View(bdDao.ToList()));
        }