public void ProcessRequest(HttpContext context) { try { long NewsID = 0; Int64.TryParse(context.Request.Form["news_id"].ToString(), out NewsID); int CatID = 0; Int32.TryParse(context.Request.Form["cat_id"].ToString(), out CatID); //NewsEditHelper.AutoSave_Insert(NewsID, CatID, context.Request.Form["news_title"].ToString(), context.Request.Form["image"].ToString(), context.Request.Form["sapo"].ToString(), context.Request.Form["news_content"].ToString(), DateTime.Now); NewsRow objNewsRow = NewsEditHelper.GetNewsInfo_News(NewsID, false); if (objNewsRow == null) { NewsEditHelper.CreateNews(NewsID, CatID, string.Empty, context.Request.Form["news_title"].ToString(), context.Request.Form["image"].ToString(), context.Request.Form["news_title"].ToString(), context.Request.Form["sapo"].ToString(), context.Request.Form["news_content"].ToString(), string.Empty, false, 0 /*lưu tạm*/, 0, string.Empty, string.Empty, string.Empty, DateTime.Now, false, false, 0, string.Empty, string.Empty, string.Empty, false, string.Empty, string.Empty, string.Empty, 0, string.Empty, string.Empty); } else if (objNewsRow.News_Status == 0) { NewsEditHelper.UpdateNews(NewsID, CatID, string.Empty, context.Request.Form["news_title"].ToString(), context.Request.Form["image"].ToString(), string.Empty, context.Request.Form["sapo"].ToString(), context.Request.Form["news_content"].ToString(), false, 0, 0, string.Empty, string.Empty, DateTime.Now, false, false, false, 0, string.Empty, string.Empty, string.Empty, string.Empty, false, string.Empty, string.Empty, string.Empty, 0, string.Empty, string.Empty); } context.Response.Write("Lưu tự động lúc : " + DateTime.Now); } catch (Exception ex) { context.Response.Write(ex.Message); } }
protected void grdList_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Copy")) { int _id = Convert.ToInt32(e.CommandArgument); DataTable _obj = NewsEditHelper.GetCrawlerNews(_id); if (_obj != null && _obj.Rows.Count > 0) { DataRow row = _obj.Rows[0]; long NewsID = Convert.ToInt64(NewsHelper.GenNewsID()); NewsEditHelper.CreateNews(NewsID, 0, string.Empty, row["News_Title"].ToString(), string.Empty, "Theo " + row["SourceName"], row["News_InitContent"].ToString(), row["News_Content"].ToString(), HttpContext.Current.User.Identity.Name, false, 0, 0, string.Empty, string.Empty, string.Empty, DateTime.Now, false, false, 0, string.Empty, string.Empty, string.Empty, false, string.Empty, string.Empty, row["News_Source"].ToString(), 0, string.Empty, string.Empty); NewsEditHelper.UpdateCrawlerStatus(_id); Response.Redirect("/office/add,templist/" + NewsID + ".aspx"); } else { Response.Redirect("/office/crawler.aspx"); } } }