Esempio n. 1
0
        public void AddQueryParam(S_DOC_FileAttr item)
        {
            var entity = this.ListConfig().S_DOC_QueryParam.FirstOrDefault(d => d.AttrField == item.FileAttrField);

            if (entity == null)
            {
                entity                 = new S_DOC_QueryParam();
                entity.AttrField       = item.FileAttrField;
                entity.AttrName        = item.FileAttrName;
                entity.InKey           = TrueOrFalse.False.ToString();
                entity.InnerField      = item.FileAttrField;
                entity.QueryType       = QueryType.LK.ToString();
                entity.InAdvancedQuery = TrueOrFalse.True.ToString();
                entity.DataType        = item.DataType;
                if (this.ListConfig().S_DOC_QueryParam.Count > 0)
                {
                    entity.QuerySort = this.ListConfig().S_DOC_QueryParam.Max(d => d.QuerySort) + 1;
                }
                else
                {
                    entity.QuerySort = 1;
                }
                this.ListConfig().S_DOC_QueryParam.Add(entity);
            }
        }
Esempio n. 2
0
        private void _InitSystemAtt(S_DOC_ListConfig listConfig)
        {
            var sort     = 1;
            var lastSort = 10000;
            var tmpList  = this.S_DOC_FileAttr.Where(a => a.AttrSort < 10000);

            if (tmpList.Count() > 0)
            {
                sort = tmpList.Max(a => a.AttrSort) + 1;
            }
            foreach (var item in S_DOC_Space.DefaultFileAttrArray)
            {
                var systemAttr = this.S_DOC_FileAttr.FirstOrDefault(a => a.FileAttrField == item.FileAttrField);
                if (systemAttr != null)
                {
                    continue;
                }
                systemAttr = new S_DOC_FileAttr
                {
                    ID            = FormulaHelper.CreateGuid(),
                    FileAttrField = item.FileAttrField,
                    FileAttrName  = item.FileAttrName,
                    AttrType      = item.AttrType,
                    DataType      = item.DataType,
                    InputType     = item.InputType,
                    IsEnum        = item.IsEnum,
                    EnumKey       = item.EnumKey,
                    ValidateType  = item.ValidateType,
                    Required      = item.Required,
                    Disabled      = item.Disabled,
                    Visible       = item.Visible,
                    VType         = item.VType,
                    SpaceID       = this.SpaceID,
                    AttrSort      = item.IsEdit ? sort : lastSort,
                    SelectorKey   = item.SelectorKey,
                    ReturnParams  = item.ReturnParams
                };
                this.S_DOC_FileAttr.Add(systemAttr);
                if (item.FileAttrField == "Name")
                {
                    var listDetail = listConfig.S_DOC_ListConfigDetail.FirstOrDefault(d => d.AttrField == item.FileAttrField);
                    if (listDetail == null)
                    {
                        listDetail            = new S_DOC_ListConfigDetail();
                        listDetail.AttrField  = item.FileAttrField;
                        listDetail.AttrName   = item.FileAttrName;
                        listDetail.Dispaly    = TrueOrFalse.True.ToString();
                        listDetail.AllowSort  = TrueOrFalse.True.ToString();
                        listDetail.Align      = Algin.center.ToString();
                        listDetail.Width      = 150;
                        listDetail.DetailSort = listConfig.S_DOC_ListConfigDetail.Count + 1;
                        listConfig.S_DOC_ListConfigDetail.Add(listDetail);
                    }
                }
                sort++;
                lastSort += 100;
            }
        }
Esempio n. 3
0
 private void _InitSystemAtt(S_DOC_ListConfig listConfig)
 {
     for (int i = 0; i < this.SystemAttrField.Length; i++)
     {
         var systemAttr = this.S_DOC_FileAttr.FirstOrDefault(d => d.FileAttrField == SystemAttrField[i]);
         if (systemAttr != null)
         {
             continue;
         }
         systemAttr = new S_DOC_FileAttr();
         systemAttr.FileAttrField = SystemAttrField[i];
         systemAttr.FileAttrName  = SystemAttrName[i];
         systemAttr.AttrType      = AttrType.System.ToString();
         systemAttr.DataType      = AttrDataType.NVarchar200.ToString();
         systemAttr.ID            = FormulaHelper.CreateGuid(); //IdentityGenerator.CreateID();
         systemAttr.InputType     = ControlType.TextBox.ToString();
         systemAttr.IsEnum        = TrueOrFalse.False.ToString();
         systemAttr.ValidateType  = ValidateType.BortherUnique.ToString();
         systemAttr.Required      = TrueOrFalse.True.ToString();
         systemAttr.Disabled      = TrueOrFalse.False.ToString();
         systemAttr.Visible       = TrueOrFalse.True.ToString();
         systemAttr.VType         = "maxLength:500";
         systemAttr.SpaceID       = this.SpaceID;
         systemAttr.AttrSort      = this.S_DOC_FileAttr.Count == 0 ? 1 : this.S_DOC_FileAttr.Max(d => d.AttrSort) + 1;
         this.S_DOC_FileAttr.Add(systemAttr);
         var listDetail = listConfig.S_DOC_ListConfigDetail.FirstOrDefault(d => d.AttrField == SystemAttrField[i]);
         if (listDetail == null)
         {
             listDetail            = new S_DOC_ListConfigDetail();
             listDetail.AttrField  = SystemAttrField[i];
             listDetail.AttrName   = SystemAttrName[i];
             listDetail.Dispaly    = TrueOrFalse.True.ToString();
             listDetail.AllowSort  = TrueOrFalse.True.ToString();
             listDetail.Align      = Algin.center.ToString();
             listDetail.Width      = 150;
             listDetail.DetailSort = listConfig.S_DOC_ListConfigDetail.Count + 1;
             listConfig.S_DOC_ListConfigDetail.Add(listDetail);
         }
     }
 }
Esempio n. 4
0
        public void AddAtlasConfig(S_DOC_FileAttr item, string type)
        {
            var entity = this.S_DOC_AtlasConfigDetail.FirstOrDefault(d => d.AttrField == item.FileAttrField && d.Type == type);

            if (entity == null)
            {
                entity           = new S_DOC_AtlasConfigDetail();
                entity.AttrField = item.FileAttrField;
                entity.AttrName  = item.FileAttrName;
                entity.Dispaly   = TrueOrFalse.True.ToString();
                if (this.S_DOC_AtlasConfigDetail.Count(d => d.Type == type) > 0)
                {
                    entity.DetailSort = this.S_DOC_AtlasConfigDetail.Where(d => d.Type == type).Max(d => d.DetailSort) + 1;
                }
                else
                {
                    entity.DetailSort = 1;
                }
                entity.Type = type;
                this.S_DOC_AtlasConfigDetail.Add(entity);
            }
        }
Esempio n. 5
0
        public void AddListConfigDetail(S_DOC_FileAttr item)
        {
            var entity = this.ListConfig().S_DOC_ListConfigDetail.FirstOrDefault(d => d.AttrField == item.FileAttrField);

            if (entity == null)
            {
                entity           = new S_DOC_ListConfigDetail();
                entity.AttrField = item.FileAttrField;
                entity.AttrName  = item.FileAttrName;
                entity.AllowSort = TrueOrFalse.True.ToString();
                entity.Align     = Algin.center.ToString();
                entity.Dispaly   = TrueOrFalse.True.ToString();
                entity.Width     = 150;
                if (this.ListConfig().S_DOC_ListConfigDetail.Count > 0)
                {
                    entity.DetailSort = this.ListConfig().S_DOC_ListConfigDetail.Max(d => d.DetailSort) + 1;
                }
                else
                {
                    entity.DetailSort = 1;
                }
                this.ListConfig().S_DOC_ListConfigDetail.Add(entity);
            }
        }
Esempio n. 6
0
        public void SaveNodeAttr(List <Dictionary <string, object> > Attrlist)
        {
            var context    = this.GetDocConfigContext();
            var listconfig = this.ListConfig();
            var sort       = 1;
            var tmpList    = this.S_DOC_FileAttr.Where(a => a.AttrSort < 10000);

            if (tmpList.Count() > 0)
            {
                sort = tmpList.Max(a => a.AttrSort) + 1;
            }
            foreach (var item in Attrlist)
            {
                // if (String.IsNullOrEmpty(item.GetValue("FileAttrField"))) continue;
                if (!item.ContainsKey("FileAttrField") || Tool.IsNullOrEmpty(item["FileAttrField"]))
                {
                    continue;
                }
                string         fileName = item.GetValue("FileAttrField");
                S_DOC_FileAttr entity;
                string         ID = item.GetValue("ID");
                if (!String.IsNullOrEmpty(ID))
                {
                    entity = context.S_DOC_FileAttr.SingleOrDefault(d => d.ID == ID);
                }
                else
                {
                    entity = this.S_DOC_FileAttr.FirstOrDefault(d => d.FileAttrField == fileName);
                    if (entity != null)
                    {
                        throw new Formula.Exceptions.BusinessException("已经存在字段名称为【" + fileName + "】的属性,不能重复添加");
                    }
                }
                if (item.GetValue("IsEnum") == TrueOrFalse.True.ToString() &&
                    string.IsNullOrEmpty(item.GetValue("EnumKey")))
                {
                    throw new Formula.Exceptions.BusinessException("枚举字段【" + item.GetValue("AttrName") + "】必须指定枚举Key");
                }
                if (entity == null)
                {
                    entity          = new S_DOC_FileAttr();
                    entity.ID       = FormulaHelper.CreateGuid();
                    entity.AttrSort = sort;
                    sort++;
                    entity.SpaceID = this.SpaceID;
                    if (String.IsNullOrEmpty(entity.AttrType))
                    {
                        entity.AttrType = AttrType.Custom.ToString();
                    }
                    if (String.IsNullOrEmpty(entity.Visible))
                    {
                        entity.Visible = TrueOrFalse.True.ToString();
                    }
                    if (String.IsNullOrEmpty(entity.Disabled))
                    {
                        entity.Disabled = TrueOrFalse.False.ToString();
                    }
                    if (String.IsNullOrEmpty(entity.FulltextProp))
                    {
                        entity.FulltextProp = TrueOrFalse.False.ToString();
                    }
                    this.S_DOC_FileAttr.Add(entity);
                    //var detail = listconfig.S_DOC_ListConfigDetail.FirstOrDefault(d => d.AttrField == entity.FileAttrField);
                    //if (detail == null)
                    //{
                    //    detail = new S_DOC_ListConfigDetail();
                    //    detail.AttrField = item.GetValue("FileAttrField");// table["FileAttrField"].ToString();
                    //    detail.AttrName = item.GetValue("FileAttrField");
                    //    detail.Dispaly = TrueOrFalse.T.ToString();
                    //    if (this.ListConfig().S_DOC_QueryParam.Count > 0)
                    //        detail.DetailSort = this.ListConfig().S_DOC_QueryParam.Max(d => d.QuerySort) + 1;
                    //    else
                    //        detail.DetailSort = 1;
                    //    detail.Width = 150;
                    //    detail.Align = Algin.center.ToString();
                    //    detail.AllowSort = TrueOrFalse.T.ToString();
                    //    detail.DetailSort = listconfig.S_DOC_ListConfigDetail.Count == 0 ? 1 : listconfig.S_DOC_ListConfigDetail.Max(d => d.DetailSort);
                    //    listconfig.S_DOC_ListConfigDetail.Add(detail);
                    //}
                }
                Tool.UpdateHashtableInstance <S_DOC_FileAttr>(entity, item);
            }
        }