Beispiel #1
0
        protected void grdMain_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            if (e.CommandName == "Select")
            {
                int selId = int.Parse(e.Item.Cells[0].Text);

                string sText  = "";
                string sTitle = "";
                using (IDataReader reader = Mediachase.IBN.Business.Common.GetArticle(selId))
                {
                    if (reader.Read())
                    {
                        sTitle = reader["Question"].ToString();
                        sText  = String.Format("<div style='border-top: solid 1px #95B7F3; padding:0px;background-color:ffffe1;'>" +
                                               "<div style='padding:5px; cursor:default;background-color:#FFD275;'><b>{0}</b></div>" +
                                               "<div style='padding:5px;'>{1}</div>" +
                                               "</div>", reader["Question"].ToString(), reader["AnswerHTML"].ToString());
                    }
                }

                Common.AddHistory(ObjectTypes.KnowledgeBase, selId, sTitle);
                Common.IncreaseArticleCounter(selId);

                string sFiles           = "";
                string containerName    = "FileLibrary";
                string containerKey     = UserRoleHelper.CreateArticleContainerKey(selId);
                CS.BaseIbnContainer bic = CS.BaseIbnContainer.Create(containerName, containerKey);
                CS.FileStorage      fs  = (CS.FileStorage)bic.LoadControl("FileStorage");
                CS.FileInfo[]       _fi = fs.Root.GetFiles();
                if (_fi.Length > 0)
                {
                    string _containerName    = "FileLibrary";
                    string _containerKey     = "EMailAttach";
                    CS.BaseIbnContainer _bic = CS.BaseIbnContainer.Create(_containerName, _containerKey);
                    CS.FileStorage      _fs  = (CS.FileStorage)_bic.LoadControl("FileStorage");
                    CS.DirectoryInfo    di   = _fs.GetDirectory(_fs.Root.Id, guid, true);
                    foreach (CS.FileInfo fi in _fi)
                    {
                        fs.CopyFile(fi.Id, di.Id, true);
                    }

                    _fi = _fs.GetFiles(di);
                    foreach (CS.FileInfo fi in _fi)
                    {
                        sFiles += String.Format("<div style='padding-bottom:1px;'><img align='absmiddle' src='{0}' width='16' height='16'>&nbsp;{1}&nbsp;&nbsp;<img src='{2}' align='absmiddle' width='16' height='16' style='cursor:pointer;' onclick='_deleteFile({3})' title='{4}' /></div>",
                                                ResolveUrl("~/Common/ContentIcon.aspx?IconID=" + fi.FileBinaryContentTypeId),
                                                Util.CommonHelper.GetShortFileName(fi.Name, 40),
                                                ResolveUrl("~/Layouts/Images/delete.gif"),
                                                fi.Id,
                                                LocRM2.GetString("tDelete"));
                    }
                }
                sText = sText.Replace("\r\n", "");
                sText = sText.Replace("\t", "");
                sText = sText.Replace("\\", "\\\\");
                sText = sText.Replace("\"", "\\\"");
                Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), String.Format("CloseAll(\"{0}\", \"{1}\");", sFiles, sText), true);
            }
        }
Beispiel #2
0
        private void PreparePage()
        {
            secHeader.Title = LocRM.GetString("tArticleView");
            secHeader.AddImageLink("../Layouts/Images/edit.gif", LocRM2.GetString("tEdit"),
                                   String.Format("../Incidents/ArticleEdit.aspx?ArticleId={0}", ArticleId));

            ContainerKey = UserRoleHelper.CreateArticleContainerKey(ArticleId);
            bic          = BaseIbnContainer.Create(ContainerName, ContainerKey);
            fs           = (FileStorage)bic.LoadControl("FileStorage");
            RootFolderId = fs.Root.Id;

            secHeader.AddImageLink("../Layouts/Images/icons/newfile.gif", LocRM3.GetString("tAddD"),
                                   String.Format("javascript:ShowWizard('{0}?ParentFolderId={1}&ContainerKey={2}&ContainerName={3}', 470, 270);",
                                                 ResolveUrl("~/FileStorage/FileUpload.aspx"),
                                                 RootFolderId, ContainerKey, ContainerName));
            secHeader.AddImageLink("../Layouts/Images/cancel.gif", LocRM.GetString("atclBackToList"), ResolveClientUrl("~/Apps/HelpDeskManagement/Pages/ArticleListMain.aspx"));
        }