示例#1
0
    public static void PointRateUpdate(Chain.Model.Mem mem, int point, int pointType, int mymemID, Chain.Model.SysUser User, string OrderAccount)
    {
        if (MEMPointUpdate.NowRateLevel <= MEMPointUpdate.RateLevel && mem.MemRecommendID != 0)
        {
            Chain.Model.Mem TEMPMEM = MEMPointUpdate.bll.GetModel(mem.MemRecommendID);
            if (TEMPMEM != null)
            {
                int temp = 0;
                if (MEMPointUpdate.RateType)
                {
                    temp = Convert.ToInt32(decimal.Truncate(point * (MEMPointUpdate.MEMRate[MEMPointUpdate.NowRateLevel - 1] / 100m)));
                }
                else
                {
                    temp = Convert.ToInt32(MEMPointUpdate.MEMRate[MEMPointUpdate.NowRateLevel - 1]);
                }
                if (PubFunction.IsShopPoint(User.UserShopID, ref temp))
                {
                    TEMPMEM.MemPoint += temp;
                    int flag = MEMPointUpdate.bll.Update(TEMPMEM);
                    MEMPointUpdate.sumPoint += temp;
                    if (flag == 1)
                    {
                        PubFunction.UpdateMemLevel(TEMPMEM);
                        Chain.Model.PointLog modelPoint = new Chain.Model.PointLog();
                        modelPoint.PointMemID      = TEMPMEM.MemID;
                        modelPoint.PointNumber     = temp;
                        modelPoint.PointChangeType = 9;
                        modelPoint.PointShopID     = TEMPMEM.MemShopID;
                        modelPoint.PointCreateTime = DateTime.Now;
                        modelPoint.PointUserID     = TEMPMEM.MemUserID;
                        modelPoint.PointOrderCode  = MEMPointUpdate.PointOrderCode;
                        modelPoint.PointGiveMemID  = mymemID;
                        switch (pointType)
                        {
                        case -1:
                            modelPoint.PointRemark = string.Concat(new object[]
                            {
                                "卡号:",
                                MEMPointUpdate.MEMCard,
                                ",姓名:",
                                MEMPointUpdate.MEMName,
                                "的会员商品消费退货,获得积分:[",
                                temp,
                                "]"
                            });
                            break;

                        case 0:
                        case 4:
                            break;

                        case 1:
                            modelPoint.PointRemark = string.Concat(new object[]
                            {
                                "卡号:",
                                MEMPointUpdate.MEMCard,
                                ",姓名:",
                                MEMPointUpdate.MEMName,
                                "的会员商品消费,获得积分:[",
                                temp,
                                "]"
                            });
                            break;

                        case 2:
                            modelPoint.PointRemark = string.Concat(new object[]
                            {
                                "卡号:",
                                MEMPointUpdate.MEMCard,
                                ",姓名:",
                                MEMPointUpdate.MEMName,
                                "的会员快速消费,获得积分:[",
                                temp,
                                "]"
                            });
                            break;

                        case 3:
                            modelPoint.PointRemark = string.Concat(new object[]
                            {
                                "卡号:",
                                MEMPointUpdate.MEMCard,
                                ",姓名:",
                                MEMPointUpdate.MEMName,
                                "的会员充次,获得积分:[",
                                temp,
                                "]"
                            });
                            break;

                        case 5:
                            modelPoint.PointRemark = string.Concat(new object[]
                            {
                                "卡号:",
                                MEMPointUpdate.MEMCard,
                                ",姓名:",
                                MEMPointUpdate.MEMName,
                                "的会员注册,获得积分:[",
                                temp,
                                "]"
                            });
                            break;

                        case 6:
                            modelPoint.PointRemark = string.Concat(new object[]
                            {
                                "卡号:",
                                MEMPointUpdate.MEMCard,
                                ",姓名:",
                                MEMPointUpdate.MEMName,
                                "的会员手动增加积分,获得积分:[",
                                temp,
                                "]"
                            });
                            break;

                        default:
                            switch (pointType)
                            {
                            case 14:
                                modelPoint.PointRemark = string.Concat(new object[]
                                {
                                    "卡号:",
                                    MEMPointUpdate.MEMCard,
                                    ",姓名:",
                                    MEMPointUpdate.MEMName,
                                    "的会员充时增加积分,获得积分:[",
                                    temp,
                                    "]"
                                });
                                break;

                            case 15:
                                modelPoint.PointRemark = string.Concat(new object[]
                                {
                                    "卡号:",
                                    MEMPointUpdate.MEMCard,
                                    ",姓名:",
                                    MEMPointUpdate.MEMName,
                                    "的会员充值增加积分,获得积分:[",
                                    temp,
                                    "]"
                                });
                                break;
                            }
                            break;
                        }
                        Chain.BLL.PointLog bllPoint = new Chain.BLL.PointLog();
                        bllPoint.Add(modelPoint);
                        PubFunction.SaveSysLog(TEMPMEM.MemUserID, 3, "会员积分提成", "会员" + TEMPMEM.MemName + "积分提成成功", TEMPMEM.MemShopID, DateTime.Now, PubFunction.ipAdress);
                    }
                    MEMPointUpdate.NowRateLevel++;
                    MEMPointUpdate.PointRateUpdate(TEMPMEM, point, pointType, mymemID, User, OrderAccount);
                }
            }
        }
    }