예제 #1
0
 protected void rtpPicHistoryList_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     try
     {
         int FileHistoryID = e.CommandArgument.ToString().ConvertInt();
         resource_filehistory objPicHistory = objFileResourceRule.resource_filehistory.FirstOrDefault(s => s.FileHistoryID == FileHistoryID);
         string PicUrl = objPicHistory.PicUrl;
         if (PicUrl.IndexOf("M00") >= 0)
         {
             resource_filestoragepath objresource_filestoragepath = objFileResourceRule.resource_filestoragepath.FirstOrDefault(s => s.FileStoragePathID == "590e546a-4695-48ef-af7f-c8f6de287bc7");
             PicUrl = PicUrl.Substring(PicUrl.IndexOf("M00"));
             int i = PicUrl.IndexOf('?');
             if (i > 0)
             {
                 PicUrl = PicUrl.Substring(0, i);
             }
             FastDFSClient objFastDFSClient = new FastDFSClient(objresource_filestoragepath.StorageConfig, string.IsNullOrWhiteSpace(objresource_filestoragepath.StorageConfig));
             objFastDFSClient.RemoveFile("g1", PicUrl);
             objFileResourceRule.resource_filehistory.DeleteDataPrimaryKey(FileHistoryID.ToString());
             MessageDialog("删除成功");
         }
         else
         {
             MessageDialog("没有找到相应的删除处理方法,请与管理员联系");
         }
     }
     catch (Exception objExp)
     {
         Log.WriteLog("删除文件失败", objExp);
         MessageDialog("删除文件失败");
     }
 }
예제 #2
0
        public static string GetFtpFullFileNamePath(resource_filerestrict objresource_filerestrict, string resourceFileName)
        {
            DateTime now = DateTime.Now;
            string   fileResourceCode = objresource_filerestrict.resource_fileresource.FileResourceCode;
            string   resourceVerID    = Guid.NewGuid().ToString();
            resource_filestoragepath _filestoragepath = objresource_filerestrict.resource_filestoragepath;
            string resourceGUIDFileName = resourceVerID + Path.GetExtension(resourceFileName);
            string pathFormatValue      = GetResourcePathFormatValue(now, resourceVerID, objresource_filerestrict.PathFormatCodeType);

            return(GetresourceFullFileNamePath(_filestoragepath.StoragePath, (AccessModeCodeType)objresource_filerestrict.AccessModeCodeType, fileResourceCode, pathFormatValue, resourceGUIDFileName, resourceFileName, false).Replace('\\', '/'));
        }
예제 #3
0
 /// <summary>
 /// 保存信息
 /// </summary>
 public void SaveInfo()
 {
     if (FileStoragePathID.IsNull())
     {
         objresource_filestoragepath.FileStoragePathID = Guid.NewGuid().ToString();
         ///存储名称
         objresource_filestoragepath.StoragePathName = txtStoragePathName.TextCutWord(256);
         ///存储类型1本地存储2FTP3文件系统
         objresource_filestoragepath.StorageTypeID = radStorageTypeID.SelectValueInt;
         ///虚目录
         objresource_filestoragepath.VirtualName = txtVirtualName.TextCutWord(1000);
         ///存储地址
         objresource_filestoragepath.StoragePath = txtStoragePath.TextCutWord(1000);
         ///IP
         objresource_filestoragepath.IPAddress = txtIPAddress.TextCutWord(100);
         ///帐号
         objresource_filestoragepath.Account = txtAccount.TextCutWord(100);
         ///密码
         objresource_filestoragepath.Password = txtPassword.TextCutWord(100);
         ///端口
         objresource_filestoragepath.Port          = txtPort.TextCutWord(100);
         objresource_filestoragepath.StorageConfig = txtStorageConfig.Text;
         objFileResourceRule.Insertfilestoragepath(objresource_filestoragepath);
         MessageDialog("新增成功", "FileStoragePathList.aspx");
     }
     else
     {
         objresource_filestoragepath = objFileResourceRule.resource_filestoragepath.FirstOrDefault(p => p.FileStoragePathID == FileStoragePathID);
         if (CheckEditObjectIsNull(objresource_filestoragepath))
         {
             return;
         }
         ///存储名称
         objresource_filestoragepath.StoragePathName = txtStoragePathName.TextCutWord(256);
         ///存储类型1本地存储2FTP3文件系统
         objresource_filestoragepath.StorageTypeID = radStorageTypeID.SelectValueInt;
         ///虚目录
         objresource_filestoragepath.VirtualName = txtVirtualName.TextCutWord(1000);
         ///存储地址
         objresource_filestoragepath.StoragePath = txtStoragePath.TextCutWord(1000);
         ///IP
         objresource_filestoragepath.IPAddress = txtIPAddress.TextCutWord(100);
         ///帐号
         objresource_filestoragepath.Account = txtAccount.TextCutWord(100);
         ///密码
         objresource_filestoragepath.Password = txtPassword.TextCutWord(100);
         ///端口
         objresource_filestoragepath.Port          = txtPort.TextCutWord(100);
         objresource_filestoragepath.StorageConfig = txtStorageConfig.Text;
         objFileResourceRule.Updatefilestoragepath(objresource_filestoragepath);
         MessageDialog("修改成功", "FileStoragePathList.aspx");
     }
 }
예제 #4
0
    /// <summary>
    /// 页面加载
    /// </summary>
    public override void RenderPage()
    {
        if (FileStoragePathID.IsNoNull())
        {
            objresource_filestoragepath = objFileResourceRule.resource_filestoragepath.FirstOrDefault(s => s.FileStoragePathID == FileStoragePathID);
            if (CheckEditObjectIsNull(objresource_filestoragepath))
            {
                return;
            }
            ///存储类型1本地存储2FTP3文件系统
            radStorageTypeID.SelectedValue = objresource_filestoragepath.StorageTypeID.ToString();

            Page.DataBind();
        }
        else
        {
        }
    }