Beispiel #1
0
        private bool Save()
        {
            try
            {
                if (string.IsNullOrEmpty(TxtTitle.Text.StripHTMLTags()))
                {
                    pnlStatus.Visible = true;
                    litStatus.Text    = language.GetString("MessageTitleRequired");
                }
                else
                {
                    forumTopic.Title       = Common.Extensions.StripHTMLTags(this.TxtTitle.Text);
                    forumTopic.Description = Common.Extensions.StripHTMLTags(this.TxtDesc.Text).CropString(20000);

                    if (objectExisting)
                    {
                        forumTopic.Update(UserDataContext.GetUserDataContext());
                    }
                    else
                    {
                        forumTopic.Insert(UserDataContext.GetUserDataContext(), Request.QueryString["FID"].ToGuid(), Helper.GetObjectTypeNumericID("Forum"));
                    }

                    return(true);
                }
            }
            catch (Exception e)
            {
                pnlStatus.Visible = true;
                litStatus.Text    = "Forum Topic konnte nicht gespeichert werden: " + e.Message;
            }
            return(false);
        }
Beispiel #2
0
        public override bool SaveStep(ref System.Collections.Specialized.NameValueCollection queryString)
        {
            try
            {
                forumTopic.Title                  = Common.Extensions.StripHTMLTags(this.TxtTitle.Text);
                forumTopic.Description            = this.TxtDesc.Content;
                forumTopic.IsModerated            = CbModerated.Checked;
                forumTopic.TopicItemCreationUsers = (CommunityUsersType)Enum.Parse(typeof(CommunityUsersType), this.RcbRights.SelectedValue);
                forumTopic.TagList                = Common.Extensions.StripHTMLTags(this.HFTagWords.Value);
                forumTopic.Status                 = (ObjectStatus)Enum.Parse(typeof(ObjectStatus), this.HFStatus.Value);
                if (AccessMode == AccessMode.Insert)
                {
                    forumTopic.ShowState = ObjectShowState.Published;
                }
                else
                {
                    forumTopic.ShowState = (ObjectShowState)Enum.Parse(typeof(ObjectShowState), this.HFShowState.Value);
                }
                forumTopic.Copyright = int.Parse(this.HFCopyright.Value);
                double geoLat;
                if (double.TryParse(this.HFGeoLat.Value, out geoLat))
                {
                    forumTopic.Geo_Lat = geoLat;
                }
                double geoLong;
                if (double.TryParse(this.HFGeoLong.Value, out geoLong))
                {
                    forumTopic.Geo_Long = geoLong;
                }
                forumTopic.Zip         = this.HFZip.Value;
                forumTopic.City        = this.HFCity.Value;
                forumTopic.Street      = this.HFStreet.Value;
                forumTopic.CountryCode = this.HFCountry.Value;

                forumTopic.Update(UserDataContext.GetUserDataContext());

                return(true);
            }
            catch (Exception ex)
            {
                this.LitMsg.Text = string.Format("{0}: ", language.GetString("MessageSaveError")) + ex.Message;
                return(false);
            }
        }