Пример #1
0
        void SaveInformation()
        {
            if (DemoSiteMessage)
            {
                return;
            }

            Channel ch          = new Channel();
            string  channelname = "";
            string  oldpath     = "";

            if (!We7Helper.IsEmptyID(ChannelID))
            {
                ch          = ChannelHelper.GetChannel(ChannelID, null);
                channelname = ch.Name;
                oldpath     = ch.FullPath;
            }


            ch.Name        = NameTextBox.Text;
            ch.Description = DescriptionTextBox.Text;
            ch.State       = Convert.ToInt32(StateDropDownList.SelectedValue);

            //TODO::这一句在新的版本中请删去。
            //ch.EnumState = StateMgr.StateProcess(ch.EnumState,
            //    EnumLibrary.Business.ChannelContentType, ModelHelper.GetModelValue(ContentTypeDropDownList.SelectedValue));

            ch.ParentID    = ParentID;
            ch.Type        = TypeDropDownList.SelectedValue;
            ch.ChannelName = ChannelNameHidden.Text;
            ch.ReturnUrl   = ReturnUrlTextBox.Text;
            //ch.ChannelFolder = CreateFolder(ChannelNameHidden.Text);
            ch.ModelName = ContentTypeDropDownList.SelectedValue;

            if (We7Helper.IsEmptyID(ch.ID))
            {
                Channel channel = ChannelHelper.AddChanel(ch);
                //IDLabel.Text = ch.ID.ToString();
                //CreatedLabel.Text = ch.Created.ToString();

                //记录日志
                string content = string.Format("新建栏目“{0}”", NameTextBox.Text);
                AddLog("新建栏目", content);

                string rawurl = We7Helper.AddParamToUrl(Request.RawUrl, "saved", "1");
                rawurl = We7Helper.RemoveParamFromUrl(rawurl, "pid");
                rawurl = We7Helper.AddParamToUrl(rawurl, "id", ch.ID);
                Response.Redirect(rawurl);
            }
            else
            {
                //ch.FullPath = ch.FullPath.Replace(channelname, NameTextBox.Text.Trim());
                ChannelHelper.UpdateChannel(ch);
                if (channelname != NameTextBox.Text.Trim())
                {
                    ChannelHelper.UpdateChannelPathBatch(ch, oldpath);
                }

                Messages.ShowMessage("栏目信息已经成功更新。");
                ShowInfomation();

                Response.Write("<script language=javascript>window.parent.freshNodeText('" + ch.Name + "');</script>");
                //记录日志
                string content = string.Format("修改了栏目“{0}”的信息", NameTextBox.Text);
                AddLog("编辑栏目", content);
            }
        }