///// <summary> ///// 若一条记录里有多个单上传控件字段,则每个上传控件的文件名和主键需保持一致 ///// </summary> ///// <param name="path"></param> ///// <param name="fileStorageName"></param> ///// <returns></returns> //protected string GetSingleResourceInfo(string path, string fileStorageName) //{ // if (!path.IsEmpty()) // { // var pathInfo = path.Split('&'); // string fileName = pathInfo[0].Substring(pathInfo[0].LastIndexOf('/') + 1); // string fileID = fileName.Split('.')[0]; // string pathID = fileName.Substring(0, 8); // string fileExt = Path.GetExtension(fileName); // if (FileID.IsEmpty()) // { // FileID = fileID; // } // else // { // //重命名 // string fullPath = new Uri(Path.Combine(FileManagementUtil.GetRootPath(fileStorageName, FilePathScheme.Physical), path)).LocalPath; // string dir = Path.GetDirectoryName(fullPath); // string newPath = new Uri(Path.Combine(dir, "\\" + FileID + fileExt)).LocalPath; // File.Move(fullPath, newPath); // File.Delete(fullPath); // fileID = FileID; // } // var resourceInfo = new ResourceInfo(); // resourceInfo.InfoType = ResourceInfoType.Config; // resourceInfo.FileId = fileID; // resourceInfo.PathID = pathID.Value<int>(); // resourceInfo.ExtName = fileExt; // resourceInfo.FileNameTitle = pathInfo[1]; // resourceInfo.FileSizeK = pathInfo[2].Value<int>(); // resourceInfo.StorageConfigName = fileStorageName; // return AtawAppContext.Current.FastJson.ToJSON(resourceInfo); // } // return ""; //} //protected string GetMultiResourceInfo(string pathList, string fileStorageName) //{ // //string fileExtension = Path.GetExtension(fileName); // //string fileID = AtawAppContext.Current.UnitOfData.GetUniId(); // //int pathID = fileID.Substring(0, 8).Value<int>(); // //string relativePath = Path.Combine(FileManagementUtil.GetRelativePath(fileStorageName, pathID), // // FileManagementUtil.GetFileName(fileStorageName, fileID, fileExtension)); // //string fullPath = new Uri(Path.Combine(FileManagementUtil.GetRootPath(fileStorageName, FilePathScheme.Physical), relativePath)).LocalPath; // //FileManagementUtil.ForeDirectories(FileManagementUtil.GetParentDirectory(fullPath)); // //string tempfile = Path.Combine(AtawAppContext.Current.MapPath, Callback.Src(tempPath)); // //if (File.Exists(tempfile)) // //{ // // File.Copy(tempfile, fullPath, false); // // File.Delete(tempfile); // //} // if (pathList.IsEmpty()) // return ""; // var pathArr = pathList.Split(','); // string fileName = ""; // List<ResourceInfo> infoList = new List<ResourceInfo>(); // pathArr.ToList().ForEach(a => // { // if (!a.IsEmpty()) // { // var path = a.Split('&'); // fileName = path[0].Substring(path[0].LastIndexOf('\\') + 1); // string fileID = fileName.Split('.')[0]; // string pathID = fileName.Substring(0, 8); // string fileExt = Path.GetExtension(fileName); // var resourceInfo = new ResourceInfo(); // resourceInfo.InfoType = ResourceInfoType.Config; // resourceInfo.FileId = fileID; // resourceInfo.PathID = pathID.Value<int>(); // resourceInfo.ExtName = fileExt; // resourceInfo.FileNameTitle = path[1]; // resourceInfo.FileSizeK = path[2].Value<int>(); // resourceInfo.StorageConfigName = fileStorageName; // infoList.Add(resourceInfo); // } // }); // //var pathInfo = new FilePathInfo { PathID = pathID.ToString(), FileID = fileID, FileExtension = fileExtension }; // return AtawAppContext.Current.FastJson.ToJSON(infoList); //} public virtual void SetPostDataRow(ObjectData data, DataAction dataAction, string key) { // throw new NotImplementedException(); // if(data.) if (SingleUploadColumns != null && SingleUploadColumns.Count > 0) { SingleUploadColumns.ForEach(a => { if (data.MODEFY_COLUMNS.Contains(a.Name)) { string storange = a.Upload.StorageName; string fpath = data.Row[a.Name].ToString(); if (!fpath.IsEmpty()) { ResourceArrange arrange = AtawAppContext.Current.FastJson.ToObject <ResourceArrange>(fpath); if (arrange != null) { arrange.MoveKeyPath(key, storange); data.Row[a.Name] = AtawAppContext.Current.FastJson.ToJSON(arrange); } } //data.Row[a.Name] = GetSingleResourceInfo(fpath, a.Upload.StorageName); } }); } if (MultiUploadColumns != null && MultiUploadColumns.Count > 0) { MultiUploadColumns.ForEach(a => { if (data.MODEFY_COLUMNS.Contains(a.Name)) { string storange = a.Upload.StorageName; string fpath = data.Row[a.Name].ToString(); if (!fpath.IsEmpty()) { ResourceArrange arrange = AtawAppContext.Current.FastJson.ToObject <ResourceArrange>(fpath); arrange.MoveKeyPath(key, storange); if (arrange != null) { data.Row[a.Name] = AtawAppContext.Current.FastJson.ToJSON(arrange); } } // data.Row[a.Name] = GetMultiResourceInfo(fpath, a.Upload.StorageName); } }); } if (MomeryColumns != null && MomeryColumns.Count > 0) { MomeryColumns.ForEach(a => { if (data.MODEFY_COLUMNS.Contains(a.Name)) { string _regname = a.RegName; IMomery rr = AtawIocContext.Current.FetchInstance <IMomery>(_regname); rr.AddText(data.Row[a.Name].ToString(), AtawAppContext.Current.UnitOfData); } }); } }
private IMomery GetMomeryInstance(string regName) { IMomery rr = AtawIocContext.Current.FetchInstance <IMomery>(regName); //SetPostDataSet(ds); // rr. // rr.Initialize(PostDataSet); return(rr); }