예제 #1
0
        protected override ChangeVipPWDRD ProcessRequest(DTO.Base.APIRequest <ChangeVipPWDRP> pRequest)
        {
            ChangeVipPWDRD rd = new ChangeVipPWDRD();

            pRequest.Parameters.Validate();

            #region 验证用户
            var bll    = new VipBLL(base.CurrentUserInfo);
            var entity = bll.GetByID(pRequest.Parameters.VipID);
            if (entity != null)
            {
                if (entity.VipPasswrod != pRequest.Parameters.SourcePWD)
                {
                    throw new APIException("原密码错误")
                          {
                              ErrorCode = ERROR_LOGGIN_PWD
                          };
                }
                else
                {
                    entity.VipPasswrod = pRequest.Parameters.NewPWD;
                    bll.Update(entity);
                }
            }
            else
            {
                throw new APIException("用户不存在")
                      {
                          ErrorCode = ERROR_LOGGIN_NOUSER
                      };
            }
            #endregion

            return(rd);
        }
예제 #2
0
 /// <summary>
 /// 获取我的卡包
 /// </summary>
 /// <param name="pRequest"></param>
 /// <returns></returns>
 public string GetCardBag(string pRequest)
 {
     try
     {
         string cloudCustomerId = ConfigurationManager.AppSettings["CloudCustomerId"];//云店标识
         var    rp = pRequest.DeserializeJSONTo <APIRequest <EmptyRequestParameter> >();
         var    loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID);
         var    vipBll             = new VipBLL(loggingSessionInfo);
         var    vipInfo            = vipBll.GetByID(rp.UserID);
         string userId             = string.Empty;
         var    rd = new CardBagRD();
         if (vipInfo != null)
         {
             if (!string.IsNullOrEmpty(vipInfo.WeiXinUserId))
             {
                 DataSet dsVip = vipBll.GetCardBag(vipInfo.WeiXinUserId, cloudCustomerId);
                 if (dsVip.Tables[0].Rows.Count > 0)
                 {
                     rd.CardBagList = DataTableToObject.ConvertToList <CardBag>(dsVip.Tables[0]);
                 }
             }
         }
         var rsp = new SuccessResponse <IAPIResponseData>(rd);
         return(rsp.ToJSON());
     }
     catch (Exception ex)
     {
         throw new APIException(ex.Message);
     }
 }
예제 #3
0
        /// <summary>
        /// 获取用户是否注册接口
        /// </summary>
        public string GetIsRegistered()
        {
            string content  = string.Empty;
            var    respData = new GetIsRegisteredRespData();

            try
            {
                string reqContent = Request["ReqContent"];
                var    reqObj     = reqContent.DeserializeJSONTo <Default.ReqData>();

                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format("GetIsRegistered: {0}", reqContent)
                });

                var loggingSessionInfo = Default.GetLjLoggingSession();
                Default.WriteLog(loggingSessionInfo, "GetIsRegistered", reqObj, respData, reqObj.ToJSON());

                respData.content = new GetIsRegisteredRespContentData();
                VipBLL vipBLL = new VipBLL(loggingSessionInfo);
                var    obj    = vipBLL.GetByID(reqObj.common.userId);
                if (obj != null && obj.Status == 2)
                {
                    respData.content.IsRegistered = 1;
                }
            }
            catch (Exception ex)
            {
                respData.code        = "103";
                respData.description = "数据库操作错误";
                respData.exception   = ex.ToString();
            }
            content = respData.ToJSON();
            return(content);
        }
예제 #4
0
        /// <summary>
        /// 获取列表
        /// </summary>
        public string GetListData()
        {
            var service = new VipEnterpriseExpandBLL(new SessionManager().CurrentUserLoginInfo);
            var vipBLL  = new VipBLL(new SessionManager().CurrentUserLoginInfo);
            IList <VipEnterpriseExpandEntity> data = new List <VipEnterpriseExpandEntity>();
            string content = string.Empty;

            string key = "";

            if (Request("pid") != null && Request("pid") != string.Empty)
            {
                key = Request("pid").ToString().Trim();
            }
            data = service.GetAll();

            if (data != null)
            {
                foreach (var item in data)
                {
                    item.Vip     = vipBLL.GetByID(item.VipId);
                    item.VipName = item.Vip.VipName + "(" + item.Position + ")";
                }
            }

            var jsonData = new JsonData();

            jsonData.totalCount = data.Count.ToString();
            jsonData.data       = data;

            content = jsonData.ToJSON();
            return(content);
        }
        /// <summary>
        /// 查询
        /// </summary>
        public string GetVipData()
        {
            var    vipBLL     = new VipBLL(CurrentUserInfo);
            var    vipCardBLL = new VipCardBLL(CurrentUserInfo);
            string content    = string.Empty;
            var    respData   = new VipRespData();

            var VipCardCode = FormatParamValue(Request("VipCardNumber"));
            var VipName     = FormatParamValue(Request("VipName"));
            var CarCode     = FormatParamValue(Request("CarNumber"));

            string vipId     = "";
            string vipCardId = "";

            var vipCardEntity = vipCardBLL.SearchTopVipCard(new VipCardEntity()
            {
                VipCardCode = VipCardCode,
                VipName     = VipName,
                CarCode     = CarCode
            });

            vipId     = vipCardEntity.VipId;
            vipCardId = vipCardEntity.VipCardID;

            respData.VipData     = vipBLL.GetByID(vipId);
            respData.VipCardData = vipCardEntity;

            content = respData.ToJSON();
            return(content);
        }
예제 #6
0
        /// <summary>
        /// 更新会员信息
        /// </summary>
        /// <returns></returns>
        public string UpdateUserInfo()
        {
            string content  = string.Empty;
            var    respData = new ambassadorLoginInRespData();

            try
            {
                //接收参数
                string reqContent = HttpContext.Current.Request["ReqContent"];
                var    reqObj     = reqContent.DeserializeJSONTo <ambassadorLoginInReqData>();
                reqObj = reqObj == null ? new ambassadorLoginInReqData() : reqObj;

                //获取客户ID
                if (!string.IsNullOrEmpty(reqObj.common.customerId))
                {
                    customerId = reqObj.common.customerId;
                }

                //初始化返回对象
                respData.content         = new ambassadorLoginInRespContentData();
                respData.content.vipList = new List <ambassadorLoginInRespContentDataItem>();

                //用户登录信息
                var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");

                VipBLL    vipBLL = new VipBLL(loggingSessionInfo);
                VipEntity entity = new VipEntity();

                //是否有此人
                var vip = vipBLL.Query(new IWhereCondition[] {
                    new EqualsCondition()
                    {
                        FieldName = "VipID", Value = reqObj.special.vipID
                    },
                    new EqualsCondition()
                    {
                        FieldName = "ClientID", Value = customerId
                    }
                }, null).FirstOrDefault();

                if (vip != null)
                {
                    entity                = vipBLL.GetByID(vip.VIPID);
                    entity.Col16          = reqObj.special.remark;
                    entity.LastUpdateTime = DateTime.Now;
                    vipBLL.Update(entity);
                }
                respData.code        = "200";
                respData.description = "操作成功";
            }
            catch (Exception ex)
            {
                respData.code        = "103";
                respData.description = "数据库操作错误";
                respData.exception   = ex.ToString();
            }
            content = respData.ToJSON();
            return(content);
        }
예제 #7
0
        /// <summary>
        /// 设置用户token信息
        /// </summary>
        /// <param name="UserId">用户标识</param>
        /// <param name="AccessToken">token不存在</param>
        private void SetAccessToken(string UserId, string AccessToken, LoggingSessionInfo loggingSessionInfo, string resultErrorUrl)
        {
            try
            {
                if (UserId == null || UserId.Trim().Equals(""))
                {
                    Loggers.Debug(new DebugLogInfo()
                    {
                        Message = string.Format("新浪回调页面2-用户标识为空")
                    });
                }
                Response.Write("设置用户token信息1");
                #region 处理业务
                #region 判断用户是否存在会员表中
                VipBLL    vipServer = new VipBLL(loggingSessionInfo);
                VipEntity vipInfo   = vipServer.GetByID(UserId);
                if (vipInfo == null || vipInfo.VIPID == null || vipInfo.VIPID.Equals(""))
                {
                    vipInfo.VIPID    = UserId;
                    vipInfo.VipCode  = vipServer.GetVipCode();
                    vipInfo.ClientID = loggingSessionInfo.CurrentUser.customer_id;
                    vipInfo.Status   = 1;
                    vipServer.Create(vipInfo);
                }
                #endregion
                #region 判断用户是否存在会员的新浪微博扩展表中
                VipExpandSinaWbBLL    vipSinaWbServer = new VipExpandSinaWbBLL(loggingSessionInfo);
                VipExpandSinaWbEntity vipSinaWbInfo   = new VipExpandSinaWbEntity();
                vipSinaWbInfo = vipSinaWbServer.GetByID(UserId);
                if (vipSinaWbInfo != null && vipSinaWbInfo.VipId != null && !vipSinaWbInfo.VipId.Equals(""))
                {
                    vipSinaWbInfo.AccessToken = AccessToken;
                    vipSinaWbServer.Update(vipSinaWbInfo, false);
                }
                else
                {
                    VipExpandSinaWbEntity vipSinaWbInfo1 = new VipExpandSinaWbEntity();
                    vipSinaWbInfo1.VipId       = UserId;
                    vipSinaWbInfo1.AccessToken = AccessToken;
                    vipSinaWbServer.Create(vipSinaWbInfo1);
                }
                #endregion
                #endregion

                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format("新浪回调页面3-设置用户信息成功.")
                });
            }
            catch (Exception ex)
            {
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format("新浪回调页面4-错误信息提示 {0}:" + ex.ToString())
                });
                Response.Write(ex.ToString());
            }
        }
예제 #8
0
        /// <summary>
        /// 用户接受协议成为分经销商
        /// </summary>
        /// <param name="pRequest"></param>
        /// <returns></returns>
        public string SetPreRetailTraderToNomal(string pRequest)
        {
            var rp = pRequest.DeserializeJSONTo <APIRequest <RetailTraderRP> >();

            if (string.IsNullOrEmpty(rp.UserID))
            {
                throw new APIException("缺少参数【UserID】或参数值为空")
                      {
                          ErrorCode = 135
                      };
            }
            var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, "1");
            var RetailTraderBLL    = new RetailTraderBLL(loggingSessionInfo);
            var VipBLL             = new VipBLL(loggingSessionInfo);

            var Data = RetailTraderBLL.GetByID(rp.UserID);

            if (Data == null)
            {
                throw new APIException("参数【rp.Parameters.RetailTraderID】错误找不到对应经销商")
                      {
                          ErrorCode = 136
                      };
            }
            var vipData = VipBLL.GetByID(Data.MultiLevelSalerFromVipId);

            if (vipData != null)
            {
                if (!string.IsNullOrWhiteSpace(vipData.SetoffUserId))//经销商二维码扫码关注的会员,成为经销商时,自动被集客
                {
                    DataSet ds = RetailTraderBLL.GetMultiLevelBeAddNode(vipData.SetoffUserId);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        Data.HigheRetailTraderID = ds.Tables[0].Rows[0]["BeAddNode"].ToString();
                        if (ds.Tables[0].Rows[0]["BeAddNodeFlag"] != DBNull.Value)
                        {
                            int Flag = Convert.ToInt32(ds.Tables[0].Rows[0]["BeAddNodeFlag"]);
                            if (Flag == 1)//添加经销商拓展节点记录
                            {
                                var T_HierarchySystemExNodeBLL = new T_HierarchySystemExNodeBLL(loggingSessionInfo);
                                T_HierarchySystemExNodeBLL.AddHierarchySystemExNode(Data.RetailTraderID);
                            }
                        }
                    }
                }
            }
            Data.Status = "1";

            RetailTraderBLL.Update(Data);
            var response = new EmptyRD();
            var rsp      = new SuccessResponse <IAPIResponseData>(response);

            return(rsp.ToJSON());
        }
예제 #9
0
        protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <UpdateVipRP> pRequest)
        {
            var rd   = new EmptyResponseData();
            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            //会员
            var VipBLL = new VipBLL(loggingSessionInfo);


            try
            {
                VipEntity UpData = VipBLL.GetByID(para.VipID);
                if (UpData == null)
                {
                    throw new APIException("会员不存在!")
                          {
                              ErrorCode = ERROR_CODES.INVALID_REQUEST_LACK_REQUEST_PARAMETER
                          }
                }
                ;


                //UpData.VipName = para.VipName;
                UpData.VipRealName = para.VipName;
                UpData.Phone       = para.Phone;

                if (!string.IsNullOrWhiteSpace(para.Col22))
                {
                    if (para.Col22.Equals("Y"))
                    {
                        UpData.Birthday = para.Birthday;
                        UpData.Col22    = "N";
                    }
                }
                UpData.Gender   = para.Gender;
                UpData.IDNumber = para.IDNumber;

                VipBLL.Update(UpData);
            }
            catch (APIException apiEx)
            {
                throw new APIException(apiEx.ErrorCode, apiEx.Message);
            }


            return(rd);
        }
예제 #10
0
        protected override EmptyResponseData ProcessRequest(APIRequest <CancelPosOrderRP> pRequest)
        {
            var rp             = pRequest.Parameters;
            var rd             = new EmptyResponseData();
            var vipBll         = new VipBLL(CurrentUserInfo);            //会员业务实例化
            var inoutBLL       = new T_InoutBLL(CurrentUserInfo);
            var vipIntegralBLL = new VipIntegralBLL(CurrentUserInfo);    //积分BLL实例化



            var count = RedisOpenAPI.Instance.CCOrderReward().GetOrderRewardLength(new CC_OrderReward
            {
                CustomerID = CurrentUserInfo.ClientID,
            });

            if (count.Result > 0)
            {
                throw new APIException("队列正在运行,请稍后再试。。")
                      {
                          ErrorCode = 100
                      };
            }


            //获取订单信息
            var inoutInfo = inoutBLL.GetInoutInfo(rp.OrderId, CurrentUserInfo);

            if (inoutInfo == null)
            {
                throw new APIException("未找到该订单信息")
                      {
                          ErrorCode = 101
                      };
            }
            //获取会员信息
            var vipInfo = vipBll.GetByID(inoutInfo.vip_no);

            //处理积分、余额、返现和优惠券
            vipBll.ProcSetCancelOrder(CurrentUserInfo.ClientID, rp.OrderId, pRequest.UserID);
            //取消订单奖励
            vipIntegralBLL.CancelReward(inoutInfo, vipInfo, null);

            return(rd);
        }
예제 #11
0
        protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <SetSalesReturnRP> pRequest)
        {
            var rd   = new EmptyResponseData();
            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var salesReturnBLL     = new T_SalesReturnBLL(loggingSessionInfo);
            var historyBLL         = new T_SalesReturnHistoryBLL(loggingSessionInfo);
            var vipBll             = new VipBLL(loggingSessionInfo);
            var salesReturnEntity  = salesReturnBLL.GetByID(para.SalesReturnID);
            var vipEntity          = vipBll.GetByID(CurrentUserInfo.UserID);
            var pTran = salesReturnBLL.GetTran();//事务

            using (pTran.Connection)
            {
                try
                {
                    if (salesReturnEntity != null)
                    {
                        salesReturnEntity.Status = 2;   //取消申请
                        salesReturnBLL.Update(salesReturnEntity, pTran);

                        var historyEntity = new T_SalesReturnHistoryEntity()
                        {
                            SalesReturnID = salesReturnEntity.SalesReturnID,
                            OperationType = 2,
                            OperationDesc = "取消申请",
                            OperatorID    = CurrentUserInfo.UserID,
                            HisRemark     = "取消申请",
                            OperatorName  = vipEntity.VipName,
                            OperatorType  = 0
                        };
                        historyBLL.Create(historyEntity, pTran);
                    }
                }
                catch (Exception ex)
                {
                    pTran.Rollback();//回滚事务
                    throw new APIException(ex.Message);
                }
            }
            return(rd);
        }
예제 #12
0
        protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <SetVipDealerRP> pRequest)
        {
            var rd     = new EmptyResponseData();
            var VipBLL = new VipBLL(CurrentUserInfo);

            bool Flag = VipBLL.IsSetVipDealer(pRequest.UserID);

            try
            {
                if (Flag)
                {
                    VipEntity Entity = VipBLL.GetByID(pRequest.UserID);
                    if (Entity != null)
                    {
                        Entity.Col48 = "1";
                        VipBLL.Update(Entity);
                    }
                    else
                    {
                        throw new APIException("会员不存在!")
                              {
                                  ErrorCode = 103
                              };
                    }
                }
                else
                {
                    //var Result = VipBLL.GetSetVipDealerUpset();
                    throw new APIException("您当前会员卡等级不符合!")
                          {
                              ErrorCode = 105
                          };
                }
            }
            catch (Exception ex)
            {
                throw new APIException(ex.Message);
            }

            return(rd);
        }
예제 #13
0
        /// <summary>
        /// 根据会员ID获取会员信息
        /// </summary>
        public string GetVipInfoById()
        {
            var       service = new VipBLL(CurrentUserInfo);
            VipEntity vip     = new VipEntity();
            string    content = string.Empty;

            string key = string.Empty;

            if (Request("VipID") != null && Request("VipID") != string.Empty)
            {
                key = Request("VipID").ToString().Trim();
            }

            vip = service.GetByID(key);

            var jsonData = new JsonData();

            jsonData.totalCount = vip == null ? "0" : "1";
            jsonData.data       = vip;

            content = jsonData.ToJSON();
            return(content);
        }
예제 #14
0
        /// <summary>
        /// 添加会员
        /// </summary>
        /// <returns></returns>
        public string GenerateQR()
        {
            string content  = string.Empty;
            var    respData = new ambassadorLoginInRespData();

            try
            {
                //接收参数
                string reqContent = HttpContext.Current.Request["ReqContent"];
                var    reqObj     = reqContent.DeserializeJSONTo <ambassadorLoginInReqData>();
                reqObj = reqObj == null ? new ambassadorLoginInReqData() : reqObj;

                //获取客户ID
                if (!string.IsNullOrEmpty(reqObj.common.customerId))
                {
                    customerId = reqObj.common.customerId;
                }

                //初始化返回对象
                respData.content         = new ambassadorLoginInRespContentData();
                respData.content.vipList = new List <ambassadorLoginInRespContentDataItem>();

                //用户登录信息
                var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");

                VipBLL    vipBLL = new VipBLL(loggingSessionInfo);
                VipEntity entity = new VipEntity();

                //是否有此人
                var vip = vipBLL.Query(new IWhereCondition[] {
                    new EqualsCondition()
                    {
                        FieldName = "VipID", Value = reqObj.common.userId
                    },
                    new EqualsCondition()
                    {
                        FieldName = "ClientID", Value = customerId
                    }
                }, null).FirstOrDefault();

                if (vip != null)
                {
                    string QRCode = null;
                    if (!string.IsNullOrEmpty(vip.Col6))
                    {
                        QRCode = vip.Col6;
                    }
                    if (reqObj.special.generater)
                    {
                        QRCode                = GeneratedQR(reqObj.special.url, vip.VIPID);
                        entity                = vipBLL.GetByID(vip.VIPID);
                        entity.Col6           = QRCode;
                        entity.LastUpdateTime = DateTime.Now;
                        vipBLL.Update(entity);
                    }
                    else
                    {
                        QRCode                = GeneratedQR(reqObj.special.url, vip.VIPID);
                        entity                = vipBLL.GetByID(vip.VIPID);
                        entity.Col6           = QRCode;
                        entity.LastUpdateTime = DateTime.Now;
                        vipBLL.Update(entity);
                    }
                    List <ambassadorLoginInRespContentDataItem> list = new List <ambassadorLoginInRespContentDataItem>();
                    ambassadorLoginInRespContentDataItem        info = new ambassadorLoginInRespContentDataItem();
                    info.VipID           = vip.VIPID;
                    info.VipName         = vip.VipName;
                    info.Phone           = vip.Phone;
                    info.DeliveryAddress = vip.DeliveryAddress;
                    info.VipRealName     = vip.VipRealName;
                    info.QRCode          = QRCode;
                    info.Code            = vip.Col4;

                    list.Add(info);

                    respData.content.vipList = list;
                }
            }
            catch (Exception ex)
            {
                respData.code        = "103";
                respData.description = "数据库操作错误";
                respData.exception   = ex.ToString();
            }
            content = respData.ToJSON();
            return(content);
        }
예제 #15
0
        /// <summary>
        /// 根据用户发送的二维码去二维码表中VipDCode匹配
        /// </summary>
        /// <param name="content"></param>
        /// <param name="vipID"></param>
        public void StoreRebate(string content, string vipID)
        {
            content = content.Trim();
            BaseService.WriteLogWeixin("返利信息:" + content);

            VipDCodeBLL          bll            = new VipDCodeBLL(requestParams.LoggingSessionInfo);
            WXSalesPolicyRateBLL SalesPolicybll = new WXSalesPolicyRateBLL(requestParams.LoggingSessionInfo);

            //var tran = bll.GetTran();
            try
            {
                //判断当前发送二维码的微信号是否是 二维码表中当前二维码Code的会员 VipId=vipID;
                //var temp = bll.QueryByEntity(new VipDCodeEntity { IsDelete = 0, DCodeId = content}, null);
                var     temp         = bll.GetByID(content);
                decimal?ReturnAmount = 0;
                string  PushInfo     = string.Empty;
                //using (tran.Connection)
                //{
                if (temp != null)   //如果可以匹配,则更新二维码表中的会员ID,OpenId
                {
                    #region 1.更新返现金额。更新返现状态
                    VipDCodeEntity entity = new VipDCodeEntity();
                    entity = temp;
                    DataSet ds = SalesPolicybll.getReturnAmount(Convert.ToDecimal(entity.SalesAmount), entity.CustomerId);
                    if (ds != null && ds.Tables[0].Rows.Count == 0 && ds.Tables[1].Rows.Count == 0)
                    {
                        BaseService.WriteLogWeixin("该客户没有配置策略信息");

                        throw new Exception("该客户没有配置策略信息");
                    }
                    if (ds != null && ds.Tables[0].Rows.Count > 0)
                    {
                        //返现金额
                        ReturnAmount = entity.ReturnAmount = Convert.ToDecimal(ds.Tables[0].Rows[0]["ReturnAmount"].ToString());
                        //返现消息内容
                        PushInfo = ds.Tables[0].Rows[0]["PushInfo"].ToString();

                        BaseService.WriteLogWeixin("PushInfo1:" + PushInfo);
                    }
                    else
                    {
                        //返现金额
                        ReturnAmount = entity.ReturnAmount = Convert.ToDecimal(ds.Tables[1].Rows[0]["ReturnAmount"].ToString());
                        //返现消息内容
                        PushInfo = ds.Tables[1].Rows[0]["PushInfo"].ToString();

                        BaseService.WriteLogWeixin("PushInfo2:" + PushInfo);
                    }

                    entity.OpenId       = requestParams.OpenId;
                    entity.VipId        = vipID;
                    entity.ReturnAmount = ReturnAmount;
                    VipAmountBLL Amountbll = new VipAmountBLL(requestParams.LoggingSessionInfo);

                    var vipBll = new VipBLL(requestParams.LoggingSessionInfo);

                    var vipEntity = vipBll.GetByID(vipID);


                    string strErrormessage = "";
                    if (entity.IsReturn != 1)  //当未返现的时候金额变更
                    {
                        Loggers.Debug(new DebugLogInfo()
                        {
                            Message = "begin update VipDcode:"
                        });

                        if (Amountbll.SetVipAmountChange(entity.CustomerId, 2, vipID, ReturnAmount ?? 0, entity.ObjectId, "门店返现", "IN", out strErrormessage))
                        {
                            entity.IsReturn = 1;
                            entity.DCodeId  = content;
                            bll.Update(entity); //更新返现金额

                            Loggers.Debug(new DebugLogInfo()
                            {
                                Message = "update VipDcode success"
                            });
                        }
                    }

                    #endregion



                    var     vipamountBll    = new VipAmountBLL(requestParams.LoggingSessionInfo);
                    var     vipAmountEntity = vipamountBll.GetByID(vipID);
                    decimal endAmount       = 0;
                    if (vipAmountEntity != null)
                    {
                        endAmount = vipAmountEntity.EndAmount ?? 0;
                    }
                    var message = PushInfo.Replace("#SalesAmount#", entity.SalesAmount.ToString()).Replace("#ReturnAmount#", Convert.ToDecimal(ReturnAmount).ToString("0.00")).Replace("#EndAmount#", endAmount.ToString("0.00")).Replace("#VipName#", vipEntity.VipName);

                    #region 插入门店返现推送消息日志表
                    WXSalesPushLogBLL    PushLogbll = new WXSalesPushLogBLL(requestParams.LoggingSessionInfo);
                    WXSalesPushLogEntity pushLog    = new WXSalesPushLogEntity();
                    pushLog.LogId    = Guid.NewGuid();
                    pushLog.WinXin   = requestParams.WeixinId;
                    pushLog.OpenId   = requestParams.OpenId;
                    pushLog.VipId    = vipID;
                    pushLog.PushInfo = message;
                    pushLog.DCodeId  = content;
                    pushLog.RateId   = Guid.NewGuid();
                    PushLogbll.Create(pushLog);
                    #endregion
                    Loggers.Debug(new DebugLogInfo()
                    {
                        Message = message
                    });
                    string code = JIT.CPOS.BS.BLL.WX.CommonBLL.SendWeixinMessage(message, "1", requestParams.LoggingSessionInfo, vipEntity);

                    Loggers.Debug(new DebugLogInfo()
                    {
                        Message = "消息推送完成,code=" + code + ", message=" + message
                    });

                    #region 增加抽奖信息
                    var rateList = SalesPolicybll.QueryByEntity(new WXSalesPolicyRateEntity {
                        CustomerId = temp.CustomerId
                    }, null);
                    if (rateList == null || rateList.Length == 0)
                    {
                        //rateList = SalesPolicybll.QueryByEntity(new WXSalesPolicyRateEntity{CustomerId =null},null);
                        rateList = SalesPolicybll.GetWxSalesPolicyRateList().ToArray();
                    }

                    if (rateList != null && rateList.Length > 0)
                    {
                        var wxSalespolicyRateMapBll = new WXSalesPolicyRateObjectMappingBLL(requestParams.LoggingSessionInfo);

                        var rateMappingEntity =
                            wxSalespolicyRateMapBll.QueryByEntity(new WXSalesPolicyRateObjectMappingEntity {
                            RateId = rateList[0].RateId
                        }, null);
                        if (rateMappingEntity != null && rateMappingEntity.Length > 0)
                        {
                            if (Convert.ToDecimal(temp.SalesAmount) >= rateMappingEntity[0].CoefficientAmount)
                            {
                                if (rateMappingEntity[0].PushInfo != null)
                                {
                                    var eventMessage = rateMappingEntity[0].PushInfo.Replace("#CustomerId#", temp.CustomerId).Replace("#EventId#", rateMappingEntity[0].ObjectId).Replace("#VipId#", vipID).Replace("#OpenId#", vipEntity.WeiXinUserId);


                                    BaseService.WriteLogWeixin("微信推送的抽奖活动URL:" + eventMessage);

                                    WXSalesPushLogEntity qrLog = new WXSalesPushLogEntity();
                                    qrLog.LogId    = Guid.NewGuid();
                                    qrLog.WinXin   = requestParams.WeixinId;
                                    qrLog.OpenId   = requestParams.OpenId;
                                    qrLog.VipId    = vipID;
                                    qrLog.PushInfo = eventMessage;
                                    qrLog.DCodeId  = content;
                                    qrLog.RateId   = Guid.NewGuid();
                                    PushLogbll.Create(qrLog);

                                    #region 增加抽奖机会

                                    LEventsVipObjectBLL    eventbll    = new LEventsVipObjectBLL(requestParams.LoggingSessionInfo);
                                    LEventsVipObjectEntity evententity = new LEventsVipObjectEntity();
                                    evententity.MappingId   = Guid.NewGuid().ToString();
                                    evententity.EventId     = rateMappingEntity[0].ObjectId;
                                    evententity.VipId       = vipID;
                                    evententity.ObjectId    = "";
                                    evententity.IsCheck     = 0;
                                    evententity.LotteryCode = "0";
                                    evententity.IsLottery   = 0;
                                    eventbll.Create(evententity);
                                    #endregion

                                    JIT.CPOS.BS.BLL.WX.CommonBLL.SendWeixinMessage(eventMessage, "1", requestParams.LoggingSessionInfo, vipEntity);
                                }
                            }
                        }
                    }
                    #endregion
                }
                // }
            }
            catch (Exception)
            {
                // tran.Rollback();
                throw;
            }
        }
예제 #16
0
        public string SendWeixinMessage(string pRequest)
        {
            var rd = new EmptyResponseData();


            var rp = pRequest.DeserializeJSONTo <APIRequest <SendWeixinMessageRP> >();
            var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, "1");

            var orderId = rp.Parameters.OrderId;

            var tInoutBll = new TInoutBLL(loggingSessionInfo);

            var tInoutEntity = tInoutBll.GetByID(orderId);

            if (tInoutEntity == null)
            {
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = orderId + "无效的订单ID;"
                });
                return(rd.ToJSON());
            }
            var vipBll = new VipBLL(loggingSessionInfo);

            var vipEntity = vipBll.GetByID(rp.UserID);

            if (vipEntity == null)
            {
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = rp.UserID + "无效的会员ID;"
                });
                return(rd.ToJSON());
            }


            var message = "亲爱的 " + vipEntity.VipName + "您好,感谢您选择花间堂!您的订单【" + tInoutEntity.OrderNo
                          + "】已收到,正在玩命确认中。您可以进入个人中心页面随时关注订单状态,如有疑问请致电4000 767 123。";

            string code = JIT.CPOS.BS.BLL.WX.CommonBLL.SendWeixinMessage(message, "1", loggingSessionInfo, vipEntity);

            Loggers.Debug(new DebugLogInfo()
            {
                Message = "消息推送完成,code=" + code + ", message=" + message
            });
            switch (code)
            {
            case "103":
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = vipEntity.VipName + "未查询到匹配的公众账号信息;"
                });
                break;

            case "203":
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = vipEntity.VipName + "发送失败;"
                });
                break;

            default:
                break;
            }

            var rsp = new SuccessResponse <IAPIResponseData>(rd);

            return(rsp.ToJSON());
        }
        public void InsertDataBase(string strCustomerId, string strVipId, string strObjectId, string strSource, CC_Coupon coupon)
        {
            try
            {
                string customerCon = GetCustomerConn(strCustomerId);

                LoggingSessionInfo loggingSessionInfo    = new LoggingSessionInfo();
                LoggingManager     CurrentLoggingManager = new LoggingManager();
                loggingSessionInfo.ClientID                = strCustomerId;
                CurrentLoggingManager.Connection_String    = customerCon;
                loggingSessionInfo.CurrentLoggingManager   = CurrentLoggingManager;
                loggingSessionInfo.CurrentUser             = new BS.Entity.User.UserInfo();
                loggingSessionInfo.CurrentUser.customer_id = strCustomerId;

                DataTable dtCoupon = new DataTable();
                dtCoupon.Columns.Add("CouponID", typeof(string));
                dtCoupon.Columns.Add("CouponCode", typeof(string));
                dtCoupon.Columns.Add("CouponDesc", typeof(string));
                dtCoupon.Columns.Add("BeginDate", typeof(DateTime));
                dtCoupon.Columns.Add("EndDate", typeof(DateTime));
                dtCoupon.Columns.Add("CouponUrl", typeof(string));
                dtCoupon.Columns.Add("ImageUrl", typeof(string));
                dtCoupon.Columns.Add("Status", typeof(Int32));
                dtCoupon.Columns.Add("CreateTime", typeof(DateTime));
                dtCoupon.Columns.Add("CreateBy", typeof(string));
                dtCoupon.Columns.Add("LastUpdateTime", typeof(DateTime));
                dtCoupon.Columns.Add("LastUpdateBy", typeof(string));
                dtCoupon.Columns.Add("IsDelete", typeof(Int32));
                dtCoupon.Columns.Add("CouponTypeID", typeof(string));
                dtCoupon.Columns.Add("CoupnName", typeof(string));
                dtCoupon.Columns.Add("DoorID", typeof(string));
                dtCoupon.Columns.Add("CouponPwd", typeof(string));
                dtCoupon.Columns.Add("CollarCardMode", typeof(string));
                dtCoupon.Columns.Add("CustomerID", typeof(string));
                DataTable dtVipCoupon = new DataTable();
                dtVipCoupon.Columns.Add("VipCouponMapping", typeof(string));
                dtVipCoupon.Columns.Add("VIPID", typeof(string));
                dtVipCoupon.Columns.Add("CouponID", typeof(string));
                dtVipCoupon.Columns.Add("UrlInfo", typeof(string));
                dtVipCoupon.Columns.Add("IsDelete", typeof(Int32));
                dtVipCoupon.Columns.Add("LastUpdateBy", typeof(string));
                dtVipCoupon.Columns.Add("LastUpdateTime", typeof(DateTime));
                dtVipCoupon.Columns.Add("CreateBy", typeof(string));
                dtVipCoupon.Columns.Add("CreateTime", typeof(DateTime));
                dtVipCoupon.Columns.Add("FromVipId", typeof(string));
                dtVipCoupon.Columns.Add("ObjectId", typeof(string));
                dtVipCoupon.Columns.Add("CouponSourceId", typeof(string));

                RedisCouponBLL redisCouponBLL = new RedisCouponBLL();
                var            response       = redisCouponBLL.RedisGetCoupon(coupon);


                if (response.Code == ResponseCode.Success && response.Result.CouponTypeId != null)
                {
                    //String uperStr = StringUtil.GetRandomUperStr(4);
                    //String strInt = StringUtil.GetRandomStrInt(8);
                    //string strCouponCode = uperStr + "-" + strInt;
                    string strCouponCode = string.Empty;
                    strCouponCode = GetCouponNum(loggingSessionInfo, strCustomerId);
                    string strCouponId = Guid.NewGuid().ToString();

                    DataRow dr_Coupon = dtCoupon.NewRow();
                    dr_Coupon["CouponID"]   = strCouponId;
                    dr_Coupon["CouponCode"] = strCouponCode;
                    dr_Coupon["CouponDesc"] = response.Result.CouponTypeDesc;
                    if (response.Result.ServiceLife > 0)
                    {
                        dr_Coupon["BeginDate"] = DateTime.Now;
                        dr_Coupon["EndDate"]   = DateTime.Now.Date.AddDays(response.Result.ServiceLife - 1).ToShortDateString() + " 23:59:59.998";
                    }
                    else
                    {
                        dr_Coupon["BeginDate"] = response.Result.BeginTime;
                        dr_Coupon["EndDate"]   = response.Result.EndTime;
                    }
                    dr_Coupon["CouponUrl"]      = "";
                    dr_Coupon["ImageUrl"]       = "";
                    dr_Coupon["Status"]         = 2;
                    dr_Coupon["CreateTime"]     = DateTime.Now;
                    dr_Coupon["CreateBy"]       = "Redis";
                    dr_Coupon["LastUpdateTime"] = DateTime.Now;
                    dr_Coupon["LastUpdateBy"]   = "Redis";
                    dr_Coupon["IsDelete"]       = 0;
                    dr_Coupon["CouponTypeID"]   = response.Result.CouponTypeId;
                    dr_Coupon["CoupnName"]      = response.Result.CouponTypeName;
                    dr_Coupon["DoorID"]         = "";
                    dr_Coupon["CouponPwd"]      = "";
                    dr_Coupon["CollarCardMode"] = "";
                    dr_Coupon["CustomerID"]     = strCustomerId;
                    dtCoupon.Rows.Add(dr_Coupon);

                    DataRow dr_VipCoupon = dtVipCoupon.NewRow();
                    dr_VipCoupon["VipCouponMapping"] = Guid.NewGuid().ToString().Replace("-", "");
                    dr_VipCoupon["VIPID"]            = strVipId;
                    dr_VipCoupon["CouponID"]         = strCouponId;
                    dr_VipCoupon["UrlInfo"]          = "";
                    dr_VipCoupon["IsDelete"]         = 0;
                    dr_VipCoupon["LastUpdateBy"]     = "Redis";
                    dr_VipCoupon["LastUpdateTime"]   = DateTime.Now;
                    dr_VipCoupon["CreateBy"]         = "Redis";
                    dr_VipCoupon["CreateTime"]       = DateTime.Now;
                    dr_VipCoupon["FromVipId"]        = "";
                    dr_VipCoupon["ObjectId"]         = strObjectId;
                    dr_VipCoupon["CouponSourceId"]   = GetSourceId(strSource);


                    dtVipCoupon.Rows.Add(dr_VipCoupon);
                    if (strSource != "Activity")
                    {
                        try
                        {
                            ///优惠券到账通知
                            var CommonBLL = new CommonBLL();
                            var bllVip    = new VipBLL(loggingSessionInfo);
                            var vip       = bllVip.GetByID(strVipId);

                            string strValidityData = Convert.ToDateTime(dr_Coupon["BeginDate"].ToString()).ToShortDateString() + "-" + Convert.ToDateTime(dr_Coupon["EndDate"].ToString()).ToShortDateString();
                            CommonBLL.CouponsArrivalMessage(response.Result.CouponCode, response.Result.CouponTypeName, strValidityData, response.Result.CouponCategory == null ? "" : response.Result.CouponCategory, vip.WeiXinUserId, loggingSessionInfo);
                        }
                        catch (Exception ex)
                        {
                            BaseService.WriteLog("优惠券到账通知异常:" + ex.Message);
                        }
                    }
                }

                if (dtCoupon != null && dtCoupon.Rows.Count > 0)
                {
                    SqlBulkCopy(customerCon, dtCoupon, "Coupon");

                    var bllCouponType = new CouponTypeBLL(loggingSessionInfo);
                    bllCouponType.UpdateCouponTypeIsVoucher(strCustomerId);
                }
                if (dtVipCoupon != null && dtVipCoupon.Rows.Count > 0)
                {
                    SqlBulkCopy(customerCon, dtVipCoupon, "VipCouponMapping");
                }
            }
            catch (Exception ex)
            {
                BaseService.WriteLog("vip绑定优惠券异常" + ex.Message);
            }
            BaseService.WriteLog("---------------------------vip绑定优惠券结束---------------------------");
        }
        /// <summary>
        /// 批量
        /// </summary>
        public void InsertDataBase()
        {
            BaseService.WriteLog("---------------------------vip绑定优惠券开始---------------------------");

            var numCount    = 30;
            var customerIDs = CustomerBLL.Instance.GetCustomerList();

            foreach (var customer in customerIDs)
            {
                try
                {
                    LoggingSessionInfo loggingSessionInfo = CustomerBLL.Instance.GetBSLoggingSession(customer.Key, "RedisSystem");

                    DataTable dtCoupon = CreateTableCoupon();

                    DataTable dtVipCoupon = CreateTableVipCoupon();

                    var count = RedisOpenAPI.Instance.CCVipMappingCoupon().GetVipMappingCouponLength(new CC_VipMappingCoupon
                    {
                        CustomerId = customer.Key
                    });
                    if (count.Code != ResponseCode.Success)
                    {
                        BaseService.WriteLog("从redis获取待绑定优惠券数量失败");
                        continue;
                    }
                    if (count.Result <= 0)
                    {
                        continue;
                    }
                    BaseService.WriteLog("优惠券redis取数据:" + customer.Key);
                    if (count.Result < numCount)
                    {
                        numCount = Convert.ToInt32(count.Result);
                    }

                    for (var i = 0; i < numCount; i++)
                    {
                        BaseService.WriteLog("---------------------------vip绑定优惠券长度:" + count.Result.ToString());
                        var response = RedisOpenAPI.Instance.CCVipMappingCoupon().GetVipMappingCoupon(new CC_VipMappingCoupon
                        {
                            CustomerId = customer.Key
                        });
                        if (response.Code == ResponseCode.Success)
                        {
                            DataRow dr_Coupon = dtCoupon.NewRow();
                            dr_Coupon["CouponID"]   = response.Result.Coupon.CouponId;
                            dr_Coupon["CouponCode"] = response.Result.Coupon.CouponCode;
                            dr_Coupon["CouponDesc"] = response.Result.Coupon.CouponTypeDesc;
                            if (response.Result.Coupon.ServiceLife > 0)
                            {
                                dr_Coupon["BeginDate"] = DateTime.Now;
                                dr_Coupon["EndDate"]   = DateTime.Now.Date.AddDays(response.Result.Coupon.ServiceLife - 1).ToShortDateString() + " 23:59:59.998";
                            }
                            else
                            {
                                dr_Coupon["BeginDate"] = response.Result.Coupon.BeginTime;
                                dr_Coupon["EndDate"]   = response.Result.Coupon.EndTime;
                            }
                            dr_Coupon["CouponUrl"]      = "";
                            dr_Coupon["ImageUrl"]       = "";
                            dr_Coupon["Status"]         = 2;
                            dr_Coupon["CreateTime"]     = DateTime.Now;
                            dr_Coupon["CreateBy"]       = "Redis";
                            dr_Coupon["LastUpdateTime"] = DateTime.Now;
                            dr_Coupon["LastUpdateBy"]   = "Redis";
                            dr_Coupon["IsDelete"]       = 0;
                            dr_Coupon["CouponTypeID"]   = response.Result.Coupon.CouponTypeId;
                            dr_Coupon["CoupnName"]      = response.Result.Coupon.CouponTypeName;
                            dr_Coupon["DoorID"]         = "";
                            dr_Coupon["CouponPwd"]      = "";
                            dr_Coupon["CollarCardMode"] = "";
                            dr_Coupon["CustomerID"]     = customer.Key;
                            dtCoupon.Rows.Add(dr_Coupon);

                            DataRow dr_VipCoupon = dtVipCoupon.NewRow();
                            dr_VipCoupon["VipCouponMapping"] = Guid.NewGuid().ToString().Replace("-", "");
                            dr_VipCoupon["VIPID"]            = response.Result.VipId;
                            dr_VipCoupon["CouponID"]         = response.Result.Coupon.CouponId;
                            dr_VipCoupon["UrlInfo"]          = "";
                            dr_VipCoupon["IsDelete"]         = 0;
                            dr_VipCoupon["LastUpdateBy"]     = "Redis";
                            dr_VipCoupon["LastUpdateTime"]   = DateTime.Now;
                            dr_VipCoupon["CreateBy"]         = "Redis";
                            dr_VipCoupon["CreateTime"]       = DateTime.Now;
                            dr_VipCoupon["FromVipId"]        = "";
                            dr_VipCoupon["ObjectId"]         = response.Result.ObjectId;
                            dr_VipCoupon["CouponSourceId"]   = GetSourceId(response.Result.Source);
                            dtVipCoupon.Rows.Add(dr_VipCoupon);
//活动或者虚拟商品发优惠券,不发通知
                            if (response.Result.Source != "Activity" && response.Result.Source != "PayVirtualItem")
                            {//会员活动延迟发送
                                try
                                {
                                    ///优惠券到账通知
                                    var CommonBLL = new CommonBLL();
                                    var bllVip    = new VipBLL(loggingSessionInfo);
                                    var vip       = bllVip.GetByID(response.Result.VipId);

                                    string strValidityData = Convert.ToDateTime(dr_Coupon["BeginDate"].ToString()).ToShortDateString() + "-" + Convert.ToDateTime(dr_Coupon["EndDate"].ToString()).ToShortDateString();
                                    CommonBLL.CouponsArrivalMessage(response.Result.Coupon.CouponCode, response.Result.Coupon.CouponTypeName, strValidityData, response.Result.Coupon.CouponCategory == null ? "" : response.Result.Coupon.CouponCategory, vip.WeiXinUserId, loggingSessionInfo);
                                }
                                catch (Exception ex)
                                {
                                    BaseService.WriteLog("优惠券到账通知异常:" + ex.Message);
                                    continue;
                                }
                            }
                        }
                    }
                    if (dtCoupon != null && dtCoupon.Rows.Count > 0)
                    {
                        SqlBulkCopy(customer.Value, dtCoupon, "Coupon");
                        var bllCouponType = new CouponTypeBLL(loggingSessionInfo);
                        bllCouponType.UpdateCouponTypeIsVoucher(customer.Key);
                        BaseService.WriteLog("批量插入Coupon:");
                    }
                    if (dtVipCoupon != null && dtVipCoupon.Rows.Count > 0)
                    {
                        SqlBulkCopy(customer.Value, dtVipCoupon, "VipCouponMapping");
                        BaseService.WriteLog("批量插入VipCouponMapping:");
                    }
                    //BaseService.WriteLog("延迟时间开始");
                    //Thread.Sleep(1000);
                    //BaseService.WriteLog("延迟时间结束");
                }
                catch (Exception ex)
                {
                    BaseService.WriteLog("vip绑定优惠券异常" + ex.Message);
                    continue;
                }
            }
            BaseService.WriteLog("---------------------------vip绑定优惠券结束---------------------------");
        }
예제 #19
0
        protected override EmptyResponseData ProcessRequest(APIRequest <SetVipAmountRP> pRequest)
        {
            var rd   = new EmptyResponseData();
            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; //登录状态信息
            var vipAmountBLL       = new VipAmountBLL(loggingSessionInfo);
            var vipAmountDetailBLL = new VipAmountDetailBLL(loggingSessionInfo);
            var objectImagesBLL    = new ObjectImagesBLL(loggingSessionInfo);    //图片表业务对象实例化
            var unitBLL            = new t_unitBLL(loggingSessionInfo);

            var vipBLL = new VipBLL(loggingSessionInfo);

            var vipInfo  = vipBLL.GetByID(para.VipID);
            var unitInfo = unitBLL.GetByID(loggingSessionInfo.CurrentUserRole.UnitId);
            var pTran    = vipAmountBLL.GetTran(); //事务

            var vipAmountEntity = vipAmountBLL.QueryByEntity(new VipAmountEntity()
            {
                VipId = vipInfo.VIPID, VipCardCode = vipInfo.VipCode
            }, null).FirstOrDefault();

            using (pTran.Connection)
            {
                try
                {
                    var amountDetail = new VipAmountDetailEntity()
                    {
                        Amount         = para.Amount,
                        AmountSourceId = para.AmountSourceID,
                        ObjectId       = "",
                        Reason         = para.Reason,
                        Remark         = para.Remark
                    };
                    string vipAmountDetailId = string.Empty;
                    if (para.AmountSourceID == "23")
                    {      //人工调整余额
                        vipAmountDetailId = vipAmountBLL.AddVipAmount(vipInfo, unitInfo, ref vipAmountEntity, amountDetail, pTran, loggingSessionInfo);

                        if (!string.IsNullOrWhiteSpace(vipAmountDetailId))
                        {//发送微信账户余额变动模板消息
                            var CommonBLL = new CommonBLL();
                            CommonBLL.BalanceChangedMessage("人工调整", vipAmountEntity, amountDetail, vipInfo.WeiXinUserId, vipInfo.VIPID, loggingSessionInfo);
                        }
                    }
                    else if (para.AmountSourceID == "24")
                    {  //人工调整返现
                        vipAmountDetailId = vipAmountBLL.AddReturnAmount(vipInfo, unitInfo, vipAmountEntity, ref amountDetail, pTran, loggingSessionInfo);
                        if (!string.IsNullOrWhiteSpace(vipAmountDetailId))
                        {//发送返现到账通知微信模板消息
                            var CommonBLL = new CommonBLL();
                            CommonBLL.CashBackMessage("人工调整", amountDetail.Amount, vipInfo.WeiXinUserId, vipInfo.VIPID, loggingSessionInfo);
                        }
                    }
                    //增加图片上传
                    if (!string.IsNullOrEmpty(para.ImageUrl))
                    {
                        var objectImagesEntity = new ObjectImagesEntity()
                        {
                            ImageId  = Guid.NewGuid().ToString(),
                            ObjectId = vipAmountDetailId,
                            ImageURL = para.ImageUrl
                        };
                        objectImagesBLL.Create(objectImagesEntity);
                    }
                    pTran.Commit();  //提交事物
                }
                catch (APIException apiEx)
                {
                    pTran.Rollback();//回滚事物
                    throw new APIException(apiEx.ErrorCode, apiEx.Message);
                }
                catch (Exception ex)
                {
                    pTran.Rollback();//回滚事物
                    throw new Exception(ex.Message);
                }
            }
            return(rd);
        }
예제 #20
0
        /// <summary>
        /// 我的小店增加商品
        /// </summary>
        /// <param name="pRequest"></param>
        /// <returns></returns>
        private string VipStoreAddItem(string pRequest)
        {
            var rp = pRequest.DeserializeJSONTo <APIRequest <VipStoreRP> >();
            LoggingSessionInfo loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, "1");


            //先判断商品是否存在
            if (string.IsNullOrWhiteSpace(rp.Parameters.ItemID))
            {
                return(new ErrorResponse(500, "没有添加商品信息").ToJSON());
            }

            //要传入的商品id组
            string[] items = rp.Parameters.ItemID.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);


            //给用户增加商品
            VipStoreBLL vipStoreBlll = new VipStoreBLL(loggingSessionInfo);



            List <string> arrItem = new List <string>();

            for (int i = 0; i < items.Length; i++)
            {
                string         itemID          = items[i];
                VipStoreEntity vipstoreEntityO = vipStoreBlll.QueryByEntity(
                    new VipStoreEntity()
                {
                    ItemID = itemID,
                    VIPID  = rp.UserID
                },
                    null
                    ).FirstOrDefault();

                //如果加入该商品就加入
                if (vipstoreEntityO == null && !arrItem.Contains(itemID))
                {
                    arrItem.Add(itemID);
                }
            }

            IDbTransaction tran = new JIT.CPOS.BS.DataAccess.Base.TransactionHelper(loggingSessionInfo).CreateTransaction();

            foreach (var item in arrItem)
            {
                VipStoreEntity vipStoreEntity = new VipStoreEntity()
                {
                    vipStoreID = Guid.NewGuid().ToString(),
                    VIPID      = rp.UserID,
                    ItemID     = item,
                    SoldCount  = 0
                };

                vipStoreBlll.Create(vipStoreEntity, tran);
            }

            tran.Commit();

            //用户是否开通小店
            VipBLL vipBll = new VipBLL(loggingSessionInfo);

            VipEntity vipEntity = vipBll.GetByID(rp.UserID);

            vipEntity.IsSotre = vipEntity.IsSotre ?? 0;
            if (vipEntity != null && vipEntity.IsSotre == 0)
            {
                vipEntity.IsSotre = 1;
                vipBll.Update(vipEntity);
            }

            return(new SuccessResponse <IAPIResponseData>().ToJSON());
        }
예제 #21
0
        protected override CTWEventShareLogRD ProcessRequest(DTO.Base.APIRequest <CTWEventShareLogRP> pRequest)
        {
            var rd   = new CTWEventShareLogRD();//返回值
            var para = pRequest.Parameters;

            if (!string.IsNullOrEmpty(para.CTWEventId) && !string.IsNullOrEmpty(para.Sender) && !string.IsNullOrEmpty(para.OpenId))
            {
                var bllLeventShareLog    = new T_LEventsSharePersonLogBLL(this.CurrentUserInfo);
                var entityLeventShareLog = new T_LEventsSharePersonLogEntity();

                entityLeventShareLog.ShareVipID    = para.Sender;
                entityLeventShareLog.ShareOpenID   = para.OpenId;
                entityLeventShareLog.BeShareOpenID = para.BeSharedOpenId;
                entityLeventShareLog.BeShareVipID  = para.BEsharedUserId;
                entityLeventShareLog.BusTypeCode   = "CTW";
                entityLeventShareLog.ObjectId      = para.CTWEventId;
                entityLeventShareLog.ShareURL      = para.ShareURL;
                entityLeventShareLog.ShareVipType  = 3;
                bllLeventShareLog.Create(entityLeventShareLog);
                //是否分享给自己
                if (para.Sender == para.BEsharedUserId)
                {
                    return(rd);
                }
                //触点奖励
                ContactEventBLL bllContactEvent = new ContactEventBLL(this.CurrentUserInfo);
                var             entityContact   = bllContactEvent.QueryByEntity(new ContactEventEntity()
                {
                    EventId = para.CTWEventId, IsDelete = 0, IsCTW = 1, ContactTypeCode = "Share"
                }, null).SingleOrDefault();
                if (entityContact != null)
                {
                    LPrizesBLL      bllPrize       = new LPrizesBLL(this.CurrentUserInfo);
                    LPrizeWinnerBLL bllPrizeWinner = new LPrizeWinnerBLL(this.CurrentUserInfo);
                    LLotteryLogBLL  bllLottery     = new LLotteryLogBLL(this.CurrentUserInfo);
                    ///判断是否已经获得奖励
                    int intLogCount = bllLottery.GetEventLotteryLogByEventId(entityContact.ContactEventId.ToString(), para.Sender);
                    if (intLogCount > 0)
                    {
                        return(rd);
                    }

                    var prize = DataTableToObject.ConvertToList <LPrizesEntity>(bllPrize.GetCouponTypeIDByEventId(entityContact.ContactEventId.ToString()).Tables[0]).FirstOrDefault();
                    if (prize != null)
                    {
                        CouponBLL bllCoupon = new CouponBLL(this.CurrentUserInfo);

                        if (prize.PrizeTypeId == "Coupon")
                        {
                            bllCoupon.CouponBindVip(para.Sender, prize.CouponTypeID, entityContact.ContactEventId.ToString(), "Share");

                            DataSet ds = bllPrize.GetAllCouponTypeByPrize(prize.PrizesID);
                            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                            {
                                var redisVipMappingCouponBLL = new JIT.CPOS.BS.BLL.RedisOperationBLL.Coupon.RedisVipMappingCouponBLL();

                                foreach (DataRow dr in ds.Tables[0].Rows)
                                {
                                    redisVipMappingCouponBLL.SetVipMappingCoupon(new CC_Coupon()
                                    {
                                        CustomerId   = this.CurrentUserInfo.ClientID,
                                        CouponTypeId = dr["CouponTypeID"].ToString()
                                    }, entityContact.ContactEventId.ToString(), para.Sender, "Share");
                                }
                            }
                        }
                        if (prize.PrizeTypeId == "Point")
                        {
                            #region 调用积分统一接口
                            var            salesReturnBLL = new T_SalesReturnBLL(this.CurrentUserInfo);
                            VipIntegralBLL bllVipIntegral = new VipIntegralBLL(this.CurrentUserInfo);
                            var            vipBLL         = new VipBLL(this.CurrentUserInfo);

                            var vipInfo        = vipBLL.GetByID(para.Sender);
                            var IntegralDetail = new VipIntegralDetailEntity()
                            {
                                Integral         = prize.Point,
                                IntegralSourceID = "28",
                                ObjectId         = entityContact.ContactEventId.ToString()
                            };
                            //变动前积分
                            string OldIntegral = (vipInfo.Integration ?? 0).ToString();
                            //变动积分
                            string ChangeIntegral      = (IntegralDetail.Integral ?? 0).ToString();
                            var    vipIntegralDetailId = bllVipIntegral.AddIntegral(ref vipInfo, null, IntegralDetail, null, this.CurrentUserInfo);
                            //发送微信积分变动通知模板消息
                            if (!string.IsNullOrWhiteSpace(vipIntegralDetailId))
                            {
                                var CommonBLL = new CommonBLL();
                                CommonBLL.PointsChangeMessage(OldIntegral, vipInfo, ChangeIntegral, vipInfo.WeiXinUserId, this.CurrentUserInfo);
                            }

                            #endregion
                        }

                        #region 奖励日志
                        LPrizeWinnerEntity entityPrizeWinner = new LPrizeWinnerEntity()
                        {
                            PrizeWinnerID = Guid.NewGuid().ToString(),
                            VipID         = para.Sender,
                            PrizeID       = prize.PrizesID,
                            PrizeName     = prize.PrizeName,
                            PrizePoolID   = "",
                            CreateBy      = this.CurrentUserInfo.UserID,
                            CreateTime    = DateTime.Now,
                            IsDelete      = 0
                        };

                        bllPrizeWinner.Create(entityPrizeWinner);


                        LLotteryLogEntity lotteryEntity = new LLotteryLogEntity()
                        {
                            LogId        = Guid.NewGuid().ToString(),
                            VipId        = para.Sender,
                            EventId      = entityContact.ContactEventId.ToString(),
                            LotteryCount = 1,
                            IsDelete     = 0
                        };
                        bllLottery.Create(lotteryEntity);
                        #endregion
                    }
                }
            }
            return(rd);
        }
        protected override GetVipCardTypeVirtualItemRD ProcessRequest(DTO.Base.APIRequest <GetVipCardTypeVirtualItemRP> pRequest)
        {
            var rd   = new GetVipCardTypeVirtualItemRD();
            var para = pRequest.Parameters;
            LoggingSessionInfo loggingSessionInfo = Default.GetBSLoggingSession(pRequest.CustomerID, pRequest.UserID);
            var vipBLL               = new VipBLL(loggingSessionInfo);
            var vipIntegralBLL       = new VipIntegralBLL(loggingSessionInfo);
            var sysVipCardTypeBLL    = new SysVipCardTypeBLL(loggingSessionInfo);
            var vipCardVipMappingBLL = new VipCardVipMappingBLL(loggingSessionInfo);
            var vipCardBLL           = new VipCardBLL(loggingSessionInfo);
            var vipCardRuleBLL       = new VipCardRuleBLL(loggingSessionInfo);
            var vipT_InoutBLL        = new T_InoutBLL(loggingSessionInfo);
            List <VipCardUpgradeRewardInfo> VipCardUpgradeRewardList = new List <VipCardUpgradeRewardInfo>();
            List <VipCardTypeRelateInfo>    VipCardTypeRelateList    = new List <VipCardTypeRelateInfo>();
            //获取当前会员卡等级
            VipEntity VipInfo         = null;
            int?      CurVipCardLevel = 0;
            //处理会员开卡礼信息
            var VipCardUpgradeRewardInfoList = sysVipCardTypeBLL.GetCardUpgradeRewardList(loggingSessionInfo.ClientID);
            //定义卡体系信息
            DataSet VipCardTypeSystemInfoList = null;
            string  strVipID = string.Empty;

            switch (para.ApplicationType)
            {
            //为1是微信,为2时表示APP请求
            case "1":    //微信
                strVipID = pRequest.UserID;
                break;

            case "2":                  //APP
                strVipID = para.VipID; //获取会员信息
                break;
            }

            VipInfo = vipBLL.GetByID(strVipID);//获取会员信息
            if (VipInfo != null)
            {
                rd.HeadImgUrl = VipInfo.HeadImgUrl == null ? "" : VipInfo.HeadImgUrl;
                var vipIntegralInfo = vipIntegralBLL.QueryByEntity(new VipIntegralEntity()
                {
                    VipID = strVipID, VipCardCode = VipInfo.VipCode
                }, null).FirstOrDefault();
                if (vipIntegralInfo != null)//获取当前会员积分
                {
                    rd.Integration = vipIntegralInfo.ValidIntegral != null ? vipIntegralInfo.ValidIntegral.Value : 0;
                }
                //获取会员卡等级相关信息
                var vipCardMappingInfo = vipCardVipMappingBLL.QueryByEntity(new VipCardVipMappingEntity()
                {
                    VIPID = strVipID, CustomerID = loggingSessionInfo.ClientID
                },
                                                                            new OrderBy[] { new OrderBy()
                                                                                            {
                                                                                                FieldName = "CreateTime", Direction = OrderByDirections.Desc
                                                                                            } }).FirstOrDefault();
                if (vipCardMappingInfo != null)
                {
                    var vipCardInfo = vipCardBLL.QueryByEntity(new VipCardEntity()
                    {
                        VipCardID = vipCardMappingInfo.VipCardID, VipCardStatusId = 1
                    }, null).FirstOrDefault();
                    if (vipCardInfo != null)
                    {
                        var vipCardTypeInfo = sysVipCardTypeBLL.QueryByEntity(new SysVipCardTypeEntity()
                        {
                            VipCardTypeID = vipCardInfo.VipCardTypeID
                        }, null).FirstOrDefault();
                        if (vipCardTypeInfo != null)//获取当前会员卡等级信息
                        {
                            rd.VipCardTypeName = vipCardTypeInfo.VipCardTypeName != null ? vipCardTypeInfo.VipCardTypeName : "";
                            rd.VipCardLevel    = vipCardTypeInfo.VipCardLevel;
                            CurVipCardLevel    = vipCardTypeInfo.VipCardLevel;
                        }
                    }
                }
                else
                {
                    var vipCardTypeInfo = sysVipCardTypeBLL.QueryByEntity(new SysVipCardTypeEntity()
                    {
                        VipCardLevel = 1, CustomerID = loggingSessionInfo.ClientID
                    }, null).FirstOrDefault();
                    if (vipCardTypeInfo != null)
                    {
                        rd.VipCardTypeName = vipCardTypeInfo.VipCardTypeName != null ? vipCardTypeInfo.VipCardTypeName : "";
                        rd.VipCardLevel    = vipCardTypeInfo.VipCardLevel != null ? vipCardTypeInfo.VipCardLevel : 1;
                        CurVipCardLevel    = vipCardTypeInfo.VipCardLevel != null ? vipCardTypeInfo.VipCardLevel : 1;
                    }
                }
                //获取会员消费金额
                decimal VipConsumptionInfo = vipT_InoutBLL.GetVipSumAmount(strVipID);
                if (VipConsumptionInfo > 0)
                {
                    rd.VipConsumptionAmount = Convert.ToDecimal(VipConsumptionInfo).ToString("0.00");
                }
                else
                {
                    rd.VipConsumptionAmount = "0";
                }
                //获取卡等级相关信息(会员卡等级信息、升级条件、基本权益关联虚拟商品)
                VipCardTypeSystemInfoList = sysVipCardTypeBLL.GetVipCardTypeVirtualItemList(loggingSessionInfo.ClientID, CurVipCardLevel, para.ApplicationType, VipInfo.VIPID);
            }


            if (VipCardTypeSystemInfoList != null && VipCardTypeSystemInfoList.Tables[0].Rows.Count > 0)
            {
                int flag = 0;//定义下面开卡礼能否进行展示(0=不进,1=进)
                if (VipCardUpgradeRewardInfoList != null && VipCardUpgradeRewardInfoList.Tables[0].Rows.Count > 0)
                {
                    flag = 1;
                    //获取开卡礼信息 为之后筛选数据使用
                    VipCardUpgradeRewardList = DataTableToObject.ConvertToList <VipCardUpgradeRewardInfo>(VipCardUpgradeRewardInfoList.Tables[0]);
                }
                var dt = VipCardTypeSystemInfoList.Tables[0];
                foreach (DataRow dr in dt.Rows)
                {
                    var DataInfo = new VipCardTypeRelateInfo();
                    //VipCardTypeRelateList = new List<VipCardTypeRelateInfo>();
                    DataInfo.VipCardType              = new VipCardTypeInfo();        //会员卡体系
                    DataInfo.VipCardUpgradeRule       = new VipCardUpgradeRuleInfo(); //会员卡升级规则
                    DataInfo.VipCardRule              = new VipCardRuleInfo();        //会员卡基本体系
                    DataInfo.VipCardUpgradeRewardList = new List <VipCardUpgradeRewardInfo>();
                    //var VipCardTypeData = new VipCardTypeInfo();
                    //给会员卡等级赋值
                    DataInfo.VipCardType.VipCardTypeID   = Convert.ToInt32(dr["VipCardTypeID"]);
                    DataInfo.VipCardType.VipCardLevel    = Convert.ToInt32(dr["VipCardLevel"]);
                    DataInfo.VipCardType.VipCardTypeName = dr["VipCardTypeName"].ToString();
                    DataInfo.VipCardType.PicUrl          = dr["PicUrl"].ToString();
                    DataInfo.VipCardType.IsPrepaid       = Convert.ToInt32(dr["IsPrepaid"]);
                    DataInfo.VipCardType.IsOnlineSales   = Convert.ToInt32(dr["IsOnlineSales"]);
                    DataInfo.VipCardType.ItemID          = dr["ItemID"].ToString();
                    DataInfo.VipCardType.SkuID           = dr["SkuID"].ToString();
                    int cardStatus = 0;
                    //获取卡状态购买信息 0=没购买,1=已购买 pRequest.UserID
                    if (DataInfo.VipCardType.IsPrepaid != 1)//非可储值类型关联订单
                    {
                        cardStatus = vipT_InoutBLL.GetVirtualItemStatus(loggingSessionInfo.ClientID, strVipID, DataInfo.VipCardType.SkuID);
                    }
                    else//可储值类型关联充值订单
                    {
                        var RechargeOrderBll  = new RechargeOrderBLL(loggingSessionInfo);
                        var RechargeOrderInfo = RechargeOrderBll.QueryByEntity(new RechargeOrderEntity()
                        {
                            OrderDesc = "Upgrade", VipID = strVipID, VipCardTypeId = DataInfo.VipCardType.VipCardTypeID, Status = 1
                        }, null).FirstOrDefault();
                        if (RechargeOrderInfo != null)//如果为空需要在订单表里查找下记录
                        {
                            cardStatus = 1;
                        }
                        else
                        {
                            cardStatus = vipT_InoutBLL.GetVirtualItemStatus(loggingSessionInfo.ClientID, strVipID, DataInfo.VipCardType.SkuID);
                        }
                    }

                    DataInfo.VipCardType.Status = cardStatus;
                    //var VipCardUpgradeRuleData = new VipCardUpgradeRuleInfo();
                    DataInfo.VipCardUpgradeRule.VipCardTypeID        = Convert.ToInt32(dr["VipCardTypeID"]);
                    DataInfo.VipCardUpgradeRule.VipCardUpgradeRuleId = dr["VipCardUpgradeRuleId"].ToString();
                    DataInfo.VipCardUpgradeRule.IsPurchaseUpgrade    = Convert.ToInt32(dr["IsPurchaseUpgrade"]);
                    DataInfo.VipCardUpgradeRule.IsExtraMoney         = Convert.ToInt32(dr["IsExtraMoney"]);
                    DataInfo.VipCardUpgradeRule.Prices             = Convert.ToDecimal(dr["Prices"]);
                    DataInfo.VipCardUpgradeRule.ExchangeIntegral   = Convert.ToInt32(dr["ExchangeIntegral"]);
                    DataInfo.VipCardUpgradeRule.IsRecharge         = Convert.ToInt32(dr["IsRecharge"]);
                    DataInfo.VipCardUpgradeRule.OnceRechargeAmount = Convert.ToDecimal(dr["OnceRechargeAmount"]);
                    DataInfo.VipCardUpgradeRule.IsBuyUpgrade       = Convert.ToInt32(dr["IsBuyUpgrade"]);
                    DataInfo.VipCardUpgradeRule.BuyAmount          = Convert.ToDecimal(dr["BuyAmount"]);
                    DataInfo.VipCardUpgradeRule.OnceBuyAmount      = Convert.ToDecimal(dr["OnceBuyAmount"]);

                    //var VipCardRuleData = new VipCardUpgradeRuleInfo();
                    DataInfo.VipCardRule.VipCardTypeID        = Convert.ToInt32(dr["VipCardTypeID"]);
                    DataInfo.VipCardRule.RuleID               = Convert.ToInt32(dr["RuleID"]);
                    DataInfo.VipCardRule.CardDiscount         = Convert.ToDecimal(dr["CardDiscount"]);
                    DataInfo.VipCardRule.PaidGivePercetPoints = Convert.ToDecimal(dr["PaidGivePercetPoints"]);
                    DataInfo.VipCardRule.PaidGivePoints       = Convert.ToDecimal(dr["PaidGivePoints"]);
                    if (flag == 1)//当flag=1的时候进行开卡礼的展示
                    {
                        DataInfo.VipCardUpgradeRewardList = VipCardUpgradeRewardList.Where(m => m.VipCardTypeID == Convert.ToInt32(dr["VipCardTypeID"])).Select(
                            t => new VipCardUpgradeRewardInfo()
                        {
                            CardUpgradeRewardId = t.CardUpgradeRewardId,
                            VipCardTypeID       = t.VipCardTypeID,
                            CouponTypeID        = t.CouponTypeID,
                            CouponNum           = t.CouponNum,
                            CouponName          = t.CouponName,
                            ValidityPeriod      = t.BeginTime == null ? ("领取后" + (t.ServiceLife == 0 ? "1天内有效" : t.ServiceLife.ToString() + "天内有效")) : (t.BeginTime.Value.ToString("yyyy-MM-dd") + "至" + t.EndTime.Value.ToString("yyyy-MM-dd")),
                            BeginTime           = t.BeginTime,
                            EndTime             = t.EndTime,
                            BeginTimeDate       = t.BeginTime == null ? "" : t.BeginTime.Value.ToString("yyyy年MM月dd日"),
                            EndTimeDate         = t.EndTime == null ? "" : t.EndTime.Value.ToString("yyyy年MM月dd日"),
                            ServiceLife         = t.ServiceLife,
                            CouponDesc          = t.CouponDesc,
                            ParValue            = t.ParValue
                        }).ToList();
                    }
                    VipCardTypeRelateList.Add(DataInfo);
                }
                rd.VipCardTypeItemList = VipCardTypeRelateList;
            }
            return(rd);
        }
예제 #23
0
        protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <SetSalesReturnRP> pRequest)
        {
            var rd             = new EmptyResponseData();
            var para           = pRequest.Parameters;
            var salesReturnBLL = new T_SalesReturnBLL(CurrentUserInfo);
            var historyBLL     = new T_SalesReturnHistoryBLL(CurrentUserInfo);
            var pTran          = salesReturnBLL.GetTran();//事务
            T_SalesReturnEntity        salesReturnEntity = null;
            T_SalesReturnHistoryEntity historyEntity     = null;


            var          vipBll     = new VipBLL(CurrentUserInfo);    //会员BLL实例化
            var          userBll    = new T_UserBLL(CurrentUserInfo); //店员BLL实例化
            VipEntity    vipEntity  = null;                           //会员信息
            T_UserEntity userEntity = null;                           //店员信息

            using (pTran.Connection)
            {
                try
                {
                    switch (para.OperationType)
                    {
                    case 1:    //申请
                        salesReturnEntity = new T_SalesReturnEntity();
                        salesReturnEntity.SalesReturnNo = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                        salesReturnEntity.VipID         = CurrentUserInfo.UserID;
                        salesReturnEntity.ServicesType  = para.ServicesType;
                        salesReturnEntity.DeliveryType  = para.DeliveryType;
                        salesReturnEntity.OrderID       = para.OrderID;
                        salesReturnEntity.ItemID        = para.ItemID;
                        salesReturnEntity.SkuID         = para.SkuID;
                        salesReturnEntity.Qty           = para.Qty;
                        salesReturnEntity.ActualQty     = para.Qty;

                        salesReturnEntity.UnitID   = para.UnitID;
                        salesReturnEntity.UnitName = para.UnitName;
                        salesReturnEntity.UnitTel  = para.UnitTel;
                        salesReturnEntity.Address  = para.Address;

                        salesReturnEntity.Contacts = para.Contacts;
                        salesReturnEntity.Phone    = para.Phone;

                        salesReturnEntity.Reason     = para.Reason;
                        salesReturnEntity.Status     = 1;   //待审核
                        salesReturnEntity.CustomerID = CurrentUserInfo.ClientID;

                        salesReturnBLL.Create(salesReturnEntity, pTran);

                        vipEntity = vipBll.GetByID(CurrentUserInfo.UserID);

                        historyEntity = new T_SalesReturnHistoryEntity()
                        {
                            SalesReturnID = salesReturnEntity.SalesReturnID,
                            OperationType = 1,
                            OperationDesc = "申请",
                            OperatorID    = CurrentUserInfo.UserID,
                            HisRemark     = "申请",
                            OperatorName  = vipEntity.VipName,
                            OperatorType  = 0
                        };
                        historyBLL.Create(historyEntity, pTran);
                        break;

                    case 2:    //取消
                        salesReturnEntity = salesReturnBLL.GetByID(para.SalesReturnID);
                        vipEntity         = vipBll.GetByID(CurrentUserInfo.UserID);
                        if (salesReturnEntity != null)
                        {
                            salesReturnEntity.Status = 2;       //取消申请
                            salesReturnBLL.Update(salesReturnEntity, pTran);
                            historyEntity = new T_SalesReturnHistoryEntity()
                            {
                                SalesReturnID = salesReturnEntity.SalesReturnID,
                                OperationType = 2,
                                OperationDesc = "取消申请",
                                OperatorID    = CurrentUserInfo.UserID,
                                HisRemark     = "取消申请",
                                OperatorName  = vipEntity.VipName,
                                OperatorType  = 0
                            };
                            historyBLL.Create(historyEntity, pTran);
                        }
                        break;

                    default:
                        break;
                    }
                    pTran.Commit();  //提交事物
                }
                catch (Exception ex)
                {
                    pTran.Rollback();//回滚事务
                    throw new APIException(ex.Message);
                }
            }
            return(rd);
        }
예제 #24
0
        /// <summary>
        /// api获取当前门店核销过的电子券
        /// </summary>
        protected override GetApiCouponUserListRD ProcessRequest(DTO.Base.APIRequest <GetCouponUseRP> pRequest)
        {
            var rd           = new GetApiCouponUserListRD();
            var para         = pRequest.Parameters;
            var CouponUseBLL = new CouponUseBLL(CurrentUserInfo);
            var VipBLL       = new VipBLL(CurrentUserInfo);
            var CouponBLL    = new CouponBLL(CurrentUserInfo);
            var UserBLL      = new T_UserBLL(CurrentUserInfo);
            //查询参数
            List <IWhereCondition> complexCondition = new List <IWhereCondition> {
            };

            #region 门店条件处理
            string UnitId = "";
            if (CurrentUserInfo.CurrentUserRole != null)
            {
                if (!string.IsNullOrWhiteSpace(CurrentUserInfo.CurrentUserRole.UnitId))
                {
                    UnitId = CurrentUserInfo.CurrentUserRole.UnitId;
                }
            }

            if (!string.IsNullOrWhiteSpace(UnitId))
            {
                complexCondition.Add(new EqualsCondition()
                {
                    FieldName = "UnitID", Value = CurrentUserInfo.CurrentUserRole.UnitId
                });
            }
            else
            {
                return(rd);
            }
            #endregion
            //排序参数
            List <OrderBy> lstOrder = new List <OrderBy> {
            };
            lstOrder.Add(new OrderBy()
            {
                FieldName = "CreateTime", Direction = OrderByDirections.Desc
            });


            var Result = CouponUseBLL.PagedQuery(complexCondition.ToArray(), lstOrder.ToArray(), para.pageSize, para.pageIndex);
            rd.TotalPageCount = Result.PageCount;
            rd.TotalCount     = Result.RowCount;

            rd.ApiCouponDataList = Result.Entities.Select(t => new CouponUserData()
            {
                VipID      = t.VipID,
                VipName    = "",
                CreateTime = t.CreateTime.ToString(),
                CouponID   = t.CouponID,
                CouponName = "",
                CouponCode = "",
                CreateBy   = t.CreateBy
            }).ToList();


            foreach (var item in rd.ApiCouponDataList)
            {
                //会员名称
                var VipData = VipBLL.GetByID(item.VipID);
                if (VipData != null)
                {
                    item.VipName    = VipData.VipName ?? "";
                    item.HeadImgUrl = VipData.HeadImgUrl ?? "";
                }
                //券名称,券号
                var CouponData = CouponBLL.GetByID(item.CouponID);
                if (CouponData != null)
                {
                    item.CouponName = CouponData.CouponName ?? "";
                    item.CouponCode = CouponData.CouponCode ?? "";
                }
                //员工名称
                var UserData = UserBLL.GetByID(item.CreateBy);
                if (UserData != null)
                {
                    item.CreateByName = UserData.user_name ?? "";
                }
            }

            return(rd);
        }
        /// <summary>
        /// 种植 角色菜单 缓存
        /// </summary>
        public void AutoSetOrderNotPayCache()
        {
            _CustomerIDList = CustomerBLL.Instance.GetCustomerList();
            foreach (var customer in _CustomerIDList)
            {
                //
                _T_loggingSessionInfo.ClientID = customer.Key;
                _T_loggingSessionInfo.CurrentLoggingManager.Connection_String = customer.Value;

                //
                _T_InoutBLL    = new T_InoutBLL(_T_loggingSessionInfo);
                _Inout3Service = new Inout3Service(_T_loggingSessionInfo);
                _VipBLL        = new VipBLL(_T_loggingSessionInfo);

                //
                // var t_InoutList = new List<string>();
                try
                {
                    var t_InoutEntitys = _T_InoutBLL.QueryByEntity(new T_InoutEntity
                    {
                        customer_id = customer.Key,
                        Field1      = "0",  //未支付
                        status      = "100" //已经正式提交
                    }, null);
                    if (t_InoutEntitys == null || t_InoutEntitys.Count() <= 0)
                    {
                        continue;
                    }
                    //
                    //   roleList = roleEntities.Select(it => it.role_id).ToList();

                    string productNames = "";
                    foreach (var t_InoutInfo in t_InoutEntitys)
                    {
                        //每次都重新设置
                        productNames = "";
                        var _T_Inout_DetailList = _Inout3Service.GetInoutDetailInfoByOrderId(t_InoutInfo.order_id, _T_loggingSessionInfo.ClientID);

                        if (_T_Inout_DetailList != null && _T_Inout_DetailList.Count > 0)//获取商品信息
                        {
                            foreach (var _T_Inout_DetailInfo in _T_Inout_DetailList)
                            {
                                if (productNames == "")
                                {
                                    productNames += _T_Inout_DetailInfo.item_name + "*" + _T_Inout_DetailInfo.order_qty;
                                }
                                else
                                {
                                    productNames += "," + _T_Inout_DetailInfo.item_name + "*" + _T_Inout_DetailInfo.order_qty;
                                }
                            }
                        }
                        try
                        {
                            //获取会员的信息
                            var vip = _VipBLL.GetByID(t_InoutInfo.vip_no);

                            new SendOrderNotPayMsgBLL().NotPayMessage(t_InoutInfo.actual_amount.ToString(), productNames, t_InoutInfo.Field4, t_InoutInfo.order_no, vip.WeiXinUserId, _T_loggingSessionInfo);
                        }
                        catch { continue; }
                    }
                }
                catch
                {
                    continue;
                }
            }
        }
예제 #26
0
        /// <summary>
        /// 校园专家 重置密码
        /// </summary>
        /// <returns></returns>
        public string ForgetPassword()
        {
            string content  = string.Empty;
            var    respData = new ambassadorLoginInRespData();

            try
            {
                //接收参数
                string reqContent = HttpContext.Current.Request["ReqContent"];
                var    reqObj     = reqContent.DeserializeJSONTo <ambassadorLoginInReqData>();
                reqObj = reqObj == null ? new ambassadorLoginInReqData() : reqObj;

                //获取客户ID
                if (!string.IsNullOrEmpty(reqObj.common.customerId))
                {
                    customerId = reqObj.common.customerId;
                }

                //初始化返回对象
                respData.content         = new ambassadorLoginInRespContentData();
                respData.content.vipList = new List <ambassadorLoginInRespContentDataItem>();

                //用户登录信息
                var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");

                OnlineShoppingItemBLL itemService = new OnlineShoppingItemBLL(loggingSessionInfo);

                var vipInfo = itemService.ForgetPassword(reqObj.special.email);
                if (vipInfo != null && vipInfo.Count > 0)
                {
                    //生成随机数 6位
                    Random rd   = new Random();
                    string code = rd.Next(100000, 999999).ToString();

                    VipBLL    vipBLL = new VipBLL(loggingSessionInfo);
                    VipEntity entity = new VipEntity();

                    entity                = vipBLL.GetByID(vipInfo[0].VIPID);
                    entity.VipPasswrod    = MD5Helper.Encryption(MD5Helper.Encryption(code) + entity.Col4);
                    entity.LastUpdateTime = DateTime.Now;
                    vipBLL.Update(entity);

                    #region 邮件发送
                    try
                    {
                        XmlManager xml = new XmlManager(ConfigurationManager.AppSettings["xmlFile"]);

                        FromSetting fs = new FromSetting();
                        fs.SMTPServer = xml.SelectNodeText("//Root/AsusMail//SMTPServer", 0);
                        fs.SendFrom   = xml.SelectNodeText("//Root/AsusMail//MailSendFrom", 0);
                        fs.UserName   = xml.SelectNodeText("//Root/AsusMail//MailUserName", 0);
                        fs.Password   = xml.SelectNodeText("//Root/AsusMail//MailUserPassword", 0);
                        Mail.SendMail(fs, entity.Col7 + "," + xml.SelectNodeText("//Root/AsusMail//MailTo", 0), xml.SelectNodeText("//Root/AsusMail//MailTitle", 0), entity.VipRealName + ":你好,你的新密码为:" + code, null);
                    }
                    catch
                    {
                        respData.code        = "111";
                        respData.description = "邮箱发送失败,请稍后重试";
                        content = respData.ToJSON();
                        return(content);
                    }
                    #endregion

                    List <ambassadorLoginInRespContentDataItem> list = new List <ambassadorLoginInRespContentDataItem>();
                    foreach (var item in vipInfo)
                    {
                        ambassadorLoginInRespContentDataItem info = new ambassadorLoginInRespContentDataItem();
                        info.VipID       = item.VIPID;
                        info.VipPassword = code;
                        info.Email       = item.Email;

                        list.Add(info);
                    }
                    respData.content.vipList = list;
                }
                else
                {
                    respData.code        = "111";
                    respData.description = "邮箱不存在";
                }
            }
            catch (Exception ex)
            {
                respData.code        = "103";
                respData.description = "数据库操作错误";
                respData.exception   = ex.ToString();
            }
            content = respData.ToJSON();
            return(content);
        }
예제 #27
0
        protected override SetRechargeOrderRD ProcessRequest(APIRequest <SetRechargeOrderRP> pRequest)
        {
            SetRechargeOrderRP rp = pRequest.Parameters;
            SetRechargeOrderRD rd = new SetRechargeOrderRD();

            var            rechargeOrderBll     = new RechargeOrderBLL(CurrentUserInfo);
            TUnitExpandBLL serviceUnitExpandBll = new TUnitExpandBLL(CurrentUserInfo);

            var vipBll = new VipBLL(CurrentUserInfo);
            var vipCardVipMappingBll  = new VipCardVipMappingBLL(CurrentUserInfo);
            var vipCardBll            = new VipCardBLL(CurrentUserInfo);
            var sysVipCardTypeBll     = new SysVipCardTypeBLL(CurrentUserInfo);
            var vipCardUpgradeRuleBll = new VipCardUpgradeRuleBLL(CurrentUserInfo);

            //获取会员信息
            VipEntity vipInfo;
            string    userId = "";

            //微信
            if (pRequest.ChannelId == "2")
            {
                vipInfo = vipBll.GetByID(pRequest.UserID);
                UnitService unitServer = new UnitService(CurrentUserInfo);
                rp.UnitId = unitServer.GetUnitByUnitTypeForWX("OnlineShopping", null).Id; //获取在线商城的门店标识
            }
            //掌柜App
            else
            {
                vipInfo = vipBll.GetByID(rp.VipId);
                userId  = pRequest.UserID;
            }

            string  OrderDesc     = "ReRecharge"; //"升级","充值"
            int?    VipCardTypeId = null;         //会员卡类型
            decimal returnAmount  = 0;            //赠送金额

            //会员卡类型条件
            List <IWhereCondition> complexConditionOne = new List <IWhereCondition> {
            };
            //获取会员与会员卡关系表
            var vipCardVipMappingEntity = vipCardVipMappingBll.QueryByEntity(new VipCardVipMappingEntity()
            {
                CustomerID = CurrentUserInfo.ClientID, VIPID = vipInfo.VIPID
            }, null).FirstOrDefault();

            //该会员有会员卡
            if (vipCardVipMappingEntity != null)
            {
                //获取该会员会员卡信息
                var vipCardEntity = vipCardBll.QueryByEntity(new VipCardEntity()
                {
                    CustomerID = CurrentUserInfo.ClientID, VipCardID = vipCardVipMappingEntity.VipCardID
                }, null).FirstOrDefault();

                //获取该会员卡类型
                var sysVipCardTypeEntity = sysVipCardTypeBll.GetByID(vipCardEntity.VipCardTypeID);
                VipCardTypeId = vipCardEntity.VipCardTypeID;

                //获取会员卡的会员活动
                var rechargeStrategyBLL = new RechargeStrategyBLL(CurrentUserInfo);
                var RechargeActivityDS  = rechargeStrategyBLL.GetRechargeActivityList(CurrentUserInfo.ClientID, VipCardTypeId.ToString(), 3);
                var RechargeStrategy    = new RechargeStrategyInfo();

                if (RechargeActivityDS != null && RechargeActivityDS.Tables[0].Rows.Count > 0)
                {
                    var RechargeStrategyList = DataTableToObject.ConvertToList <RechargeStrategyInfo>(RechargeActivityDS.Tables[0]);
                    //获取与充值金额最接近的活动
                    RechargeStrategy = RechargeStrategyList.Where(n => n.RechargeAmount <= rp.ActuallyPaid).OrderByDescending(n => n.RechargeAmount).FirstOrDefault();
                    if (RechargeStrategy != null)
                    {
                        //梯度
                        if (RechargeStrategy.RuleType == "Step")
                        {
                            //赠送金额 = 会员活动梯度设置赠送金额
                            returnAmount = RechargeStrategy.GiftAmount;
                        }
                        //叠加
                        if (RechargeStrategy.RuleType == "Superposition")
                        {
                            //赠送金额与满赠条件金额比例
                            decimal discount = RechargeStrategy.GiftAmount / RechargeStrategy.RechargeAmount;
                            //赠送金额 = 充值金额 * (设置赠送金额 / 设置满赠条件金额)
                            returnAmount = rp.ActuallyPaid * RechargeStrategy.GiftAmount / RechargeStrategy.RechargeAmount;
                        }
                    }
                }

                //获取等级高的会员卡类型条件
                complexConditionOne.Add(new MoreThanCondition()
                {
                    FieldName = "VipCardLevel", Value = sysVipCardTypeEntity.VipCardLevel, IncludeEquals = false
                });
                complexConditionOne.Add(new EqualsCondition()
                {
                    FieldName = "CustomerID", Value = CurrentUserInfo.ClientID
                });
            }
            //该会员没有会员卡
            else
            {
                //获取所有的会员卡类型条件
                complexConditionOne.Add(new EqualsCondition()
                {
                    FieldName = "CustomerID", Value = CurrentUserInfo.ClientID
                });
            }

            var sysVipCardTypeList = sysVipCardTypeBll.Query(complexConditionOne.ToArray(), null).ToList();

            if (sysVipCardTypeList == null)
            {
                throw new APIException("没有建立会员体系")
                      {
                          ErrorCode = 200
                      };
            }

            //获取会员卡类型升级规则
            List <IWhereCondition> complexConditionTwo = new List <IWhereCondition> {
            };

            complexConditionTwo.Add(new EqualsCondition()
            {
                FieldName = "CustomerID", Value = CurrentUserInfo.ClientID
            });
            complexConditionTwo.Add(new EqualsCondition()
            {
                FieldName = "IsRecharge", Value = 1
            });
            var vipCardUpgradeRuleList = vipCardUpgradeRuleBll.Query(complexConditionTwo.ToArray(), null);

            //将升级卡规则和可升级的会员卡匹配
            var vipCardTypeDetailList = vipCardUpgradeRuleList.Join(sysVipCardTypeList, n => n.VipCardTypeID, m => m.VipCardTypeID, (n, m) => new { n, m }).OrderByDescending(t => t.m.VipCardLevel).ToList();

            //判断是否满充值条件
            bool isUpgrade = false;


            for (int i = 0; i < vipCardTypeDetailList.Count; i++)
            {
                //实付金额 >= 可升级金额
                if (vipCardTypeDetailList[i].n.OnceRechargeAmount <= rp.ActuallyPaid)
                {
                    isUpgrade     = true;
                    VipCardTypeId = vipCardTypeDetailList[i].n.VipCardTypeID ?? 0;
                    break;
                }
            }
            if (isUpgrade)
            {
                OrderDesc = "Upgrade";  //升级
            }


            //充值订单
            var rechargeOrderEntity = new RechargeOrderEntity()
            {
                OrderID       = Guid.NewGuid(),
                OrderNo       = serviceUnitExpandBll.GetUnitOrderNo(),
                OrderDesc     = OrderDesc,
                VipID         = vipInfo.VIPID,
                VipCardNo     = vipInfo.VipCode,
                UnitId        = rp.UnitId,
                UserId        = userId,
                TotalAmount   = rp.ActuallyPaid,
                ActuallyPaid  = rp.ActuallyPaid,
                PosSourceName = rp.PosSourceName,
                ReturnAmount  = returnAmount,
                PayerID       = vipInfo.VIPID,
                Status        = 0,
                CustomerID    = CurrentUserInfo.ClientID,
                VipCardTypeId = VipCardTypeId
            };

            rechargeOrderBll.Create(rechargeOrderEntity);
            rd.orderId = rechargeOrderEntity.OrderID.ToString();

            //支付完成
            if (rp.PayStatus == 1)
            {
                //获取门店信息
                t_unitBLL    unitBLL  = new t_unitBLL(CurrentUserInfo);
                t_unitEntity unitInfo = null;
                if (!string.IsNullOrEmpty(rechargeOrderEntity.UnitId))
                {
                    unitInfo = unitBLL.GetByID(rechargeOrderEntity.UnitId);
                }
                //充值
                rechargeOrderBll.Recharge(rechargeOrderEntity, vipInfo, unitInfo, "");
            }

            return(rd);
        }
예제 #28
0
        protected override GetEventPrizesRD ProcessRequest(DTO.Base.APIRequest <GetEventPrizesRP> pRequest)
        {
            GetEventPrizesRD rd = new GetEventPrizesRD();

            string vipID = pRequest.UserID;

            //string vipID = "f3d925e364e34bf69dfda34fcedc58f8";
            string vipName           = string.Empty;
            string reCommandId       = pRequest.Parameters.RecommandId;
            string eventId           = pRequest.Parameters.EventId;
            float  longitude         = pRequest.Parameters.Longitude;
            float  latitude          = pRequest.Parameters.Latitude;
            string customerId        = this.CurrentUserInfo.ClientID;
            int    pointsLotteryFlag = pRequest.Parameters.PointsLotteryFlag;

            if (string.IsNullOrEmpty(customerId))
            {
                customerId = "f6a7da3d28f74f2abedfc3ea0cf65c01";
            }

            var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");

            #region 是否在活动现场
            //respData.content.isSite = "1";
            rd.content = new EventPrizesInfo {
                IsSite = 1
            };

            #endregion

            #region 判断活动是否需要注册

            var leventsBll = new LEventsBLL(this.CurrentUserInfo);

            var enableFlag = leventsBll.GetEnableFlagByEventId(eventId);

            var vipService = new VipBLL(loggingSessionInfo);
            rd.SignFlag = 1;
            //如果需要注册,则判断该会员有没有注册,没有返回
            if (enableFlag.Substring(0, 1) == "1")
            {
                var vipEntity = vipService.GetByID(vipID);
                if (vipEntity == null)
                {
                    rd.SignFlag = 0;
                    return(rd);
                }
                else
                {
                    rd.SignFlag = 1;
                    vipID       = vipEntity.VIPID;
                    vipName     = vipEntity.VipName;
                }
            }



            #endregion

            #region 获取VIPID

            #endregion



            #region

            Loggers.Debug(new DebugLogInfo()
            {
                Message = "vipName = " + vipName
                          + ",vipID =" + vipID
                          + ",eventId=" + eventId
                          + ",longitude" + longitude
                          + ",latitude" + latitude
                          + ",customerId" + customerId
                          + ",reCommandId" + reCommandId
            });
            LPrizePoolsBLL poolsServer = new LPrizePoolsBLL(loggingSessionInfo);
            var            ds          = poolsServer.GetEventWinningInfo(vipName, vipID, eventId, longitude, latitude, customerId, reCommandId, pointsLotteryFlag);

            int    isLottery  = Convert.ToInt32(ds.Tables[0].Rows[0]["IsLottery"]);
            int    winnerFlag = Convert.ToInt32(ds.Tables[0].Rows[0]["WinnerFlag"]);//是否中奖
            string prizeName  = ds.Tables[0].Rows[0]["prizeName"].ToString();
            string prizesId   = ds.Tables[0].Rows[0]["prizesId"].ToString();


            rd.content.IsLottery      = isLottery;
            rd.content.IsWinning      = winnerFlag;
            rd.content.WinningDesc    = prizeName;
            rd.content.Remark         = ds.Tables[0].Rows[0]["Remark"].ToString();
            rd.content.WinningExplan  = ds.Tables[0].Rows[0]["PrizeDesc"].ToString();
            rd.content.EventRound     = ds.Tables[0].Rows[0]["EventRoundId"].ToString();
            rd.content.Status         = Convert.ToInt32(ds.Tables[0].Rows[0]["step"].ToString());
            rd.content.PrizesTypeName = ds.Tables[0].Rows[0]["prizeTypeName"].ToString();
            rd.content.PrizesName     = ds.Tables[0].Rows[0]["prizesName"].ToString();
            rd.content.EventPoints    = Convert.ToInt32(ds.Tables[0].Rows[0]["EventPoints"].ToString());

            #region update by wzq 2014/07/01 积分兑换标识(活动,个人)
            rd.content.PersonPointsLotteryFlag = Convert.ToInt32(ds.Tables[0].Rows[0]["PersonPointsLotteryFlag"].ToString());
            rd.content.EventPointsLotteryFlag  = Convert.ToInt32(ds.Tables[0].Rows[0]["EventPointsLotteryFlag"].ToString());
            #endregion

            #endregion


            #region 推荐人
            //活动是否分享


            var isShare = leventsBll.GetIsShareByEventId(eventId);

            rd.IsShare = isShare;
            Loggers.Debug(new DebugLogInfo()
            {
                Message = "isShare = " + isShare
            });

            CouponBLL couponService = new CouponBLL(loggingSessionInfo);

            //Updated by Willie Yan on 2014-05-30   必须是新推荐的会员
            if (isShare == 1 && !couponService.IfRecordedRecommendTrace(vipID, reCommandId))
            {
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = "reCommandId = " + reCommandId + ", VipID = " + vipID
                });
                if (reCommandId != "" && !string.IsNullOrEmpty(reCommandId))
                {
                    if (reCommandId != vipID)
                    {
                        var vipEntity = vipService.GetByID(vipID);
                        vipEntity.HigherVipID = reCommandId;
                        vipService.Update(vipEntity);

                        Loggers.Debug(new DebugLogInfo()
                        {
                            Message = "Update HigherVipID = " + reCommandId + "for vipid=" + vipID
                        });

                        //查看推荐人成功推荐人数,满足条件给奖励

                        //TODO:added by zhangwei20141009,保存上下线记录
                        couponService.UpdateVipRecommandTrace(vipID, reCommandId);
                        Loggers.Debug(new DebugLogInfo()
                        {
                            Message = "UpdateVipRecommandTrace vipid=" + vipID + ",reCommandId= " + reCommandId
                        });

                        couponService.RecommenderPrize(reCommandId, eventId);
                        Loggers.Debug(new DebugLogInfo()
                        {
                            Message = "RecommenderPrize reCommandId= " + reCommandId
                        });
                    }
                }
            }

            //推荐人是否为空

            //推荐人跟vipId是否相同
            #endregion

            #region 奖品集合

            LPrizesBLL prizesService = new LPrizesBLL(loggingSessionInfo);

            var orderby = new List <OrderBy> {
                new OrderBy()
                {
                    FieldName = "DisplayIndex", Direction = OrderByDirections.Asc
                }
            };


            var prizesList = prizesService.QueryByEntity(new LPrizesEntity()
            {
                EventId = eventId
            }, orderby.ToArray());

            rd.content.PrizesList = new List <PrizesEntity>();
            if (prizesList != null && prizesList.Length > 0)
            {
                foreach (var item in prizesList)
                {
                    var entity = new PrizesEntity()
                    {
                        PrizesID     = item.PrizesID,
                        PrizeName    = item.PrizeName,
                        PrizeDesc    = item.PrizeDesc,
                        DisplayIndex = item.DisplayIndex.ToString(),
                        CountTotal   = item.CountTotal.ToString(),
                        ImageUrl     = item.ImageUrl,
                        Sponsor      = item.ContentText
                    };

                    if (prizesId == item.PrizesID)
                    {
                        rd.content.PrizeIndex = item.DisplayIndex;
                    }
                    rd.content.PrizesList.Add(entity);
                }
            }

            #endregion


            #region 中奖集合
            var winDs = poolsServer.GetPersonWinnerList(vipID, eventId);
            rd.content.WinnerList = new List <WinnerList>();
            if (winDs != null && winDs.Tables.Count > 0 && winDs.Tables[0].Rows.Count > 0)
            {
                rd.content.WinnerList = DataTableToObject.ConvertToList <WinnerList>(winDs.Tables[0]);
            }

            #endregion


            #region  新增字段



            var leventsInfoDs = leventsBll.GetLeventsInfoDataSet(eventId);

            if (leventsInfoDs.Tables[0].Rows.Count > 0)
            {
                rd.BootUrl        = leventsInfoDs.Tables[0].Rows[0]["BootUrl"].ToString();
                rd.OverRemark     = leventsInfoDs.Tables[0].Rows[0]["OverRemark"].ToString();
                rd.PosterImageUrl = leventsInfoDs.Tables[0].Rows[0]["PosterImageUrl"].ToString();
                rd.ShareRemark    = leventsInfoDs.Tables[0].Rows[0]["ShareRemark"].ToString();
                rd.ShareLogoUrl   = leventsInfoDs.Tables[0].Rows[0]["ShareLogoUrl"].ToString();
            }

            #endregion

            #region 添加引导页URL

            //var bootDs = leventsBll.GetBootUrlByEventId(eventId);

            //if (bootDs.Tables[0].Rows.Count > 0)
            //{
            //    rd.ShareRemark = bootDs.Tables[0].Rows[0]["ShareRemark"].ToString();
            //    rd.OverRemark = bootDs.Tables[0].Rows[0]["OverRemark"].ToString();
            //    rd.PosterImageUrl = bootDs.Tables[0].Rows[0]["PosterImageUrl"].ToString();
            //    rd.BootUrl = bootDs.Tables[0].Rows[0]["BootUrl"].ToString();
            //}

            #endregion
            return(rd);
        }
예제 #29
0
        //
        /// <summary>
        /// 处理会员的上下线关系
        /// 会员状态        已经有上级关系    有新的附带上级关系
        /// 从未关注的Vip          1                  1             重建关系
        /// 从未关注的Vip          0                  1             重建关系
        /// 取消关注的Vip          0                  1             重建关系

        /// 从未关注的Vip          0                  0
        /// 从未关注的Vip          1                  0
        /// 取消关注的Vip          1                  0
        /// 取消关注的Vip          0                  0
        /// 取消关注的Vip          1                  1

        /// ShareVipID 没内容的 return
        public void SetShareVip(string vipid, string openId)
        {
            #region 验证
            if (string.IsNullOrEmpty(ShareVipID))//如果没有上级分享人员
            {
                return;
            }
            #endregion

            #region Vip实体
            VipBLL    vipBll     = new VipBLL(loggingSessionInfo);
            VipEntity vipInfotmp = null;
            if (string.IsNullOrEmpty(vipid))
            {
                return;
            }
            else
            {
                vipInfotmp = vipBll.GetByID(vipid);
            }
            if (vipInfotmp == null)
            {
                return;
            }
            #endregion

            #region UnitId
            string UnitId = "";
            //获取分享人的门店信息
            //员工 或者 客服

            string shareVipOpenid = "";
            if (SourceId == 1 || SourceId == 2)              //获取分享员工的默认门店
            {
                UnitId = vipBll.GetUnitByUserId(ShareVipID); //获取员工的默认门店
            }
            else
            {
                //获取分享会员的门店
                VipEntity shareVip = vipBll.GetByID(ShareVipID);
                if (shareVip != null)
                {
                    UnitId         = shareVip.CouponInfo;//会员的会籍店
                    shareVipOpenid = shareVip.WeiXinUserId;
                }
            }
            #endregion

            #region 判断用户类型

            #region 关注的
            if (vipInfotmp.Status >= 1)//关注过的
            {
                //当前没有上线,才给他建立一个上线
                if (string.IsNullOrEmpty(vipInfotmp.SetoffUserId) && string.IsNullOrEmpty(vipInfotmp.HigherVipID))
                {
                    //会员 或者 客服
                    if (SourceId == 1 || SourceId == 2)//获取分享员工的默认门店
                    {
                        vipInfotmp.SetoffUserId = ShareVipID;
                        vipInfotmp.HigherVipID  = "";
                        vipInfotmp.Col21        = System.DateTime.Now.ToString();
                    }
                    //会员
                    else
                    {
                        vipInfotmp.HigherVipID  = ShareVipID;
                        vipInfotmp.SetoffUserId = "";
                        vipInfotmp.Col21        = System.DateTime.Now.ToString();
                    }
                }
                else if (SourceId == 4 && string.IsNullOrEmpty(vipInfotmp.Col20))
                {
                    vipInfotmp.Col20 = ShareVipID;
                    vipInfotmp.Col21 = System.DateTime.Now.ToString();
                }
            }
            #endregion

            #region 取消关注的
            else if (vipInfotmp.Status == 0 && vipInfotmp.Col25 == "1")//取消关注的
            {
                if (string.IsNullOrEmpty(vipInfotmp.SetoffUserId) && string.IsNullOrEmpty(vipInfotmp.HigherVipID))
                {
                    if (SourceId == 1 || SourceId == 2)//获取分享员工的默认门店
                    {
                        vipInfotmp.SetoffUserId = ShareVipID;
                        vipInfotmp.HigherVipID  = null;
                        vipInfotmp.Col21        = System.DateTime.Now.ToString();
                    }
                    else
                    {
                        vipInfotmp.HigherVipID  = ShareVipID;
                        vipInfotmp.SetoffUserId = null;
                        vipInfotmp.Col21        = System.DateTime.Now.ToString();
                    }
                }
                else if (SourceId == 4 && string.IsNullOrEmpty(vipInfotmp.Col20))
                {
                    vipInfotmp.Col20 = ShareVipID;
                    vipInfotmp.Col21 = System.DateTime.Now.ToString();
                }
            }
            #endregion

            #region 未关注的
            else
            {                                       //未关注的(oauth认证获取的)
                //客服 员工
                if (SourceId == 1 || SourceId == 2) //获取分享员工的默认门店
                {
                    vipInfotmp.SetoffUserId = ShareVipID;
                    vipInfotmp.HigherVipID  = null;
                    vipInfotmp.Col21        = System.DateTime.Now.ToString();
                }
                else if (SourceId == 4)
                {
                    vipInfotmp.Col20 = ShareVipID;
                    vipInfotmp.Col21 = System.DateTime.Now.ToString();
                }
                //会员
                else
                {
                    vipInfotmp.HigherVipID  = ShareVipID;
                    vipInfotmp.SetoffUserId = null;
                    vipInfotmp.Col21        = System.DateTime.Now.ToString();
                }
            }
            #endregion

            #endregion

            if (string.IsNullOrEmpty(UnitId))
            {
                UnitService unitServer = new UnitService(loggingSessionInfo);
                UnitId = unitServer.GetUnitByUnitTypeForWX("总部", null).Id; //获取总部门店标识
            }
            vipInfotmp.CouponInfo = UnitId;
            vipInfotmp.Col24      = ObjectID;
            vipInfotmp.Col23      = SourceId.ToString();
            vipBll.Update(vipInfotmp, false);

            //分享记录
            T_LEventsSharePersonLogBLL t_LEventsSharePersonLogBLL = new T_LEventsSharePersonLogBLL(loggingSessionInfo);

            //先查看这个会员之前是否已经打开这个图文素材
            var t_LEventsSharePersonLogTemp = new T_LEventsSharePersonLogEntity();
            t_LEventsSharePersonLogTemp.BusTypeCode  = objectType;
            t_LEventsSharePersonLogTemp.ObjectId     = ObjectID; ////分享的链接代表的对象,活动或者商品
            t_LEventsSharePersonLogTemp.ShareVipType = SourceId; // 1员工,2客服,3会员  4超级分销商
            t_LEventsSharePersonLogTemp.ShareVipID   = ShareVipID;
            t_LEventsSharePersonLogTemp.BeShareVipID = vipid;    //被分享人
            var t_LEventsSharePersonLogOld = t_LEventsSharePersonLogBLL.QueryByEntity(t_LEventsSharePersonLogTemp, null);
            //如果已经有这样的记录,就不要再写了
            if (t_LEventsSharePersonLogOld != null && t_LEventsSharePersonLogOld.Length > 0)
            {
                return;
            }


            //第一次打开的时候才创建
            var t_LEventsSharePersonLog = new T_LEventsSharePersonLogEntity();
            t_LEventsSharePersonLog.SharePersonLogId = Guid.NewGuid();
            t_LEventsSharePersonLog.BusTypeCode      = objectType;
            t_LEventsSharePersonLog.ObjectId         = ObjectID; ////分享的链接代表的对象,活动或者商品
            t_LEventsSharePersonLog.ShareVipType     = SourceId; // 1员工,2客服,3会员
            t_LEventsSharePersonLog.ShareVipID       = ShareVipID;

            t_LEventsSharePersonLog.ShareOpenID   = shareVipOpenid; //如果是会员,取出来
            t_LEventsSharePersonLog.BeShareVipID  = vipid;          //新建的会员会员的vipid
            t_LEventsSharePersonLog.BeShareOpenID = openId;         //本分享人的id

            t_LEventsSharePersonLog.ShareURL       = goUrl;         //分享的链接
            t_LEventsSharePersonLog.CreateTime     = System.DateTime.Now;
            t_LEventsSharePersonLog.CreateBy       = "";
            t_LEventsSharePersonLog.LastUpdateBy   = "";
            t_LEventsSharePersonLog.LastUpdateTime = System.DateTime.Now;
            t_LEventsSharePersonLog.CustomerId     = loggingSessionInfo.ClientID;
            t_LEventsSharePersonLog.IsDelete       = 0;
            t_LEventsSharePersonLogBLL.Create(t_LEventsSharePersonLog);
        }
예제 #30
0
        protected override GetMemberInfoRD ProcessRequest(DTO.Base.APIRequest <GetMemberInfoRP> pRequest)
        {
            GetMemberInfoRD rd = new GetMemberInfoRD();

            rd.MemberInfo = new MemberInfo();
            var vipLoginBLL = new VipBLL(base.CurrentUserInfo);

            //如果有一个查询标识非空,就用查询标识查,发现没有会员就报错
            if (!string.IsNullOrEmpty(pRequest.Parameters.SearchFlag))
            {
                List <IWhereCondition> complexCondition = new List <IWhereCondition> {
                };
                complexCondition.Add(new EqualsCondition()
                {
                    FieldName = "ClientID", Value = CurrentUserInfo.ClientID
                });
                var cond1 = new LikeCondition()
                {
                    FieldName = "VipName", Value = "%" + pRequest.Parameters.SearchFlag + "%"
                };
                var cond2 = new LikeCondition()
                {
                    FieldName = "VipRealName", Value = "%" + pRequest.Parameters.SearchFlag + "%"
                };
                var com1 = new ComplexCondition()
                {
                    Left = cond1, Right = cond2, Operator = LogicalOperators.Or
                };

                var cond3 = new EqualsCondition()
                {
                    FieldName = "Phone", Value = pRequest.Parameters.SearchFlag
                };
                var com2 = new ComplexCondition()
                {
                    Left = com1, Right = cond3, Operator = LogicalOperators.Or
                };
                complexCondition.Add(com2);
                complexCondition.Add(new DirectCondition("(WeiXinUserId!='' Or WeiXinUserId IS NOT NULL)"));
                var tempVipList = vipLoginBLL.Query(complexCondition.ToArray(), null);
                if (tempVipList != null && tempVipList.Length != 0)
                {
                    pRequest.UserID = pRequest.Parameters.MemberID = tempVipList[0].VIPID;
                }
            }

            string m_MemberID = "";

            if (!string.IsNullOrWhiteSpace(pRequest.Parameters.OwnerVipID))
            {
                m_MemberID = string.IsNullOrWhiteSpace(pRequest.Parameters.OwnerVipID) ? pRequest.UserID : pRequest.Parameters.OwnerVipID;
            }
            else
            {
                m_MemberID = string.IsNullOrWhiteSpace(pRequest.Parameters.MemberID) ? pRequest.UserID : pRequest.Parameters.MemberID;
            }

            string UserID       = m_MemberID;
            var    VipLoginInfo = vipLoginBLL.GetByID(UserID);

            if (VipLoginInfo == null)
            {
                throw new APIException("用户不存在")
                      {
                          ErrorCode = 330
                      }
            }
            ;
            #region 20140909 kun.zou 发现状态为0,改为1
            if (VipLoginInfo.Status.HasValue && VipLoginInfo.Status == 0)
            {
                VipLoginInfo.Status = 1;
                vipLoginBLL.Update(VipLoginInfo, false);
                var log = new VipLogEntity()
                {
                    Action       = "更新",
                    ActionRemark = "vip状态为0的改为1.",
                    CreateBy     = UserID,
                    CreateTime   = DateTime.Now,
                    VipID        = VipLoginInfo.VIPID,
                    LogID        = Guid.NewGuid().ToString("N")
                };
                var logBll = new VipLogBLL(base.CurrentUserInfo);
                logBll.Create(log);
            }
            #endregion
            int couponCount = vipLoginBLL.GetVipCoupon(UserID);

            rd.MemberInfo.Mobile      = VipLoginInfo.Phone;      //手机号码
            rd.MemberInfo.Name        = VipLoginInfo.UserName;   //姓名
            rd.MemberInfo.VipID       = VipLoginInfo.VIPID;      //组标识
            rd.MemberInfo.VipName     = VipLoginInfo.VipName;    //会员名
            rd.MemberInfo.ImageUrl    = VipLoginInfo.HeadImgUrl; //会员头像  add by Henry 2014-12-5
            rd.MemberInfo.VipRealName = VipLoginInfo.VipRealName;
            rd.MemberInfo.VipNo       = VipLoginInfo.VipCode;
            rd.MemberInfo.IsDealer    = VipLoginInfo.Col48 != null?int.Parse(VipLoginInfo.Col48) : 0;

            //超级分销体系配置表 为判断是否存在分销体系使用
            var T_SuperRetailTraderConfigbll = new T_SuperRetailTraderConfigBLL(CurrentUserInfo);
            //获取分销体系信息
            var T_SuperRetailTraderConfigInfo = T_SuperRetailTraderConfigbll.QueryByEntity(new T_SuperRetailTraderConfigEntity()
            {
                IsDelete = 0, CustomerId = CurrentUserInfo.CurrentUser.customer_id
            }, null).FirstOrDefault();
            if (T_SuperRetailTraderConfigInfo != null)
            {
                rd.MemberInfo.CanBeSuperRetailTrader = 1;
            }
            else
            {
                rd.MemberInfo.CanBeSuperRetailTrader = 0;
            }
            rd.MemberInfo.SuperRetailTraderID = VipLoginInfo.Col26;
            //rd.MemberInfo.Integration = VipLoginInfo.Integration ?? 0;//会员积分

            #region 会员有效积分
            var vipIntegralBLL  = new VipIntegralBLL(CurrentUserInfo);
            var vipIntegralInfo = vipIntegralBLL.QueryByEntity(new VipIntegralEntity()
            {
                VipID = UserID, VipCardCode = VipLoginInfo.VipCode
            }, null).FirstOrDefault();
            if (vipIntegralInfo != null)
            {
                rd.MemberInfo.Integration = vipIntegralInfo.ValidIntegral != null ? vipIntegralInfo.ValidIntegral.Value : 0;
            }
            #endregion

            //会员等级
            //rd.MemberInfo.VipLevelName = string.IsNullOrEmpty(vipLoginBLL.GetVipLeave(UserID)) ? null : vipLoginBLL.GetVipLeave(UserID);
            #region 会员卡名称
            var                vipCardVipMappingBLL = new VipCardVipMappingBLL(CurrentUserInfo);
            var                vipCardBLL           = new VipCardBLL(CurrentUserInfo);
            var                vipCardTypeBLL       = new SysVipCardTypeBLL(CurrentUserInfo);
            var                vipCardRuleBLL       = new VipCardRuleBLL(CurrentUserInfo);
            var                vipT_InoutBLL        = new T_InoutBLL(CurrentUserInfo);
            VipAmountBLL       vipAmountBLL         = new VipAmountBLL(CurrentUserInfo);
            ShoppingCartBLL    service     = new ShoppingCartBLL(CurrentUserInfo);
            ShoppingCartEntity queryEntity = new ShoppingCartEntity();
            queryEntity.VipId = UserID;
            int totalQty = service.GetListQty(queryEntity);
            rd.MemberInfo.ShopCartCount = totalQty;
            //定义当前自定义等级
            int?CurVipLevel        = 0;
            var vipCardMappingInfo = vipCardVipMappingBLL.QueryByEntity(new VipCardVipMappingEntity()
            {
                VIPID = UserID, CustomerID = CurrentUserInfo.ClientID
            },
                                                                        new OrderBy[] { new OrderBy()
                                                                                        {
                                                                                            FieldName = "CreateTime", Direction = OrderByDirections.Desc
                                                                                        } }).FirstOrDefault();
            if (vipCardMappingInfo != null)
            {
                var vipCardInfo = vipCardBLL.QueryByEntity(new VipCardEntity()
                {
                    VipCardID = vipCardMappingInfo.VipCardID, VipCardStatusId = 1
                }, null).FirstOrDefault();
                if (vipCardInfo != null)
                {
                    var vipCardTypeInfo = vipCardTypeBLL.QueryByEntity(new SysVipCardTypeEntity()
                    {
                        VipCardTypeID = vipCardInfo.VipCardTypeID
                    }, null).FirstOrDefault();
                    if (vipCardTypeInfo != null)
                    {
                        rd.MemberInfo.VipLevelName     = vipCardTypeInfo.VipCardTypeName != null ? vipCardTypeInfo.VipCardTypeName : "";
                        rd.MemberInfo.CardTypeImageUrl = vipCardTypeInfo.PicUrl != null ? vipCardTypeInfo.PicUrl : "";
                        rd.MemberInfo.CardTypePrice    = vipCardTypeInfo.Prices != null ? vipCardTypeInfo.Prices.Value : 0;
                        rd.MemberInfo.IsExtraMoney     = vipCardTypeInfo.IsExtraMoney != null ? vipCardTypeInfo.IsExtraMoney : 0;
                        CurVipLevel             = vipCardTypeInfo.VipCardLevel;
                        rd.MemberInfo.IsPrepaid = vipCardTypeInfo.Isprepaid;
                        if (CurVipLevel > 1)
                        {
                            var VipCardTypeSysInfo = vipCardTypeBLL.GetBindVipCardTypeInfo(CurrentUserInfo.ClientID, VipLoginInfo.Phone, pRequest.UserID, CurVipLevel);
                            if (VipCardTypeSysInfo == null || VipCardTypeSysInfo.Tables[0].Rows.Count == 0)
                            {
                                rd.MemberInfo.IsNeedCard = 2;
                            }
                        }
                        else
                        {
                            rd.MemberInfo.IsNeedCard = 1;
                        }
                        //因为卡等级不能重复,知道当前等级后查找相应的下一级是否是自动升级(消费升级)
                        var NextVipCardTypeInfo = vipCardTypeBLL.QueryByEntity(new SysVipCardTypeEntity()
                        {
                            VipCardLevel = CurVipLevel + 1, CustomerID = CurrentUserInfo.ClientID
                        }, null).FirstOrDefault();
                        if (NextVipCardTypeInfo != null)
                        {
                            //获取当前会员的消费金额信息
                            decimal CurVipConsumptionAmount = 0;
                            decimal VipConsumptionInfo      = vipT_InoutBLL.GetVipSumAmount(UserID);
                            if (VipConsumptionInfo > 0)
                            {
                                CurVipConsumptionAmount = Convert.ToDecimal(Convert.ToDecimal(VipConsumptionInfo).ToString("0.00"));
                            }
                            //知道下一等级后要判断,升级条件是否是消费升级
                            //定义累积消费金额
                            decimal AccumulatedAmount      = 0;
                            var     vipCardTypeUpGradeInfo = vipCardTypeBLL.GetVipCardTypeUpGradeInfo(CurrentUserInfo.ClientID, CurVipLevel);
                            if (vipCardTypeUpGradeInfo != null && vipCardTypeUpGradeInfo.Tables[0].Rows.Count > 0)
                            {
                                //判断拉取的所有卡等级里的最近的一级满足条件即可返回提示所需的值
                                int flag = 0;
                                foreach (DataRow dr in vipCardTypeUpGradeInfo.Tables[0].Rows)
                                {
                                    AccumulatedAmount = Convert.ToDecimal(Convert.ToDecimal(dr["BuyAmount"].ToString()).ToString("0.00"));
                                    //获取消费升级还需多少钱
                                    if (AccumulatedAmount > CurVipConsumptionAmount && flag == 0)
                                    {
                                        flag = 1;
                                        rd.MemberInfo.UpGradeNeedMoney = AccumulatedAmount - CurVipConsumptionAmount;
                                        if (rd.MemberInfo.UpGradeNeedMoney > 0)
                                        {
                                            rd.MemberInfo.UpgradePrompt = "还需要消费" + rd.MemberInfo.UpGradeNeedMoney + "元可以升级啦,快点通知会员!";
                                        }
                                    }
                                }
                            }
                        }

                        var VipCardRuleInfo = vipCardRuleBLL.QueryByEntity(new VipCardRuleEntity()
                        {
                            CustomerID = CurrentUserInfo.ClientID, VipCardTypeID = vipCardTypeInfo.VipCardTypeID
                        }, null).FirstOrDefault();
                        if (VipCardRuleInfo != null)
                        {
                            rd.MemberInfo.CardDiscount = Convert.ToDecimal(Convert.ToDecimal((VipCardRuleInfo.CardDiscount / 10)).ToString("0.00"));
                        }
                    }
                }
            }
            else
            {
                //表示需要领卡,并展示等级为1的默认卡
                rd.MemberInfo.IsNeedCard = 0;
                var VipCardTypeData = vipCardTypeBLL.QueryByEntity(new SysVipCardTypeEntity()
                {
                    VipCardLevel = 1, CustomerID = CurrentUserInfo.ClientID
                }, null).FirstOrDefault();
                if (VipCardTypeData != null)
                {
                    rd.MemberInfo.CardTypeImageUrl = VipCardTypeData.PicUrl != null ? VipCardTypeData.PicUrl : "";
                }
            }
            //获取红利/// decimal[0]=总收入(红利) decimal[2]=支出余额 decimal[1]=总提现金额
            decimal[] array = vipAmountBLL.GetVipSumAmountByCondition(UserID, CurrentUserInfo.ClientID, true);
            if (array[0] != null)
            {
                rd.MemberInfo.ProfitAmount = array[0];
            }
            //是否有付费的会员卡
            List <IWhereCondition> freeCardCon = new List <IWhereCondition> {
            };
            freeCardCon.Add(new EqualsCondition()
            {
                FieldName = "CustomerID", Value = CurrentUserInfo.ClientID
            });
            freeCardCon.Add(new DirectCondition("Prices>0"));
            var freeCardTypeInfo = vipCardTypeBLL.Query(freeCardCon.ToArray(), null).FirstOrDefault();
            if (freeCardTypeInfo != null)
            {
                rd.MemberInfo.IsCostCardType = 1;
            }
            else
            {
                rd.MemberInfo.IsCostCardType = 0;
            }

            #endregion

            rd.MemberInfo.Status       = VipLoginInfo.Status.HasValue ? VipLoginInfo.Status.Value : 1;
            rd.MemberInfo.CouponsCount = couponCount;
            rd.MemberInfo.IsActivate   = (VipLoginInfo.IsActivate.HasValue && VipLoginInfo.IsActivate.Value == 1 ? true : false);
            var customerBasicSettingBll = new CustomerBasicSettingBLL(CurrentUserInfo);
            rd.MemberInfo.MemberBenefits = customerBasicSettingBll.GetMemberBenefits(pRequest.CustomerID);



            //获取标签信息
            TagsBLL TagsBLL = new TagsBLL(base.CurrentUserInfo);


            var dsIdentity = TagsBLL.GetVipTagsList("", UserID);//“车主标签”  传7
            if (dsIdentity != null && dsIdentity.Tables.Count > 0 && dsIdentity.Tables[0].Rows.Count > 0)
            {
                rd.IdentityTagsList = DataTableToObject.ConvertToList <TagsInfo>(dsIdentity.Tables[0]).ToArray(); //“年龄段”  传8
            }


            #region 获取注册表单的列明和值

            var vipEntity = vipLoginBLL.QueryByEntity(new VipEntity()
            {
                VIPID = UserID
            }, null);

            if (vipEntity == null || vipEntity.Length == 0)
            {
                return(rd);
            }
            else
            {
                var ds = vipLoginBLL.GetVipColumnInfo(CurrentUserInfo.ClientID, "online005");

                var vipDs = vipLoginBLL.GetVipInfo(UserID);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    var temp = ds.Tables[0].AsEnumerable().Select(t => new MemberControlInfo()
                    {
                        ColumnName  = t["ColumnName"].ToString(),
                        ControlType = Convert.ToInt32(t["ControlType"]),
                        ColumnValue = vipDs.Tables[0].Rows[0][t["ColumnName"].ToString()].ToString(),
                        ColumnDesc  = t["columnDesc"].ToString()
                    });

                    rd.MemberControlList = temp.ToArray();
                }
            }

            //var vipamountBll = new VipAmountBLL(this.CurrentUserInfo);

            //var vipAmountEntity = vipamountBll.GetByID(UserID);


            var unitBll = new UnitBLL(this.CurrentUserInfo);
            //Hashtable htPara = new Hashtable();
            //htPara["MemberID"] = UserID;
            //htPara["CustomerID"] = CurrentUserInfo.ClientID;
            //htPara["PageIndex"] = 1;
            //htPara["PageSize"] = 10;
            //DataSet dsMyAccount = unitBll.GetMyAccount(htPara);

            //if (dsMyAccount.Tables[0].Rows.Count > 0)
            //{
            //    //rd.AccountList = DataTableToObject.ConvertToList<AccountInfo>(dsMyAccount.Tables[0]);
            //    //rd.MemberInfo.Balance = Convert.ToDecimal(dsMyAccount.Tables[0].Rows[0]["Total"].ToString());
            //    //rd.TotalPageCount = int.Parse(dsMyAccount.Tables[0].Rows[0]["PageCount"].ToString());

            //}
            //else
            //    rd.MemberInfo.Balance = 0;

            //返现 add by Henry 2015-4-15
            var vipAmountBll = new VipAmountBLL(CurrentUserInfo);
            //var vipAmountInfo = vipAmountBll.GetByID(UserID);
            var vipAmountInfo = vipAmountBll.QueryByEntity(new VipAmountEntity()
            {
                VipId = UserID, VipCardCode = VipLoginInfo.VipCode
            }, null).FirstOrDefault();
            decimal returnAmount = 0;
            decimal amount       = 0;
            if (vipAmountInfo != null)
            {
                returnAmount = vipAmountInfo.ValidReturnAmount == null ? 0 : vipAmountInfo.ValidReturnAmount.Value;
                amount       = vipAmountInfo.EndAmount == null ? 0 : vipAmountInfo.EndAmount.Value;
            }
            rd.MemberInfo.ReturnAmount = returnAmount; //返现
            rd.MemberInfo.Balance      = amount;       //余额
            #endregion


            //获取订单的日期和订单的里的商品名称、商品单价、商品数量
            //先获取订单列表,再获取订单详细信息
            int?         pageSize     = 3; //rp.Parameters.PageSize;,只取三条记录
            int?         pageIndex    = 1; //rp.Parameters.PageIndex;
            string       OrderBy      = "";
            string       OrderType    = "";
            T_InoutBLL   T_InoutBLL   = new T_InoutBLL(CurrentUserInfo);
            InoutService InoutService = new InoutService(CurrentUserInfo);
            //只取状态为700的
            //根据订单列表取订单详情
            DataSet dsOrder = T_InoutBLL.GetOrdersByVipID(rd.MemberInfo.VipID, pageIndex ?? 1, pageSize ?? 15, OrderBy, OrderType);//获取会员信息
            if (dsOrder != null && dsOrder.Tables.Count != 0 && dsOrder.Tables[0].Rows.Count != 0)
            {
                List <JIT.CPOS.DTO.Module.VIP.Login.Response.OrderInfo> orderList = DataTableToObject.ConvertToList <JIT.CPOS.DTO.Module.VIP.Login.Response.OrderInfo>(dsOrder.Tables[1]);
                foreach (JIT.CPOS.DTO.Module.VIP.Login.Response.OrderInfo oi in orderList)
                {
                    IList <InoutDetailInfo> detailList = InoutService.GetInoutDetailInfoByOrderId(oi.order_id);
                    oi.DetailList = detailList;
                }
                rd.OrderList = orderList;
            }

            MessageInfo message = new MessageInfo();


            InnerGroupNewsBLL InnerGroupNewsService = new InnerGroupNewsBLL(CurrentUserInfo);
            SetoffToolsBLL    setofftoolsService    = new SetoffToolsBLL(CurrentUserInfo);

            //1=微信用户 2=APP员工
            int UnReadInnerMessageCount = InnerGroupNewsService.GetVipInnerGroupNewsUnReadCount(CurrentUserInfo.UserID, pRequest.CustomerID, 1, null, Convert.ToDateTime(VipLoginInfo.CreateTime));
            var setofftoolsMessageCount = setofftoolsService.GetUnReadSetoffToolsCount(CurrentUserInfo.UserID, pRequest.CustomerID, 1, 1);
            message.InnerGroupNewsCount = UnReadInnerMessageCount;
            message.SetoffToolsCount    = setofftoolsMessageCount;
            var VipUpNewsInfo = InnerGroupNewsService.GetVipInnerNewsInfo(CurrentUserInfo.ClientID, 2, 1, 3, 0);
            if (VipUpNewsInfo != null && VipUpNewsInfo.Tables[0].Rows.Count > 0)
            {
                message.UpGradeSucess = VipUpNewsInfo.Tables[0].Rows[0]["Text"] != null ? VipUpNewsInfo.Tables[0].Rows[0]["Text"].ToString() : "";
                //获取通知信息 并更新已读状态 数据如果不是一条进行更新所有数据
                var newsUserMappingBLL = new NewsUserMappingBLL(CurrentUserInfo);
                if (VipUpNewsInfo.Tables[0].Rows.Count > 1)//数据如果不是一条进行更新所有数据
                {
                    foreach (DataRow VipNewsdr in VipUpNewsInfo.Tables[0].Rows)
                    {
                        var vipNewsInfo = newsUserMappingBLL.QueryByEntity(new NewsUserMappingEntity()
                        {
                            CustomerId = CurrentUserInfo.ClientID, MappingID = VipNewsdr["MappingID"].ToString()
                        }, null).FirstOrDefault();
                        if (vipNewsInfo != null)
                        {
                            vipNewsInfo.HasRead = 1;
                            newsUserMappingBLL.Update(vipNewsInfo);
                        }
                    }
                }
                else
                {
                    var vipNewsInfo = newsUserMappingBLL.QueryByEntity(new NewsUserMappingEntity()
                    {
                        CustomerId = CurrentUserInfo.ClientID, MappingID = VipUpNewsInfo.Tables[0].Rows[0]["MappingID"].ToString()
                    }, null).FirstOrDefault();
                    if (vipNewsInfo != null)
                    {
                        vipNewsInfo.HasRead = 1;
                        newsUserMappingBLL.Update(vipNewsInfo);
                    }
                }
            }
            else
            {
                message.UpGradeSucess = "";
            }
            rd.MessageInfo = message;
            return(rd);
        }
    }