Esempio n. 1
0
        public void GivePoint()
        {
            CustomerScoreLogDA         da   = new CustomerScoreLogDA();
            List <CustomerScoreEntity> list = da.LoadWaitGivePointList();

            if (list != null && list.Count > 0)
            {
                foreach (CustomerScoreEntity item in list)
                {
                    if (string.IsNullOrWhiteSpace(item.CrmMemberID))
                    {
                        string errorMark = "CrmMemberID为空";
                        da.GivePointFaild(item.SysNo, errorMark);
                        string msg = string.Format("CRM赠送积分失败:编号-{0},积分-{1},顾客-{2},CRM顾客编号-,原因-{3}", item.SysNo
                                                   , item.ValidScore, item.CustomerSysNo, errorMark);
                        Writelog(msg);
                        continue;
                    }
                    string message = string.Empty;
                    List <CRMLuckDrawLog> luckList = CRMExternalService.CrmTradeConfirm(item, out message);
                    if (string.IsNullOrEmpty(message))
                    {
                        da.GivePointSuccess(item.SysNo);
                        string msg = string.Format("CRM赠送积分成功:编号-{0},积分-{1},顾客-{2},CRM顾客编号-{3}", item.SysNo
                                                   , item.ValidScore, item.CustomerSysNo, item.CrmMemberID);
                        //插入抽奖信息
                        if (luckList != null && luckList.Count > 0)
                        {
                            foreach (var entity in luckList)
                            {
                                da.InsertCRMLuckDrawLog(entity);
                            }
                        }
                        Writelog(msg);
                    }
                    else
                    {
                        string errorMark = CRMExternalService.CrmOpClaUtilInStance.RMsg;
                        da.GivePointFaild(item.SysNo, errorMark);
                        string msg = string.Format("CRM赠送积分失败:编号-{0},积分-{1},顾客-{2},CRM顾客编号-{3},原因-{4}", item.SysNo
                                                   , item.ValidScore, item.CustomerSysNo, item.CrmMemberID, errorMark);
                        Writelog(msg);
                    }
                }
            }
        }
Esempio n. 2
0
        public void ReturnPoint()
        {
            CustomerScoreLogDA         da   = new CustomerScoreLogDA();
            List <CustomerScoreEntity> list = da.GetWaitReturnSOIDs();

            if (list != null && list.Count > 0)
            {
                foreach (CustomerScoreEntity item in list)
                {
                    if (string.IsNullOrWhiteSpace(item.CrmMemberID))
                    {
                        string errorMark = "CrmMemberID为空";
                        string msg       = string.Format("CRM退还积分失败:编号-{0},积分-{1},顾客-{2},CRM顾客编号-,原因-{3}", item.SysNo
                                                         , item.ValidScore, item.CustomerSysNo, errorMark);
                        da.GivePointFaild(item.SysNo, msg);
                        Writelog(msg);
                        continue;
                    }
                    string message = string.Empty;
                    bool   success = CRMExternalService.CrmReturn(item, out message);
                    if (success)
                    {
                        string msg = string.Format("CRM退还积分成功:编号-{0},积分-{1},顾客-{2},CRM顾客编号-,原因-{3}", item.SysNo
                                                   , item.ValidScore, item.CustomerSysNo, message);
                        da.ReturnPiontSuccess(item.SysNo);
                        Writelog(msg);
                    }
                    else
                    {
                        if (message == "noneed")
                        {
                            //:该订单没有退款的商品
                        }
                        else
                        {
                            string msg = string.Format("CRM退还积分失败:编号-{0},积分-{1},顾客-{2},CRM顾客编号-,原因-{3}", item.SysNo
                                                       , item.ValidScore, item.CustomerSysNo, message);
                            da.GivePointFaild(item.SysNo, msg);
                            Writelog(msg);
                        }
                    }
                }
            }
        }