public ArrayList GetFileExistence(string fName, string ContainerName, string ContainerKey, string ParentFolderId) { ArrayList values = new ArrayList(); string sFName = fName; if (sFName.LastIndexOf("\\") >= 0) { sFName = sFName.Substring(sFName.LastIndexOf("\\") + 1); } Mediachase.IBN.Business.ControlSystem.BaseIbnContainer bic = Mediachase.IBN.Business.ControlSystem.BaseIbnContainer.Create(ContainerName, ContainerKey); Mediachase.IBN.Business.ControlSystem.FileStorage fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage"); if (fs.FileExist(sFName, int.Parse(ParentFolderId))) { if (fs.GetFile(int.Parse(ParentFolderId), sFName).AllowHistory) { values.Add(2); } else { values.Add(1); } } else { values.Add(0); } return(values); }
private void GetCurrentFolder() { ContainerKey = ViewState["ContainerKey"].ToString(); bic = CS.BaseIbnContainer.Create(ContainerName, ContainerKey); fs = (CS.FileStorage)bic.LoadControl("FileStorage"); if (!Page.IsPostBack && Request["FolderId"] != null && Request["FolderId"] != String.Empty) { FolderId = int.Parse(Request["FolderId"]); } else if (FolderId < 0 && pc["fs_FolderId_" + ContainerKey] != null) { int iFolder = int.Parse(pc["fs_FolderId_" + ContainerKey]); CS.DirectoryInfo di = fs.GetDirectory(iFolder); if (di != null) { FolderId = iFolder; } else { FolderId = fs.Root.Id; } } else { FolderId = fs.Root.Id; } RootId = fs.Root.Id; pc["fs_FolderId_" + ContainerKey] = FolderId.ToString(); }
void grdMain_ItemCommand(object source, DataGridCommandEventArgs e) { if (e.CommandName == "Select") { int selId = int.Parse(e.Item.Cells[0].Text); string containerKey = "EMailAttach"; CS.BaseIbnContainer bic2 = CS.BaseIbnContainer.Create(ContainerName, containerKey); CS.FileStorage fs2 = (CS.FileStorage)bic2.LoadControl("FileStorage"); CS.DirectoryInfo di = fs2.GetDirectory(fs2.Root.Id, guid, true); try { fs.CopyFile(selId, di.Id); } catch { } string sFiles = ""; CS.FileInfo[] _fi = fs2.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'/> {1} <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, LocRM.GetString("tDelete")); } Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), String.Format("CloseAll(\"{0}\");", sFiles), true); } }
public ArrayList DeleteAttachment(string _guid, string _id) { string sFiles = ""; ArrayList values = new ArrayList(); string _containerName = "FileLibrary"; string _containerKey = "EMailAttach"; CS.BaseIbnContainer bic = CS.BaseIbnContainer.Create(_containerName, _containerKey); CS.FileStorage fs = (CS.FileStorage)bic.LoadControl("FileStorage"); fs.DeleteFile(int.Parse(_id)); CS.DirectoryInfo di = fs.GetDirectory(fs.Root.Id, _guid, false); if (di != null) { CS.FileInfo[] _fi = fs.GetFiles(di); foreach (CS.FileInfo fi in _fi) { sFiles += String.Format(CultureInfo.InvariantCulture, "<div style='padding-bottom:1px;'><img align='absmiddle' src='{0}' width='16' height='16'> {1} <img src='{2}' align='absmiddle' width='16' height='16' style='cursor:pointer;' onclick='_deleteFile({3})' title='{4}' /></div>", CHelper.GetAbsolutePath("/Common/ContentIcon.aspx?IconID=" + fi.FileBinaryContentTypeId), Util.CommonHelper.GetShortFileName(fi.Name, 40), CHelper.GetAbsolutePath("/Layouts/Images/delete.gif"), fi.Id, LocRM.GetString("Delete")); } } values.Add(sFiles); return(values); }
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'> {1} <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); } }
public static BaseIbnContainer Create(string name, string key) { IbnContainerConfiguration config = (IbnContainerConfiguration)ConfigurationManager.GetSection("ibnContainers"); BaseIbnContainer retVal = new BaseIbnContainer(name, key, config.Containers[name]); return(retVal); }
protected void Page_Load(object sender, EventArgs e) { bic = BaseIbnContainer.Create("Reports", "GlobalReports"); rs = (ReportStorage)bic.LoadControl("ReportStorage"); BindToolBar(); if (!IsPostBack) BindRepeaters(); }
public static BaseIbnContainer Create(string name, string key) { IbnContainerConfiguration config = (IbnContainerConfiguration)ConfigurationManager.GetSection("ibnContainers"); BaseIbnContainer retVal = new BaseIbnContainer(name,key,config.Containers[name]); return retVal; }
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(); }
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); }
private void Process() { 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); for (int Index = 0; Index < Request.Files.Count; Index++) { if (!String.IsNullOrEmpty(Request.Files[Index].FileName)) { using (McHttpPostedFile PostedFile = new McHttpPostedFile(Request.Files[Index])) { if (PostedFile.InputStream != null) { fs.SaveFile(di.Id, PostedFile.FileName, PostedFile.InputStream); } } } } }
void lbSelectChecked_Click(object sender, EventArgs e) { string sIds = hidForSelect.Value; ArrayList alIds = new ArrayList(); while (sIds.Length > 0) { alIds.Add(sIds.Substring(0, sIds.IndexOf(","))); sIds = sIds.Remove(0, sIds.IndexOf(",") + 1); } string _containerKey = "EMailAttach"; CS.BaseIbnContainer bic2 = CS.BaseIbnContainer.Create(ContainerName, _containerKey); CS.FileStorage fs2 = (CS.FileStorage)bic2.LoadControl("FileStorage"); CS.DirectoryInfo di = fs2.GetDirectory(fs2.Root.Id, guid, true); foreach (string scId in alIds) { int assetID = int.Parse(scId); try { fs.CopyFile(assetID, di.Id); } catch { } } string sFiles = ""; CS.FileInfo[] _fi = fs2.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'/> {1} <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, LocRM.GetString("tDelete")); } Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), String.Format("CloseAll(\"{0}\");", sFiles), true); }
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(); }
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(); } }
private void BindData() { Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "<script language='javascript'>" + "ChColl=document.getElementsByTagName('input');" + "for(j=0;j<ChColl.length;j++){" + "obj = ChColl[j];" + "_obj_id = obj.id;" + "if(_obj_id.indexOf('cbAutoApprove')>=0)" + "obj.disabled=true;" + "if(_obj_id.indexOf('cbAutoDelete')>=0)" + "obj.disabled=true;" + "if(_obj_id.indexOf('cbUseExternal')>=0)" + "obj.disabled=true;}" + "</script>"); ddFolder.Items.Clear(); bic = BaseIbnContainer.Create("FileLibrary", "Workspace"); fs = (FileStorage)bic.LoadControl("FileStorage"); ProcessFolder(fs.Root.Id); /*using (IDataReader reader1 = Folder.GetFolderList(0)) { while (reader1.Read()) { ProcessFolder((int)reader1["FolderId"]); } }*/ //using (IDataReader reader = Mailbox.Get(MailBoxId, false)) //{ // if(reader.Read()) if (MailBoxId > 0) { txtMBTitle.Text = Pop3Manager.Current.SelectedPop3Box.Name; if (Pop3Manager.Current.SelectedPop3Box.IsActive) { cbUseMailIncs.Checked = true; txtPeriod.Disabled = false; //int iPeriod = (int)reader["Period"]; int iPeriod = Pop3Manager.Current.SelectedPop3Box.Interval; foreach (ListItem li in txtPeriod.Items) { if (li.Value == iPeriod.ToString()) { li.Selected = true; break; } else li.Selected = false; } txtServer.Disabled = false; txtServer.Value = Pop3Manager.Current.SelectedPop3Box.Server; txtPort.Disabled = false; txtPort.Value = Pop3Manager.Current.SelectedPop3Box.Port.ToString(); txtUser.Disabled = false; txtUser.Value = Pop3Manager.Current.SelectedPop3Box.Login; txtPass.Disabled = false; ViewState["_Pass"] = Pop3Manager.Current.SelectedPop3Box.Password; txtPass.Value = Pop3Manager.Current.SelectedPop3Box.Password; if (mbType == MailboxType.Folder) { ddFolder.Disabled = false; ListItem liItem = ddFolder.Items.FindByValue(Pop3Manager.Current.SelectedPop3Box.Parameters["FolderId"]); if (liItem != null) liItem.Selected = true; } Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "<script language='javascript'>" + "ChColl=document.getElementsByTagName('input');" + "for(j=0;j<ChColl.length;j++){" + "obj = ChColl[j];" + "_obj_id = obj.id;" + "if(_obj_id.indexOf('cbAutoApprove')>=0)" + "obj.disabled=false;" + "if(_obj_id.indexOf('cbAutoDelete')>=0)" + "obj.disabled=false;" + "if(_obj_id.indexOf('cbUseExternal')>=0)" + "obj.disabled=false;}" + "</script>"); cbAutoApprove.Checked = Pop3Manager.Current.SelectedPop3Box.Parameters["AutoApproveForKnown"] == "1"; cbAutoDelete.Checked = Pop3Manager.Current.SelectedPop3Box.Parameters["AutoKillForUnknown"] == "1"; cbUseExternal.Checked = Pop3Manager.Current.SelectedPop3Box.Parameters["OnlyExternalSenders"] == "1"; visCheck.Disabled = false; } else { // if(reader["Period"]!=DBNull.Value) // { int iPeriod = Pop3Manager.Current.SelectedPop3Box.Interval; foreach (ListItem li in txtPeriod.Items) { if (li.Value == iPeriod.ToString()) { li.Selected = true; break; } } // } //if(reader["Server"]!=DBNull.Value) txtServer.Value = Pop3Manager.Current.SelectedPop3Box.Server; //if(reader["Port"]!=DBNull.Value) txtPort.Value = Pop3Manager.Current.SelectedPop3Box.Port.ToString(); //if(reader["User"]!=DBNull.Value) txtUser.Value = Pop3Manager.Current.SelectedPop3Box.Login; //if(reader["Password"]!=DBNull.Value) //{ ViewState["_Pass"] = Pop3Manager.Current.SelectedPop3Box.Password; txtPass.Value = Pop3Manager.Current.SelectedPop3Box.Password; //} if (mbType == MailboxType.Folder) { ddFolder.Disabled = false; ListItem liItem = ddFolder.Items.FindByValue(Pop3Manager.Current.SelectedPop3Box.Parameters["FolderId"]); if (liItem != null) liItem.Selected = true; ddFolder.Disabled = true; } //if(reader["AutoApproveForKnown"]!=DBNull.Value) // cbAutoApprove.Checked=(bool)reader["AutoApproveForKnown"]; //if(reader["AutoKillForUnknown"]!=DBNull.Value) // cbAutoDelete.Checked=(bool)reader["AutoKillForUnknown"]; //if(reader["OnlyExternalSenders"]!=DBNull.Value) // cbUseExternal.Checked=(bool)reader["OnlyExternalSenders"]; cbAutoApprove.Checked = Pop3Manager.Current.SelectedPop3Box.Parameters["AutoApproveForKnown"] == "1"; cbAutoDelete.Checked = Pop3Manager.Current.SelectedPop3Box.Parameters["AutoKillForUnknown"] == "1"; cbUseExternal.Checked = Pop3Manager.Current.SelectedPop3Box.Parameters["OnlyExternalSenders"] == "1"; } // } } }
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"); }
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); }
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(); }
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"); }
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; }
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(); }
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; }
protected void btnSubmit_Click(object sender, System.EventArgs e) { bool withResponse = false; if (this.IsPostBack) { try { string sUserLight = "userlight"; // check user's name and password here UserLight currentUser = Security.GetUser(Login.Value, Password.Value); if (currentUser == null) { throw new HttpException(405, "Your login or password is invalid."); } // Security Addon [3/2/2004] UserLight retUser = null; if (HttpContext.Current.Items.Contains(sUserLight)) { retUser = (UserLight)HttpContext.Current.Items[sUserLight]; HttpContext.Current.Items.Remove(sUserLight); } HttpContext.Current.Items.Add(sUserLight, currentUser); // End Security Addon [3/2/2004] // New Folder System Addon [12/27/2005] string ContainerName = "FileLibrary"; string ContainerKey = String.Empty; int objectId = Int32.Parse(ObjectId.Value); int objectTypeId = Int32.Parse(ObjectTypeId.Value); int folderId = 0; switch ((ObjectTypes)objectTypeId) { case ObjectTypes.Project: ContainerKey = "ProjectId_" + objectId.ToString(); break; case ObjectTypes.Issue: ContainerKey = string.Empty; break; case ObjectTypes.Task: ContainerKey = "TaskId_" + objectId.ToString(); break; case ObjectTypes.CalendarEntry: ContainerKey = "EventId_" + objectId.ToString(); break; case ObjectTypes.Folder: ContainerKey = "Workspace"; if (objectId != 0) { folderId = objectId; ContainerKey = Mediachase.IBN.Business.ControlSystem.DirectoryInfo.GetContainerKey(folderId); } break; case ObjectTypes.Document: ContainerKey = "DocumentId_" + objectId.ToString(); break; case ObjectTypes.ToDo: ContainerKey = "ToDoId_" + objectId.ToString(); break; } if (ContainerKey != String.Empty) { Mediachase.IBN.Business.ControlSystem.BaseIbnContainer bic = Mediachase.IBN.Business.ControlSystem.BaseIbnContainer.Create(ContainerName, ContainerKey); Mediachase.IBN.Business.ControlSystem.FileStorage fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage"); if (folderId == 0) { folderId = fs.Root.Id; } string fileName = Path.GetFileName(PublishedFile.PostedFile.FileName); if (FileName.Value != string.Empty) { fileName = FileName.Value; } /*int index = 0; * while (fs.FileExist(fileName, folderId)) * { * fileName = Path.GetFileNameWithoutExtension(PublishedFile.PostedFile.FileName) + (index++).ToString(); * fileName += Path.GetExtension(PublishedFile.PostedFile.FileName); * }*/ fs.SaveFile(folderId, fileName, PublishedFile.PostedFile.InputStream); } else if ((ObjectTypes)objectTypeId == ObjectTypes.List) { string xml = SaveNParseExcel(PublishedFile.PostedFile.FileName, PublishedFile.PostedFile.InputStream); Response.BinaryWrite(System.Text.Encoding.UTF8.GetBytes(xml)); withResponse = true; } else if ((ObjectTypes)objectTypeId == ObjectTypes.Issue) { string fileName = Path.GetFileName(PublishedFile.PostedFile.FileName); if (FileName.Value != string.Empty) { fileName = FileName.Value; } // OZ: 2008-08-19 Add Process Eml Attachments if (Path.GetExtension(fileName).ToLower() == ".eml") { // Calculate email box int emailBoxId = EMailRouterOutputMessage.FindEMailRouterPublicId(objectId); // Save Email to email storage int eMailMessageId = EMailMessage.CreateFromStream(emailBoxId, PublishedFile.PostedFile.InputStream); EMailMessage.AddToIncidentMessage(false, objectId, eMailMessageId); try { ArrayList excludeUsers = EMailRouterOutputMessage.Send(objectId, eMailMessageId); SystemEvents.AddSystemEvents(SystemEventTypes.Issue_Updated_Forum_MessageAdded, objectId, -1, excludeUsers); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); //Log.WriteError(ex.ToString()); } } // Process Default files else { BaseIbnContainer destContainer = BaseIbnContainer.Create("FileLibrary", string.Format("IncidentId_{0}", objectId)); ForumStorage forumStorage = (ForumStorage)destContainer.LoadControl("ForumStorage"); ForumThreadNodeInfo info = forumStorage.CreateForumThreadNode(string.Empty, Security.CurrentUser.UserID, (int)ForumStorage.NodeContentType.TextWithFiles); BaseIbnContainer forumContainer = BaseIbnContainer.Create("FileLibrary", string.Format("ForumNodeId_{0}", info.Id)); FileStorage fs = (FileStorage)forumContainer.LoadControl("FileStorage"); fs.SaveFile(fileName, PublishedFile.PostedFile.InputStream); ForumThreadNodeSettingCollection settings1 = new ForumThreadNodeSettingCollection(info.Id); settings1.Add(ForumThreadNodeSetting.Internal, "1"); } } // End New Folder System Addon [12/27/2005] // Security Addon [3/2/2004] HttpContext.Current.Items.Remove(sUserLight); HttpContext.Current.Items.Add(sUserLight, retUser); // End Security Addon [3/2/2004] } catch (Exception ex) { throw new HttpException(405, "Internal Exception", ex); } if (!withResponse) { this.Response.Write("Published Completed"); } this.Response.End(); } }
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"); }
protected void lbSend_Click(object sender, System.EventArgs e) { string sTo = txtTo.Text.Trim(); // all recipients string string allRecipients = String.Empty; if (sTo != String.Empty) { allRecipients = sTo; } if (allRecipients != String.Empty) { allRecipients += "; "; } allRecipients += lblCC.Text; CommonHelper.AddToContext(ForumThreadNodeSetting.AllRecipients, allRecipients); string regex = "([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\\w]*[0-9a-zA-Z])*\\.)+[a-zA-Z]" + "{2,9})"; List <string> dic = new List <string>(); System.Text.RegularExpressions.RegexOptions options = ((System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace | System.Text.RegularExpressions.RegexOptions.Multiline) | System.Text.RegularExpressions.RegexOptions.IgnoreCase); System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(regex, options); foreach (Match item in reg.Matches(sTo)) { if (!dic.Contains(item.Value)) { dic.Add(item.Value); } } string[] masTo = dic.ToArray(); if (masTo.Length == 0 && lblCC.Text == String.Empty) { lblException.Text = LocRM.GetString("NoRecipients"); divMessage.Visible = true; Page.ClientScript.RegisterStartupScript(this.GetType(), "_getFiles", "window.setTimeout('updateAttachments()', 500);", true); return; } 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); try { if (IncidentId > 0) { NameValueCollection _params = new NameValueCollection(); _params["IssueId"] = IncidentId.ToString(); EMailClient.SendMessage(masTo, txtSubject.Text, fckEditor.Text, di, EMailClient.IssueMode, _params); string sUrl = "../Incidents/IncidentView.aspx?IncidentId=" + IncidentId; if (Request["back"] != null) { sUrl = HttpUtility.UrlDecode(Request["back"]); } Page.ClientScript.RegisterStartupScript(this.GetType(), "_close", "try{window.opener.location.href='" + sUrl + "';}catch(ex){}window.close();", true); } else { EMailClient.SendMessage(masTo, txtSubject.Text, fckEditor.Text, di); Page.ClientScript.RegisterStartupScript(this.GetType(), "_close", "window.close();", true); } } catch (Exception ex) { string sException = ""; switch (ex.GetType().ToString()) { case "System.Net.Sockets.SocketException": sException = ex.Message; break; case "Mediachase.IBN.Business.EMail.SmtpClientException": sException = LocRM2.GetString("tServerSMTPError") + ": <span style='color:#444;font-style:italic;'>" + ex.Message + "</span>"; break; default: // TODO: Save Exception to IBN Log And Show Friendly Link to Log sException = ex.Message; CHelper.GenerateErrorReport(ex); break; } lblException.Text = LocRM2.GetString("SMTPSettingsIncorrect") + " " + LocRM2.GetString("tWereErrorsSMTP") + "<br/>" + sException; if (Security.IsUserInGroup(InternalSecureGroups.Administrator)) { lblSMTP.Text = "<a href='javascript:ToSMTPSettings();'><font style='color:Red;'><b><u>" + LocRM2.GetString("tSetupSMTPServer") + "</u></b></font></a>"; } else { lblSMTP.Text = LocRM2.GetString("tContactSMTPError"); } divMessage.Visible = true; Page.ClientScript.RegisterStartupScript(this.GetType(), "_getFiles", "window.setTimeout('updateAttachments()', 500);", true); } }
private void GetCurrentFolder() { ContainerKey = ViewState["ContainerKey"].ToString(); bic = CS.BaseIbnContainer.Create(ContainerName, ContainerKey); fs = (CS.FileStorage)bic.LoadControl("FileStorage"); if (!Page.IsPostBack && Request["FolderId"] != null && Request["FolderId"] != String.Empty) FolderId = int.Parse(Request["FolderId"]); else if (FolderId < 0 && pc["fs_FolderId_" + ContainerKey] != null) { int iFolder = int.Parse(pc["fs_FolderId_" + ContainerKey]); CS.DirectoryInfo di = fs.GetDirectory(iFolder); if (di != null) FolderId = iFolder; else FolderId = fs.Root.Id; } else FolderId = fs.Root.Id; RootId = fs.Root.Id; pc["fs_FolderId_" + ContainerKey] = FolderId.ToString(); }
private void GetCurrentFolder() { _bic = BaseIbnContainer.Create(_containerName, _containerKey); _fs = (FileStorage)_bic.LoadControl("FileStorage"); if (Request["FolderId"] != null && Request["FolderId"] != String.Empty) _folderId = int.Parse(Request["FolderId"]); else if (_folderId < 0 && _pc["fs_FolderId_" + _containerKey] != null) { int iFolder = int.Parse(_pc["fs_FolderId_" + _containerKey]); DirectoryInfo di = _fs.GetDirectory(iFolder); if (di != null) _folderId = iFolder; else _folderId = _fs.Root.Id; } else _folderId = _fs.Root.Id; _rootId = _fs.Root.Id; _pc["fs_FolderId_" + _containerKey] = _folderId.ToString(); }
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"); }
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 BindDefaultValues() { string fromEmail = Security.CurrentUser.Email; if (IncidentId > 0) { fromEmail = EMailRouterOutputMessage.FindEMailRouterPublicEmail(IncidentId); } txtFrom.Text = String.Format(CultureInfo.InvariantCulture, "{1} <{0}>", fromEmail, Security.CurrentUser.DisplayName); lblCCTitle.Text = ""; lblToTitle.Text = LocRM.GetString("tTo") + ":"; if (IncidentId > 0) { NameValueCollection _params = new NameValueCollection(); _params["IssueId"] = IncidentId.ToString(); string[] erList = EMailClient.GetDefaultRecipientList(EMailClient.IssueMode, _params); for (int i = 0; i < erList.Length; i++) { string sName = GetNameByEMail(erList[i]); if (sName != "") { lblCC.Text += String.Format(CultureInfo.InvariantCulture, "{0} <{1}>; ", sName, erList[i]); } else { lblCC.Text += erList[i] + "; "; } } string sValue = EMailMessage.GetOutgoingEmailFormatBodyPreview(IncidentId).Replace("[=Text=]", ""); if (NodeId > 0) { EMailMessageInfo mi = EMailMessageInfo.Load(NodeId); sValue += "<br/>" + "<blockquote style='border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;' dir='ltr'>" + mi.HtmlBody + "</blockquote>"; } fckEditor.Text = sValue; using (IDataReader reader = Incident.GetIncident(IncidentId)) { if (reader.Read()) { txtSubject.Text = string.Format(CultureInfo.InvariantCulture , "RE: [{0}] {1}" , (reader["Identifier"] != DBNull.Value) ? reader["Identifier"].ToString() : TicketUidUtil.Create(IncidentBox.Load((int)reader["IncidentBoxId"]).IdentifierMask, IncidentId) , HttpUtility.HtmlDecode(reader["Title"].ToString()) ); } } } if (FileIds != "") { string sFiles = FileIds.Trim(); if (sFiles.EndsWith(",")) { sFiles = sFiles.Substring(0, sFiles.Length - 1); } string[] masFiles = sFiles.Split(','); if (masFiles.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.BaseIbnContainer bic2 = CS.BaseIbnContainer.Create(FilesContainerName, FilesContainerKey); CS.FileStorage fs2 = (CS.FileStorage)bic.LoadControl("FileStorage"); CS.DirectoryInfo di = fs.GetDirectory(fs.Root.Id, _guid, true); for (int i = 0; i < masFiles.Length; i++) { fs2.CopyFile(int.Parse(masFiles[i]), di.Id); } Page.ClientScript.RegisterStartupScript(this.GetType(), "_getFiles", "window.setTimeout('updateAttachments()', 500);", true); } } if (ErrorId != "") { string support_email = GlobalResourceManager.Strings["SupportEmail"]; //if (Security.CurrentUser != null && Security.CurrentUser.Culture.ToLower().IndexOf("ru") >= 0) // support_email = "*****@*****.**"; txtTo.Text = support_email + "; "; txtSubject.Text = String.Format("{0} {1} {2} Error Report", IbnConst.CompanyName, IbnConst.ProductFamilyShort, IbnConst.VersionMajorDotMinor); string prefix = Request.Url.Host.Replace(".", "_"); string FilePath = Server.MapPath("../Admin/Log/Error/" + prefix + "_" + ErrorId + ".html"); string sTemp = String.Empty; using (StreamReader sr = File.OpenText(FilePath)) { sTemp += sr.ReadToEnd(); } Match match = Regex.Match(sTemp, @"<body[^>]*>(?<HtmlBody>[\s\S]*?)</body>", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Multiline); if (match.Success) { string body = match.Groups["HtmlBody"].Value; Match matchStyle = Regex.Match(sTemp, @"<style[^>]*>(?<HtmlStyle>[\s\S]*?)</style>", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Multiline); if (matchStyle.Success) { body += matchStyle.Value; } sTemp = body; } fckEditor.Text = sTemp; } if (lblCC.Text != "") { lblCCTitle.Text = LocRM.GetString("tTo") + ":"; lblToTitle.Text = LocRM.GetString("tCc") + ":"; } }
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"); }