Beispiel #1
0
        private void ShowInfo()
        {
            var weixin = GetWeiXinCode();
            lblWeixinName.Text = weixin.WxName;
            lblAppid.Text = weixin.AppId;

            var wxpayBll = new PaymentService();
            var model = wxpayBll.GetModelByAppId(weixin.Id);
            if (model == null || model.Id == 0)
            {
                //新增记录
            }
            else
            {
                //修改
                hidId.Value = model.Id.ToString();
                this.txtmch_id.Text = model.MchId;
                this.txtpaykey.Text = model.Paykey;
                this.txtcertInfoPath.Text = model.CertInfoPath;
                this.txtcerInfoPwd.Text = model.CerInfoPwd;

            }
            var propertyBll = new PropertyService(new PropertyRepository());
            var propertyEntity = propertyBll.GetModelByIName(weixin.Id, MXEnums.WXPropertyKeyName.OpenOauth.ToString());
            if (propertyEntity != null)
            {
                radOpenOAuth.SelectedValue = propertyEntity.iContent;
                hidOpenOauthId.ID = propertyEntity.Id.ToString();
            }
        }
Beispiel #2
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            var wxpayBll = new PaymentService();
            int id = MyCommFun.Obj2Int(hidId.Value, 0);
            var wxpayModel = new PaymentInfo();
            var weixin = GetWeiXinCode();
            if (id == 0)
            {
                //新增

                wxpayModel.AppId = weixin.Id;
                wxpayModel.CreateDate = DateTime.Now;
            }
            else
            {
                //修改
                wxpayModel = wxpayBll.GetModel(id);
            }

            wxpayModel.MchId = txtmch_id.Text.Trim();
            wxpayModel.Paykey = txtpaykey.Text.Trim();
            wxpayModel.CertInfoPath = txtcertInfoPath.Text.Trim();
            wxpayModel.CerInfoPwd = txtcerInfoPwd.Text.Trim();

            bool ret = false;
            if (id == 0)
            {
                wxpayModel.CreateDate = DateTime.Now;
                int retNum = wxpayBll.Add(wxpayModel);
                if (retNum > 0)
                {
                    ret = true;
                }
            }
            else
            {
                ret = wxpayBll.Update(wxpayModel);
            }

            //OpenOAuth开启
            var propertyBll = new PropertyService(new PropertyRepository());
            string pValue = radOpenOAuth.SelectedItem.Value;
            propertyBll.AddProperty(weixin.Id, MXEnums.WXPropertyKeyName.OpenOauth.ToString(), pValue);

            if (ret)
            {
                JscriptMsg("修改信息成功!", "baseSetting.aspx", "Success");
            }
            else
            {
                JscriptMsg("修改信息成功!", "", "Error");
                return;
            }

        }