public string GetMaterial(Model.Material material) { Util.Ftp.FtpFile ftpFile = new Util.Ftp.FtpFile(); ftpFile.Title = material.Name; ftpFile.FilePath = material.Path; string tempFilePath = Path.Combine(tempFileDir, material.Name); Util.Ftp.FtpHelper.DownLoad(ftpFile, tempFilePath); return(ftpFile.Title); }
public Object AddMaterial(int materialTempInstId, string materialLocalPath) { FileInfo fileInfo = new FileInfo(materialLocalPath); Model.Material material = new Model.Material(); material.MaterialTempInstId = materialTempInstId; material.Name = fileInfo.Name; material.Extension = fileInfo.Extension; int materialId = (int)material.Create(); material.Path = "/OASystem/" + materialId + material.Extension; material.Update(); Util.Ftp.FtpFile ftpFile = new Util.Ftp.FtpFile(); ftpFile.FilePath = material.Path; ftpFile.Title = material.Name; Util.Log.LogHelper.WriteLog(Util.Ftp.FtpHelper.UpLoad(ftpFile, materialLocalPath)); Dictionary <string, string> backData = new Dictionary <string, string>(); backData.Add("Id", materialId.ToString()); backData.Add("Path", material.Path); return(Newtonsoft.Json.JsonConvert.SerializeObject(backData)); }