예제 #1
0
        /// <summary>
        /// 注册获取等级
        /// </summary>
        /// <param name="upUser"></param>
        /// <returns></returns>
        public DAO.MemberLevel GetLevel(int uid, int upUser)
        {
            ExpRecordBLL expBll = new ExpRecordBLL();

            DAO.ExpRecord  expModel = new DAO.ExpRecord();
            MemberLevelBLL mleve    = new MemberLevelBLL();

            DAO.MemberLevel lmodel;
            if (upUser == -1)//独立注册的新会员可自动升级为二星会员 且自主购货累计双倍积分。
            {
                lmodel = mleve.GetLevelBySelf();
                //添加积分记录
                expModel.Source = "独立注册";
            }
            else if (upUser == 0)
            {
                lmodel = mleve.GetLevelBySelf();
                //添加积分记录
                expModel.Source = "微信注册";
            }
            else
            { //推荐注册 一星会员
                lmodel = mleve.GetLevelByUser();
                //添加积分记录
                expModel.Source = "邀请码注册";
            }
            expModel.Uid      = uid;
            expModel.Exp      = lmodel.MinIntegral;
            expModel.Datetime = DateTime.Now;
            expModel.Status   = 1;
            expBll.AddRecord(expModel);
            return(lmodel);
        }
예제 #2
0
        /// <summary>
        /// 给上级返利
        /// </summary>
        /// <param name="cuid"></param>
        /// <param name="puid"></param>
        /// <param name="orderNumber"></param>
        /// <param name="orderPrice"></param>
        /// <returns></returns>
        public bool GiveParentRebate(string cuid, string cuName, int puid, string orderNumber, decimal orderPrice)
        {
            //MemberBLL mbBll=new MemberBLL ();
            //DAO.MemberBase mb= mbBll.GetUserByID(pUid.ToString());

            MemberLevelBLL mlBll = new MemberLevelBLL();

            DAO.MemberLevel ml = mlBll.GetLeveByUid(puid.ToString());//上级会员等级

            DAO.RebateRecord rr = new DAO.RebateRecord();
            rr.UID            = puid;
            rr.Price          = decimal.Parse(ConfigurationApp.PV) * orderPrice * ml.Income;
            rr.Source         = "推广返利";
            rr.PType          = "收入";
            rr.LowerUID       = int.Parse(cuid);
            rr.LowerOrder     = orderNumber;
            rr.OrderPrice     = orderPrice;
            rr.Datetime       = DateTime.Now;
            rr.Status         = 0;
            rr.InCome         = ml.Income;
            rr.LowerLoginName = cuName;
            if (orderPrice > 0 && rr.Price > 0)
            {
                db.RebateRecord.Add(rr);
                if (db.SaveChanges() > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }