Esempio n. 1
0
        public IControl GetDataGrid(bool needBorrowColumn = false, bool needStateColumn = false, int stateColumnwidth = 80)
        {
            var dataGrid   = new MiniDataGrid();
            var listCofig  = this.S_DOC_Space.S_DOC_ListConfig.FirstOrDefault(d => d.RelationID == this.ID);
            var detailList = listCofig.S_DOC_ListConfigDetail.Where(d => d.Dispaly == "True").OrderBy(d => d.DetailSort).ToList();

            if (needStateColumn)
            {
                MiniGridColumn column = new MiniGridColumn();
                column.Field      = "State";
                column.HeaderText = "状态";
                column.align      = "center"; column.Allowsort = false; column.Width = stateColumnwidth;
                dataGrid.AddControl(column);
            }
            if (needBorrowColumn && this.CanBorrow == "True")
            {
                MiniGridColumn column = new MiniGridColumn();
                column.Field      = "BorrowState";
                column.HeaderText = "是否借出";
                column.align      = "center"; column.Allowsort = false; column.Width = 80;
                dataGrid.AddControl(column);
                MiniGridColumn column2 = new MiniGridColumn();
                column2.Field      = "BorrowDetail";
                column2.HeaderText = "借阅记录";
                column2.align      = "center"; column2.Allowsort = false; column2.Width = 80;
                dataGrid.AddControl(column2);
            }
            foreach (var item in detailList)
            {
                MiniGridColumn column   = new MiniGridColumn();
                var            nodeAttr = this.S_DOC_FileAttr.FirstOrDefault(d => d.FileAttrField == item.AttrField);
                if (nodeAttr == null)
                {
                    continue;
                }
                column.Field      = item.AttrField;
                column.HeaderText = item.AttrName;
                column.align      = item.Align;
                if (item.AllowSort == TrueOrFalse.False.ToString())
                {
                    column.Allowsort = false;
                }
                column.Width = Convert.ToInt32(item.Width);
                if (nodeAttr.DataType == AttrDataType.DateTime.ToString())
                {
                    column.SetAttribute("dateformat", "yyyy-MM-dd");
                }
                dataGrid.AddControl(column);
            }
            return(dataGrid);
        }
Esempio n. 2
0
        //档案空间的项目列表展示
        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") }));
        }