Esempio n. 1
0
        private void btnEditAffiche_Click(object sender, EventArgs e)
        {
            AfficheInfo afficheInfo = new AfficheInfo();

            afficheInfo.AfficheId = this.afficheId;
            afficheInfo.Title     = this.txtAfficheTitle.Text.Trim();
            afficheInfo.Content   = this.fcContent.Text;
            afficheInfo.AddedDate = DateTime.Now;
            ValidationResults validationResults = Validation.Validate(afficheInfo, "ValAfficheInfo");
            string            text = string.Empty;

            if (!validationResults.IsValid)
            {
                foreach (ValidationResult item in (IEnumerable <ValidationResult>)validationResults)
                {
                    text += Formatter.FormatErrorMessage(item.Message);
                }
                this.ShowMsg(text, false);
            }
            else
            {
                afficheInfo.AfficheId = this.afficheId;
                if (NoticeHelper.UpdateAffiche(afficheInfo))
                {
                    this.ShowMsg("成功修改了当前公告信息", true);
                }
                else
                {
                    this.ShowMsg("修改公告信息错误", false);
                }
            }
        }
Esempio n. 2
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);
            }
        }
Esempio n. 3
0
        public override AfficheInfo GetFrontOrNextAffiche(int afficheId, string type)
        {
            string query = string.Empty;

            if (type == "Next")
            {
                query = "SELECT TOP 1 * FROM Hishop_Affiche WHERE AfficheId < @AfficheId  ORDER BY AfficheId DESC";
            }
            else
            {
                query = "SELECT TOP 1 * FROM Hishop_Affiche WHERE AfficheId > @AfficheId ORDER BY AfficheId ASC";
            }
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(query);

            this.database.AddInParameter(sqlStringCommand, "AfficheId", DbType.Int32, afficheId);
            AfficheInfo info = null;

            using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
            {
                if (reader.Read())
                {
                    info = DataMapper.PopulateAffiche(reader);
                }
            }
            return(info);
        }
Esempio n. 4
0
        private void btnAddAffiche_Click(object sender, System.EventArgs e)
        {
            AfficheInfo afficheInfo = new AfficheInfo();

            afficheInfo.Title     = this.txtAfficheTitle.Text.Trim();
            afficheInfo.Content   = this.fcContent.Text;
            afficheInfo.AddedDate = System.DateTime.Now;
            ValidationResults validationResults = Validation.Validate <AfficheInfo>(afficheInfo, new string[]
            {
                "ValAfficheInfo"
            });
            string text = string.Empty;

            if (!validationResults.IsValid)
            {
                foreach (ValidationResult current in (System.Collections.Generic.IEnumerable <ValidationResult>)validationResults)
                {
                    text += Formatter.FormatErrorMessage(current.Message);
                }
                this.ShowMsg(text, false);
                return;
            }
            if (SubsiteCommentsHelper.CreateAffiche(afficheInfo))
            {
                this.txtAfficheTitle.Text = string.Empty;
                this.fcContent.Text       = string.Empty;
                this.ShowMsg("成功发布了一条公告", true);
                return;
            }
            this.ShowMsg("添加公告失败", false);
        }
        private void btnEditAffiche_Click(object sender, EventArgs e)
        {
            AfficheInfo target = new AfficheInfo();

            target.AfficheId = this.afficheId;
            target.Title     = this.txtAfficheTitle.Text.Trim();
            target.Content   = this.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);
                }
                this.ShowMsg(msg, false);
            }
            else
            {
                target.AfficheId = this.afficheId;
                if (SubsiteCommentsHelper.UpdateAffiche(target))
                {
                    this.ShowMsg("成功修改了当前公告信息", true);
                }
                else
                {
                    this.ShowMsg("修改公告信息错误", false);
                }
            }
        }
Esempio n. 6
0
        public override AfficheInfo GetFrontOrNextAffiche(int afficheId, string type)
        {
            string text = string.Empty;

            if (type == "Next")
            {
                text = "SELECT TOP 1 * FROM distro_Affiche WHERE AfficheId< @AfficheId AND DistributorUserId=@DistributorUserId ORDER BY AfficheId DESC";
            }
            else
            {
                text = "SELECT TOP 1 * FROM distro_Affiche WHERE AfficheId> @AfficheId AND DistributorUserId=@DistributorUserId ORDER BY AfficheId ASC";
            }
            System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand(text);
            this.database.AddInParameter(sqlStringCommand, "AfficheId", System.Data.DbType.Int32, afficheId);
            this.database.AddInParameter(sqlStringCommand, "DistributorUserId", System.Data.DbType.Int32, HiContext.Current.SiteSettings.UserId.Value);
            AfficheInfo result = null;

            using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand))
            {
                if (dataReader.Read())
                {
                    result = DataMapper.PopulateAffiche(dataReader);
                }
            }
            return(result);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!int.TryParse(base.Request.QueryString["afficheId"], out this.afficheId))
     {
         base.GotoResourceNotFound();
     }
     else
     {
         this.btnEditAffiche.Click += new EventHandler(this.btnEditAffiche_Click);
         if (!this.Page.IsPostBack)
         {
             AfficheInfo affiche = SubsiteCommentsHelper.GetAffiche(this.afficheId);
             if (affiche == null)
             {
                 base.GotoResourceNotFound();
             }
             else
             {
                 Globals.EntityCoding(affiche, false);
                 this.txtAfficheTitle.Text = affiche.Title;
                 this.fcContent.Text       = affiche.Content;
             }
         }
     }
 }
Esempio n. 8
0
        private void btnEditAffiche_Click(object sender, System.EventArgs e)
        {
            AfficheInfo afficheInfo = new AfficheInfo();

            afficheInfo.AfficheId = this.afficheId;
            afficheInfo.Title     = this.txtAfficheTitle.Text.Trim();
            afficheInfo.Content   = this.fcContent.Text;
            afficheInfo.AddedDate = System.DateTime.Now;
            ValidationResults validationResults = Validation.Validate <AfficheInfo>(afficheInfo, new string[]
            {
                "ValAfficheInfo"
            });
            string text = string.Empty;

            if (!validationResults.IsValid)
            {
                foreach (ValidationResult current in (System.Collections.Generic.IEnumerable <ValidationResult>)validationResults)
                {
                    text += Formatter.FormatErrorMessage(current.Message);
                }
                this.ShowMsg(text, false);
                return;
            }
            afficheInfo.AfficheId = this.afficheId;
            if (NoticeHelper.UpdateAffiche(afficheInfo))
            {
                this.ShowMsg("成功修改了当前公告信息", true);
                return;
            }
            this.ShowMsg("修改公告信息错误", false);
        }
Esempio n. 9
0
 public static bool UpdateAffiche(AfficheInfo affiche)
 {
     if (null == affiche)
     {
         return(false);
     }
     Globals.EntityCoding(affiche, true);
     return(SubsiteCommentsProvider.Instance().UpdateAffiche(affiche));
 }
Esempio n. 10
0
        public bool AddAffiche(AfficheInfo affiche)
        {
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand("INSERT INTO Ecshop_Affiche(Title, Content, AddedDate) VALUES (@Title, @Content, @AddedDate)");

            this.database.AddInParameter(sqlStringCommand, "Title", DbType.String, affiche.Title);
            this.database.AddInParameter(sqlStringCommand, "Content", DbType.String, affiche.Content);
            this.database.AddInParameter(sqlStringCommand, "AddedDate", DbType.DateTime, affiche.AddedDate);
            return(this.database.ExecuteNonQuery(sqlStringCommand) == 1);
        }
 protected override void AttachChildControls()
 {
     if (!int.TryParse(this.Page.Request.QueryString["AfficheId"], out this.affichesId))
     {
         base.GotoResourceNotFound();
     }
     this.litAffichesAddedDate = (FormatedTimeLabel)this.FindControl("litAffichesAddedDate");
     this.litContent           = (Literal)this.FindControl("litContent");
     this.litTilte             = (Literal)this.FindControl("litTilte");
     this.lblFront             = (Label)this.FindControl("lblFront");
     this.lblNext       = (Label)this.FindControl("lblNext");
     this.aFront        = (HtmlAnchor)this.FindControl("front");
     this.aNext         = (HtmlAnchor)this.FindControl("next");
     this.lblFrontTitle = (Label)this.FindControl("lblFrontTitle");
     this.lblNextTitle  = (Label)this.FindControl("lblNextTitle");
     if (!this.Page.IsPostBack)
     {
         AfficheInfo affiche = CommentBrowser.GetAffiche(this.affichesId);
         if (affiche != null)
         {
             PageTitle.AddSiteNameTitle(affiche.Title, HiContext.Current.Context);
             this.litTilte.Text = affiche.Title;
             string str = HiContext.Current.HostPath + Globals.GetSiteUrls().UrlData.FormatUrl("AffichesDetails", new object[] { this.affichesId });
             this.litContent.Text           = affiche.Content.Replace("href=\"#\"", "href=\"" + str + "\"");
             this.litAffichesAddedDate.Time = affiche.AddedDate;
             AfficheInfo frontOrNextAffiche = CommentBrowser.GetFrontOrNextAffiche(this.affichesId, "Front");
             AfficheInfo info3 = CommentBrowser.GetFrontOrNextAffiche(this.affichesId, "Next");
             if ((frontOrNextAffiche != null) && (frontOrNextAffiche.AfficheId > 0))
             {
                 if (this.lblFront != null)
                 {
                     this.lblFront.Visible   = true;
                     this.aFront.HRef        = "AffichesDetails.aspx?afficheId=" + frontOrNextAffiche.AfficheId;
                     this.lblFrontTitle.Text = frontOrNextAffiche.Title;
                 }
             }
             else if (this.lblFront != null)
             {
                 this.lblFront.Visible = false;
             }
             if ((info3 != null) && (info3.AfficheId > 0))
             {
                 if (this.lblNext != null)
                 {
                     this.lblNext.Visible   = true;
                     this.aNext.HRef        = "AffichesDetails.aspx?afficheId=" + info3.AfficheId;
                     this.lblNextTitle.Text = info3.Title;
                 }
             }
             else if (this.lblNext != null)
             {
                 this.lblNext.Visible = false;
             }
         }
     }
 }
        public override bool AddAffiche(AfficheInfo affiche)
        {
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand("INSERT INTO distro_Affiche(DistributorUserId,Title, Content, AddedDate) VALUES (@DistributorUserId,@Title, @Content, @AddedDate)");

            this.database.AddInParameter(sqlStringCommand, "Title", DbType.String, affiche.Title);
            this.database.AddInParameter(sqlStringCommand, "Content", DbType.String, affiche.Content);
            this.database.AddInParameter(sqlStringCommand, "AddedDate", DbType.DateTime, affiche.AddedDate);
            this.database.AddInParameter(sqlStringCommand, "DistributorUserId", DbType.Int32, HiContext.Current.User.UserId);
            return(this.database.ExecuteNonQuery(sqlStringCommand) == 1);
        }
Esempio n. 13
0
        public bool UpdateAffiche(AfficheInfo affiche)
        {
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE Ecshop_Affiche SET Title = @Title, AddedDate = @AddedDate, Content = @Content WHERE AfficheId = @AfficheId");

            this.database.AddInParameter(sqlStringCommand, "Title", DbType.String, affiche.Title);
            this.database.AddInParameter(sqlStringCommand, "Content", DbType.String, affiche.Content);
            this.database.AddInParameter(sqlStringCommand, "AddedDate", DbType.DateTime, affiche.AddedDate);
            this.database.AddInParameter(sqlStringCommand, "AfficheId", DbType.Int32, affiche.AfficheId);
            return(this.database.ExecuteNonQuery(sqlStringCommand) == 1);
        }
Esempio n. 14
0
 public static bool UpdateAffiche(AfficheInfo affiche)
 {
     if (affiche == null)
     {
         return(false);
     }
     Globals.EntityCoding(affiche, true);
     HiCache.Remove("DataCache-Affiches");
     return(new AfficheDao().Update(affiche, null));
 }
        public override bool UpdateAffiche(AfficheInfo affiche)
        {
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE distro_Affiche SET Title = @Title, AddedDate = @AddedDate, Content = @Content WHERE AfficheId = @AfficheId AND DistributorUserId=@DistributorUserId");

            this.database.AddInParameter(sqlStringCommand, "Title", DbType.String, affiche.Title);
            this.database.AddInParameter(sqlStringCommand, "Content", DbType.String, affiche.Content);
            this.database.AddInParameter(sqlStringCommand, "AddedDate", DbType.DateTime, affiche.AddedDate);
            this.database.AddInParameter(sqlStringCommand, "AfficheId", DbType.Int32, affiche.AfficheId);
            this.database.AddInParameter(sqlStringCommand, "DistributorUserId", DbType.Int32, HiContext.Current.User.UserId);
            return(this.database.ExecuteNonQuery(sqlStringCommand) == 1);
        }
Esempio n. 16
0
        public static bool UpdateAffiche(AfficheInfo affiche)
        {
            bool result;

            if (null == affiche)
            {
                result = false;
            }
            else
            {
                Globals.EntityCoding(affiche, true);
                result = new AfficheDao().UpdateAffiche(affiche);
            }
            return(result);
        }
Esempio n. 17
0
        public override AfficheInfo GetAffiche(int afficheId)
        {
            System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM distro_Affiche WHERE AfficheId = @AfficheId");
            this.database.AddInParameter(sqlStringCommand, "AfficheId", System.Data.DbType.Int32, afficheId);
            AfficheInfo result = null;

            using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand))
            {
                if (dataReader.Read())
                {
                    result = DataMapper.PopulateAffiche(dataReader);
                }
            }
            return(result);
        }
Esempio n. 18
0
        public override List <AfficheInfo> GetAfficheList()
        {
            List <AfficheInfo> list             = new List <AfficheInfo>();
            DbCommand          sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Hishop_Affiche  ORDER BY AddedDate DESC");

            using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
            {
                while (reader.Read())
                {
                    AfficheInfo item = DataMapper.PopulateAffiche(reader);
                    list.Add(item);
                }
            }
            return(list);
        }
Esempio n. 19
0
        public static bool UpdateAffiche(AfficheInfo affiche)
        {
            bool result;

            if (null == affiche)
            {
                result = false;
            }
            else
            {
                Globals.EntityCoding(affiche, true);
                result = SubsiteCommentsProvider.Instance().UpdateAffiche(affiche);
            }
            return(result);
        }
Esempio n. 20
0
        public AfficheInfo GetFrontOrNextAffiche(int afficheId, string type)
        {
            string empty = string.Empty;

            empty = ((!(type == "Next")) ? "SELECT TOP 1 * FROM Hishop_Affiche WHERE AfficheId > @AfficheId ORDER BY AfficheId ASC" : "SELECT TOP 1 * FROM Hishop_Affiche WHERE AfficheId < @AfficheId  ORDER BY AfficheId DESC");
            DbCommand sqlStringCommand = base.database.GetSqlStringCommand(empty);

            base.database.AddInParameter(sqlStringCommand, "AfficheId", DbType.Int32, afficheId);
            AfficheInfo result = null;

            using (IDataReader objReader = base.database.ExecuteReader(sqlStringCommand))
            {
                result = DataHelper.ReaderToModel <AfficheInfo>(objReader);
            }
            return(result);
        }
Esempio n. 21
0
        public override AfficheInfo GetAffiche(int afficheId)
        {
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Hishop_Affiche WHERE AfficheId = @AfficheId");

            this.database.AddInParameter(sqlStringCommand, "AfficheId", DbType.Int32, afficheId);
            AfficheInfo info = null;

            using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
            {
                if (reader.Read())
                {
                    info = DataMapper.PopulateAffiche(reader);
                }
            }
            return(info);
        }
Esempio n. 22
0
        public override List <AfficheInfo> GetAfficheList()
        {
            List <AfficheInfo> list             = new List <AfficheInfo>();
            DbCommand          sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM distro_Affiche WHERE DistributorUserId=@DistributorUserId  ORDER BY AddedDate DESC");

            this.database.AddInParameter(sqlStringCommand, "DistributorUserId", DbType.Int32, HiContext.Current.SiteSettings.UserId.Value);
            using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
            {
                while (reader.Read())
                {
                    AfficheInfo item = DataMapper.PopulateAffiche(reader);
                    list.Add(item);
                }
            }
            return(list);
        }
Esempio n. 23
0
 protected override void AttachChildControls()
 {
     if (!int.TryParse(base.GetParameter("AfficheId", false), out this.affichesId))
     {
         base.GotoResourceNotFound();
     }
     this.litAffichesAddedDate = (FormatedTimeLabel)this.FindControl("litAffichesAddedDate");
     this.litContent           = (Literal)this.FindControl("litContent");
     this.litTilte             = (Literal)this.FindControl("litTilte");
     this.lblFront             = (Label)this.FindControl("lblFront");
     this.lblNext       = (Label)this.FindControl("lblNext");
     this.aFront        = (HtmlAnchor)this.FindControl("front");
     this.aNext         = (HtmlAnchor)this.FindControl("next");
     this.lblFrontTitle = (Label)this.FindControl("lblFrontTitle");
     this.lblNextTitle  = (Label)this.FindControl("lblNextTitle");
     if (!this.Page.IsPostBack)
     {
         AfficheInfo affiche = CommentBrowser.GetAffiche(this.affichesId);
         if (affiche != null)
         {
             PageTitle.AddSiteNameTitle(affiche.Title);
             this.litTilte.Text = affiche.Title;
             string str = HiContext.Current.HostPath + base.GetRouteUrl("AffichesDetails", new
             {
                 afficheId = this.affichesId
             });
             this.litContent.Text           = affiche.Content.Replace("href=\"#\"", "href=\"" + str + "\"");
             this.litAffichesAddedDate.Time = affiche.AddedDate;
             AfficheInfo frontOrNextAffiche  = CommentBrowser.GetFrontOrNextAffiche(this.affichesId, "Front");
             AfficheInfo frontOrNextAffiche2 = CommentBrowser.GetFrontOrNextAffiche(this.affichesId, "Next");
             if (frontOrNextAffiche != null && frontOrNextAffiche.AfficheId > 0)
             {
                 if (this.lblFront != null)
                 {
                     this.lblFront.Visible = true;
                     this.aFront.HRef      = base.GetRouteUrl("AffichesDetails", new
                     {
                         afficheId = frontOrNextAffiche.AfficheId
                     });
                     this.lblFrontTitle.Text = frontOrNextAffiche.Title;
                 }
             }
             else if (this.lblFront != null)
             {
                 this.lblFront.Visible = false;
             }
             if (frontOrNextAffiche2 != null && frontOrNextAffiche2.AfficheId > 0)
             {
                 if (this.lblNext != null)
                 {
                     this.lblNext.Visible = true;
                     this.aNext.HRef      = base.GetRouteUrl("AffichesDetails", new
                     {
                         afficheId = frontOrNextAffiche2.AfficheId
                     });
                     this.lblNextTitle.Text = frontOrNextAffiche2.Title;
                 }
             }
             else if (this.lblNext != null)
             {
                 this.lblNext.Visible = false;
             }
         }
     }
 }
Esempio n. 24
0
 public abstract bool AddAffiche(AfficheInfo affiche);
Esempio n. 25
0
 public abstract bool UpdateAffiche(AfficheInfo affiche);