Exemple #1
0
        private void btnSave_ServerClick(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }
            if (FileId > 0)
            {
                fs.RenameFile(FileId, txtTitle.Text, textDescription.Text);
                fs.AllowFileHistory(FileId, cbKeepHistory.Checked);
            }
            else if (LinkId == 0 && ParentFolderId >= 0)
            {
                string       data      = string.Format("[InternetShortcut]\r\nURL={0}", txtLink.Text);
                MemoryStream memStream = new MemoryStream();
                StreamWriter writer    = new StreamWriter(memStream, Encoding.Unicode);
                writer.Write(data);
                writer.Flush();
                memStream.Seek(0, SeekOrigin.Begin);
                string title         = txtTitle.Text;
                string html_filename = Mediachase.UI.Web.Util.CommonHelper.GetHtmlFileTitle(title);
                if (html_filename.IndexOf(".url") < 0)
                {
                    html_filename += ".url";
                }
                fs.SaveFile(ParentFolderId, html_filename, textDescription.Text, memStream);
            }

            CommandParameters cp = new CommandParameters("FL_NewLinkItem");

            if (Request["PrimaryKeyId"] != null)
            {
                cp.CommandName = "FL_Storage_EditFileItem";
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.GetCloseOpenedFrameScript(this.Page, cp.ToString());
            }
            else
            {
                if (Request["New"] != null)
                {
                    Mediachase.Ibn.Web.UI.WebControls.CommandHandler.GetCloseOpenedFrameScript(this.Page, cp.ToString());
                }
                else
                {
                    CHelper.CloseItAndRefresh(Response);
                }
            }
        }