Esempio n. 1
0
        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'>&nbsp;{1}&nbsp;&nbsp;<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);
        }
Esempio n. 2
0
        private void grdMain_DeleteCommand(object source, DataGridCommandEventArgs e)
        {
            int delId = int.Parse(e.Item.Cells[0].Text);

            try
            {
                _fs.DeleteFile(delId);
            }
            catch { }
            Response.Redirect(GetCurrentLink());
        }