Exemplo n.º 1
0
        /// <summary>
        /// 特殊车型附加安装费开关控制
        /// </summary>
        /// <param name="isOpen"></param>
        /// <returns></returns>
        public bool UpdateVehicleAdditionalPriceSwitch(bool isOpen)
        {
            var result = false;

            try
            {
                var switchStatus = dbScopeManagerConfigRead.Execute(conn => DalBaoYangInstallFeeConfig.IsExistVehicleAdditionalPriceSwitch(conn));
                if (string.IsNullOrWhiteSpace(switchStatus))
                {
                    result = dbScopeManagerConfig.Execute(conn => DalBaoYangInstallFeeConfig.AddVehicleAdditionalPriceSwitch(conn, isOpen));
                }
                else
                {
                    result = dbScopeManagerConfig.Execute(conn => DalBaoYangInstallFeeConfig.UpdateVehicleAdditionalPriceSwitch(conn, isOpen));
                }
                if (result)
                {
                    RefreshVehicleAdditionalPriceCache();
                }
            }
            catch (Exception ex)
            {
                Logger.Error("UpdateVehicleAdditionalPriceSwitch", ex);
            }
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取特殊车型附加安装费开关状态
        /// </summary>
        /// <returns></returns>
        public bool GetVehicleAdditionalPriceSwitchStatus()
        {
            var status    = true;
            var switchXml = dbScopeManagerConfigRead.Execute(conn => DalBaoYangInstallFeeConfig.IsExistVehicleAdditionalPriceSwitch(conn));

            if (!string.IsNullOrWhiteSpace(switchXml))
            {
                var xmlDoc = new XmlDocument();
                xmlDoc.LoadXml(switchXml);
                var node = xmlDoc.SelectSingleNode("Switch");
                Boolean.TryParse(node.InnerText, out status);
            }
            return(status);
        }