public void AddFile(S_FileInfo file, bool withDefaultAttr = false) { file.NodeID = this.ID; file.FullNodeID = this.FullPathID; if (!file.IsNewModel) { throw new Formula.Exceptions.BusinessException("文件对象不是新建对象,无法调用添加方法"); } file.Save(withDefaultAttr); this.FileInfos.Add(file); }
public void AddFile(S_FileInfo file, bool withDefaultAttr = false) { this.SetNodeFileCount(); file.NodeID = this.ID; file.FullNodeID = this.FullPathID; file.FullNodeName = this.FullPathName; file.DataEntity.SetValue("State", DocState.Normal.ToString()); if (!file.IsNewModel) { throw new Formula.Exceptions.BusinessException("文件对象不是新建对象,无法调用添加方法"); } file.Save(withDefaultAttr); this.FileInfos.Add(file); }
public void SyncInstanceDataState() { var details = this.T_Borrow_FileInfo.ToList(); var spaceList = new List <S_DOC_Space>(); foreach (var item in details) { var space = spaceList.FirstOrDefault(a => a.ID == item.SpaceID); if (space == null) { space = DocConfigHelper.CreateConfigSpaceByID(item.SpaceID); if (space == null) { continue; } spaceList.Add(space); } if (!String.IsNullOrEmpty(item.FileID)) { var file = new S_FileInfo(item.FileID, space); if (file == null) { continue; } file.DataEntity.SetValue("BorrowState", BorrowReturnState.Borrow.ToString()); file.DataEntity.SetValue("BorrowUserID", this.CreateUserID); file.DataEntity.SetValue("BorrowUserName", this.CreateUserName); file.Save(false); } else { var node = new S_NodeInfo(item.NodeID, space); if (node == null) { continue; } node.DataEntity.SetValue("BorrowState", BorrowReturnState.Borrow.ToString()); node.DataEntity.SetValue("BorrowUserID", this.CreateUserID); node.DataEntity.SetValue("BorrowUserName", this.CreateUserName); node.Save(false); } } }
private S_FileInfo archFile(Dictionary <string, object> reorganizeDetail, S_NodeInfo node, string targetConfigID = "") { var fileConfig = node.ConfigInfo.S_DOC_FileNodeRelation.FirstOrDefault(a => a.FileID == targetConfigID); if (fileConfig == null) { throw new Formula.Exceptions.BusinessException("节点【" + node.Name + "】下无法绑定该文件类型【" + targetConfigID + "】!"); } if (fileConfig != null && fileConfig.S_DOC_File != null) { var file = new DocSystem.Logic.Domain.S_FileInfo(node.Space.ID, fileConfig.S_DOC_File.ID); var fileFields = fileConfig.S_DOC_File.S_DOC_FileAttr.Select(a => a.FileAttrField).ToList(); var buttonEditFields = fileConfig.S_DOC_File.S_DOC_FileAttr.Where(a => a.InputType.IndexOf(ControlType.ButtonEdit.ToString()) > -1).ToList(); foreach (var item in buttonEditFields) { fileFields.Add(item.FileAttrField + "Name"); } foreach (var fileds in fileFields) { if (fileds.ToLower() == "id" || fileds.ToLower() == "attr" || fileds.ToLower() == "storagenum" || fileds.ToLower() == "storagetype" || fileds.ToLower() == "mainfile") { continue; } var _value = reorganizeDetail.GetValue(fileds); if (fileds.ToLower().Equals("quantity")) { file.DataEntity.SetValue("StorageNum", _value); } if (!string.IsNullOrEmpty(_value)) { file.DataEntity.SetValue(fileds, _value); } } //var file = new DocSystem.Logic.Domain.S_FileInfo(node.Space.ID, fileConfig.S_DOC_File.ID); if (!String.IsNullOrEmpty(reorganizeDetail.GetValue("Attr"))) { SetFileAttr(file, reorganizeDetail.GetValue("Attr")); } //file.DataEntity.SetValue("Name", reorganizeDetail.GetValue("Name")); file.DataEntity.SetValue("StorageType", "Electronic"); file.DataEntity.SetValue("NodeID", node.ID); //file.DataEntity.SetValue("Code", reorganizeDetail.GetValue("Code")); //file.DataEntity.SetValue("RelateID", reorganizeDetail.GetValue("RelateID")); //file.DataEntity.SetValue("State", DocState.Normal); //归档人、部门、时间存储 if (!string.IsNullOrEmpty(GetQueryString("SendUser"))) { Dictionary <string, string> depate = GetDepartment(GetQueryString("SendUser")); file.DataEntity.SetValue("ArchivePeople", GetQueryString("SendUser")); file.DataEntity.SetValue("ArchivePeopleName", depate.GetValue("SendUserName")); file.DataEntity.SetValue("ArchiveDate", GetQueryString("SendDate")); file.DataEntity.SetValue("ArchiveDepartment", depate.GetValue("DeptID")); file.DataEntity.SetValue("ArchiveDepartmentName", depate.GetValue("DeptName")); } if (!String.IsNullOrEmpty(reorganizeDetail.GetValue("MainFile"))) { var attachment = new S_Attachment(node.Space.ID); attachment.DataEntity.SetValue("MainFile", reorganizeDetail.GetValue("MainFile")); attachment.DataEntity.SetValue("PDFFile", reorganizeDetail.GetValue("PDFFile")); attachment.DataEntity.SetValue("PlotFile", reorganizeDetail.GetValue("PlotFile")); attachment.DataEntity.SetValue("XrefFile", reorganizeDetail.GetValue("XrefFile")); attachment.DataEntity.SetValue("DwfFile", reorganizeDetail.GetValue("DwfFile")); attachment.DataEntity.SetValue("TiffFile", reorganizeDetail.GetValue("TiffFile")); attachment.DataEntity.SetValue("SignPdfFile", reorganizeDetail.GetValue("SignPdfFile")); file.AddAttachment(attachment); } file.IsValidateDataAttr = false; DocSystem.FileController.FileValidateDataAttr(file); //node.AddFile(file, true); file.Save(true); return(file); } return(null); }