public static bool Exists(string spaceID, string configID, string whereStr) { var space = DocConfigHelper.CreateConfigSpaceByID(spaceID); if (space == null) { throw new Formula.Exceptions.BusinessException("未找到ID为【" + spaceID + "】档案配置对象,无法获取节点对象"); } string where = whereStr.Replace("where", "").Replace("WHERE", ""); bool result = false; var db = SQLHelper.CreateSqlHelper(space.SpaceKey, space.ConnectString); string sql = String.Format(" select ID from S_NodeInfo where ConfigID='{0}'", configID); if (!String.IsNullOrEmpty(where)) { sql += " and " + where; } var dt = db.ExecuteDataTable(sql); if (dt != null && dt.Rows.Count > 0) { result = true; } else { result = false; } return(result); }
public JsonResult BrownFile(string FileID, string SpaceID) { var space = DocConfigHelper.CreateConfigSpaceByID(SpaceID); var file = new S_FileInfo(FileID, space); if (file.CurrentAttachment == null || String.IsNullOrEmpty(file.CurrentAttachment.DataEntity.GetValue("MainFile"))) { throw new Formula.Exceptions.BusinessException("没有上传附件,无法进行浏览!"); } var fileDB = SQLHelper.CreateSqlHelper(ConnEnum.FileStore); var docType = file.CurrentAttachment.DataEntity.GetValue("FileType"); var fileID = file.CurrentAttachment.DataEntity.GetValue("PDFFile").Split('_')[0]; if (String.IsNullOrEmpty(fileID)) { fileID = file.CurrentAttachment.DataEntity.GetValue("MainFile").Split('_')[0]; } var constEntities = FormulaHelper.GetEntities <DocConstEntities>(); var log = constEntities.S_DocumentLog.Create(); log.ID = FormulaHelper.CreateGuid(); log.Name = file.Name; log.LogType = "Browse"; log.NodeID = file.NodeID; log.SpaceID = file.Space.ID; log.FileID = file.ID; log.FullNodeID = file.FullNodeID; log.ConfigID = file.ConfigInfo.ID; log.CreateDate = DateTime.Now; log.CreateUserID = this.CurrentUserInfo.UserID; log.CreateUserName = this.CurrentUserInfo.UserName; constEntities.S_DocumentLog.Add(log); constEntities.SaveChanges(); return(Json(new { DocType = docType, SWFFileID = fileID })); }
//最加文件类型节点 public JsonResult AddFileNodeType(string NodeData) { var data = JsonHelper.ToObject(NodeData); var children = new List <Dictionary <string, string> >(); var configID = data.GetValue("ConfigID"); var SpaceID = data.GetValue("SpaceID"); var space = DocConfigHelper.CreateConfigSpaceByID(SpaceID); var config = space.S_DOC_Node.FirstOrDefault(a => a.ID == configID); var fileRelationList = config.S_DOC_FileNodeRelation.ToList(); foreach (var relation in fileRelationList) { Dictionary <string, string> relationDic = new Dictionary <string, string>(); relationDic["ID"] = data.GetValue("ID") + '.' + relation.FileID;//NodeID.FileConfigID 作为虚拟节点ID; relationDic["Name"] = relation.S_DOC_File.Name; relationDic["ParentID"] = data.GetValue("ID"); relationDic["FullPathID"] = data.GetValue("FullPathID"); relationDic["ConfigID"] = relation.FileID; relationDic["NodeType"] = "FileConfig"; children.Add(relationDic); //table.Rows.Add(relationRow); } data.SetValue("children", children); return(Json(data)); }
public JsonResult GetNodeTreeMenu(string SpaceID, string ConfigID) { var space = DocConfigHelper.CreateConfigSpaceByID(SpaceID); if (space == null) { throw new BusinessException("未指定档案实体空间,无法获取数据访问对象"); } var nodeConfig = space.S_DOC_Node.FirstOrDefault(d => d.ID == ConfigID); if (nodeConfig == null) { throw new BusinessException("未能找ID为【" + ConfigID + "】的编目定义对象"); } var list = nodeConfig.StructNode.Children.ToList(); var arraylist = new ArrayList(); foreach (var item in list) { arraylist.Add(createMenuItem(item.ID, item.NodeID, "添加" + item.Name, "icon-add", "addNode")); } arraylist.Add(createMenuItem("", "edit", "编辑", "icon-edit", "editNode")); arraylist.Add(createMenuItem("", "delete", "删除", "icon-remove", "deleteNode")); arraylist.Add(createMenuItem("", "remove", "移除", "icon-remove", "RemoveNode")); return(Json(arraylist, JsonRequestBehavior.AllowGet)); }
public JsonResult ArchiveReorganize(string FileList, string SpaceID, string TargetNodeID) { //直接归档 var docSpace = DocConfigHelper.CreateConfigSpaceByID(SpaceID); S_NodeInfo node = S_NodeInfo.GetNode(TargetNodeID, SpaceID); var list = JsonHelper.ToList(FileList); StringBuilder sb = new StringBuilder(); foreach (var item in list) { var archFileID = item.GetValue("ArchiveFileID"); if (string.IsNullOrEmpty(archFileID)) { //新增档案文件记录 S_FileInfo fileInfo = archFile(item, node, item.GetValue("ConfigID")); archFileID = fileInfo.ID; item.SetValue("ArchiveFileID", archFileID); } else { //移动文件 S_FileInfo fileInfo = new S_FileInfo(archFileID, docSpace); fileInfo.MoveTo(TargetNodeID, item.GetValue("ConfigID")); } var sql = "update S_R_Reorganize_DocumentList set ReorganizePath='{1}',ReorganizeFullID='{2}',ArchiveFileID='{3}',ReorganizeConfigID='{4}' where id='{0}'"; sql = string.Format(sql, item.GetValue("ID"), item.GetValue("ReorganizePath"), item.GetValue("ReorganizeFullID"), archFileID, item.GetValue("ConfigID")); sb.AppendLine(sql); } if (sb.Length > 0) { this.SqlHelper.ExecuteNonQuery(sb.ToString()); } return(Json(list)); }
public JsonResult DeleteReorganizeFile(string FileList, string SpaceID) { var docSpace = DocConfigHelper.CreateConfigSpaceByID(SpaceID); var list = JsonHelper.ToList(FileList); StringBuilder sb = new StringBuilder(); foreach (var item in list) { var archFileID = item.GetValue("ArchiveFileID"); S_FileInfo fileInfo = new S_FileInfo(archFileID, docSpace); fileInfo.Delete(); item.SetValue("ReorganizePath", ""); item.SetValue("ReorganizeFullID", ""); item.SetValue("ReorganizeConfigID", ""); item.SetValue("ArchiveFileID", ""); item.SetValue("ArchiveFileAttrs", ""); var sql = "update S_R_Reorganize_DocumentList set ReorganizePath='',ReorganizeFullID='',ReorganizeConfigID='',ArchiveFileID='',ArchiveFileAttrs='' where id='{0}'"; sql = string.Format(sql, item.GetValue("ID")); sb.AppendLine(sql); } if (sb.Length > 0) { this.SqlHelper.ExecuteNonQuery(sb.ToString()); } return(Json(list)); }
public JsonResult ApplyFileBorrow(string files, string SpaceID) { var space = DocConfigHelper.CreateConfigSpaceByID(SpaceID); if (space == null) { throw new Formula.Exceptions.BusinessException("为找到【ID】为【" + SpaceID + "】的图档实例库"); } var list = JsonHelper.ToList(files); foreach (var file in list) { S_FileInfo fileInfo = new S_FileInfo(file.GetValue("ID"), space); if (fileInfo == null) { continue; } if (fileInfo.ConfigInfo == null) { throw new Formula.Exceptions.BusinessException("未能找到文件【" + fileInfo.ID + "】的配置对象信息"); } if (fileInfo.DataEntity.GetValue("StorageType") != StorageType.Physical.ToString()) { throw new Formula.Exceptions.BusinessException("电子版文件不能借阅!"); } CarFO.CreateCarItem(fileInfo, ItemType.Borrow.ToString()); } this.entities.SaveChanges(); return(Json(new { })); }
public ActionResult QueryList() { string spaceID = this.Request["SpaceID"]; var space = DocConfigHelper.CreateConfigSpaceByID(spaceID); if (space != null) { ViewBag.CarHTML = DocInstanceHepler.GetBtnHTML("True", "True"); var fileConfig = space.S_DOC_File.FirstOrDefault(); var queryForm = fileConfig.GetQueryForm(); ViewBag.QueryFormHtml = queryForm.Render(); SQLHelper sqlhelper = SQLHelper.CreateSqlHelper(ConnEnum.InfrasBaseConfig); string sql = "select distinct AttrField as value,AttrName as text from S_DOC_ListConfig a inner join S_DOC_File b on a.RelationID=b.ID inner join S_DOC_ListConfigDetail c on c.ListConfigID=a.ID order by AttrName"; var dt = sqlhelper.ExecuteDataTable(sql); ViewBag.SortField = JsonHelper.ToJson(dt); } var ArchiveType = System.Configuration.ConfigurationManager.AppSettings["ArchiveType"]; var archiveTypeEnum = new List <object>(); archiveTypeEnum.Add(new { value = "MainFile", text = "主文件" }); if (string.IsNullOrEmpty(ArchiveType)) { ArchiveType = "PdfFile"; } ArchiveType = ArchiveType.Replace("PdfFile", "PDFFile"); foreach (var item in ArchiveType.Split(',')) { archiveTypeEnum.Add(new { value = item, text = item.Replace("File", "") }); } ViewBag.ArchiveType = JsonHelper.ToJson(archiveTypeEnum); return(View()); }
public JsonResult ApplyReDownload() { string fileID = this.GetQueryString("files"); string SpaceID = this.GetQueryString("SpaceID"); var space = DocConfigHelper.CreateConfigSpaceByID(SpaceID); if (space == null) { throw new Formula.Exceptions.BusinessException("为找到【ID】为【" + SpaceID + "】的图档实例库"); } S_FileInfo fileInfo = new S_FileInfo(fileID, space); if (fileInfo.ConfigInfo == null) { throw new Formula.Exceptions.BusinessException("未能找到文件【" + fileInfo.ID + "】的配置对象信息"); } if (fileInfo.CurrentAttachment == null) { throw new Formula.Exceptions.BusinessException("附件不存在"); } if (fileInfo.DataEntity.GetValue("StorageType") != StorageType.Electronic.ToString()) { throw new Formula.Exceptions.BusinessException("实物文件不能下载!"); } CarFO.CreateCarItem(fileInfo, ItemType.DownLoad.ToString()); this.entities.SaveChanges(); return(Json(new { })); }
public override JsonResult Delete() { var ids = Request["ID"]; var entity = this.BusinessEntities.Set <S_SU_DocumentRelieveSeal>().SingleOrDefault(c => c.ID == ids); if (entity != null) { var detailIst = entity.S_SU_DocumentRelieveSeal_DetailList.ToList(); var spaceList = new List <S_DOC_Space>(); var spaceIDs = detailIst.Where(a => !string.IsNullOrEmpty(a.SpaceID)).Select(a => a.SpaceID).ToList(); foreach (var spaceID in spaceIDs) { var nodeIds = detailIst.Where(a => a.SpaceID == spaceID && !string.IsNullOrEmpty(a.RelateID)).Select(a => a.RelateID); StringBuilder sb = new StringBuilder(); var space = spaceList.FirstOrDefault(a => a.ID == spaceID); if (space == null) { space = DocConfigHelper.CreateConfigSpaceByID(spaceID); spaceList.Add(space); } var db = SQLHelper.CreateSqlHelper(space.SpaceKey, space.ConnectString); foreach (var nodeid in nodeIds) { //将解封申请中、解封状态的节点及文件设置为禁用 sb.AppendLine("update S_NodeInfo set State = '" + DocState.SealUp.ToString() + "' where State in ('" + DocState.SealUpApply.ToString() + "','" + DocState.Normal.ToString() + "') and FullPathID like '%" + nodeid + "%'"); sb.AppendLine("update S_FileInfo set State = '" + DocState.SealUp.ToString() + "' where State in ('" + DocState.SealUpApply.ToString() + "','" + DocState.Normal.ToString() + "') and FullNodeID like '%" + nodeid + "%'"); } if (sb.Length > 0) { db.ExecuteNonQuery(sb.ToString()); } } } return(base.Delete()); }
public ActionResult Edit() { string nodeConfigID = this.Request["ConfigID"]; string spaceID = this.Request["SpaceID"]; var space = DocConfigHelper.CreateConfigSpaceByID(spaceID); if (space == null) { throw new Formula.Exceptions.BusinessException("未能找到ID为【" + spaceID + "】的档案空间配置对象"); } var node = space.S_DOC_Node.FirstOrDefault(d => d.ID == nodeConfigID); if (node == null) { throw new Formula.Exceptions.BusinessException("未能找到ID为【" + nodeConfigID + "】的节点定义对象"); } var queryForm = node.GetEditForm(); ViewBag.FormHtml = queryForm.Render(); var enumsList = node.S_DOC_NodeAttr.Where(d => d.IsEnum == "True").ToList().Select(d => d.EnumKey).ToList(); ViewBag.Enums = enumsList; ViewBag.IsMulti = this.Request["IsMulti"]; var fileShowItems = node.S_DOC_NodeAttr.Where(a => a.Visible == "True"); var dic = new Dictionary <string, string>(); foreach (var item in fileShowItems) { dic.SetValue(item.AttrField, item.AttrName); } ViewBag.FieldInfo = JsonHelper.ToJson(dic); ViewBag.SelectorScipts = renderSelectorScipts(node); return(View()); }
public ActionResult TreeEdit() { string nodeConfigID = this.Request["ConfigID"]; string spaceID = this.Request["SpaceID"]; var space = DocConfigHelper.CreateConfigSpaceByID(spaceID); if (space == null) { throw new Formula.Exceptions.BusinessException("未能找到ID为【" + spaceID + "】的档案空间配置对象"); } var node = space.S_DOC_Node.FirstOrDefault(d => d.ID == nodeConfigID); if (node == null) { throw new Formula.Exceptions.BusinessException("未能找到ID为【" + nodeConfigID + "】的节点定义对象"); } var queryForm = node.GetEditForm(); ViewBag.FormHtml = queryForm.Render(); var enumsList = node.S_DOC_NodeAttr.Where(d => d.IsEnum == "True").ToList().Select(d => d.EnumKey).ToList(); ViewBag.Enums = enumsList; ViewBag.SelectorScipts = renderSelectorScipts(node); return(View()); }
public JsonResult ApplyFileDownload(string files, string SpaceID) { ArrayList dirDownloads = new ArrayList(); var space = DocConfigHelper.CreateConfigSpaceByID(SpaceID); if (space == null) { throw new Formula.Exceptions.BusinessException("为找到【ID】为【" + SpaceID + "】的图档实例库"); } var list = JsonHelper.ToList(files); var ArchiveType = System.Configuration.ConfigurationManager.AppSettings["ArchiveType"]; if (string.IsNullOrEmpty(ArchiveType)) { ArchiveType = "PdfFile"; } ArchiveType = ArchiveType.Replace("PdfFile", "PDFFile"); foreach (var file in list) { S_FileInfo fileInfo = new S_FileInfo(file.GetValue("ID"), space); if (fileInfo.ConfigInfo == null) { throw new Formula.Exceptions.BusinessException("未能找到文件【" + fileInfo.ID + "】的配置对象信息"); } if (fileInfo.DataEntity.GetValue("StorageType") != StorageType.Electronic.ToString()) { throw new Formula.Exceptions.BusinessException("实物文件不能下载!"); } if (fileInfo.CurrentAttachment == null) { throw new Formula.Exceptions.BusinessException("【" + fileInfo.Name + "】还没有主文件,不能下载!"); } if (String.IsNullOrEmpty(fileInfo.ConfigInfo.DownloadFlowKey)) { dirDownloads.Add(fileInfo.CurrentAttachment.DataEntity); var entities = FormulaHelper.GetEntities <DocConstEntities>(); var user = FormulaHelper.GetUserInfo(); S_DocumentLog log = entities.S_DocumentLog.Create(); log.ID = FormulaHelper.CreateGuid(); log.LogType = "DownLoad"; log.Name = fileInfo.Name; log.NodeID = fileInfo.NodeID; log.SpaceID = fileInfo.Space.ID; log.ConfigID = fileInfo.ConfigInfo.ID; log.CreateDate = DateTime.Now; log.CreateUserID = user.UserID; log.CreateUserName = user.UserName; log.FileID = fileInfo.ID; log.FullNodeID = fileInfo.FullNodeID; entities.S_DocumentLog.Add(log); } else { CarFO.CreateCarItem(fileInfo, ItemType.DownLoad.ToString()); } } this.entities.SaveChanges(); return(Json(dirDownloads)); }
public JsonResult getnodeconfiginfo() { string spaceID = this.Request["SpaceID"]; var space = DocConfigHelper.CreateConfigSpaceByID(spaceID); var list = this.Space.S_DOC_Node.Where(d => d.AllowDisplay == "True").ToList(); return(Json(list, JsonRequestBehavior.AllowGet)); }
public void publish() { string ID = this.Request["ID"]; if (!string.IsNullOrEmpty(ID)) { DocConfigHelper.PublishSpaceBySpaceID(ID); } }
public void savelog() { var result = new Hashtable(); string spaceID = this.Request["SpaceID"]; string FileID = this.Request["FileID"]; var space = DocConfigHelper.CreateConfigSpaceByID(spaceID); S_FileInfo file = new S_FileInfo(FileID, space); // S_DocumentLog.Svae(file, this.PageDomainSession, DocInstance.Logic.ApplyType.Browse); }
protected override void OnFlowEnd(S_I_DestroyApply entity, S_WF_InsTaskExec taskExec, S_WF_InsDefRouting routing) { var state = IdentifyState.Finish.ToString(); var infoIDs = entity.S_I_DestroyApply_DetailInfo.Select(a => a.IdentifyInfoID).ToArray(); var IdentifyApplyDetailInfoIDs = entity.S_I_DestroyApply_DetailInfo.Select(a => a.IdentifyApplyDetailInfoID).ToArray(); this.BusinessEntities.Set <S_I_IdentifyApply_DetailInfo>().Where(a => IdentifyApplyDetailInfoIDs.Contains(a.ID)).Update(a => a.HandleResult = state); var apply = this.BusinessEntities.Set <S_I_IdentifyApply>().FirstOrDefault(a => a.ID == entity.IdentifyApplyID); if (apply != null) { if (apply.S_I_IdentifyApply_DetailInfo.Count(a => !IdentifyApplyDetailInfoIDs.Contains(a.ID) && a.HandleResult != state) == 0) { apply.HandleState = HandleState.Finish.ToString(); } else { apply.HandleState = HandleState.Part.ToString(); } } var updateDic = new Dictionary <S_DOC_Space, StringBuilder>(); var infos = this.BusinessEntities.Set <S_I_IdentifyInfo>().Where(a => infoIDs.Contains(a.ID)).ToList(); foreach (var info in infos) { info.State = state; var space = DocConfigHelper.CreateConfigSpaceByID(info.SpaceID); var nodeInfo = new S_NodeInfo(info.NodeID, space); if (!updateDic.ContainsKey(space)) { updateDic.Add(space, new StringBuilder()); } updateDic[space].AppendLine(string.Format(@" update S_NodeInfo set [State] = '{0}' where FullPathID like '{1}%' update S_FileInfo set [State] = '{0}' where FullNodeID like '{1}%'", DocState.Invalid.ToString(), nodeInfo.FullPathID)); } foreach (var item in updateDic.Keys) { var instanceDB = SQLHelper.CreateSqlHelper(item.SpaceKey, item.ConnectString); instanceDB.ExecuteNonQuery(updateDic[item].ToString()); } //添加销毁记录 var IdentifyApplyDetails = this.BusinessEntities.Set <S_I_IdentifyApply_DetailInfo>().Where(a => IdentifyApplyDetailInfoIDs.Contains(a.ID)).Select(a => a).ToList(); foreach (var IdentifyApplyDetail in IdentifyApplyDetails) { var identifyInfo = this.BusinessEntities.Set <S_I_IdentifyInfo>().FirstOrDefault(b => b.ID.Equals(IdentifyApplyDetail.IdentifyInfoID)); S_NodeInfo node = new S_NodeInfo(identifyInfo.NodeID, FormulaHelper.GetEntities <DocConfigEntities>().S_DOC_Space.FirstOrDefault(b => b.ID.Equals(identifyInfo.SpaceID))); InventoryFO.CreateNewInventoryLedger(node, "", InventoryType.Destroy); } }
public ActionResult List() { string QueryKey = ""; string btnTemplate = "<a class=\"mini-button\" iconcls=\"{1}\" onclick=\"{2}\" plain=\"true\" id=\"{3}\">{0}</a>"; string nodeConfigID = this.Request["ConfigID"]; string spaceID = this.Request["SpaceID"]; var space = DocConfigHelper.CreateConfigSpaceByID(spaceID); if (space == null) { throw new Formula.Exceptions.BusinessException("未能找到ID为【" + spaceID + "】的档案空间配置对象"); } var node = space.S_DOC_Node.FirstOrDefault(d => d.ID == nodeConfigID); if (node == null) { throw new Formula.Exceptions.BusinessException("未能找到ID为【" + nodeConfigID + "】的节点定义对象"); } var grid = node.GetDataGrid(true) as MiniDataGrid; grid.Url = "GetList"; grid.Multiselect = true; ViewBag.DatagridHtml = grid.Render(node.IsShowIndex == "True"); var queryForm = node.GetQueryForm(); var table = queryForm.Controls.FirstOrDefault() as Table; int height = table.Rows.Count * 30 + 60; ViewBag.QueryFormHtml = queryForm.Render(); QueryKey = space.S_DOC_ListConfig.FirstOrDefault(d => d.RelationID == nodeConfigID).QueryKeyText; if (node.S_DOC_FileNodeRelation.Count > 0) { ViewBag.BtnHTML += String.Format(btnTemplate, "查看文件", "icon-extensions", "openfile()", "btnOpenFile"); } ViewBag.BtnHTML += String.Format(btnTemplate, "打开树形图", "icon-goto", "opentree()", "btnOpenTree"); if (node.CanBorrow == "True") { ViewBag.BtnHTML += String.Format(btnTemplate, "借阅", "icon-copy", "borrow()", "btnBorrow"); } var enumsList = node.S_DOC_NodeAttr.Where(d => d.IsEnum == "True").ToList().Select(d => d.EnumKey).Distinct().ToList(); ViewBag.Enums = enumsList; foreach (var item in node.S_DOC_NodeAttr.Where(d => d.IsEnum == "True").ToList()) { if (String.IsNullOrEmpty(item.EnumKey)) { continue; } var enumKey = item.EnumKey; if (enumKey.Split('.').Length > 1) { enumKey = enumKey.Split('.')[1]; } ViewBag.Script += "addGridEnum(\"dataGrid\", \"" + item.AttrField + "\", \"" + enumKey + "\");"; } return(View()); }
public S_Attachment(string spaceID) { _initEntity(); this.Space = DocConfigHelper.CreateConfigSpaceByID(spaceID); if (this.Space == null) { throw new Formula.Exceptions.BusinessException("未找到ID为【" + spaceID + "】档案配置对象,无法实例化附件对象"); } this.InstanceDB = SQLHelper.CreateSqlHelper(this.Space.SpaceKey, this.Space.ConnectString); this.IsNewModel = true; }
private void Return(Dictionary <string, object> row) { var returnNumber = 0; int.TryParse(row.GetValue("ReturnNumber"), out returnNumber); var id = row.GetValue("ID"); var borrowDetail = this.entities.Set <S_BorrowDetail>().FirstOrDefault(a => a.ID == id); if (returnNumber > 0 && borrowDetail != null) { borrowDetail.ReturnUserID = row.GetValue("ReturnUserID"); borrowDetail.ReturnUser = row.GetValue("ReturnUser"); borrowDetail.ReturnDeptID = row.GetValue("ReturnDeptID"); borrowDetail.ReturnDeptName = row.GetValue("ReturnDeptName"); borrowDetail.ReturnNumber = (borrowDetail.ReturnNumber ?? 0) + returnNumber; borrowDetail.ReturnDate = Convert.ToDateTime(row.GetValue("ReturnDate")); var isFinish = ((borrowDetail.LendNumber ?? 0) - (borrowDetail.ReturnNumber ?? 0) - (borrowDetail.LostNumber ?? 0)) == 0; if (isFinish) { borrowDetail.BorrowState = BorrowDetailState.Finish.ToString(); } if (borrowDetail.DetailType == NodeType.Node.ToString()) { var space = DocConfigHelper.CreateConfigSpaceByID(borrowDetail.SpaceID); var nodeInfo = new S_NodeInfo(borrowDetail.RelateID, space); InventoryFO.CreateInventoryLedger(nodeInfo, InventoryType.Return, 0, returnNumber, borrowDetail.ID, borrowDetail.ReturnUserID, borrowDetail.ReturnUser, EnumBaseHelper.GetEnumDescription(InventoryType.Return.GetType(), InventoryType.Return.ToString()) + "份数:" + returnNumber + "份"); if (isFinish) { nodeInfo.DataEntity.SetValue("BorrowState", BorrowReturnState.Return.ToString()); } nodeInfo.Save(false); } else { var space = DocConfigHelper.CreateConfigSpaceByID(borrowDetail.SpaceID); var fileInfo = new S_FileInfo(borrowDetail.RelateID, space); InventoryFO.CreateInventoryLedger(fileInfo, InventoryType.Return, 0, returnNumber, borrowDetail.ID, borrowDetail.ReturnUserID, borrowDetail.ReturnUser, EnumBaseHelper.GetEnumDescription(InventoryType.Return.GetType(), InventoryType.Return.ToString()) + "份数:" + returnNumber + "份"); if (isFinish) { fileInfo.DataEntity.SetValue("BorrowState", BorrowReturnState.Return.ToString()); } fileInfo.Save(false); } } }
public JsonResult MoveDown(string ID, string SpaceID, string TargetNodeID) { var space = DocConfigHelper.CreateConfigSpaceByID(SpaceID); if (space == null) { throw new BusinessException("未指定档案实体空间,无法获取数据访问对象"); } var node = new S_NodeInfo(ID, space); node.MoveDown(TargetNodeID); return(Json("")); }
public void applyfileborrow(List <Dictionary <string, object> > files) { var list = files; var docConstEntities = FormulaHelper.GetEntities <DocConstEntities>(); var user = FormulaHelper.GetUserInfo(); foreach (var file in list) { var space = DocConfigHelper.CreateConfigSpaceByID(file.GetValue("SpaceID")); //var FileInfo = docConstEntities.T_Borrow_FileInfo.FirstOrDefault(d => d.T_BorrowID == file.GetValue("BorrowID") && d.FileName == file.GetValue("Name")); S_FileInfo fileInfo = new S_FileInfo(file.GetValue("RelateID"), space); if (fileInfo.ConfigInfo == null) { throw new Formula.Exceptions.BusinessException("未能找到文件【" + fileInfo.ID + "】的配置对象信息"); } if (fileInfo.DataEntity.GetValue("BorrowState") == "Borrow") { throw new Formula.Exceptions.BusinessException("已经借出,不能借阅!"); } if (fileInfo.DataEntity.GetValue("Media") == "电子版") { throw new Formula.Exceptions.BusinessException("载体是电子版,不能借阅!"); } var carItem = this.entities.Set <S_CarInfo>().FirstOrDefault(d => d.FileID == fileInfo.ID && d.State == "New" && d.UserID == this.CurrentUserInfo.UserID && d.Type == "Borrow"); if (carItem == null) { carItem = new S_CarInfo(); carItem.ID = FormulaHelper.CreateGuid(); carItem.NodeID = fileInfo.NodeID; carItem.Type = ItemType.Borrow.ToString(); carItem.UserID = user.UserID; carItem.UserName = user.UserName; carItem.CreateDate = DateTime.Now; carItem.DataType = fileInfo.ConfigInfo.Name; carItem.FileID = fileInfo.ID; carItem.SpaceID = file.GetValue("SpaceID"); carItem.ConfigID = fileInfo.ConfigInfo.ID; carItem.Name = fileInfo.CreateCarName();// fileInfo.Name; carItem.State = ItemState.New.ToString(); carItem.CreateUser = user.UserName; carItem.CreateUserID = user.UserID; this.entities.Set <S_CarInfo>().Add(carItem); } else if (list.Count == 1) { throw new Formula.Exceptions.BusinessException("该文件已在借阅车中,请前往借阅车申请借阅"); } } this.entities.SaveChanges(); }
public JsonResult getnodeconfiginfo() { string spaceID = this.Request["SpaceID"]; var space = DocConfigHelper.CreateConfigSpaceByID(spaceID); var list = this.Space.S_DOC_Node.Where(d => d.AllowDisplay == "True").OrderBy(a => a.SortIndex).ToList(); var queryType = this.GetQueryString("$QueryType"); if (queryType.ToLower() == "sealup") { list = list.Where(a => a.IsPhysicalBox == TrueOrFalse.True.ToString()).ToList(); } return(Json(list, JsonRequestBehavior.AllowGet)); }
public JsonResult DoCopy(string ID) { if (string.IsNullOrEmpty(ID)) { throw new Formula.Exceptions.BusinessException("请选择要复制的模版"); } var space = DocConfigHelper.CreateConfigSpaceByID(ID); space.DoCopy(); entities.SaveChanges(); return(Json("")); }
public S_Attachment(DataRow row, string spaceID) { this._initEntity(); _validateColumns(row); DataAdapter.DataRowToHashTable(row, this.DataEntity); this.Space = DocConfigHelper.CreateConfigSpaceByID(spaceID); if (this.Space == null) { throw new Formula.Exceptions.BusinessException("未找到ID为【" + this.DataEntity["SpaceID"].ToString() + "】档案配置对象,无法实例化附件对象"); } this.InstanceDB = SQLHelper.CreateSqlHelper(this.Space.SpaceKey, this.Space.ConnectString); if (Tool.IsNullOrEmpty(this.ID)) { this.IsNewModel = true; } }
public void applynodeborrow(List <Dictionary <string, object> > nodes) { var docConstEntities = FormulaHelper.GetEntities <DocConstEntities>(); var list = nodes; foreach (var item in list) { var space = DocConfigHelper.CreateConfigSpaceByID(item.GetValue("SpaceID")); // var FileInfo = docConstEntities.T_Borrow_FileInfo.FirstOrDefault(d => d.T_BorrowID == item.GetValue("BorrowID") && d.FileName == item.GetValue("Name")); S_NodeInfo nodeInfo = new S_NodeInfo(item.GetValue("RelateID"), space); if (nodeInfo == null) { continue; } if (nodeInfo.ConfigInfo == null) { throw new Formula.Exceptions.BusinessException("未能找到文件【" + nodeInfo.ID + "】的配置对象信息"); } var carInfo = docConstEntities.S_CarInfo.FirstOrDefault(d => d.UserID == this.CurrentUserInfo.UserID && d.NodeID == nodeInfo.ID && d.State == "New" && d.Type == "Borrow" && d.DataType == nodeInfo.ConfigInfo.Name); if (carInfo == null) { carInfo = new S_CarInfo(); carInfo.ID = FormulaHelper.CreateGuid();; carInfo.Name = nodeInfo.CreateCarName(); //nodeInfo.Name; carInfo.NodeID = nodeInfo.ID; carInfo.NodeName = nodeInfo.Name; carInfo.SpaceID = item.GetValue("SpaceID"); carInfo.State = "New"; carInfo.Type = ItemType.Borrow.ToString(); carInfo.UserID = this.CurrentUserInfo.UserID; carInfo.UserName = this.CurrentUserInfo.UserName; //carInfo.Code = nodeInfo.; carInfo.ConfigID = nodeInfo.ConfigInfo.ID; carInfo.CreateDate = DateTime.Now; carInfo.CreateUser = this.CurrentUserInfo.UserName; carInfo.CreateUserID = this.CurrentUserInfo.UserID; carInfo.DataType = nodeInfo.ConfigInfo.Name; docConstEntities.S_CarInfo.Add(carInfo); } else if (list.Count == 1) { throw new Formula.Exceptions.BusinessException("【" + nodeInfo.Name + "】已在借阅车中,请前往借阅车申请借阅"); } } docConstEntities.SaveChanges(); }
public S_FileInfo(string spaceID, string configID) { _initEntity(); this.Space = DocConfigHelper.CreateConfigSpaceByID(spaceID); if (this.Space == null) { throw new Formula.Exceptions.BusinessException("未找到ID为【" + spaceID + "】档案配置对象,无法实例化编目节点对象"); } this.ConfigInfo = this.Space.S_DOC_File.FirstOrDefault(d => d.ID == configID); if (this.ConfigInfo == null) { throw new Formula.Exceptions.BusinessException("未找到ID为【" + configID + "】编目定义对象,无法实例化编目节点对象"); } this.InstanceDB = SQLHelper.CreateSqlHelper(this.Space.SpaceKey, this.Space.ConnectString); //new DbAccess(this.Space.ConnectString); this.IsNewModel = true; }
protected override void BeforeSave(Dictionary <string, string> dic, Base.Logic.Domain.S_UI_Form formInfo, bool isNew) { var detailJsonStr = dic.GetValue("DetailList"); var spaceList = new List <S_DOC_Space>(); if (!string.IsNullOrEmpty(detailJsonStr)) { var formID = dic.GetValue("ID"); var subTableDataList = JsonHelper.ToObject <List <Dictionary <string, string> > >(detailJsonStr); var spaceIDs = subTableDataList.Where(a => !string.IsNullOrEmpty(a.GetValue("SpaceID"))).Select(a => a.GetValue("SpaceID")).Distinct(); foreach (var spaceID in spaceIDs) { //所有关联节点的ID var nodeIds = subTableDataList.Where(c => c.GetValue("SpaceID") == spaceID && !string.IsNullOrEmpty(c.GetValue("RelateID"))).Select(c => c.GetValue("RelateID")).ToList(); //获取全部子表项ID var oldIds = this.DocConstSQLDB.ExecuteDataTable(string.Format("select RelateID from S_SU_DocumentRelieveSeal_DetailList where S_SU_DocumentRelieveSealID='{0}' and SpaceID='{1}'", formID, spaceID)) .AsEnumerable().Select(c => c.Field <string>("RelateID")).ToList(); //本次移除的节点ID string notExistIDs = string.Join("','", oldIds.Where(c => !nodeIds.Contains(c)).ToArray()); var space = spaceList.FirstOrDefault(a => a.ID == spaceID); if (space == null) { space = DocConfigHelper.CreateConfigSpaceByID(spaceID); spaceList.Add(space); } var db = SQLHelper.CreateSqlHelper(space.SpaceKey, space.ConnectString); StringBuilder sb = new StringBuilder(); foreach (var nodeid in nodeIds) { sb.AppendLine("update S_NodeInfo set State = '" + DocState.SealUpApply.ToString() + "',RackNumber='" + dic.GetValue("SealUpRackNumber") + "',RackNumberName='" + dic.GetValue("SealUpRackNumberName") + "',StorageRoom='" + dic.GetValue("SealUpStorageRoom") + "',StorageRoomName='" + dic.GetValue("SealUpStorageRoomName") + "' where State <>'" + DocState.SealUpApply.ToString() + "' and FullPathID like '%" + nodeid + "%'"); sb.AppendLine("update S_FileInfo set State = '" + DocState.SealUpApply.ToString() + "' where State <>'" + DocState.SealUpApply.ToString() + "' and FullNodeID like '%" + nodeid + "%'"); } foreach (var nodeid in notExistIDs) { sb.AppendLine("update S_NodeInfo set State = '" + DocState.SealUp.ToString() + "' where State ='" + DocState.SealUpApply.ToString() + "' and FullPathID like '%" + nodeid + "%'"); sb.AppendLine("update S_FileInfo set State = '" + DocState.SealUp.ToString() + "' where State ='" + DocState.SealUpApply.ToString() + "' and FullNodeID like '%" + nodeid + "%'"); } if (sb.Length > 0) { db.ExecuteNonQuery(sb.ToString()); } } } }
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); } } }
//档案空间的项目列表展示 public JsonResult GetDataGridHtml() { string nodeConfigID = this.Request["ConfigID"]; string spaceID = this.Request["SpaceID"]; var space = DocConfigHelper.CreateConfigSpaceByID(spaceID); if (space == null) { throw new Formula.Exceptions.BusinessException("未能找到ID为【" + spaceID + "】的档案空间配置对象"); } var node = space.S_DOC_Node.FirstOrDefault(d => d.ID == nodeConfigID); if (node == null) { throw new Formula.Exceptions.BusinessException("未能找到ID为【" + nodeConfigID + "】的节点定义对象"); } MiniDataGrid grid = node.GetDataGrid(true) as MiniDataGrid; MiniGridColumn column = new MiniGridColumn(); column.Field = "img"; column.HeaderText = "打开树形图"; column.align = "center"; column.Allowsort = false; column.Width = 100; grid.AddControl(column, 0); grid.Url = "/DocSystem/View/NodeView/GetList?SpaceID=" + spaceID + "&ConfigID=" + nodeConfigID; //借阅状态显示红绿状态 grid.SetAttribute("ondrawcell", "onDrawCell"); if (node.CanBorrow == "True") { MiniGridColumn columnBorrow = new MiniGridColumn(); columnBorrow.Field = "Borrow"; columnBorrow.HeaderText = "操作"; columnBorrow.align = "center"; columnBorrow.Allowsort = false; columnBorrow.Width = 100; grid.AddControl(columnBorrow, 1); } //var listconfig = node.ListConfig().ID; var list = node.ListConfig().S_DOC_QueryParam.Where(a => a.InKey == "True").ToList(); var quickQueryField = String.Join(",", list.Select(a => a.InnerField)); var quickQueryText = String.Join(",", list.Select(a => a.AttrName)); return(Json(new { QuickQuery = new { field = quickQueryField, text = quickQueryText }, GridHtml = grid.Render(node.IsShowIndex == "True") })); }