Пример #1
0
        //进到下载借阅车时,根据配置生成名称
        public string CreateCarName()
        {
            var resultName = this.Name;

            if (this.ConfigInfo == null)
            {
                return(resultName);
            }
            if (this.ConfigInfo.ExtentionObject.GetValue("Ext_Car_UseFullName").ToLower() == "true")
            {
                var fullName = string.Empty;
                var splitStr = this.ConfigInfo.ExtentionObject.GetValue("Ext_Car_FullNameSplit");
                if (string.IsNullOrEmpty(splitStr))
                {
                    splitStr = " > ";
                }
                var nameFormatStr = this.ConfigInfo.ExtentionObject.GetValue("Ext_Car_NameFormat");
                if (string.IsNullOrEmpty(nameFormatStr))
                {
                    nameFormatStr = "{FullName} > {Name}";
                }
                var node = S_NodeInfo.GetNode(this.NodeID, this.Space.ID);
                if (node != null)
                {
                    fullName = string.Join(splitStr, node.Seniorities.Select(a => a.Name).ToList());
                }
                resultName = nameFormatStr.Replace("{FullName}", fullName).Replace("{Name}", this.Name);
            }
            return(resultName);
        }
Пример #2
0
        public virtual void MoveTo(string nodeID)
        {
            var node = S_NodeInfo.GetNode(nodeID, this.Space.ID);

            if (node == null)
            {
                throw new Formula.Exceptions.BusinessException("未能找到ID为【" + nodeID + "】的编目信息,移动文件信息失败");
            }
            if (this.IsNewModel)
            {
                throw new Formula.Exceptions.BusinessException("新创建的文件对象,不能使用Move方法进行文件移动");
            }
            this.FullNodeID = node.FullPathID;
            this.NodeID     = nodeID;
            this.Save(true);
        }
Пример #3
0
        public virtual void MoveTo(string nodeID)
        {
            var node = S_NodeInfo.GetNode(nodeID, this.Space.ID);

            if (node == null)
            {
                throw new Formula.Exceptions.BusinessException("未能找到ID为【" + nodeID + "】的编目信息,移动卷册失败");
            }
            if (this.IsNewModel)
            {
                throw new Formula.Exceptions.BusinessException("新创建的卷册对象,不能使用Move方法进行卷册移动");
            }
            this.FullPathID   = node.FullPathID + "." + this.ID;
            this.FullPathName = node.FullPathName + "$.$" + this.Name;
            this.ParentID     = nodeID;
            this.Save(true);
        }
Пример #4
0
        public virtual void MoveTo(string nodeID, string targetConfigID = "")
        {
            var node = S_NodeInfo.GetNode(nodeID, this.Space.ID);

            if (node == null)
            {
                throw new Formula.Exceptions.BusinessException("未能找到ID为【" + nodeID + "】的编目信息,移动文件信息失败");
            }
            if (this.IsNewModel)
            {
                throw new Formula.Exceptions.BusinessException("新创建的文件对象,不能使用Move方法进行文件移动");
            }
            var targetNodeFiles = node.ConfigInfo.S_DOC_FileNodeRelation.ToList();

            if (!string.IsNullOrEmpty(targetConfigID))
            {
                targetNodeFiles = targetNodeFiles.Where(a => a.FileID == targetConfigID).ToList();
                if (targetNodeFiles.Count == 0)
                {
                    throw new Formula.Exceptions.BusinessException("编目信息【" + node.Name + "】下,移动文件信息失败");
                }
                this.DataEntity["ConfigID"] = targetConfigID;
            }
            else
            {
                if (targetNodeFiles.Count == 0)
                {
                    throw new Formula.Exceptions.BusinessException("编目信息【" + node.Name + "】下,移动文件信息失败");
                }
                if (!targetNodeFiles.Any(a => a.FileID == this.DataEntity["ConfigID"].ToString()))
                {
                    this.DataEntity["ConfigID"] = targetNodeFiles.FirstOrDefault().FileID;
                }
            }
            this.FullNodeID   = node.FullPathID;
            this.FullNodeName = node.FullPathName;
            this.NodeID       = nodeID;
            var sql = "update S_R_PhysicalReorganize_FileDetail set ReorganizePath='{1}',ReorganizeFullID='{2}' where ArchiveFileID='{0}' ";

            sql = string.Format(sql, this.ID, node.Name, node.FullPathID);
            var configDB = SQLHelper.CreateSqlHelper(ConnEnum.DocConst);

            configDB.ExecuteNonQuery(sql);
            this.Save(true);
        }
Пример #5
0
        public void FillConfigDefaultAttr()
        {
            if (this.ConfigInfo == null)
            {
                throw new Formula.Exceptions.BusinessException("无法获取配置信息,保存失败");
            }
            var node  = S_NodeInfo.GetNode(this.DataEntity.GetValue("NodeID"), this.Space.ID);
            var attrs = this.ConfigInfo.S_DOC_FileAttr.Where(d => !String.IsNullOrEmpty(d.DefaultValue)).ToList();

            foreach (var attr in attrs)
            {
                if (attr.DefaultValue.Split(',').Length > 0 && attr.InputType.IndexOf(ControlType.ButtonEdit.ToString()) >= 0 &&
                    this.DataEntity.ContainsKey(attr.FileAttrField + "Name"))
                {
                    SetDefualtValue(attr.FileAttrField, attr.DefaultValue.Split(',')[0], node);
                    SetDefualtValue(attr.FileAttrField + "Name", attr.DefaultValue.Split(',')[1], node);
                }
                else
                {
                    SetDefualtValue(attr.FileAttrField, attr.DefaultValue, node);
                }
            }
        }
Пример #6
0
        public void FillConfigDefaultAttr()
        {
            if (this.ConfigInfo == null)
            {
                throw new Formula.Exceptions.BusinessException("无法获取配置信息,保存失败");
            }
            var attrs           = this.ConfigInfo.S_DOC_FileAttr.Where(d => !String.IsNullOrEmpty(d.DefaultValue)).ToList();
            var CurrentUserInfo = FormulaHelper.GetUserInfo();

            foreach (var attr in attrs)
            {
                if (attr.DefaultValue.IndexOf("{") < 0)
                {
                    this.DataEntity[attr.FileAttrField] = attr.DefaultValue;
                }
                else
                {
                    if (attr.DefaultValue.IndexOf("{") >= 0)
                    {
                        var defaultStr = attr.DefaultValue.Replace("{", "").Replace("}", "");
                        if (defaultStr == "Now")
                        {
                            this.DataEntity[attr.FileAttrField] = DateTime.Now;
                        }
                        else if (defaultStr == "UserID")
                        {
                            this.DataEntity[attr.FileAttrField] = CurrentUserInfo.UserID; //user.UserID;
                        }
                        else if (defaultStr == "UserName")
                        {
                            this.DataEntity[attr.FileAttrField] = CurrentUserInfo.UserName;
                        }
                        if (!String.IsNullOrEmpty(this.DataEntity.GetValue("NodeID")))
                        {
                            var node         = S_NodeInfo.GetNode(this.DataEntity.GetValue("NodeID"), this.Space.ID);
                            var defaultValue = attr.DefaultValue.Replace("{", "").Replace("}", "").Split(':');
                            if (defaultValue.Length > 1)
                            {
                                var nodePositon  = defaultValue[0];
                                var defaultField = defaultValue[1];
                                if (nodePositon == "Root")
                                {
                                    if (node.RootNode.DataEntity.ContainsKey(defaultField))
                                    {
                                        this.DataEntity[attr.FileAttrField] = node.RootNode.DataEntity[defaultField];
                                    }
                                }
                                else if (nodePositon == "Node")
                                {
                                    if (node.DataEntity.ContainsKey(defaultField))
                                    {
                                        this.DataEntity[attr.FileAttrField] = node.DataEntity[defaultField];
                                    }
                                }
                                else if (nodePositon.Split('.').Length > 0)
                                {
                                    var pnode = _getParentNode(node, nodePositon.Split('.').Length);
                                    if (pnode.DataEntity.ContainsKey(defaultField))
                                    {
                                        this.DataEntity[attr.FileAttrField] = node.DataEntity[defaultField];
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }