示例#1
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();
        }
示例#2
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);
        }
示例#3
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);
        }
示例#4
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;
        }
示例#5
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();
        }
示例#6
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");
        }
示例#7
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);
        }
示例#8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     bic = BaseIbnContainer.Create("Reports", "GlobalReports");
     rs  = (ReportStorage)bic.LoadControl("ReportStorage");
     BindToolBar();
     if (!IsPostBack)
     {
         BindRepeaters();
     }
 }
示例#9
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");
        }
示例#10
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");
 }
示例#11
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();
 }
示例#12
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);
        }
示例#13
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);
        }
示例#14
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);
        }
示例#15
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"));
        }
示例#16
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();
            }
        }
示例#17
0
 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");
 }
示例#18
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();
            }
        }
示例#19
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();
            }
        }
示例#20
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);
        }
示例#21
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);
            }
        }
示例#22
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;
            }
        }
示例#23
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");
        }
示例#24
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Response.Cache.SetNoStore();
            try
            {
                int userId     = UserId;
                int originalId = OriginalId;

                if (userId < 0 && originalId > 0)
                {
                    using (IDataReader reader = Mediachase.IBN.Business.User.GetUserInfoByOriginalId(originalId))
                    {
                        if (reader.Read())
                        {
                            userId = (int)reader["UserId"];
                        }
                    }
                }

                string pictureUrl = string.Empty;
                using (IDataReader rdr = Mediachase.IBN.Business.User.GetUserProfile(userId))
                {
                    if (rdr.Read())
                    {
                        if (rdr["PictureUrl"] != DBNull.Value)
                        {
                            pictureUrl = (string)rdr["PictureUrl"];
                        }
                    }
                }

                int fileId = -1;
                if (!string.IsNullOrEmpty(pictureUrl))
                {
                    fileId = DSFile.GetFileIDFromURL(pictureUrl);
                }

                if (fileId > 0)
                {
                    const string     containerName = "FileLibrary";
                    const string     containerKey  = "SystemPicture";
                    BaseIbnContainer bic           = BaseIbnContainer.Create(containerName, containerKey);
                    Mediachase.IBN.Business.ControlSystem.FileStorage fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage");
                    FileInfo fi = fs.GetFile(fileId);
                    Response.ContentType = "image/jpeg";
                    Response.AddHeader("content-disposition", String.Format("attachment; filename=\"{0}\"", GetNameForCurrentBrowser(fi.Name)));
                    Mediachase.IBN.Business.ControlSystem.FileStorage.LightLoadFile(fi, Response.OutputStream);
                }
                else
                {
                    Response.ContentType = "image/jpeg";
                    Response.Redirect("~/Layouts/Images/nofoto.gif");
                }
            }
            catch
            {
                Response.Redirect("~/Layouts/Images/nofoto.gif", true);
            }

            Response.End();
        }
示例#25
0
        protected void grdDetails_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Header)
            {
                foreach (Control c in e.Item.Controls[4].Controls)
                {
                    if (c is LinkButton)
                    {
                        LinkButton lb = (LinkButton)c;
                        switch (lb.CommandArgument)
                        {
                        case "sortName":
                            lb.Text = LocRM.GetString("tName");
                            break;

                        case "ContainerKey":
                            lb.Text = LocRM.GetString("tLocation");
                            break;

                        case "sortModifier":
                            lb.Text = LocRM.GetString("UpdatedBy");
                            break;

                        case "sortModified":
                            lb.Text = LocRM.GetString("UpdatedDate");
                            break;

                        case "sortSize":
                            lb.Text = LocRM.GetString("Size");
                            break;

                        default:
                            break;
                        }
                        if (lb.CommandArgument == _pc["fl_Sort_" + _containerKey].ToString())
                        {
                            lb.Text += String.Format("&nbsp;<img border='0' align='absmiddle' width='9px' height='5px' src='{0}'/>",
                                                     ResolveUrl("~/layouts/images/upbtnF.jpg"));
                        }
                        else if (lb.CommandArgument + " DESC" == _pc["fl_Sort_" + _containerKey].ToString())
                        {
                            lb.Text += String.Format("&nbsp;<img border='0' align='absmiddle' width='9px' height='5px' src='{0}'/>",
                                                     ResolveUrl("~/layouts/images/downbtnF.jpg"));
                        }
                    }
                }
            }


            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);
                    Label lbl = (Label)item.Cells[4].FindControl("lblLocation");
                    if (lbl != null)
                    {
                        lbl.Text = parentLink;
                    }
                }
            }
        }
示例#26
0
        protected override void OnProcessPop3Message(Pop3Box box, Mediachase.Net.Mail.Pop3Message message)
        {
            try
            {
                // Step 0. Get settings
                FileSettings settings = GetSettings(box);

                // Step 0.5 Create storage
                string containerKey = "Workspace";
                if (settings.ContainerKey != String.Empty)
                {
                    containerKey = settings.ContainerKey;
                }
                BaseIbnContainer baseContainer = BaseIbnContainer.Create("FileLibrary", containerKey);
                FileStorage      storage       = (FileStorage)baseContainer.LoadControl("FileStorage");

                // Step 1. Get Email sender info
                MailAddress from = message.Sender;
                if (from == null)
                {
                    from = message.From;
                }

                // Step 2. Get Ibn User
                int userId = GetUserIdByEmail(from.Address, settings.OnlyExternalSenders);

                if (userId != -1)
                {
                }
                else
                {
                    if (settings.AutoKillForUnknown)
                    {
                        return;
                    }
                }

                // Step 3. Find Folder
                int FolderId = settings.FolderId;
                if (settings.FolderPattern != String.Empty)
                {
                    String FolderName = ValidatePatternPath(ParseFolderPattern(settings.FolderPattern, message, userId));

                    Mediachase.IBN.Business.ControlSystem.DirectoryInfo dirInfo = storage.GetDirectory(FolderId, FolderName, true);
                    if (dirInfo != null)
                    {
                        FolderId = dirInfo.Id;
                    }
                    else
                    {
                        FolderId = -1;
                    }
                }

                // Step 3. Create Files
                AddAttachments(storage, FolderId, message, userId);

                // Step 4. Create EML File
                if (settings.SaveMessageBodyAsEml)
                {
                    UploadEmlFile(storage, FolderId, userId, message);
                }
                // Step 5. Create MHT File
                if (settings.SaveMessageBodyAsMht)
                {
                    UploadMhtFile(storage, FolderId, userId, message);
                }
                // Step 5. Create MSG File
                if (settings.SaveMessageBodyAsMsg)
                {
                    UploadMsgFile(storage, FolderId, userId, message);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex);
                throw;
            }
        }
示例#27
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);
            }
        }
示例#28
0
        private void BindValues()
        {
            int DocumentID = -1;

            using (IDataReader reader = ToDo.GetToDo(ToDoID))
            {
                if (reader.Read())
                {
                    if (reader["DocumentID"] != DBNull.Value)
                    {
                        DocumentID = (int)reader["DocumentID"];
                    }
                }
            }

            if (DocumentID < 0)
            {
                this.Visible = false;
                return;
            }

            using (IDataReader reader = Document.GetDocument(DocumentID))
            {
                if (reader.Read())
                {
                    ///  DocumentId, ProjectId, ProjectTitle, CreatorId, ManagerId,
                    ///  Title, Description, CreationDate, PriorityId, PriorityName,
                    ///  StatusId, StatusName, StateId

                    bool IsExternal = Security.CurrentUser.IsExternal;
                    if (!IsExternal)
                    {
                        lblTitle.Text = "<a href='../Documents/DocumentView.aspx?DocumentID=" + ((int)reader["DocumentID"]).ToString() + "'>" + reader["Title"].ToString() + "</a>";
                    }
                    else
                    {
                        lblTitle.Text = reader["Title"].ToString();
                    }

                    //					lblState.ForeColor = Util.CommonHelper.GetStateColor((int)reader["StateId"]);
                    lblState.Text = reader["StateName"].ToString();
                    if ((int)reader["StateId"] == (int)ObjectStates.Active || (int)reader["StateId"] == (int)ObjectStates.Overdue)
                    {
                        lblState.Text += String.Format(" ({0})", reader["StatusName"].ToString());
                    }

                    lblPriority.Text = reader["PriorityName"].ToString();
                    //					lblPriority.ForeColor = Util.CommonHelper.GetPriorityColor((int)reader["PriorityId"]);
                    lblPriority.Visible = PortalConfig.CommonDocumentAllowViewPriorityField;

                    if (reader["Description"] != DBNull.Value)
                    {
                        string txt = CommonHelper.parsetext(reader["Description"].ToString(), false);
                        if (PortalConfig.ShortInfoDescriptionLength > 0 && txt.Length > PortalConfig.ShortInfoDescriptionLength)
                        {
                            txt = txt.Substring(0, PortalConfig.ShortInfoDescriptionLength) + "...";
                        }
                        lblDescription.Text = txt;
                    }
                }
            }

            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");
            FileInfo[] _fi           = fs.GetFiles(fs.Root.Id);
            FileInfo   LatestVersion = null;

            foreach (FileInfo fi in _fi)
            {
                if (LatestVersion == null || LatestVersion.Created < fi.Created)
                {
                    LatestVersion = fi;
                }
            }

            if (LatestVersion == null)
            {
                lblLatestVersion.Text = LocRM.GetString("None");
            }
            else
            {
                string Icon = String.Format("<img src='{0}' width='16' height='16' align='absmiddle' border='0'>", ResolveUrl("~/Common/ContentIcon.aspx?IconID=" + LatestVersion.FileBinaryContentTypeId));
                //string Link = String.Format("{0}?Id={1}&CName={2}&CKey={3}", ResolveUrl("~/FileStorage/DownloadFile.aspx"), LatestVersion.Id, ContainerName, ContainerKey);
                string Link        = Util.CommonHelper.GetAbsoluteDownloadFilePath(LatestVersion.Id, LatestVersion.Name, ContainerName, ContainerKey);
                string sNameLocked = CommonHelper.GetLockerText(Link);

                lblLatestVersion.Text = String.Format("<a href=\"{0}\">{1} {2}</a> (#{3}) {4}",
                                                      Link, Icon,
                                                      LatestVersion.Name, _fi.Length,
                                                      sNameLocked);
            }


            // Toolbar
            tbView.AddText(LocRM.GetString("tbDocView"));

            ComponentArt.Web.UI.MenuItem topMenuItem = new ComponentArt.Web.UI.MenuItem();
            topMenuItem.Text                = /*"<img border='0' src='../Layouts/Images/downbtn.gif' width='9px' height='5px' align='absmiddle'/>&nbsp;" + */ LocRM2.GetString("Actions");
            topMenuItem.Look.LeftIconUrl    = ResolveUrl("~/Layouts/Images/downbtn1.gif");
            topMenuItem.Look.LeftIconHeight = Unit.Pixel(5);
            topMenuItem.Look.LeftIconWidth  = Unit.Pixel(16);
            topMenuItem.LookId              = "TopItemLook";

            ComponentArt.Web.UI.MenuItem subItem;

            if (!Security.CurrentUser.IsExternal)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/icon-search.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.NavigateUrl         = String.Format("~/Documents/DocumentView.aspx?DocumentID={0}", DocumentID);
                subItem.Text = LocRM.GetString("View");
                topMenuItem.Items.Add(subItem);
            }

            if (Document.CanAddVersion(DocumentID))
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/FileTypes/common.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                string commandLink = (Security.CurrentUser.IsExternal) ? "~/External/FileUpload.aspx" : "~/FileStorage/FileUpload.aspx";
                subItem.ClientSideCommand = String.Format("javascript:ShowWizard('{0}?ParentFolderId={1}&ContainerKey={2}&ContainerName={3}{4}', 470, 270);",
                                                          ResolveUrl(commandLink), fs.Root.Id, ContainerKey, ContainerName,
                                                          (Security.CurrentUser.IsExternal) ? ("&ExternalId=" + Security.CurrentUser.UserID) : "");
                subItem.Text = LocRM3.GetString("tAddVersion");
                topMenuItem.Items.Add(subItem);
            }

            if (topMenuItem.Items.Count > 0)
            {
                tbView.ActionsMenu.Items.Add(topMenuItem);
            }
        }
示例#29
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;
        }
示例#30
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");
                }
            }
        }