public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _ruleId = TranslateUtils.ToInt(Request.QueryString["RuleID"]);

            if (!IsPostBack)
            {
                EGovPublicIdentifierTypeUtils.AddListItems(ddlIdentifierType);

                var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.GovPublicContent, PublishmentSystemInfo.AuxiliaryTableForGovPublic, null);
                foreach (var tableStyleInfo in styleInfoList)
                {
                    if (tableStyleInfo.AttributeName == ContentAttribute.Title || tableStyleInfo.AttributeName == GovPublicContentAttribute.Content || tableStyleInfo.AttributeName == GovPublicContentAttribute.DepartmentId || tableStyleInfo.AttributeName == GovPublicContentAttribute.Description || tableStyleInfo.AttributeName == GovPublicContentAttribute.ImageUrl || tableStyleInfo.AttributeName == GovPublicContentAttribute.FileUrl || tableStyleInfo.AttributeName == GovPublicContentAttribute.Identifier || tableStyleInfo.AttributeName == GovPublicContentAttribute.Keywords || tableStyleInfo.AttributeName == GovPublicContentAttribute.DocumentNo || tableStyleInfo.AttributeName == GovPublicContentAttribute.Publisher)
                    {
                        continue;
                    }
                    ddlAttributeName.Items.Add(new ListItem(tableStyleInfo.DisplayName + "(" + tableStyleInfo.AttributeName + ")", tableStyleInfo.AttributeName));
                }
                EBooleanUtils.AddListItems(rblIsSequenceChannelZero);
                EBooleanUtils.AddListItems(rblIsSequenceDepartmentZero);
                EBooleanUtils.AddListItems(rblIsSequenceYearZero);

                ControlUtils.SelectListItemsIgnoreCase(rblIsSequenceChannelZero, true.ToString());
                ControlUtils.SelectListItemsIgnoreCase(rblIsSequenceDepartmentZero, false.ToString());
                ControlUtils.SelectListItemsIgnoreCase(rblIsSequenceYearZero, true.ToString());

                if (_ruleId > 0)
                {
                    var ruleInfo = DataProvider.GovPublicIdentifierRuleDao.GetIdentifierRuleInfo(_ruleId);
                    if (ruleInfo != null)
                    {
                        tbRuleName.Text = ruleInfo.RuleName;
                        ControlUtils.SelectListItems(ddlIdentifierType, EGovPublicIdentifierTypeUtils.GetValue(ruleInfo.IdentifierType));
                        ControlUtils.SelectListItems(ddlAttributeName, ruleInfo.AttributeName);
                        tbMinLength.Text    = ruleInfo.MinLength.ToString();
                        tbFormatString.Text = ruleInfo.FormatString;
                        tbSuffix.Text       = ruleInfo.Suffix;
                        tbSequence.Text     = ruleInfo.Sequence.ToString();

                        ControlUtils.SelectListItemsIgnoreCase(rblIsSequenceChannelZero, ruleInfo.Additional.IsSequenceChannelZero.ToString());
                        ControlUtils.SelectListItemsIgnoreCase(rblIsSequenceDepartmentZero, ruleInfo.Additional.IsSequenceDepartmentZero.ToString());
                        ControlUtils.SelectListItemsIgnoreCase(rblIsSequenceYearZero, ruleInfo.Additional.IsSequenceYearZero.ToString());
                    }
                }

                ddlIdentifierType.SelectedIndexChanged += ddlIdentifierType_SelectedIndexChanged;
                ddlIdentifierType_SelectedIndexChanged(null, EventArgs.Empty);
            }
        }
Ejemplo n.º 2
0
        public void Update(GovPublicIdentifierRuleInfo ruleInfo)
        {
            var parms = new IDataParameter[]
            {
                GetParameter(ParmRuleName, EDataType.NVarChar, 255, ruleInfo.RuleName),
                GetParameter(ParmIdentifierType, EDataType.VarChar, 50, EGovPublicIdentifierTypeUtils.GetValue(ruleInfo.IdentifierType)),
                GetParameter(ParmMinLength, EDataType.Integer, ruleInfo.MinLength),
                GetParameter(ParmSuffix, EDataType.VarChar, 50, ruleInfo.Suffix),
                GetParameter(ParmFormatString, EDataType.VarChar, 50, ruleInfo.FormatString),
                GetParameter(ParmAttributeName, EDataType.VarChar, 50, ruleInfo.AttributeName),
                GetParameter(ParmSequence, EDataType.Integer, ruleInfo.Sequence),
                GetParameter(ParmSettingsXml, EDataType.NText, ruleInfo.Additional.ToString()),
                GetParameter(ParmRuleId, EDataType.Integer, ruleInfo.RuleID)
            };

            ExecuteNonQuery(SqlUpdate, parms);
        }
Ejemplo n.º 3
0
        public void Insert(GovPublicIdentifierRuleInfo ruleInfo)
        {
            var taxis = GetMaxTaxis(ruleInfo.PublishmentSystemID) + 1;

            var sqlInsert = "INSERT INTO wcm_GovPublicIdentifierRule (RuleName, PublishmentSystemID, IdentifierType, MinLength, Suffix, FormatString, AttributeName, Sequence, Taxis, SettingsXML) VALUES (@RuleName, @PublishmentSystemID, @IdentifierType, @MinLength, @Suffix, @FormatString, @AttributeName, @Sequence, @Taxis, @SettingsXML)";

            var parms = new IDataParameter[]
            {
                GetParameter(ParmRuleName, EDataType.NVarChar, 255, ruleInfo.RuleName),
                GetParameter(ParmPublishmentsystemid, EDataType.Integer, ruleInfo.PublishmentSystemID),
                GetParameter(ParmIdentifierType, EDataType.VarChar, 50, EGovPublicIdentifierTypeUtils.GetValue(ruleInfo.IdentifierType)),
                GetParameter(ParmMinLength, EDataType.Integer, ruleInfo.MinLength),
                GetParameter(ParmSuffix, EDataType.VarChar, 50, ruleInfo.Suffix),
                GetParameter(ParmFormatString, EDataType.VarChar, 50, ruleInfo.FormatString),
                GetParameter(ParmAttributeName, EDataType.VarChar, 50, ruleInfo.AttributeName),
                GetParameter(ParmSequence, EDataType.Integer, ruleInfo.Sequence),
                GetParameter(ParmTaxis, EDataType.Integer, taxis),
                GetParameter(ParmSettingsXml, EDataType.NText, ruleInfo.Additional.ToString())
            };

            ExecuteNonQuery(sqlInsert, parms);
        }