Esempio n. 1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _tableStyleId      = Body.GetQueryInt("TableStyleID");
            _relatedIdentities = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("RelatedIdentities"));
            if (_relatedIdentities.Count == 0)
            {
                _relatedIdentities.Add(0);
            }
            _tableName     = Body.GetQueryString("TableName");
            _attributeName = Body.GetQueryString("AttributeName");
            _tableStyle    = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle"));
            _redirectUrl   = StringUtils.ValueFromUrl(Body.GetQueryString("RedirectUrl"));

            _styleInfo = _tableStyleId != 0 ? BaiRongDataProvider.TableStyleDao.GetTableStyleInfo(_tableStyleId) : TableStyleManager.GetTableStyleInfo(_tableStyle, _tableName, _attributeName, _relatedIdentities);

            if (!IsPostBack)
            {
                RblIsVisible.Items[0].Value = true.ToString();
                RblIsVisible.Items[1].Value = false.ToString();

                RblIsSingleLine.Items[0].Value = true.ToString();
                RblIsSingleLine.Items[1].Value = false.ToString();

                RblIsFormatString.Items[0].Value = true.ToString();
                RblIsFormatString.Items[1].Value = false.ToString();

                DdlIsHorizontal.Items[0].Value = true.ToString();
                DdlIsHorizontal.Items[1].Value = false.ToString();

                EInputTypeUtils.AddListItems(DdlInputType);

                var arraylist = DataProvider.RelatedFieldDao.GetRelatedFieldInfoArrayList(PublishmentSystemId);
                foreach (RelatedFieldInfo rfInfo in arraylist)
                {
                    var listItem = new ListItem(rfInfo.RelatedFieldName, rfInfo.RelatedFieldID.ToString());
                    DdlRelatedFieldId.Items.Add(listItem);
                }

                ERelatedFieldStyleUtils.AddListItems(DdlRelatedFieldStyle);

                if (_styleInfo.TableStyleId != 0 || _attributeName == "IsHot" || _attributeName == "IsRecommend" || _attributeName == "IsColor" || _attributeName == "IsTop")
                {
                    DdlItemType.SelectedValue = false.ToString();
                }
                else
                {
                    DdlItemType.SelectedValue = true.ToString();
                }

                TbAttributeName.Text = _styleInfo.AttributeName;
                TbDisplayName.Text   = _styleInfo.DisplayName;
                TbHelpText.Text      = _styleInfo.HelpText;
                ControlUtils.SelectListItems(DdlInputType, _styleInfo.InputType);
                ControlUtils.SelectListItems(RblIsVisible, _styleInfo.IsVisible.ToString());
                ControlUtils.SelectListItems(RblIsSingleLine, _styleInfo.IsSingleLine.ToString());
                ControlUtils.SelectListItems(RblIsFormatString, _styleInfo.Additional.IsFormatString.ToString());
                TbDefaultValue.Text           = _styleInfo.DefaultValue;
                DdlIsHorizontal.SelectedValue = _styleInfo.IsHorizontal.ToString();
                TbColumns.Text = _styleInfo.Additional.Columns.ToString();

                ControlUtils.SelectListItems(DdlRelatedFieldId, _styleInfo.Additional.RelatedFieldId.ToString());
                ControlUtils.SelectListItems(DdlRelatedFieldStyle, _styleInfo.Additional.RelatedFieldStyle);

                TbHeight.Text = _styleInfo.Additional.Height.ToString();
                TbWidth.Text  = _styleInfo.Additional.Width;

                var styleItems = _styleInfo.StyleItems ?? BaiRongDataProvider.TableStyleDao.GetStyleItemInfoList(_styleInfo.TableStyleId);
                TbItemCount.Text        = styleItems.Count.ToString();
                RptItems.DataSource     = TableStyleManager.GetStyleItemDataSet(styleItems.Count, styleItems);
                RptItems.ItemDataBound += MyRepeater_ItemDataBound;
                RptItems.DataBind();
                if (RptItems.Items.Count > 0)
                {
                    DdlItemType.SelectedValue = false.ToString();
                }
            }

            ReFresh(null, EventArgs.Empty);
        }
Esempio n. 2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _tableStyleId      = AuthRequest.GetQueryInt("TableStyleID");
            _relatedIdentities = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("RelatedIdentities"));
            if (_relatedIdentities.Count == 0)
            {
                _relatedIdentities.Add(0);
            }
            _tableName     = AuthRequest.GetQueryString("TableName");
            _attributeName = AuthRequest.GetQueryString("AttributeName");
            _redirectUrl   = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("RedirectUrl"));

            _styleInfo = _tableStyleId != 0 ? DataProvider.TableStyleDao.GetTableStyleInfo(_tableStyleId) : TableStyleManager.GetTableStyleInfo(_tableName, _attributeName, _relatedIdentities);

            if (IsPostBack)
            {
                return;
            }

            InputTypeUtils.AddListItems(DdlInputType);

            var relatedFieldInfoList = DataProvider.RelatedFieldDao.GetRelatedFieldInfoList(SiteId);

            foreach (var rfInfo in relatedFieldInfoList)
            {
                var listItem = new ListItem(rfInfo.Title, rfInfo.Id.ToString());
                DdlRelatedFieldId.Items.Add(listItem);
            }

            ERelatedFieldStyleUtils.AddListItems(DdlRelatedFieldStyle);

            ControlUtils.SelectSingleItem(DdlIsRapid, _styleInfo.Id != 0 ? false.ToString() : true.ToString());

            TbAttributeName.Text = _styleInfo.AttributeName;
            TbDisplayName.Text   = _styleInfo.DisplayName;
            TbHelpText.Text      = _styleInfo.HelpText;
            ControlUtils.SelectSingleItem(DdlInputType, _styleInfo.InputType.Value);
            TbTaxis.Text = _styleInfo.Taxis.ToString();
            ControlUtils.SelectSingleItem(DdlIsFormatString, _styleInfo.Additional.IsFormatString.ToString());
            TbDefaultValue.Text           = _styleInfo.DefaultValue;
            DdlIsHorizontal.SelectedValue = _styleInfo.IsHorizontal.ToString();
            TbColumns.Text = _styleInfo.Additional.Columns.ToString();

            ControlUtils.SelectSingleItem(DdlRelatedFieldId, _styleInfo.Additional.RelatedFieldId.ToString());
            ControlUtils.SelectSingleItem(DdlRelatedFieldStyle, _styleInfo.Additional.RelatedFieldStyle);

            TbHeight.Text = _styleInfo.Additional.Height == 0 ? string.Empty : _styleInfo.Additional.Height.ToString();
            TbWidth.Text  = _styleInfo.Additional.Width;

            var styleItems = _styleInfo.StyleItems ?? DataProvider.TableStyleItemDao.GetStyleItemInfoList(_styleInfo.Id);

            TbItemCount.Text        = styleItems.Count.ToString();
            RptItems.DataSource     = GetDataSource(styleItems.Count, styleItems);
            RptItems.ItemDataBound += RptItems_ItemDataBound;
            RptItems.DataBind();

            var isSelected  = false;
            var isNotEquals = false;
            var list        = new List <string>();

            foreach (var item in styleItems)
            {
                list.Add(item.ItemValue);
                if (item.IsSelected)
                {
                    isSelected = true;
                }
                if (item.ItemValue != item.ItemTitle)
                {
                    isNotEquals = true;
                }
            }

            DdlIsRapid.SelectedValue = (!isSelected && !isNotEquals).ToString();
            TbRapidValues.Text       = string.Join(",", list);

            TbCustomizeLeft.Text  = _styleInfo.Additional.CustomizeLeft;
            TbCustomizeRight.Text = _styleInfo.Additional.CustomizeRight;

            ReFresh(null, EventArgs.Empty);
        }