示例#1
0
文件: Config.cs 项目: ZQuanLi/Test
        /// <summary>
        /// 微信配置信息
        /// </summary>
        public static void GetSysConfig()
        {
            AliSmsConfig AliSms = new AliSmsConfig();
            ComSmsConfig ComSms = new ComSmsConfig();
            WxConfig     wx     = new WxConfig();
            EmailConfig  em     = new EmailConfig();

            //
            System.Reflection.PropertyInfo[] AliSmsInfo = AliSms.GetType().GetProperties();
            System.Reflection.PropertyInfo[] ComSmsInfo = ComSms.GetType().GetProperties();
            System.Reflection.PropertyInfo[] wxInfo     = wx.GetType().GetProperties();
            System.Reflection.PropertyInfo[] emInfo     = em.GetType().GetProperties();
            DataTable dtConfig = YDS6000.BLL.WholeBLL.GetSysConfig(WebConfig.Ledger, "");

            foreach (DataRow dr in dtConfig.Rows)
            {
                foreach (System.Reflection.PropertyInfo f_key in AliSmsInfo)
                {
                    if (CommFunc.ConvertDBNullToString(dr["CfKey"]).Equals(f_key.Name))
                    {
                        f_key.SetValue(AliSms, dr["CfValue"], null);
                    }
                }
                foreach (System.Reflection.PropertyInfo f_key in ComSmsInfo)
                {
                    if (CommFunc.ConvertDBNullToString(dr["CfKey"]).Equals(f_key.Name))
                    {
                        f_key.SetValue(ComSms, dr["CfValue"], null);
                    }
                }
                foreach (System.Reflection.PropertyInfo f_key in wxInfo)
                {
                    if (CommFunc.ConvertDBNullToString(dr["CfKey"]).Equals(f_key.Name))
                    {
                        f_key.SetValue(wx, dr["CfValue"], null);
                    }
                }
                foreach (System.Reflection.PropertyInfo f_key in emInfo)
                {
                    if (CommFunc.ConvertDBNullToString(dr["CfKey"]).Equals(f_key.Name))
                    {
                        f_key.SetValue(em, dr["CfValue"], null);
                    }
                }
            }
            //SmsFun.ComSmsConfig = ComSms;
            WebConfig.ComSmsConfig  = ComSms;
            SmsFun.AliSmsConfig     = AliSms;
            EmailUtilities.EmConfig = em;
            WebConfig.WxConfig      = wx;
            //
            WxPayAPI.WxPayConfig.APPID        = wx.WxAPPID;
            WxPayAPI.WxPayConfig.MCHID        = wx.WxMCHID;
            WxPayAPI.WxPayConfig.KEY          = wx.WxKEY;
            WxPayAPI.WxPayConfig.APPSECRET    = wx.WxAPPSECRET;
            WxPayAPI.WxPayConfig.Redirect_uri = wx.WxRedirect_uri;
            WxPayAPI.WxPayConfig.LOG_LEVENL   = 3;
        }
示例#2
0
        public int SetComConfig(ComSmsConfig ComConfig)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Clear();
            strSql.Append("insert into sys_config(Ledger,CfKey,CfType,CfValue,Rule)values(@Ledger,'ComSms','Sms',@ComSms,'')");
            strSql.Append("ON DUPLICATE KEY UPDATE CfValue=@ComSms;");
            object obj = SQLHelper.Execute(strSql.ToString(), new { Ledger = this.Ledger, ComSms = ComConfig.ComSms });

            return(CommFunc.ConvertDBNullToInt32(obj));
        }
示例#3
0
        /// <summary>
        /// 设置短信接口信息
        /// </summary>
        /// <param name="AliUrl">APPID</param>
        /// <param name="AliAppKey">商户号</param>
        /// <param name="AliAppSecret">商户支付密钥</param>
        /// <param name="AliSignName">公众号Secert(仅JSAPI支付时需配置)</param>
        /// <param name="AliTemplateCode">公众号回调页面(仅JSAPI支付时需配置)</param>
        /// <param name="ComSms">商户支付密钥</param>
        /// <returns></returns>
        public APIRst SetAliConfig(string AliUrl, string AliAppKey, string AliAppSecret, string AliSignName, string AliTemplateCode, string ComSms)
        {
            APIRst rst = new APIRst();

            try
            {
                if (string.IsNullOrEmpty(AliUrl))
                {
                    throw new Exception(" 请求地址不能为空");
                }
                if (string.IsNullOrEmpty(AliAppKey))
                {
                    throw new Exception(" 应用AppKey不能为空");
                }
                if (string.IsNullOrEmpty(AliAppSecret))
                {
                    throw new Exception(" 密钥不能为空");
                }
                if (string.IsNullOrEmpty(AliSignName))
                {
                    throw new Exception(" 签名名称不能为空");
                }
                if (string.IsNullOrEmpty(AliTemplateCode))
                {
                    throw new Exception(" 模板ID不能为空");
                }

                AliSmsConfig Alisms = new AliSmsConfig();
                Alisms.AliUrl          = AliUrl;
                Alisms.AliAppKey       = AliAppKey;
                Alisms.AliAppSecret    = AliAppSecret;
                Alisms.AliSignName     = AliSignName;
                Alisms.AliTemplateCode = AliTemplateCode;

                rst.data = bll.SetAliConfig(Alisms);

                ComSmsConfig comConfig = new ComSmsConfig();
                comConfig.ComSms = ComSms;
                bll.SetComConfig(comConfig);
                WebConfig.GetSysConfig();
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("系统配置-短信接口信息错误(SetAlarmCfg):" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
示例#4
0
 public int SetComConfig(ComSmsConfig ComConfig)
 {
     return(dal.SetComConfig(ComConfig));
 }