Beispiel #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);
                }
            }
        }
Beispiel #2
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);
        }
Beispiel #3
0
        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 (NoticeHelper.UpdateAffiche(target))
                {
                    this.ShowMsg("成功修改了当前公告信息", true);
                }
                else
                {
                    this.ShowMsg("修改公告信息错误", false);
                }
            }
        }