Beispiel #1
0
 public static bool CreateHelp(HelpInfo help)
 {
     if (null == help)
     {
         return false;
     }
     Globals.EntityCoding(help, true);
     return CommentsProvider.Instance().AddHelp(help);
 }
Beispiel #2
0
 public override bool AddHelp(HelpInfo help)
 {
     DbCommand sqlStringCommand = database.GetSqlStringCommand("INSERT INTO Hishop_Helps(CategoryId, Title, Meta_Description, Meta_Keywords, Description, Content, AddedDate, IsShowFooter) VALUES (@CategoryId, @Title, @Meta_Description, @Meta_Keywords, @Description, @Content, @AddedDate, @IsShowFooter)");
     database.AddInParameter(sqlStringCommand, "CategoryId", DbType.Int32, help.CategoryId);
     database.AddInParameter(sqlStringCommand, "Title", DbType.String, help.Title);
     database.AddInParameter(sqlStringCommand, "Meta_Description", DbType.String, help.MetaDescription);
     database.AddInParameter(sqlStringCommand, "Meta_Keywords", DbType.String, help.MetaKeywords);
     database.AddInParameter(sqlStringCommand, "Description", DbType.String, help.Description);
     database.AddInParameter(sqlStringCommand, "Content", DbType.String, help.Content);
     database.AddInParameter(sqlStringCommand, "AddedDate", DbType.DateTime, help.AddedDate);
     database.AddInParameter(sqlStringCommand, "IsShowFooter", DbType.Boolean, help.IsShowFooter);
     return (database.ExecuteNonQuery(sqlStringCommand) == 1);
 }
Beispiel #3
0
 private void btnAddHelp_Click(object sender, EventArgs e)
 {
     HelpInfo target = new HelpInfo();
     if (!this.dropHelpCategory.SelectedValue.HasValue)
     {
         this.ShowMsg("请选择帮助分类", false);
     }
     else
     {
         target.AddedDate = DateTime.Now;
         target.CategoryId = this.dropHelpCategory.SelectedValue.Value;
         target.Title = this.txtHelpTitle.Text;
         target.MetaDescription = this.txtMetaDescription.Text;
         target.MetaKeywords = this.txtMetaKeywords.Text;
         target.Description = this.txtShortDesc.Text;
         target.Content = this.fcContent.Text;
         target.IsShowFooter = this.radioShowFooter.SelectedValue;
         ValidationResults results = Hishop.Components.Validation.Validation.Validate<HelpInfo>(target, new string[] { "ValHelpInfo" });
         string msg = string.Empty;
         if (!results.IsValid)
         {
             foreach (ValidationResult result in (IEnumerable<ValidationResult>) results)
             {
                 msg = msg + Formatter.FormatErrorMessage(result.Message);
             }
             this.ShowMsg(msg, false);
         }
         else if (!(!this.radioShowFooter.SelectedValue || SubsiteCommentsHelper.GetHelpCategory(target.CategoryId).IsShowFooter))
         {
             this.ShowMsg("当选中的帮助分类设置不在底部帮助显示时,此分类下的帮助主题就不能设置在底部帮助显示", false);
         }
         else if (SubsiteCommentsHelper.CreateHelp(target))
         {
             this.txtHelpTitle.Text = string.Empty;
             this.txtShortDesc.Text = string.Empty;
             this.fcContent.Text = string.Empty;
             this.ShowMsg("成功添加了一个帮助主题", true);
         }
         else
         {
             this.ShowMsg("添加帮助主题错误", false);
         }
     }
 }
Beispiel #4
0
 public override bool UpdateHelp(HelpInfo help)
 {
     DbCommand sqlStringCommand = database.GetSqlStringCommand("UPDATE Hishop_Helps SET CategoryId = @CategoryId, AddedDate = @AddedDate, Title = @Title, Meta_Description = @Meta_Description, Meta_Keywords = @Meta_Keywords,  Description = @Description, Content = @Content, IsShowFooter = @IsShowFooter WHERE HelpId = @HelpId");
     database.AddInParameter(sqlStringCommand, "CategoryId", DbType.Int32, help.CategoryId);
     database.AddInParameter(sqlStringCommand, "Title", DbType.String, help.Title);
     database.AddInParameter(sqlStringCommand, "Meta_Description", DbType.String, help.MetaDescription);
     database.AddInParameter(sqlStringCommand, "Meta_Keywords", DbType.String, help.MetaKeywords);
     database.AddInParameter(sqlStringCommand, "Description", DbType.String, help.Description);
     database.AddInParameter(sqlStringCommand, "Content", DbType.String, help.Content);
     database.AddInParameter(sqlStringCommand, "AddedDate", DbType.DateTime, help.AddedDate);
     database.AddInParameter(sqlStringCommand, "IsShowFooter", DbType.Boolean, help.IsShowFooter);
     database.AddInParameter(sqlStringCommand, "HelpId", DbType.Int32, help.HelpId);
     return (database.ExecuteNonQuery(sqlStringCommand) == 1);
 }
Beispiel #5
0
 public static HelpInfo PopulateHelp(IDataReader reader)
 {
     if (null == reader)
     {
         return null;
     }
     HelpInfo info = new HelpInfo();
     info.CategoryId = (int) reader["CategoryId"];
     info.HelpId = (int) reader["HelpId"];
     info.Title = (string) reader["Title"];
     if (reader["Meta_Description"] != DBNull.Value)
     {
         info.MetaDescription = (string) reader["Meta_Description"];
     }
     if (reader["Meta_Keywords"] != DBNull.Value)
     {
         info.MetaKeywords = (string) reader["Meta_Keywords"];
     }
     if (reader["Description"] != DBNull.Value)
     {
         info.Description = (string) reader["Description"];
     }
     info.Content = (string) reader["Content"];
     info.AddedDate = (DateTime) reader["AddedDate"];
     info.IsShowFooter = (bool) reader["IsShowFooter"];
     return info;
 }
Beispiel #6
0
 public abstract bool AddHelp(HelpInfo help);
Beispiel #7
0
 public abstract bool UpdateHelp(HelpInfo help);