protected override GetBusinessBasisConfigInfoRD ProcessRequest(DTO.Base.APIRequest <GetBusinessBasisConfigInfoRP> pRequest)
        {
            var rd   = new GetBusinessBasisConfigInfoRD();
            var para = pRequest.Parameters;
            var loggingSessionInfo      = new SessionManager().CurrentUserLoginInfo;
            var customerBasicSettingBLL = new CustomerBasicSettingBLL(loggingSessionInfo);

            #region 商户基础信息
            DataRow dr = customerBasicSettingBLL.GetCustomerInfo(loggingSessionInfo.ClientID).Tables[0].Rows[0];
            rd.customer_name = dr["customer_name"].ToString();//商户全称
            //
            var ResultList = customerBasicSettingBLL.GetBusinessBasisConfigInfo(loggingSessionInfo.ClientID);
            //var Data1 = ResultList.FirstOrDefault(m => m.SettingCode.Equals("BusinessLogo"));
            var Data = ResultList.FirstOrDefault(m => m.SettingCode.Equals("CustomerShortName"));
            rd.CustomerShortName = Data == null ? "" : Data.SettingValue; //商户简称
            var Data1 = ResultList.FirstOrDefault(m => m.SettingCode.Equals("WebLogo"));
            rd.WebLogo = Data1 == null ? "" : Data1.SettingValue;         //商户Logo
            var Data2 = ResultList.FirstOrDefault(m => m.SettingCode.Equals("CustomerPhone"));
            rd.CustomerPhone = Data2 == null ? "" : Data2.SettingValue;   //客户电话
            //var Data3 = ResultList.FirstOrDefault(m => m.SettingCode.Equals("ShareTitle"));
            var Data3 = ResultList.FirstOrDefault(m => m.SettingCode.Equals("ForwardingMessageTitle"));
            rd.ForwardingMessageTitle = Data3 == null ? "" : Data3.SettingValue;//分享标题
            //var Data4 = ResultList.FirstOrDefault(m => m.SettingCode.Equals("ShareImageUrl"));
            var Data4 = ResultList.FirstOrDefault(m => m.SettingCode.Equals("ForwardingMessageLogo"));
            rd.ForwardingMessageLogo = Data4 == null ? "" : Data4.SettingValue;//分享图片
            //var Data5 = ResultList.FirstOrDefault(m => m.SettingCode.Equals("ShareContent"));
            var Data5 = ResultList.FirstOrDefault(m => m.SettingCode.Equals("ForwardingMessageSummary"));
            rd.ForwardingMessageSummary = Data5 == null ? "" : Data5.SettingValue; //分享摘要内容
            var Data6 = ResultList.FirstOrDefault(m => m.SettingCode.Equals("GuideLinkUrl"));
            rd.GuideLinkUrl = Data6 == null ? "" : Data6.SettingValue;             //引导链接
            var Data7 = ResultList.FirstOrDefault(m => m.SettingCode.Equals("GuideQRCode"));
            rd.GuideQRCode = Data7 == null ? "" : Data7.SettingValue;              //引导二维码
            var Data8 = ResultList.FirstOrDefault(m => m.SettingCode.Equals("CustomerGreeting"));
            rd.CustomerGreeting = Data8 == null ? "" : Data8.SettingValue;         //欢迎去

            #endregion

            return(rd);
        }
예제 #2
0
        protected override GrantCouponRD ProcessRequest(DTO.Base.APIRequest <GrantCouponRP> pRequest)
        {
            var rd    = new GrantCouponRD();//返回值
            var param = pRequest.Parameters;
            VipCouponMappingBLL bllVipCoupon = new VipCouponMappingBLL(this.CurrentUserInfo);

            try
            {
                var customerBasicSettingBLL = new CustomerBasicSettingBLL(this.CurrentUserInfo);
                var ResultList = customerBasicSettingBLL.GetBusinessBasisConfigInfo(CurrentUserInfo.ClientID);

                rd.CustomerName = ResultList.FirstOrDefault(m => m.SettingCode.Equals("CustomerShortName")) == null ? "" : ResultList.FirstOrDefault(m => m.SettingCode.Equals("CustomerShortName")).SettingValue; //引导二维码
                rd.FollowUrl    = ResultList.FirstOrDefault(m => m.SettingCode.Equals("GuideLinkUrl")) == null ? "" : ResultList.FirstOrDefault(m => m.SettingCode.Equals("GuideLinkUrl")).SettingValue;           //引导链接
                rd.GuideQRCode  = ResultList.FirstOrDefault(m => m.SettingCode.Equals("GuideQRCode")) == null ? "" : ResultList.FirstOrDefault(m => m.SettingCode.Equals("GuideQRCode")).SettingValue;             //引导二维码


                if (bllVipCoupon.HadBeGranted(param.CouponId, param.Giver) == 0)
                {
                    rd.IsAccept  = 1;
                    rd.IsSuccess = false;
                    rd.Message   = "手慢一步,优惠券已被高人领走!";
                    return(rd);
                }
                CouponBLL bll = new CouponBLL(this.CurrentUserInfo);
                DataSet   ds  = bll.GetCouponDetail(pRequest.Parameters.CouponId, "");
                if (ds.Tables != null && ds.Tables.Count > 0 && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["Status"].ToString() == "2")
                {
                    if (bllVipCoupon.GrantCoupon(param.Giver, pRequest.UserID, param.CouponId) > 0)
                    {
                        CouponGrantLogBLL bllCouponGrantLog = new CouponGrantLogBLL(this.CurrentUserInfo);
                        bllCouponGrantLog.Create(new CouponGrantLogEntity()
                        {
                            CouponId = param.CouponId, FromVipId = param.Giver, ToVipId = pRequest.UserID, CouponGrantLogId = Guid.NewGuid()
                        });


                        VipBLL bllVip  = new VipBLL(this.CurrentUserInfo);
                        var    vipInfo = bllVip.GetVipDetailByVipID(param.Giver);
                        rd.IsSuccess = true;
                        rd.Message   = vipInfo.VipName + "赠送你一张" + ds.Tables[0].Rows[0]["CouponName"] + "的优惠券";
                        rd.IsAccept  = 0;
                    }
                    else
                    {
                        rd.IsAccept  = 1;
                        rd.IsSuccess = false;
                        rd.Message   = "领取失败";
                    }
                }
                else
                {
                    rd.IsAccept  = 1;
                    rd.IsSuccess = false;
                    rd.Message   = "优惠券已被使用";
                }
            }
            catch (Exception ex)
            {
                rd.IsAccept  = 0;
                rd.IsSuccess = false;
                rd.Message   = ex.Message.ToString();
                throw;
            }

            return(rd);
        }