protected void submitButton_Click(object sender, EventArgs e) { string idString = Request.QueryString["id"]; int idInt = Convert.ToInt32(idString); if (null == idString || idString.Equals(string.Empty) || 1 > idInt) { UtilFunctions.AlertBox("请输入正确的请求代号!", Page); return; } string title = TitleTextBox.Text; string article = ArticleTextBox.Text; NewsDAO newsDao = new NewsDAO(); int categoryId = Convert.ToInt32(this.CategoryDropDownList.SelectedValue); if (1 > categoryId) { UtilFunctions.AlertBox("请选择正确的文章类型!", Page); return; } if (-1 == newsDao.EditNews(idInt, categoryId, title, article)) { UtilFunctions.AlertBox("修改失败!", Page); } else { UtilFunctions.AlertBox("修改成功!", Page); } }
public ActionResult Insert(NEWS entity) { var dao = new NewsDAO(); dao.insertNews(entity); return(RedirectToAction("Management")); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string idString = Request.QueryString["id"]; int idInt = Convert.ToInt32(idString); if (null == idString || idString.Equals(string.Empty) || 1 > idInt) { this.showFalseMessage("请输入正确的请求代号!"); return; } NewsDAO newsDao = new NewsDAO(); DataSet infoDataset = newsDao.GetNewsInfo(idInt); if (null == infoDataset || 0 == infoDataset.Tables.Count || 0 == infoDataset.Tables[0].Rows.Count) { this.showFalseMessage("未找到所请求的新闻!"); return; } DataRow infoDatarow = infoDataset.Tables[0].Rows[0]; int outline_id = Convert.ToInt32(infoDatarow["outline_id"].ToString()); this.OutlineRadioButtonList.Items.FindByValue(outline_id.ToString()).Selected = true; DataSet categoryDataset = newsDao.GetCategory(outline_id, "category"); this.CategoryDropDownList.DataSource = categoryDataset; this.CategoryDropDownList.DataTextField = "name"; this.CategoryDropDownList.DataValueField = "id"; this.CategoryDropDownList.DataBind(); this.CategoryDropDownList.Items.FindByValue(infoDatarow["category_id"].ToString()).Selected = true; this.TitleTextBox.Text = infoDatarow["title"].ToString(); this.ArticleTextBox.Text = infoDatarow["article"].ToString(); } }
protected void OutlineRadioButtonList_SelectedIndexChanged(object sender, EventArgs e) { string categoryIdString = OutlineRadioButtonList.SelectedValue; DataSet categoryDataset = null; if (null == Cache["category"]) { NewsDAO newsDao = new NewsDAO(); categoryDataset = newsDao.GetAllCategory(); Cache.Insert("category", categoryDataset, null, DateTime.UtcNow.AddMinutes(10), System.Web.Caching.Cache.NoSlidingExpiration); } else { categoryDataset = Cache["category"] as DataSet; if (null == categoryDataset) { NewsDAO newsDao = new NewsDAO(); categoryDataset = newsDao.GetAllCategory(); Cache.Insert("category", categoryDataset, null, DateTime.UtcNow.AddMinutes(10), System.Web.Caching.Cache.NoSlidingExpiration); } } this.CategoryDropDownList.DataSource = categoryDataset.Tables[categoryIdString]; this.CategoryDropDownList.DataTextField = "name"; this.CategoryDropDownList.DataValueField = "id"; this.CategoryDropDownList.DataBind(); }
public ActionResult Management() { var dao = new NewsDAO(); var model = dao.getAllNews(); return(View(model)); }
protected void Page_Load(object sender, EventArgs e) { User currentUser = (User)Session["currentUser"]; Boolean authenticate = authenticateAccess(currentUser); if (Request.QueryString["id"] != null) { if (!authenticate) { Response.Redirect("errorPage.aspx"); } else { //TestimonialDAO tdao = new TestimonialDAO(); string id = Request.QueryString["id"]; int id_num = Convert.ToInt32(id); NewsDAO adao = new NewsDAO(); adao.deactivateNews(id_num); News obj = adao.getNewsById(id_num); if (File.Exists(obj.img_path)) { File.Delete(obj.img_path); } //set audit setAudit(currentUser, "news banner", "delete", id, "deleted news banner name: " + obj.banner_name); Response.Redirect("manageNewsBanners.aspx"); } } else { Response.Redirect("errorPage.aspx"); } }
// GET: News public ActionResult Index(int id = 0, int page = 1, int pagesize = 5) { NewsDAO newsDAO = new NewsDAO(); var list = newsDAO.getContens(id).ToPagedList(page, pagesize); return(View(list)); }
// GET: Administrator/TinTuc public ActionResult Index(string filter, string SearchKey, int page = 1, int pageSize = 12) { ViewBag.ListCategory = new NewCategoryDAO().ListAll(); switch (filter) { case "CN001": var model1 = new NewsDAO().ListAllByCateID("CN001", page, pageSize); return(View(model1)); case "CN002": var model2 = new NewsDAO().ListAllByCateID("CN002", page, pageSize); return(View(model2)); case "CN003": var model3 = new NewsDAO().ListAllByCateID("CN003", page, pageSize); return(View(model3)); case "LuotXem": var model4 = new NewsDAO().ListAllByView(page, pageSize); return(View(model4)); case "BaiVietBiKhoa": var model5 = new NewsDAO().ListAllStatusFalse(page, pageSize); return(View(model5)); default: var model = new NewsDAO().ListAll(SearchKey, page, pageSize); return(View(model)); } }
// GET: CarManufacturerClient public ActionResult Index(int id) { var listHX = new CarManufacturerDAO().ListOf(); ViewBag.HX = listHX; var listTL = new CategoryDAO().ListOf(); ViewBag.TL = listTL; var listPK = new CylinderCapacityDAO().ListOf(); ViewBag.PK = listPK; var listCL = new ColorDAO().ListOf(); ViewBag.CL = listCL; var listNews = new NewsDAO().ListAll(); ViewBag.New = listNews; var listNewPr = new ProductDAO().ListNewPro(); ViewBag.Product = listNewPr; var listAllPr = new ProductDAO().ListByIDCar(id); ViewBag.ALLPro = listAllPr; return(View()); }
public ActionResult Remove(int IDNewsCanXoa) { NewsDAO newsDAO = new NewsDAO(); string newsNameSelected = newsDAO.Xoa(IDNewsCanXoa); return(RedirectToAction("Index", "News")); }
public void deleteNewsBtnClick(object sender, EventArgs e) { String id = ((LinkButton)sender).CommandArgument; NewsDAO mNewsDAO = new NewsDAO (); mNewsDAO.deleteByID (id, repNewsManage); initNewsManage (); }
public ActionResult Edit(News NewsEdit, string trangthai, int id) { NewsEdit.NewsID = id; if (ModelState.IsValid) { NewsDAO newsDAO = new NewsDAO(); if (trangthai == "Khóa") { NewsEdit.Status = false; } else { NewsEdit.Status = true; } NewsEdit.ModifiedBy = BaseController.NguoiDungHienTai.UserAccount; int checksuccess = newsDAO.EditNews(NewsEdit); if (checksuccess > 0) { TempData["msg"] = MessageBox.Show("Edit Thành Công"); return(RedirectToAction("Index", "News")); } else { ModelState.AddModelError("", "Edit Không Thành Công"); } } return(View("Edit", "News", new { @NewsEditID = NewsEdit.NewsID })); }
public ActionResult Update(NEWS entity) { var dao = new NewsDAO(); dao.updateNews(entity); return(RedirectToAction("Management")); }
public ActionResult Delete(int id) { var dao = new NewsDAO(); dao.deleteNews(id); return(RedirectToAction("Management")); }
public ActionResult Update(int id) { var dao = new NewsDAO(); var ob = dao.getById(id); ob.CONTENT = ""; return(View(ob)); }
public ActionResult ListNews() { NewsDAO newsDAO = new NewsDAO(); var list = newsDAO.ListAll(); newsDAO.ChuyenDoi(list); return(PartialView(list)); }
public ActionResult Create() { var listNews = new NewsDAO().ListAll(); ViewBag.New = listNews; return(View()); }
protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack){ searchText = Request.QueryString["search"]; NewsDAO mNewsDAO = new NewsDAO (); mNewsDAO.searchNews (searchText, repSearchResult); } }
// GET: Admin/News public ActionResult Index(int page = 1, int pagesize = 2) { TempData["page"] = page; NewsDAO newsDAO = new NewsDAO(); var list = newsDAO.ListAll().ToPagedList(page, pagesize); return(View(list)); }
public ActionResult Edit(int NewsEditID) { NewsDAO newsDAO = new NewsDAO(); var newsEditting = newsDAO.getNews(NewsEditID); SetParentNewsName(); return(View(newsEditting)); }
public JsonResult LoadProvincial() { var provincials = new NewsDAO().GetProvincials(); return(Json(new { data = provincials }, JsonRequestBehavior.AllowGet)); }
public JsonResult LoadNews(int newid) { var result = new NewsDAO().FindById(newid); return(Json(new { data = result }, JsonRequestBehavior.AllowGet)); }
public JsonResult DeleteImage(string picture) { var result = new NewsDAO().DeleteImage(picture); return(Json(new { data = result })); }
public JsonResult UpdateStatus(int newid, int status) { var result = new NewsDAO().UpdateStatus(newid, status); return(Json(new { data = result }, JsonRequestBehavior.AllowGet)); }
public JsonResult LoadDistrict(int keyLoad) { var districts = new NewsDAO().GetDistricts(keyLoad); return(Json(new { data = districts }, JsonRequestBehavior.AllowGet)); }
public JsonResult XoaTin(string newId) { var result = new NewsDAO().XoaMauTin(newId); return(Json(new { status = result }, JsonRequestBehavior.AllowGet)); }
// // GET: /Home/ public ActionResult Index() { NewsDAO tbnew = new NewsDAO(); ViewBag.viewdate = tbnew.GetviewDate(); var model = tbnew.ViewListAll(); return(View(model)); }
// GET: NewsClient public ActionResult Index(string search, int page = 1, int pageSize = 12) { var listAllNews = new NewsDAO(); var model = listAllNews.ListAllPage(search, page, pageSize); ViewBag.Search = search; return(View(model)); }
public JsonResult GetDetail(int newid) { var result = new NewsDAO().GetDetail(newid); return(Json(new { data = result }, JsonRequestBehavior.AllowGet)); }
public ActionResult Index(string CategoryNewID, string KeyWord, int page = 1, int pageSize = 6) { key = KeyWord; ViewBag.KeyWordSearch = key; var model = new NewsDAO().DanhSachTinMoi(CategoryNewID, KeyWord, page, pageSize); return(View(model)); }
public JsonResult ChangeStatus(int newsid) { NewsDAO newsDAO = new NewsDAO(); var trangthai = newsDAO.ChangeStatus(newsid); return(Json(new { status = trangthai })); }
public JsonResult LoadData(string fullname, string sex, int status, int page, int pageSize) { var result = new NewsDAO().GetAllPaging(fullname, sex, status, page, pageSize); return(Json(new { totalRow = result.TotalRecord, data = result.Items }, JsonRequestBehavior.AllowGet)); }
protected void Page_Load(object sender, EventArgs e) { NewsDAO mNewsDAO = new NewsDAO (); // get hotest activity news mNewsDAO.selectHotNews (Constant.NEWSACTIVITY, mHotActNews); // get hotest academic news mNewsDAO.selectHotNews (Constant.NEWSACADEMIC, mHotAcaNews); //get hotest else news mNewsDAO.selectHotNews (Constant.NEWSELSE, mHotElseNews); this.DataBind (); }
public void button1Clicked(object sender, EventArgs args) { Response.Write (searchText.Value); //button1.Text = "You clicked me"; //Server.Transfer ("../Web/index.aspx", true); NewsDAO mNewsDAO = new NewsDAO (); News mNews = new News (); mNewsDAO.selectByID ("SELECT * FROM News WHERE news_id = 1;", mNews); Console.WriteLine (mNews.toString()); }
private NewsService() { // _daoManager = ServiceConfig.GetInstance().DaoManager; //_newsDao = _daoManager.GetDao(typeof(INews)) as INews; _newsDao = new NewsDAO(); }
public void initNewsManage() { NewsDAO mNewsDAO = new NewsDAO (); mNewsDAO.selectAll (repNewsManage); }