예제 #1
0
 private void btnAddAffiche_Click(object sender, EventArgs e)
 {
     AfficheInfo target = new AfficheInfo();
     target.Title = txtAfficheTitle.Text.Trim();
     target.Content = fcContent.Text;
     target.AddedDate = DateTime.Now;
     ValidationResults results = Hishop.Components.Validation.Validation.Validate<AfficheInfo>(target, new string[] { "ValAfficheInfo" });
     string msg = string.Empty;
     if (!results.IsValid)
     {
         foreach (ValidationResult result in (IEnumerable<ValidationResult>)results)
         {
             msg = msg + Formatter.FormatErrorMessage(result.Message);
         }
         ShowMsg(msg, false);
     }
     else if (NoticeHelper.CreateAffiche(target))
     {
         txtAfficheTitle.Text = string.Empty;
         fcContent.Text = string.Empty;
         ShowMsg("成功发布了一条公告", true);
     }
     else
     {
         ShowMsg("添加公告失败", false);
     }
 }
예제 #2
0
 private void btnEditAffiche_Click(object sender, EventArgs e)
 {
     AfficheInfo info2 = new AfficheInfo();
     info2.AfficheId = this.afficheId;
     info2.Title = this.txtAfficheTitle.Text.Trim();
     info2.Content = this.fcContent.Text;
     info2.AddedDate = DateTime.Now;
     AfficheInfo target = info2;
     ValidationResults results = Hishop.Components.Validation.Validation.Validate<AfficheInfo>(target, new string[] { "ValAfficheInfo" });
     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
     {
         target.AfficheId = this.afficheId;
         if (SubsiteCommentsHelper.UpdateAffiche(target))
         {
             this.ShowMsg("成功修改了当前公告信息", true);
         }
         else
         {
             this.ShowMsg("修改公告信息错误", false);
         }
     }
 }
예제 #3
0
 public override bool AddAffiche(AfficheInfo affiche)
 {
     DbCommand sqlStringCommand = database.GetSqlStringCommand("INSERT INTO Hishop_Affiche(Title, Content, AddedDate) VALUES (@Title, @Content, @AddedDate)");
     database.AddInParameter(sqlStringCommand, "Title", DbType.String, affiche.Title);
     database.AddInParameter(sqlStringCommand, "Content", DbType.String, affiche.Content);
     database.AddInParameter(sqlStringCommand, "AddedDate", DbType.DateTime, affiche.AddedDate);
     return (database.ExecuteNonQuery(sqlStringCommand) == 1);
 }
예제 #4
0
 public static bool CreateAffiche(AfficheInfo affiche)
 {
     if (null == affiche)
     {
         return false;
     }
     Globals.EntityCoding(affiche, true);
     return CommentsProvider.Instance().AddAffiche(affiche);
 }
예제 #5
0
 public override bool AddAffiche(AfficheInfo affiche)
 {
     DbCommand sqlStringCommand = database.GetSqlStringCommand("INSERT INTO distro_Affiche(DistributorUserId,Title, Content, AddedDate) VALUES (@DistributorUserId,@Title, @Content, @AddedDate)");
     database.AddInParameter(sqlStringCommand, "Title", DbType.String, affiche.Title);
     database.AddInParameter(sqlStringCommand, "Content", DbType.String, affiche.Content);
     database.AddInParameter(sqlStringCommand, "AddedDate", DbType.DateTime, affiche.AddedDate);
     database.AddInParameter(sqlStringCommand, "DistributorUserId", DbType.Int32, HiContext.Current.User.UserId);
     return (database.ExecuteNonQuery(sqlStringCommand) == 1);
 }
예제 #6
0
 public override bool UpdateAffiche(AfficheInfo affiche)
 {
     DbCommand sqlStringCommand = database.GetSqlStringCommand("UPDATE Hishop_Affiche SET Title = @Title, AddedDate = @AddedDate, Content = @Content WHERE AfficheId = @AfficheId");
     database.AddInParameter(sqlStringCommand, "Title", DbType.String, affiche.Title);
     database.AddInParameter(sqlStringCommand, "Content", DbType.String, affiche.Content);
     database.AddInParameter(sqlStringCommand, "AddedDate", DbType.DateTime, affiche.AddedDate);
     database.AddInParameter(sqlStringCommand, "AfficheId", DbType.Int32, affiche.AfficheId);
     return (database.ExecuteNonQuery(sqlStringCommand) == 1);
 }
예제 #7
0
파일: DataMapper.cs 프로젝트: davinx/himedi
 public static AfficheInfo PopulateAffiche(IDataReader reader)
 {
     if (null == reader)
     {
         return null;
     }
     AfficheInfo info = new AfficheInfo();
     info.AfficheId = (int) reader["AfficheId"];
     if (reader["Title"] != DBNull.Value)
     {
         info.Title = (string) reader["Title"];
     }
     info.Content = (string) reader["Content"];
     info.AddedDate = (DateTime) reader["AddedDate"];
     return info;
 }
예제 #8
0
 public abstract bool AddAffiche(AfficheInfo affiche);
예제 #9
0
 public abstract bool UpdateAffiche(AfficheInfo affiche);