示例#1
0
        public void SaveAtlasConfig(List <Dictionary <string, object> > detailList, string type)
        {
            var context = this.GetDocConfigContext();

            foreach (var item in detailList)
            {
                if (!item.ContainsKey("AttrField") || Tool.IsNullOrEmpty(item["AttrField"]))
                {
                    continue;
                }
                string fileName = item.GetValue("AttrField");
                S_DOC_AtlasConfigDetail entity;
                string ID = item.GetValue("ID");
                if (!String.IsNullOrEmpty(ID))
                {
                    int id = Convert.ToInt32(ID);
                    entity = context.S_DOC_AtlasConfigDetail.SingleOrDefault(d => d.ID == id);
                }
                else
                {
                    entity = this.S_DOC_AtlasConfigDetail.FirstOrDefault(d => d.AttrField == fileName && d.Type == type);
                }
                if (entity == null)
                {
                    entity         = new S_DOC_AtlasConfigDetail();
                    entity.Dispaly = TrueOrFalse.True.ToString();
                    if (this.S_DOC_AtlasConfigDetail.Count(a => a.Type == type) > 0)
                    {
                        entity.DetailSort = this.S_DOC_AtlasConfigDetail.Where(a => a.Type == type).Max(d => d.DetailSort) + 1;
                    }
                    else
                    {
                        entity.DetailSort = 1;
                    }
                    this.S_DOC_AtlasConfigDetail.Add(entity);
                }
                Tool.UpdateHashtableInstance <S_DOC_AtlasConfigDetail>(entity, item);
                ;
            }
        }
示例#2
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);
            }
        }