void Bind() { intArticleId = Basic.RequestHelper.GetQueryInt("articleid", 0); intProfessionalId = Basic.RequestHelper.GetQueryInt("professionalid", 0); Entity.Professional infoSP = DAL.Professional.ProfessionalEntityGet(intProfessionalId); if (infoSP != null) { strProfessionalName = infoSP.ProfessionalName;//专业名称 ProfessionalBase1.info = infoSP; ProfessionalLeft1.ProfessionalId = infoSP.Id; ProfessionalLeft1.XueKeMenLeiName = infoSP.XueKeMenLeiName; Crumb1.NavString = " <span>></span> <a href=\"/zhuanye.shtml\" title\"高考报考专业库\">高考报考专业库</a> <span>></span> <a href=\"/zhuanye-jianjie-" + infoSP.Id + ".shtml\" title\"" + infoSP.ProfessionalName + "\">" + infoSP.ProfessionalName + "</a> <span>></span> <a href=\"/zhuanye-bianxi-" + infoSP.Id + ".shtml\" title\"" + infoSP.ProfessionalName + "专业辨析\">专业辨析</a>"; Entity.Article info = DAL.Article.ArticleEntityGet(intArticleId); if (info != null) { Crumb1.NavString += " <span>></span> " + info.Title; strPageTitle = info.Title;//标题 ltlTitle.Text = info.Title; ltlContent.Text = info.Content; } else { Basic.MsgHelper.AlertBackMsg("获取专业信息失败"); } } else { Basic.MsgHelper.AlertBackMsg("获取专业信息失败"); } }
protected void Article_Submit_Click(object sender, EventArgs e) { e_Article = b_Article.Select_Article(g_Article_ClassID, Convert.ToInt32(Article_LanguageID.SelectedValue)); e_Article.Article_Content = Article_Content.Value; b_Article.Update_Article(e_Article.Article_ID, e_Article.Article_ClassID, e_Article.Article_LanguageID, e_Article.Article_Content); ResponseSuccess("修改成功", "Article.aspx?Article_ClassID=" + e_Article.Article_ClassID); }
protected void Page_Load(object sender, EventArgs e) { b_Article = new BLL.Article(); if (!IsPostBack) { GetArticleTXT(Article_Name); SetLanguageControl(Article_LanguageID); e_Article = b_Article.Select_Article(g_Article_ClassID, Convert.ToInt32(Article_LanguageID.SelectedValue)); Article_Content.Value = e_Article.Article_Content; } }
public async Task CreateOrEditAsync(Entity.Article model) { model.TenantId = _AbpSession.TenantId ?? 0; if (model.Id <= 0) { model.UserId = _AbpSession.UserId ?? 0; await _Repository.InsertAsync(model); } else { await _Repository.UpdateAsync(model); } }
public async Task <IActionResult> Add(long?id) { Entity.Article a = new Entity.Article(); if (id != null) { a = await _AppService.GetByIdAsync((long)id); } var list = await _catAppService.GetCategoryDropDownList(); ViewData.Add("Category", new Microsoft.AspNetCore.Mvc.Rendering.SelectList(list, "Id", "Title")); return(View(a)); }
public static void RebuildPages() { Pages.Clear(); var files = System.IO.Directory.GetFiles(System.Web.HttpContext.Current.Server.MapPath("~") + "\\Pages", "*.md"); foreach (var file in files) { var article = new Entity.Article(); article.Title = System.IO.Path.GetFileNameWithoutExtension(file); article.IsPage = true; Pages.Add(article); } Pages.Sort((a, b) => { return(DateTime.Compare(b.CreationTime, a.CreationTime)); }); }
public static void RebuildArticles() { Articles.Clear(); var files = System.IO.Directory.GetFiles(System.Web.HttpContext.Current.Server.MapPath("~") + "\\Articles", "*.md"); foreach (var file in files) { var article = new Entity.Article(); article.Title = System.IO.Path.GetFileNameWithoutExtension(file); Articles.Add(article); } Articles.Sort((a, b) => { return DateTime.Compare(b.CreationTime, a.CreationTime); }); try { Begin = Articles[Articles.Count() - 1].CreationTime; End = Articles[0].CreationTime; } catch { } }
public static void RebuildArticles() { Articles.Clear(); var files = System.IO.Directory.GetFiles(System.Web.HttpContext.Current.Server.MapPath("~") + "\\Articles", "*.md"); foreach (var file in files) { var article = new Entity.Article(); article.Title = System.IO.Path.GetFileNameWithoutExtension(file); Articles.Add(article); } Articles.Sort((a, b) => { return(DateTime.Compare(b.CreationTime, a.CreationTime)); }); try { Begin = Articles[Articles.Count() - 1].CreationTime; End = Articles[0].CreationTime; } catch { } }
public static void Pop(Entity.Article article) { System.IO.File.Delete(article.Directory); if (!article.IsPage) { Articles.RemoveAt(Articles.FindIndex(x => x.Title == article.Title)); try { Site.Category = null; Begin = Articles[Articles.Count() - 1].CreationTime; End = Articles[0].CreationTime; } catch { } } else { Pages.RemoveAt(Pages.FindIndex(x => x.Title == article.Title)); } }
public static void Push(Entity.Article article) { article.Save(); if (article.IsPage) { Pages.Add(article); Pages.Sort((a, b) => { return(DateTime.Compare(b.CreationTime, a.CreationTime)); }); } else { Articles.Add(article); Articles.Sort((a, b) => { return(DateTime.Compare(b.CreationTime, a.CreationTime)); }); } Dal.ArticleDao.Rebuild(); try { Site.Category = null; Begin = Articles[Articles.Count() - 1].CreationTime; End = Articles[0].CreationTime; } catch { } }
public static Entity.Article ArticleEntityGetByProfessionalId(int ProfessionalId) { Entity.Article info = new Entity.Article(); DataTable dt = SqlDB.ExecuteDataset(CommandType.Text, "SELECT * FROM [Article] WHERE CategoryId = 2 AND ProfessionalId = " + ProfessionalId + ";").Tables[0]; if (dt.Rows.Count > 0) { info.Id = Basic.Utils.StrToInt(dt.Rows[0]["Id"].ToString(), 0); info.CategoryId = Basic.Utils.StrToInt(dt.Rows[0]["CategoryId"].ToString(), 0); info.Icon = dt.Rows[0]["Icon"].ToString(); info.Title = dt.Rows[0]["Title"].ToString(); info.ShortTitle = dt.Rows[0]["ShortTitle"].ToString(); info.MetaTitle = dt.Rows[0]["MetaTitle"].ToString(); info.MetaKeyWords = dt.Rows[0]["MetaKeyWords"].ToString(); info.MetaDescription = dt.Rows[0]["MetaDescription"].ToString(); info.Summary = dt.Rows[0]["Summary"].ToString(); info.Content = dt.Rows[0]["Content"].ToString(); info.IsPause = Basic.Utils.StrToInt(dt.Rows[0]["IsPause"].ToString(), 0); info.IsTuiJian = Basic.Utils.StrToInt(dt.Rows[0]["IsTuiJian"].ToString(), 0); info.IsNew = Basic.Utils.StrToInt(dt.Rows[0]["IsNew"].ToString(), 0); info.IsZhiDing = Basic.Utils.StrToInt(dt.Rows[0]["IsZhiDing"].ToString(), 0); info.AddWid = Basic.Utils.StrToInt(dt.Rows[0]["AddWid"].ToString(), 0); info.IsCheck = Basic.Utils.StrToInt(dt.Rows[0]["IsCheck"].ToString(), 0); info.CheckWid = Basic.Utils.StrToInt(dt.Rows[0]["CheckWid"].ToString(), 0); info.ClickNum = Basic.Utils.StrToInt(dt.Rows[0]["ClickNum"].ToString(), 0); info.AddTime = Basic.Utils.StrToDateTime(dt.Rows[0]["AddTime"].ToString()); info.CheckTime = Basic.Utils.StrToDateTime(dt.Rows[0]["CheckTime"].ToString()); info.PublishTime = Basic.Utils.StrToDateTime(dt.Rows[0]["PublishTime"].ToString()); info.ZhiDingTime = Basic.Utils.StrToDateTime(dt.Rows[0]["ZhiDingTime"].ToString()); return(info); } else { return(null); } }
/// <summary> /// UpdateArticle /// </summary> /// <param name="aricle"></param> /// <returns></returns> public int UpdateArticle(Entity.Article aricle) { try { int code = -1; using (SqlConnection connection = new SqlConnection(connectString)) { connection.Open(); using (SqlCommand cmd = new SqlCommand()) { cmd.CommandTimeout = Constants.TIMOUT_CONNECT_SQL; cmd.Connection = connection; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "sp_UpdateArticle"; cmd.Parameters.Add("@ArticleId", SqlDbType.BigInt); cmd.Parameters["@ArticleId"].Value = aricle.id; cmd.Parameters.Add("@CategoryTags", SqlDbType.VarChar, 250); cmd.Parameters["@CategoryTags"].Value = aricle.categoriesTags; cmd.Parameters.Add("@Title", SqlDbType.NVarChar, 150); cmd.Parameters["@Title"].Value = aricle.title; cmd.Parameters.Add("@Description", SqlDbType.NVarChar, 1000); cmd.Parameters["@Description"].Value = aricle.description; cmd.Parameters.Add("@Product_Specifications", SqlDbType.NVarChar, 2000); cmd.Parameters["@Product_Specifications"].Value = aricle.product_Specifications; cmd.Parameters.Add("@Body", SqlDbType.NVarChar, -1); cmd.Parameters["@Body"].Value = aricle.body; cmd.Parameters.Add("@ProductId", SqlDbType.VarChar, 50); cmd.Parameters["@ProductId"].Value = aricle.productCode; cmd.Parameters.Add("@Images", SqlDbType.VarChar, 4000); cmd.Parameters["@Images"].Value = aricle.images; cmd.Parameters.Add("@Videos", SqlDbType.VarChar, 4000); cmd.Parameters["@Videos"].Value = aricle.videos; cmd.Parameters.Add("@Author", SqlDbType.NVarChar, 50); cmd.Parameters["@Author"].Value = aricle.author; cmd.Parameters.Add("@Quote", SqlDbType.NVarChar, 100); cmd.Parameters["@Quote"].Value = aricle.quote; cmd.Parameters.Add("@Tags", SqlDbType.NVarChar, 250); cmd.Parameters["@Tags"].Value = aricle.tags; cmd.Parameters.Add("@Link", SqlDbType.VarChar, 50); cmd.Parameters["@Link"].Value = aricle.link != null ? aricle.link : ""; cmd.Parameters.Add("@MetaKeywords", SqlDbType.NVarChar, 250); cmd.Parameters["@MetaKeywords"].Value = aricle.metaKeyword; cmd.Parameters.Add("@MetaDescription", SqlDbType.NVarChar, 250); cmd.Parameters["@MetaDescription"].Value = aricle.metaDescription; cmd.Parameters.Add("@DatePublish", SqlDbType.NVarChar, 20); cmd.Parameters["@DatePublish"].Value = aricle.datePublish; cmd.Parameters.Add("@Status", SqlDbType.TinyInt); cmd.Parameters["@Status"].Value = aricle.status; cmd.Parameters.Add("@AccountId", SqlDbType.Int); cmd.Parameters["@AccountId"].Value = aricle.accountId; cmd.Parameters.Add("@PublisherId", SqlDbType.Int); cmd.Parameters["@PublisherId"].Value = aricle.publisherId; cmd.Parameters.Add("@Key", SqlDbType.VarChar, 100); cmd.Parameters["@Key"].Value = Lib.Constants.KEY_SQL; cmd.Parameters.Add("@Code", SqlDbType.Int); cmd.Parameters["@Code"].Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); code = int.Parse(cmd.Parameters["@Code"].Value.ToString()); } } return(code); } catch (Exception ex) { Lib.Logs.SaveError("ERROR UpdateArticle: " + ex); throw new Exception("lỗi: " + ex.Message); } }
public static void RebuildPages() { Pages.Clear(); var files = System.IO.Directory.GetFiles(System.Web.HttpContext.Current.Server.MapPath("~") + "\\Pages", "*.md"); foreach (var file in files) { var article = new Entity.Article(); article.Title = System.IO.Path.GetFileNameWithoutExtension(file); article.IsPage = true; Pages.Add(article); } Pages.Sort((a, b) => { return DateTime.Compare(b.CreationTime, a.CreationTime); }); }
private bool DoAdd() { bool result = true; BLL.ArticleBll bll = new BLL.ArticleBll(); Entity.Article model = new Entity.Article(); model.ChannelID = this.channel_id; model.Title = txtTitle.Text.Trim(); model.LinkURL = txtLinkUrl.Text.Trim(); model.ImageURL = txtImgUrl.Text.Trim(); model.SortID = int.Parse(txtSortId.Text.Trim()); model.ClickCount = int.Parse(txtClick.Text.Trim()); model.Content = txtContent.Value; model.IsRecommend = 0; model.IsHot = 0; if (cblItem.Items[0].Selected == true) { model.IsRecommend = 1; } if (bll.Add(model) < 1) { result = false; } return result; }
protected void Article_LanguageID_SelectedIndexChanged(object sender, EventArgs e) { e_Article = b_Article.Select_Article(g_Article_ClassID, Convert.ToInt32(Article_LanguageID.SelectedValue)); Article_Content.Value = e_Article.Article_Content; }