コード例 #1
0
        public void AddQueryParam(S_DOC_NodeAttr item)
        {
            var entity = this.ListConfig().S_DOC_QueryParam.FirstOrDefault(d => d.AttrField == item.AttrField);

            if (entity == null)
            {
                entity                 = new S_DOC_QueryParam();
                entity.AttrField       = item.AttrField;
                entity.AttrName        = item.AttrName;
                entity.InKey           = TrueOrFalse.False.ToString();
                entity.InnerField      = item.AttrField;
                entity.InAdvancedQuery = TrueOrFalse.True.ToString();
                entity.QueryType       = QueryType.LK.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);
            }
        }
コード例 #2
0
        public void SaveNodeAttr(List <Dictionary <string, object> > Attrlist)
        {
            var listconfig = this.ListConfig();

            foreach (var item in Attrlist)
            {
                var context = this.GetDocConfigContext();
                if (!item.ContainsKey("AttrField") || Tool.IsNullOrEmpty(item["AttrField"]))
                {
                    continue;
                }
                string         fileName = item.GetValue("AttrField");
                S_DOC_NodeAttr entity;
                string         ID = item.GetValue("ID");
                if (!String.IsNullOrEmpty(ID))
                {
                    entity = context.S_DOC_NodeAttr.SingleOrDefault(d => d.ID == ID);
                }
                else
                {
                    entity = this.S_DOC_NodeAttr.FirstOrDefault(d => d.AttrField == 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_NodeAttr();
                    entity.ID       = FormulaHelper.CreateGuid();
                    entity.AttrSort = this.S_DOC_NodeAttr.Count + 1;
                    entity.SpaceID  = this.SpaceID;
                    if (String.IsNullOrEmpty(entity.AttrType))
                    {
                        entity.AttrType = Logic.Domain.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_NodeAttr.Add(entity);
                }
                Tool.UpdateHashtableInstance <S_DOC_NodeAttr>(entity, item);
            }
        }
コード例 #3
0
ファイル: S_C_Node.cs プロジェクト: tianzhifeng/EPC
        private void _InitSystemAtt(S_DOC_ListConfig listConfig)
        {
            var sort     = 1;
            var lastSort = 10000;
            var tmpList  = this.S_DOC_NodeAttr.Where(a => a.AttrSort < 10000);

            if (tmpList.Count() > 0)
            {
                sort = tmpList.Max(a => a.AttrSort) + 1;
            }
            foreach (var item in S_DOC_Space.DefaultNodeAttrArray)
            {
                var systemAttr = this.S_DOC_NodeAttr.FirstOrDefault(a => a.AttrField == item.AttrField);
                if (systemAttr != null)
                {
                    continue;
                }
                systemAttr = new S_DOC_NodeAttr
                {
                    ID           = FormulaHelper.CreateGuid(),
                    AttrField    = item.AttrField,
                    AttrName     = item.AttrName,
                    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_NodeAttr.Add(systemAttr);
                if (item.AttrField == "Name")
                {
                    var listDetail = listConfig.S_DOC_ListConfigDetail.FirstOrDefault(d => d.AttrField == item.AttrField);
                    if (listDetail == null)
                    {
                        listDetail            = new S_DOC_ListConfigDetail();
                        listDetail.AttrField  = item.AttrField;
                        listDetail.AttrName   = item.AttrName;
                        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;
            }
        }
コード例 #4
0
 private void _InitSystemAtt(S_DOC_ListConfig listConfig)
 {
     for (int i = 0; i < this.SystemAttrField.Length; i++)
     {
         var systemAttr = this.S_DOC_NodeAttr.FirstOrDefault(d => d.AttrField == SystemAttrField[i]);
         if (systemAttr != null)
         {
             continue;
         }
         systemAttr              = new S_DOC_NodeAttr();
         systemAttr.AttrField    = SystemAttrField[i];
         systemAttr.AttrName     = SystemAttrName[i];
         systemAttr.AttrType     = AttrType.System.ToString();
         systemAttr.DataType     = AttrDataType.NVarchar200.ToString();
         systemAttr.ID           = FormulaHelper.CreateGuid();
         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;
         this.S_DOC_NodeAttr.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);
         }
     }
 }
コード例 #5
0
        public void AddListConfigDetail(S_DOC_NodeAttr item)
        {
            var entity = this.ListConfig().S_DOC_ListConfigDetail.FirstOrDefault(d => d.AttrField == item.AttrField);

            if (entity == null)
            {
                entity           = new S_DOC_ListConfigDetail();
                entity.AttrName  = item.AttrName;
                entity.AttrField = item.AttrField;
                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);
            }
        }