Ejemplo n.º 1
0
        public string GetEditStyleHtml(int tableMetadataId, string attributeName)
        {
            var tableStyle       = EAuxiliaryTableTypeUtils.GetTableStyle(_tableType);
            var styleInfo        = TableStyleManager.GetTableStyleInfo(tableStyle, _tableName, attributeName, null);
            var showPopWinString = ModalTableStyleAdd.GetOpenWindowString(0, _tableName, attributeName, tableStyle, _redirectUrl);

            var editText = "设置";

            if (styleInfo.TableStyleId != 0)//数据库中有样式
            {
                editText = "修改";
            }
            string retval = $"<a href=\"javascript:void 0;\" onClick=\"{showPopWinString}\">{editText}</a>";

            if (styleInfo.TableStyleId == 0)
            {
                return(retval);
            }

            var attributes = new NameValueCollection
            {
                { "DeleteStyle", true.ToString() },
                { "TableMetadataID", tableMetadataId.ToString() },
                { "AttributeName", attributeName }
            };
            var deleteUrl = PageUtils.AddQueryString(_redirectUrl, attributes);

            retval +=
                $@"&nbsp;&nbsp;<a href=""{deleteUrl}"" onClick=""javascript:return confirm('此操作将删除对应显示样式,确认吗?');"">删除</a>";
            return(retval);
        }
Ejemplo n.º 2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _tableName      = Body.GetQueryString("tableName");
            _tableType      = EAuxiliaryTableTypeUtils.GetEnumType(Body.GetQueryString("tableType"));
            _tableStyle     = ETableStyleUtils.GetStyleType(_tableType);
            _redirectUrl    = GetRedirectUrl(_tableName, _tableType);
            _attributeNames = TableManager.GetAttributeNameList(_tableStyle, _tableName);

            if (IsPostBack)
            {
                return;
            }

            BreadCrumbSys(AppManager.Sys.LeftMenu.Auxiliary, $"虚拟字段管理({_tableName})", AppManager.Sys.Permission.SysAuxiliary);

            //删除样式
            if (Body.IsQueryExists("DeleteStyle"))
            {
                DeleteStyle();
            }
            else if (Body.IsQueryExists("SetTaxis"))
            {
                SetTaxis();
            }

            var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, _tableName, new List <int> {
                0
            });

            DgContents.DataSource     = styleInfoList;
            DgContents.ItemDataBound += dgContents_ItemDataBound;
            DgContents.DataBind();

            AddStyle.Attributes.Add("onclick", ModalTableStyleAdd.GetOpenWindowString(0, _tableName, string.Empty, _tableStyle, _redirectUrl));
            AddStyles.Attributes.Add("onclick", ModalTableStylesAdd.GetOpenWindowString(_tableName, _tableStyle, _redirectUrl));
            Import.Attributes.Add("onclick", ModalTableStyleImport.GetOpenWindowString(_tableName, _tableStyle));
            Export.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToSingleTableStyle(_tableStyle, _tableName));
        }
Ejemplo n.º 3
0
        void dgContents_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var styleInfo = (TableStyleInfo)e.Item.DataItem;
                if (_attributeNames.Contains(styleInfo.AttributeName))
                {
                    e.Item.Visible = false;
                    return;
                }

                var ltlAttributeName = (Literal)e.Item.FindControl("ltlAttributeName");
                var ltlDisplayName   = (Literal)e.Item.FindControl("ltlDisplayName");
                var ltlInputType     = (Literal)e.Item.FindControl("ltlInputType");
                var ltlFieldType     = (Literal)e.Item.FindControl("ltlFieldType");
                var ltlIsVisible     = (Literal)e.Item.FindControl("ltlIsVisible");
                var ltlValidate      = (Literal)e.Item.FindControl("ltlValidate");
                var ltlEditStyle     = (Literal)e.Item.FindControl("ltlEditStyle");
                var ltlEditValidate  = (Literal)e.Item.FindControl("ltlEditValidate");
                var upLinkButton     = (HyperLink)e.Item.FindControl("UpLinkButton");
                var downLinkButton   = (HyperLink)e.Item.FindControl("DownLinkButton");

                var showPopWinString = ModalTableMetadataView.GetOpenWindowString(_tableType, _tableName, styleInfo.AttributeName);
                ltlAttributeName.Text = $"<a href=\"javascript:void 0;\" onClick=\"{showPopWinString}\">{styleInfo.AttributeName}</a>";

                ltlDisplayName.Text = styleInfo.DisplayName;
                ltlInputType.Text   = EInputTypeUtils.GetText(EInputTypeUtils.GetEnumType(styleInfo.InputType));
                ltlFieldType.Text   = TableManager.IsAttributeNameExists(_tableStyle, _tableName, styleInfo.AttributeName) ? $"真实 {TableManager.GetTableMetadataDataType(_tableName, styleInfo.AttributeName)}" : "虚拟字段";

                ltlIsVisible.Text = StringUtils.GetTrueOrFalseImageHtml(styleInfo.IsVisible.ToString());
                ltlValidate.Text  = EInputValidateTypeUtils.GetValidateInfo(styleInfo);

                showPopWinString = ModalTableStyleAdd.GetOpenWindowString(styleInfo.TableStyleId, _tableName, styleInfo.AttributeName, _tableStyle, _redirectUrl);
                var editText = "添加";
                if (styleInfo.TableStyleId != 0)//数据库中有样式
                {
                    editText = "修改";
                }
                ltlEditStyle.Text = $"<a href=\"javascript:void 0;\" onClick=\"{showPopWinString}\">{editText}</a>";

                showPopWinString     = ModalTableStyleValidateAdd.GetOpenWindowString(styleInfo.TableStyleId, _tableName, styleInfo.AttributeName, _tableStyle, _redirectUrl);
                ltlEditValidate.Text = $"<a href=\"javascript:void 0;\" onClick=\"{showPopWinString}\">设置</a>";

                if (styleInfo.TableStyleId != 0)//数据库中有样式
                {
                    var urlStyle = PageUtils.GetSysUrl(nameof(PageTableStyle), new NameValueCollection
                    {
                        { "tableName", _tableName },
                        { "tableType", EAuxiliaryTableTypeUtils.GetValue(_tableType) },
                        { "DeleteStyle", true.ToString() },
                        { "AttributeName", styleInfo.AttributeName }
                    });
                    ltlEditStyle.Text +=
                        $@"&nbsp;&nbsp;<a href=""{urlStyle}"" onClick=""javascript:return confirm('此操作将删除对应显示样式,确认吗?');"">删除</a>";
                }

                //if (TableStyleManager.IsMetadata(this.tableStyle, styleInfo.AttributeName) || styleInfo.RelatedIdentity != this.nodeInfo.NodeID)
                //{
                //    isTaxisVisible = false;
                //}
                //else
                //{
                var isTaxisVisible = !TableStyleManager.IsExistsInParents(new List <int> {
                    0
                }, _tableName, styleInfo.AttributeName);
                //}

                if (!isTaxisVisible)
                {
                    upLinkButton.Visible = downLinkButton.Visible = false;
                }
                else
                {
                    var tableMetadataId = BaiRongDataProvider.TableMetadataDao.GetTableMetadataId(styleInfo.TableName, styleInfo.AttributeName);
                    upLinkButton.NavigateUrl = PageUtils.GetSysUrl(nameof(PageTableStyle), new NameValueCollection
                    {
                        { "tableName", _tableName },
                        { "tableType", EAuxiliaryTableTypeUtils.GetValue(_tableType) },
                        { "SetTaxis", true.ToString() },
                        { "TableStyleID", styleInfo.TableStyleId.ToString() },
                        { "Direction", "UP" },
                        { "TableMetadataId", tableMetadataId.ToString() }
                    });
                    downLinkButton.NavigateUrl = PageUtils.GetSysUrl(nameof(PageTableStyle), new NameValueCollection
                    {
                        { "tableName", _tableName },
                        { "tableType", EAuxiliaryTableTypeUtils.GetValue(_tableType) },
                        { "SetTaxis", true.ToString() },
                        { "TableStyleID", styleInfo.TableStyleId.ToString() },
                        { "Direction", "DOWN" },
                        { "TableMetadataId", tableMetadataId.ToString() }
                    });
                }
            }
        }