public void ddlIdentifierType_SelectedIndexChanged(object sender, EventArgs e)
        {
            var identifierType = EGovPublicIdentifierTypeUtils.GetEnumType(ddlIdentifierType.SelectedValue);

            if (identifierType == EGovPublicIdentifierType.Department || identifierType == EGovPublicIdentifierType.Channel)
            {
                phAttributeName.Visible = false;
                phFormatString.Visible  = false;
                phMinLength.Visible     = true;
                phSequence.Visible      = false;
            }
            else if (identifierType == EGovPublicIdentifierType.Sequence)
            {
                phAttributeName.Visible = false;
                phFormatString.Visible  = false;
                phMinLength.Visible     = true;
                phSequence.Visible      = true;
            }
            else if (identifierType == EGovPublicIdentifierType.Attribute)
            {
                phAttributeName.Visible = true;
                phFormatString.Visible  = true;
                phMinLength.Visible     = true;
                phSequence.Visible      = false;
            }
        }
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged         = false;
            var ruleInfoArrayList = DataProvider.GovPublicIdentifierRuleDao.GetRuleInfoArrayList(PublishmentSystemId);

            if (_ruleId > 0)
            {
                try
                {
                    var ruleInfo = DataProvider.GovPublicIdentifierRuleDao.GetIdentifierRuleInfo(_ruleId);
                    ruleInfo.RuleName       = tbRuleName.Text;
                    ruleInfo.IdentifierType = EGovPublicIdentifierTypeUtils.GetEnumType(ddlIdentifierType.SelectedValue);
                    ruleInfo.MinLength      = TranslateUtils.ToInt(tbMinLength.Text);
                    ruleInfo.Suffix         = tbSuffix.Text;
                    ruleInfo.FormatString   = tbFormatString.Text;
                    ruleInfo.AttributeName  = ddlAttributeName.SelectedValue;
                    ruleInfo.Sequence       = TranslateUtils.ToInt(tbSequence.Text);

                    if (ruleInfo.IdentifierType == EGovPublicIdentifierType.Sequence)
                    {
                        ruleInfo.Additional.IsSequenceChannelZero    = TranslateUtils.ToBool(rblIsSequenceChannelZero.SelectedValue);
                        ruleInfo.Additional.IsSequenceDepartmentZero = TranslateUtils.ToBool(rblIsSequenceDepartmentZero.SelectedValue);
                        ruleInfo.Additional.IsSequenceYearZero       = TranslateUtils.ToBool(rblIsSequenceYearZero.SelectedValue);
                    }

                    foreach (GovPublicIdentifierRuleInfo identifierRuleInfo in ruleInfoArrayList)
                    {
                        if (identifierRuleInfo.RuleID == ruleInfo.RuleID)
                        {
                            continue;
                        }
                        if (identifierRuleInfo.IdentifierType != EGovPublicIdentifierType.Attribute && identifierRuleInfo.IdentifierType == ruleInfo.IdentifierType)
                        {
                            FailMessage("规则修改失败,本类型规则只能添加一次!");
                            return;
                        }
                        if (identifierRuleInfo.RuleName == tbRuleName.Text)
                        {
                            FailMessage("规则修改失败,规则名称已存在!");
                            return;
                        }
                    }

                    DataProvider.GovPublicIdentifierRuleDao.Update(ruleInfo);

                    Body.AddSiteLog(PublishmentSystemId, "修改规则", $"规则:{ruleInfo.RuleName}");

                    isChanged = true;
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "规则修改失败!");
                }
            }
            else
            {
                var identifierType = EGovPublicIdentifierTypeUtils.GetEnumType(ddlIdentifierType.SelectedValue);

                foreach (GovPublicIdentifierRuleInfo ruleInfo in ruleInfoArrayList)
                {
                    if (ruleInfo.IdentifierType != EGovPublicIdentifierType.Attribute && ruleInfo.IdentifierType == identifierType)
                    {
                        FailMessage("规则添加失败,本类型规则只能添加一次!");
                        return;
                    }
                    if (ruleInfo.RuleName == tbRuleName.Text)
                    {
                        FailMessage("规则添加失败,规则名称已存在!");
                        return;
                    }
                }

                try
                {
                    var ruleInfo = new GovPublicIdentifierRuleInfo(0, tbRuleName.Text, PublishmentSystemId, identifierType, TranslateUtils.ToInt(tbMinLength.Text), tbSuffix.Text, tbFormatString.Text, ddlAttributeName.SelectedValue, TranslateUtils.ToInt(tbSequence.Text), 0, string.Empty);

                    if (ruleInfo.IdentifierType == EGovPublicIdentifierType.Sequence)
                    {
                        ruleInfo.Additional.IsSequenceChannelZero    = TranslateUtils.ToBool(rblIsSequenceChannelZero.SelectedValue);
                        ruleInfo.Additional.IsSequenceDepartmentZero = TranslateUtils.ToBool(rblIsSequenceDepartmentZero.SelectedValue);
                        ruleInfo.Additional.IsSequenceYearZero       = TranslateUtils.ToBool(rblIsSequenceYearZero.SelectedValue);
                    }

                    DataProvider.GovPublicIdentifierRuleDao.Insert(ruleInfo);

                    Body.AddSiteLog(PublishmentSystemId, "添加规则", $"规则:{ruleInfo.RuleName}");

                    isChanged = true;
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "规则添加失败!");
                }
            }

            if (isChanged)
            {
                PageUtils.CloseModalPageAndRedirect(Page, PageGovPublicIdentifierRule.GetRedirectUrl(PublishmentSystemId));
            }
        }
        public GovPublicIdentifierRuleInfo GetIdentifierRuleInfo(int ruleId)
        {
            GovPublicIdentifierRuleInfo ruleInfo = null;

            var parms = new IDataParameter[]
            {
                GetParameter(ParmRuleId, EDataType.Integer, ruleId)
            };

            using (var rdr = ExecuteReader(SqlSelect, parms))
            {
                if (rdr.Read())
                {
                    var i = 0;
                    ruleInfo = new GovPublicIdentifierRuleInfo(GetInt(rdr, i++), GetString(rdr, i++), GetInt(rdr, i++), EGovPublicIdentifierTypeUtils.GetEnumType(GetString(rdr, i++)), GetInt(rdr, i++), GetString(rdr, i++), GetString(rdr, i++), GetString(rdr, i++), GetInt(rdr, i++), GetInt(rdr, i++), GetString(rdr, i));
                }
                rdr.Close();
            }

            return(ruleInfo);
        }
        public ArrayList GetRuleInfoArrayList(int publishmentSystemId)
        {
            var arraylist = new ArrayList();

            var selectParms = new IDataParameter[]
            {
                GetParameter(ParmPublishmentsystemid, EDataType.Integer, publishmentSystemId)
            };

            using (var rdr = ExecuteReader(SqlSelectAll, selectParms))
            {
                while (rdr.Read())
                {
                    var i        = 0;
                    var ruleInfo = new GovPublicIdentifierRuleInfo(GetInt(rdr, i++), GetString(rdr, i++), GetInt(rdr, i++), EGovPublicIdentifierTypeUtils.GetEnumType(GetString(rdr, i++)), GetInt(rdr, i++), GetString(rdr, i++), GetString(rdr, i++), GetString(rdr, i++), GetInt(rdr, i++), GetInt(rdr, i++), GetString(rdr, i));
                    arraylist.Add(ruleInfo);
                }
                rdr.Close();
            }

            return(arraylist);
        }