Exemple #1
0
        /// <summary>
        /// Loads the file library acl.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        private bool LoadFileLibraryAcl(WorkflowInstanceEntity entity, out FileStorage fs, out AccessControlList acl)
        {
            acl = null;
            fs  = null;

            // Resolve ContainerKey
            string containerName = "FileLibrary";
            string containerKey  = string.Empty;

            if (entity.OwnerDocumentId.HasValue)
            {
                containerKey = UserRoleHelper.CreateDocumentContainerKey(entity.OwnerDocumentId.Value);
            }
            //else
            // TODO: Extend Owner Processing

            // Check ContainerKey
            if (string.IsNullOrEmpty(containerKey))
            {
                return(false);
            }

            // Open ACL
            BaseIbnContainer bic = BaseIbnContainer.Create(containerName, containerKey);

            fs = (FileStorage)bic.LoadControl("FileStorage");

            acl = AccessControlList.GetACL(fs.Root.Id);

            return(true);
        }
Exemple #2
0
        //newRespId: UserId OR "-2" - NotSet, "-1" - GroupResponsibility
        public static int AddForumMesageWithResponsibleChange(int IncidentId, int ForumNodeId, int newRespId)
        {
            ForumThreadNodeInfo info = null;

            using (DbTransaction tran = DbTransaction.Begin())
            {
                BaseIbnContainer destContainer = BaseIbnContainer.Create("FileLibrary", string.Format("IncidentId_{0}", IncidentId));
                ForumStorage     forumStorage  = (ForumStorage)destContainer.LoadControl("ForumStorage");
                if (ForumNodeId > 0)
                {
                    info = forumStorage.GetForumThreadNode(ForumNodeId);
                }
                else
                {
                    info = forumStorage.CreateForumThreadNode("", Security.CurrentUser.UserID, (int)ForumStorage.NodeContentType.Text);
                }

                ForumThreadNodeSettingCollection settings = new ForumThreadNodeSettingCollection(info.Id);
//				settings.Add("IssueEvent", IssueEvent.Responsibility.ToString());
                settings.Add(IssueEvent.Responsibility.ToString(), newRespId.ToString());

                tran.Commit();
            }
            return(info.Id);
        }
Exemple #3
0
        private void BindToolBarAndButtons()
        {
            tbView.AddText(LocRM.GetString("QuickTracking"));

            // O.R. [2009-05-25]: DisableButtons function doesn't work with CausesValidation property

            /*
             * btnComplete.Attributes.Add("onclick","DisableButtons(this);");
             * btnSuspend.Attributes.Add("onclick","DisableButtons(this);");
             * btnUncomplete.Attributes.Add("onclick","DisableButtons(this);");
             * btnResume.Attributes.Add("onclick","DisableButtons(this);");
             * btnDecline.Attributes.Add("onclick","DisableButtons(this);");
             * btnAccept.Attributes.Add("onclick","DisableButtons(this);");
             * btnActivate.Attributes.Add("onclick","DisableButtons(this);");
             */

            string           ContainerKey  = "DocumentVers_" + DocumentID.ToString();
            string           ContainerName = "FileLibrary";
            BaseIbnContainer bic           = BaseIbnContainer.Create(ContainerName, ContainerKey);

            Mediachase.IBN.Business.ControlSystem.FileStorage fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage");
            string commandLink = (Security.CurrentUser.IsExternal) ? "~/External/FileUpload.aspx" : "~/FileStorage/FileUpload.aspx";
            string link        = String.Format("javascript:ShowWizard('{0}?ParentFolderId={1}&ContainerKey={2}&ContainerName={3}{4}', 470, 270);return false;",
                                               ResolveUrl(commandLink), fs.Root.Id, ContainerKey, ContainerName,
                                               (Security.CurrentUser.IsExternal) ? ("&ExternalId=" + Security.CurrentUser.UserID) : "");

            btnNewVersion.Attributes.Add("onclick", link);
        }
Exemple #4
0
        /// <summary>
        /// Adds the internal E mail2 incident.
        /// </summary>
        /// <param name="IncidentId">The incident id.</param>
        /// <param name="EMailMessageId">The E mail message id.</param>
        /// <param name="SenderName">Name of the sender.</param>
        /// <param name="SenderEmail">The sender email.</param>
        /// <returns></returns>
        private static int AddInternalEMail2Incident(int IncidentId, int EMailMessageId, string SenderName, string SenderEmail)
        {
            ForumThreadNodeInfo info = null;

            using (DbTransaction tran = DbTransaction.Begin())
            {
                BaseIbnContainer FOcontainer  = BaseIbnContainer.Create("FileLibrary", string.Format("IncidentId_{0}", IncidentId));
                ForumStorage     forumStorage = (ForumStorage)FOcontainer.LoadControl("ForumStorage");

                int SenderUserID    = Security.UserID;
                EMailMessageInfo mi = EMailMessageInfo.Load(EMailMessageId);

                info = forumStorage.CreateForumThreadNode(EMailMessageInfo.ExtractTextFromHtml(mi.HtmlBody),
                                                          DateTime.UtcNow,
                                                          Security.UserID,
                                                          EMailMessageId,
                                                          (int)ForumStorage.NodeContentType.EMail);

                ForumThreadNodeSettingCollection settings = new ForumThreadNodeSettingCollection(info.Id);
                settings.Add(ForumThreadNodeSetting.Outgoing, "1");

                if (HttpContext.Current != null && HttpContext.Current.Items.Contains(ForumThreadNodeSetting.AllRecipients))
                {
                    settings.Add(ForumThreadNodeSetting.AllRecipients, HttpContext.Current.Items[ForumThreadNodeSetting.AllRecipients].ToString());
                }

                tran.Commit();
            }

            return(info.Id);
        }
Exemple #5
0
        private void GetCurrentFolderAndMoveObjects()
        {
            bic = BaseIbnContainer.Create(ContainerName, ContainerKey);
            fs  = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage");

            string sFolders = Request["Folders"].ToString();
            string sFiles   = Request["Files"].ToString();

            while (sFolders.Length > 0)
            {
                alFolders.Add(sFolders.Substring(0, sFolders.IndexOf(",")));
                sFolders = sFolders.Remove(0, sFolders.IndexOf(",") + 1);
            }
            while (sFiles.Length > 0)
            {
                alFiles.Add(sFiles.Substring(0, sFiles.IndexOf(",")));
                sFiles = sFiles.Remove(0, sFiles.IndexOf(",") + 1);
            }
            if (alFolders.Count > 0)
            {
                ParentFolderId = fs.GetDirectory(int.Parse(alFolders[0].ToString())).ParentDirectoryId;
            }
            else if (alFiles.Count > 0)
            {
                int      i  = int.Parse(alFiles[0].ToString());
                FileInfo fi = fs.GetFile(i);
                ParentFolderId = fi.ParentDirectoryId;
            }
            ctrlDirTree.DisFolderId = ParentFolderId;
        }
Exemple #6
0
        private void BindTree()
        {
            TreeView1.MultipleSelectEnabled       = false;
            TreeView1.DragAndDropEnabled          = false;
            TreeView1.KeyboardEnabled             = true;
            TreeView1.NodeEditingEnabled          = false;
            TreeView1.KeyboardCutCopyPasteEnabled = false;
            TreeView1.ShowLines     = true;
            TreeView1.DisplayMargin = false;

            TreeViewNode rootNode = new TreeViewNode();

            rootNode.Text          = "Projects";
            rootNode.Selectable    = false;
            rootNode.CssClass      = "TreeNodeGray";
            rootNode.HoverCssClass = "TreeNodeGray";

            DataTable dt = Project.GetListActiveProjectsByUserDataTable();            // ActiveProjectsByUserOnlyDataTable();

            foreach (DataRow dr in dt.Rows)
            {
                string ContainerKey = Mediachase.IBN.Business.UserRoleHelper.CreateProjectContainerKey((int)dr["ProjectId"]);
                bic = BaseIbnContainer.Create("FileLibrary", ContainerKey);
                fs  = (FileStorage)bic.LoadControl("FileStorage");
                ProcessFolderNode(rootNode, ContainerKey, fs.Root.Id, dr["Title"].ToString(), true);
            }

            TreeView1.Nodes.Add(rootNode);
            TreeView1.ExpandAll();
        }
Exemple #7
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            _bic = BaseIbnContainer.Create(_containerName, _containerKey);
            _fs  = (Mediachase.IBN.Business.ControlSystem.FileStorage)_bic.LoadControl("FileStorage");
            ApplyLocalization();
            if (!Page.IsPostBack)
            {
                if (_pc["fl_Sort_" + _containerKey] == null)
                {
                    _pc["fl_Sort_" + _containerKey] = "sortName";
                }

                if (_pc["fs_List_ViewStyle"] == null)
                {
                    _pc["fs_List_ViewStyle"] = "ListView";
                }

                if (Top <= 0)
                {
                    BindDefaultValues();
                }
                else
                {
                    trFilter.Visible = false;
                }
            }
            if (Top <= 0)
            {
                BindSavedValues();
                BindInfoTable();
            }
            BindList();

            BindToolbar();
        }
Exemple #8
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            UtilHelper.RegisterCssStyleSheet(Page, "~/Styles/IbnFramework/windows.css");
            UtilHelper.RegisterCssStyleSheet(Page, "~/Styles/IbnFramework/Theme.css");
            UtilHelper.RegisterCssStyleSheet(Page, "~/Styles/IbnFramework/mcCalendClient.css");

            UtilHelper.RegisterScript(Page, "~/Scripts/browser.js");
            UtilHelper.RegisterScript(Page, "~/Scripts/buttons.js");

            if (Request["PrimaryKeyId"] != null)
            {
                string[] elem = Request["PrimaryKeyId"].Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries);
                FolderId      = int.Parse(elem[1]);
                ContainerName = elem[2];
                ContainerKey  = elem[3];
            }
            bic = BaseIbnContainer.Create(ContainerName, ContainerKey);
            fs  = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage");
            rfTitle.ErrorMessage = LocRM.GetString("Required");
            cvTitle.ErrorMessage = LocRM.GetString("tDuplicateName");
            if (!IsPostBack)
            {
                BindValues();
            }

            btnSave.Text   = LocRM.GetString("Save");
            btnCancel.Text = LocRM.GetString("Cancel");

            btnSave.Attributes.Add("onclick", "DisableButtons(this);");
            btnCancel.Attributes.Add("onclick", "window.close()");

            btnSave.CustomImage = this.Page.ResolveUrl("~/layouts/images/saveitem.gif");
        }
Exemple #9
0
        private void BindValues()
        {
            BaseIbnContainer bic = BaseIbnContainer.Create("FileLibrary", "Workspace");

            Mediachase.IBN.Business.ControlSystem.FileStorage fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage");

            ctrlDirTree.DisFolderId = fs.Root.Id;
        }
Exemple #10
0
        private void BindDGFiles(string Keyword)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("Id", typeof(int)));
            dt.Columns.Add(new DataColumn("Title", typeof(string)));
            dt.Columns.Add(new DataColumn("_Href", typeof(string)));
            dt.Columns.Add(new DataColumn("_New", typeof(int)));
            dt.Columns.Add(new DataColumn("Location", typeof(string)));
            DataRow dr;

            FileInfo[] _fi = Mediachase.IBN.Business.ControlSystem.FileStorage.SearchFiles(Security.CurrentUser.UserID, -1, -1, Keyword, -1, DateTime.MinValue, DateTime.MinValue, -1, -1);
            foreach (FileInfo fi in _fi)
            {
                dr          = dt.NewRow();
                dr["Id"]    = fi.Id;
                dr["Title"] = Util.CommonHelper.GetShortFileName(fi.Name, 40);
                string sLink = "";
                if (fi.FileBinaryContentType.ToLower().IndexOf("url") >= 0)
                {
                    sLink = GetLinkText(fi);
                }
                if (sLink == "")
                {
                    //sLink = Util.CommonHelper.GetAbsolutePath(Mediachase.IBN.Business.ControlSystem.WebDavFileUserTicket.GetDownloadPath(fi.Id, fi.Name));
                    sLink = WebDavUrlBuilder.GetFileStorageWebDavUrl(fi, true);
                }
                dr["_Href"] = sLink;
                dr["_New"]  = Common.OpenInNewWindow(fi.FileBinaryContentType) ? 1 : 0;


                string           containerKey = fi.ContainerKey;
                BaseIbnContainer bic          = BaseIbnContainer.Create("FileLibrary", containerKey);
                Mediachase.IBN.Business.ControlSystem.FileStorage fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage");
                string parentName = "";
                string parentLink = "";
                Util.CommonHelper.GetParentContainer(containerKey, fi.ParentDirectory, out parentName, out parentLink);
                dr["Location"] = parentName;

                dt.Rows.Add(dr);
            }

            dgFiles.DataSource = dt.DefaultView;
            dgFiles.DataBind();

            int RowCount = dgFiles.Items.Count;

            if (RowCount == 0)
            {
                Sep6.Visible = false;
                Pan6.Visible = false;
            }
            else
            {
                Sep6.Title = String.Format("{0} ({1})", LocRM.GetString("Files"), RowCount);
            }
        }
Exemple #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     bic = BaseIbnContainer.Create("Reports", "GlobalReports");
     rs  = (ReportStorage)bic.LoadControl("ReportStorage");
     BindToolBar();
     if (!IsPostBack)
     {
         BindRepeaters();
     }
 }
Exemple #12
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            int iIconId = -1;

            if (CTypeId > 0)
            {
                using (IDataReader reader = Mediachase.IBN.Business.ContentType.GetContentType(CTypeId))
                {
                    if (reader.Read())
                    {
                        if (Big && reader["BigIconFileId"] != DBNull.Value)
                        {
                            iIconId = (int)reader["BigIconFileId"];
                        }
                        if (!Big && reader["IconFileId"] != DBNull.Value)
                        {
                            iIconId = (int)reader["IconFileId"];
                        }
                    }
                }
            }

            Response.ContentType = "image/jpeg";
            if (Big && Request["ContainerKey"] != null && Request["FileId"] != null)
            {
                string CKey = Request["ContainerKey"].ToString();
                int    FId  = int.Parse(Request["FileId"].ToString());
                Size   sz   = new Size(90, 90);
                if (Mediachase.IBN.Business.ImageThumbnail.Create(ImageThumbnailMode.SaveProportion | ImageThumbnailMode.SkipSmallImage, CKey, FId, sz, System.Drawing.Imaging.ImageFormat.Jpeg, Response.OutputStream))
                {
                    return;
                }
            }
            if (iIconId > 0)
            {
                string           ContainerName = "FileLibrary";
                string           ContainerKey  = "ContentType";
                BaseIbnContainer bic           = BaseIbnContainer.Create(ContainerName, ContainerKey);
                Mediachase.IBN.Business.ControlSystem.FileStorage fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage");
                FileInfo fi = fs.GetFile(iIconId);
                Response.AddHeader("content-disposition", String.Format("inline; filename=\"{0}\"", GetNameForCurrentBrowser(fi.Name)));
                Mediachase.IBN.Business.ControlSystem.FileStorage.LightLoadFile(fi, Response.OutputStream);
            }
            else
            {
                if (Big)
                {
                    Response.Redirect("~/Layouts/Images/filetypes/unknown48.gif");
                }
                else
                {
                    Response.Redirect("~/Layouts/Images/filetypes/unknown16.gif");
                }
            }
        }
Exemple #13
0
        private void ApplyAttributes()
        {
            bic = BaseIbnContainer.Create("Reports", "GlobalReports");
            rs  = (ReportStorage)bic.LoadControl("ReportStorage");

            btnSave.Attributes.Add("onclick", "DisableButtons(this);");
            btnAdd.InnerText = LocRM.GetString("tAdd");
            dgMembers.Columns[1].HeaderText = LocRM.GetString("FieldName");
            dgMembers.Columns[2].HeaderText = LocRM.GetString("tAllow");
            dgMembers.Columns[3].HeaderText = LocRM.GetString("tDeny");
        }
Exemple #14
0
 private void ApplyValues()
 {
     if (Request["PrimaryKeyId"] != null)
     {
         string[] elem = Request["PrimaryKeyId"].Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries);
         FileId        = int.Parse(elem[1]);
         ContainerName = elem[2];
         ContainerKey  = elem[3];
     }
     bic = BaseIbnContainer.Create(ContainerName, ContainerKey);
     fs  = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage");
 }
Exemple #15
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     bic = BaseIbnContainer.Create("Reports", "GlobalReports");
     rs  = (ReportStorage)bic.LoadControl("ReportStorage");
     if (!Page.IsPostBack)
     {
         if (pc["rep_Config_Sort"] == null)
         {
             pc["rep_Config_Sort"] = "sortName";
         }
         BindDG();
     }
     BindToolBar();
 }
Exemple #16
0
        private void btnPublish_ServerClick(object sender, EventArgs e)
        {
            int iDestFolder = -1;

            try
            {
                iDestFolder = ctrlDirTree.FolderId;
            }
            catch { }
            if (iDestFolder == -1)
            {
                lblNotValid.Visible = true;
                return;
            }

            BaseIbnContainer sourceBic = BaseIbnContainer.Create(ContainerName, ContainerKey);

            Mediachase.IBN.Business.ControlSystem.FileStorage sourceFS = (Mediachase.IBN.Business.ControlSystem.FileStorage)sourceBic.LoadControl("FileStorage");
            FileInfo sourceFi = sourceFS.GetFile(FileId);

            string cKey = DirectoryInfo.GetContainerKey(iDestFolder);

            if (String.IsNullOrEmpty(cKey))
            {
                cKey = "Workspace";
            }
            BaseIbnContainer destBic = BaseIbnContainer.Create("FileLibrary", cKey);

            Mediachase.IBN.Business.ControlSystem.FileStorage destFS = (Mediachase.IBN.Business.ControlSystem.FileStorage)destBic.LoadControl("FileStorage");
            DirectoryInfo destDi = destFS.GetDirectory(iDestFolder);

            try
            {
                destFS.CopyFile(sourceFi, destDi);
            }
            catch (SqlException exception)
            {
                if (exception.Number == 2627 || exception.Number == 50000)
                {
                    lblErrorMessage.Text = LocRM.GetString("tDuplicateName");
                    trError.Visible      = true;
                    return;
                }
            }

            Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                                                    "try {window.opener.location.href=window.opener.location.href;window.close();}" +
                                                    "catch (e){}", true);
        }
Exemple #17
0
        private void BindData()
        {
            string ContainerKey = "Workspace";

            bic = BaseIbnContainer.Create("FileLibrary", ContainerKey);
            fs  = (FileStorage)bic.LoadControl("FileStorage");

            TreeViewNode rootNode = new TreeViewNode();

            rootNode.Text = LocRM.GetString("tRoot");

            ProcessFolderNode(rootNode, ContainerKey, fs.Root.Id, LocRM.GetString("tRoot"), false);

            TreeView1.Nodes.Add(rootNode);
        }
Exemple #18
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            bic = BaseIbnContainer.Create("Reports", "GlobalReports");
            rs  = (ReportStorage)bic.LoadControl("ReportStorage");
            if (!Page.IsPostBack)
            {
                BindDGs(true, true);
            }
            BindToolBar();

            this.dgRepGeneral.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.dgRepGeneral_PageIndexChanged);
            this.dgRepGeneral.SortCommand      += new System.Web.UI.WebControls.DataGridSortCommandEventHandler(this.dgRepGeneral_Sort);
            this.dgRepGeneral.PageSizeChanged  += new Mediachase.UI.Web.Modules.DGExtension.DataGridPageSizeChangedEventHandler(this.dgRepGeneral_PageSizeChanged);
            this.dgRepGeneral.ItemCommand      += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgRepGeneral_view);
            this.dgRepGeneral.DeleteCommand    += new DataGridCommandEventHandler(this.dgRepGeneral_DeleteCommand);
        }
Exemple #19
0
        public static int Create(string Extension, string ContentTypeString,
                                 string FriendlyName, string FileName, Stream _inputStream, string BigFileName,
                                 Stream _bigInputStream, bool AllowWebDav, bool AllowNewWindow, bool AllowForceDownload)
        {
            int ContentTypeId = -1;

            using (DbTransaction tran = DbTransaction.Begin())
            {
                int IconFileId    = -1;
                int BigIconFileId = -1;
                if (FileName != null && FileName != "")
                {
                    string ContainerName = "FileLibrary";
                    string ContainerKey  = "ContentType";

                    BaseIbnContainer bic = BaseIbnContainer.Create(ContainerName, ContainerKey);
                    FileStorage      fs  = (FileStorage)bic.LoadControl("FileStorage");
                    Mediachase.IBN.Business.ControlSystem.FileInfo fi = fs.SaveFile(fs.Root.Id, FileName, _inputStream);
                    IconFileId = fi.Id;
                }
                if (BigFileName != null && BigFileName != "")
                {
                    string ContainerName = "FileLibrary";
                    string ContainerKey  = "ContentType";

                    BaseIbnContainer bic1 = BaseIbnContainer.Create(ContainerName, ContainerKey);
                    FileStorage      fs1  = (FileStorage)bic1.LoadControl("FileStorage");
                    Mediachase.IBN.Business.ControlSystem.FileInfo fi1 = fs1.SaveFile(fs1.Root.Id, BigFileName, _bigInputStream);
                    BigIconFileId = fi1.Id;
                }

                object oIconFileId = DBNull.Value;
                if (IconFileId > 0)
                {
                    oIconFileId = IconFileId;
                }
                object oBigIconFileId = DBNull.Value;
                if (BigIconFileId > 0)
                {
                    oBigIconFileId = BigIconFileId;
                }
                ContentTypeId = DBContentType.Create(Extension, ContentTypeString, FriendlyName, oIconFileId, oBigIconFileId, AllowWebDav, AllowNewWindow, AllowForceDownload);

                tran.Commit();
            }
            return(ContentTypeId);
        }
Exemple #20
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"));
        }
 private void GetDocumentId()
 {
     if (DocumentId <= 0 && ToDoId > 0)
     {
         using (IDataReader reader = Mediachase.IBN.Business.ToDo.GetToDo(ToDoId, false))
         {
             if (reader.Read())
             {
                 if (reader["DocumentId"] != DBNull.Value)
                 {
                     DocumentId = (int)reader["DocumentId"];
                 }
             }
         }
     }
     ContainerKey = "DocumentVers_" + DocumentId.ToString();
     _bic         = BaseIbnContainer.Create(ContainerName, ContainerKey);
     _fs          = (FileStorage)_bic.LoadControl("FileStorage");
 }
Exemple #22
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            UtilHelper.RegisterCssStyleSheet(Page, "~/Styles/IbnFramework/windows.css");
            UtilHelper.RegisterCssStyleSheet(Page, "~/Styles/IbnFramework/Theme.css");
            UtilHelper.RegisterCssStyleSheet(Page, "~/Styles/IbnFramework/mcCalendClient.css");

            UtilHelper.RegisterScript(Page, "~/Scripts/browser.js");
            UtilHelper.RegisterScript(Page, "~/Scripts/buttons.js");

            Response.Cache.SetNoStore();

            bic = BaseIbnContainer.Create(ContainerName, ContainerKey);
            fs  = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage");

            if (!Page.IsPostBack)
            {
                BindDG();
            }
        }
Exemple #23
0
        public static void Update(int ContentTypeId, string FriendlyName,
                                  string FileName, Stream _inputStream, string BigFileName,
                                  Stream _bigInputStream, bool AllowWebDav, bool AllowNewWindow, bool AllowForceDownload)
        {
            //		int OldIconFileId = DBContentType.GetIconFileId(ContentTypeId);
            //		int OldBigIconFileId = DBContentType.GetBigIconFileId(ContentTypeId);

            using (DbTransaction tran = DbTransaction.Begin())
            {
                DBContentType.Update(ContentTypeId, FriendlyName, AllowWebDav, AllowNewWindow, AllowForceDownload);
                if (FileName != null && FileName != "")
                {
                    string ContainerName = "FileLibrary";
                    string ContainerKey  = "ContentType";

                    BaseIbnContainer bic = BaseIbnContainer.Create(ContainerName, ContainerKey);
                    FileStorage      fs  = (FileStorage)bic.LoadControl("FileStorage");
                    Mediachase.IBN.Business.ControlSystem.FileInfo fi = fs.SaveFile(fs.Root.Id, FileName, _inputStream);

                    DBContentType.UpdateIconFileId(ContentTypeId, fi.Id);
                    //				if(OldIconFileId>0 && OldIconFileId!=fi.Id)
                    //					fs.DeleteFile(OldIconFileId);
                }

                if (BigFileName != null && BigFileName != "")
                {
                    string ContainerName = "FileLibrary";
                    string ContainerKey  = "ContentType";

                    BaseIbnContainer bic = BaseIbnContainer.Create(ContainerName, ContainerKey);
                    FileStorage      fs  = (FileStorage)bic.LoadControl("FileStorage");
                    Mediachase.IBN.Business.ControlSystem.FileInfo fi = fs.SaveFile(fs.Root.Id, BigFileName, _bigInputStream);

                    DBContentType.UpdateBigIconFileId(ContentTypeId, fi.Id);
                    //				if(OldBigIconFileId>0 && OldBigIconFileId!=fi.Id)
                    //					fs.DeleteFile(OldBigIconFileId);
                }

                tran.Commit();
            }
        }
Exemple #24
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            _bic = BaseIbnContainer.Create(_containerName, _containerKey);
            _fs  = (Mediachase.IBN.Business.ControlSystem.FileStorage)_bic.LoadControl("FileStorage");

            if (!Page.IsPostBack)
            {
                BindLists();
                ViewState["fls_Sort"] = _sort;

                if (_pc["fs_Search_ViewStyle"] == null)
                {
                    _pc["fs_Search_ViewStyle"] = "ListView";
                }
            }
            else
            {
                BindSavedValues();
                BindDG();
            }
        }
Exemple #25
0
        /// <summary>
        /// Adds the external E mail to incident.
        /// </summary>
        /// <param name="IncidentId">The incident id.</param>
        /// <param name="EMailMessageId">The E mail message id.</param>
        /// <param name="message">The message.</param>
        private static int AddExternalEMail2Incident(int IncidentId, int EMailMessageId, string SenderName, string SenderEmail)
        {
            ForumThreadNodeInfo info = null;

            using (DbTransaction tran = DbTransaction.Begin())
            {
                BaseIbnContainer FOcontainer  = BaseIbnContainer.Create("FileLibrary", string.Format("IncidentId_{0}", IncidentId));
                ForumStorage     forumStorage = (ForumStorage)FOcontainer.LoadControl("ForumStorage");

                EMailMessageInfo mi = EMailMessageInfo.Load(EMailMessageId);

                info = forumStorage.CreateForumThreadNode(EMailMessageInfo.ExtractTextFromHtml(mi.HtmlBody),
                                                          DateTime.UtcNow,
                                                          Security.UserID,
                                                          EMailMessageId,
                                                          (int)ForumStorage.NodeContentType.EMail);

                // 2006-12-12 OZ: Register EMail External Recepient
                if (!EMailIssueExternalRecipient.Contains(IncidentId, SenderEmail))
                {
                    EMailIssueExternalRecipient.Create(IncidentId, SenderEmail);
                }

                ForumThreadNodeSettingCollection settings = new ForumThreadNodeSettingCollection(info.Id);
                settings.Add(ForumThreadNodeSetting.Incoming, "1");

                if (HttpContext.Current != null && HttpContext.Current.Items.Contains(ForumThreadNodeSetting.AllRecipients))
                {
                    settings.Add(ForumThreadNodeSetting.AllRecipients, HttpContext.Current.Items[ForumThreadNodeSetting.AllRecipients].ToString());
                }

                // O.R. [2008-09-19]: Recalculate Expected Dates
                DBIncident.RecalculateExpectedResponseDate(IncidentId);
                DBIncident.RecalculateExpectedAssignDate(IncidentId);

                tran.Commit();
            }

            return(info.Id);
        }
Exemple #26
0
        public static bool Create(ImageThumbnailMode mode, string ContainerKey, int FileId, Size size, ImageFormat imageFormat, System.IO.Stream output)
        {
            try
            {
                BaseIbnContainer bic = BaseIbnContainer.Create("FileLibrary", ContainerKey);
                FileStorage      fs  = (FileStorage)bic.LoadControl("FileStorage");

                using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
                {
                    fs.LoadFile(FileId, stream);

                    Image image = Image.FromStream(stream);

                    return(Create(mode, image, size, imageFormat, output));
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex);
                return(false);
            }
        }
Exemple #27
0
 private void grdMain_ItemDataBound(object sender, DataGridItemEventArgs e)
 {
     if (Top > 0)
     {
         return;
     }
     else
     {
         DataGridItem item = e.Item;
         if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem || item.ItemType == ListItemType.EditItem)
         {
             string           containerKey1 = item.Cells[1].Text;
             BaseIbnContainer bic           = BaseIbnContainer.Create("FileLibrary", containerKey1);
             Mediachase.IBN.Business.ControlSystem.FileStorage fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage");
             DirectoryInfo di         = fs.GetDirectory(int.Parse(item.Cells[2].Text));
             string        parentName = "";
             string        parentLink = "";
             Util.CommonHelper.GetParentContainer(containerKey1, di, out parentName, out parentLink);
             item.Cells[5].Text = parentLink;
         }
     }
 }
Exemple #28
0
        private void ApplyValues()
        {
            if (Request["PrimaryKeyId"] != null)
            {
                string[] elem = Request["PrimaryKeyId"].Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries);
                FileId        = int.Parse(elem[1]);
                ContainerName = elem[2];
                ContainerKey  = elem[3];
            }
            bic = BaseIbnContainer.Create(ContainerName, ContainerKey);
            fs  = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage");

            btnSave.Text   = LocRM.GetString("Save");
            btnCancel.Text = LocRM.GetString("Cancel");

            btnSave.Attributes.Add("onclick", "DisableButtons(this);");
            btnCancel.Attributes.Add("onclick", "window.close()");
            btnSave.CustomImage = this.Page.ResolveUrl("~/layouts/images/saveitem.gif");

            rfTitle.ErrorMessage        = LocRM.GetString("Required");
            cvTitle.ErrorMessage        = LocRM.GetString("tDuplicateName");
            cvInvalidChars.ErrorMessage = "*";

            cbKeepHistory.Text = LocRM.GetString("tKeepHistory");

            if (LinkId == 0 && ParentFolderId >= 0)
            {
                trLink.Visible = true;
            }
            else
            {
                trLink.Visible = false;
            }

            if (!ShowHistory)
            {
                cbKeepHistory.Visible = false;
            }
        }
Exemple #29
0
        private void ApplyAttributes()
        {
            if (Request["PrimaryKeyId"] != null)
            {
                string[] elem = Request["PrimaryKeyId"].Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries);
                FolderId      = int.Parse(elem[1]);
                ContainerName = elem[2];
                ContainerKey  = elem[3];
            }

            bic = BaseIbnContainer.Create(ContainerName, ContainerKey);
            fs  = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage");

            btnSave.Attributes.Add("onclick", "DisableButtons(this);DisableCheck();");
            btnAdd.InnerText = LocRM.GetString("tAdd");
            dgMembers.Columns[1].HeaderText = LocRM.GetString("tName");
            dgMembers.Columns[2].HeaderText = LocRM.GetString("Rights");
            dgMembers.Columns[3].HeaderText = LocRM.GetString("tAllow");
            //dgMembers.Columns[4].HeaderText = LocRM.GetString("tDeny");

            lgdPModal.InnerText     = LocRM.GetString("Security");
            lgdLostRights.InnerText = LocRM.GetString("tAttention");
        }
Exemple #30
0
        void BindDefaultValues()
        {
            txtFolder.Text = "";

            int iFolderId = -1;

            try{ iFolderId = int.Parse(txtFolderId.Value); }
            catch { return; }

            string ContainerKey = txtContainerKey.Value;

            //if(ContainerKey == "")
            //	return;

            bic = BaseIbnContainer.Create("FileLibrary", ContainerKey);
            fs  = (FileStorage)bic.LoadControl("FileStorage");

            string name = "unknown";

            if (iFolderId == fs.Root.Id)
            {
                if (ContainerKey.LastIndexOf("_") > 0)
                {
                    int ProjectId = -1;
                    try
                    {
                        ProjectId = int.Parse(ContainerKey.Substring(ContainerKey.LastIndexOf("_") + 1));
                    }
                    catch {}
                    if (ProjectId != -1)
                    {
                        using (IDataReader reader = Project.GetProject(ProjectId))
                        {
                            reader.Read();
                            if (reader["Title"] != null)
                            {
                                name = reader["Title"].ToString();
                            }
                        }
                    }
                }
                else
                {
                    name = LocRM.GetString("tRoot");
                }
            }
            else
            {
                DirectoryInfo di = fs.GetDirectory(iFolderId);
                if (di != null)
                {
                    name = di.Name;
                }
                else
                {
                    ContainerKey = "";
                    FolderId     = -1;
                    return;
                }
            }
            //	name = fs.GetDirectory(iFolderId).Name;

            System.IO.StringWriter writer = new System.IO.StringWriter();
            Server.HtmlDecode(name, writer);
            string decoded = writer.ToString();

            txtFolder.Text = decoded;
        }