Ejemplo n.º 1
0
        /// <summary>
        /// 订单详情
        /// </summary>
        /// <param name="uid"></param>
        /// <param name="orderNum"></param>
        /// <returns></returns>
        public OrderDetail OrderDetail(string uid, string orderNum)
        {
            OrderDetail order    = new model.OrderDetail();
            string      orderSql = " select * from [Order] where Uid={0} and OrderId={1}";

            DAO.Order o     = db.Database.SqlQuery <DAO.Order>(string.Format(orderSql, uid, orderNum)).FirstOrDefault();
            string    opSql = " SELECT *  FROM [OrderProList] where [OrderId] ={0}";
            List <DAO.OrderProList> opList = db.Database.SqlQuery <DAO.OrderProList>(string.Format(opSql, orderNum)).ToList();
            string imgSql = "select * from imgstock where partID in (select ProductID from orderProList where orderID={0})";
            List <DAO.ImgStock> imgList = db.Database.SqlQuery <DAO.ImgStock>(string.Format(imgSql, orderNum)).ToList();
            string expSql = "select * from ExpRecord where orderNum ='{0}'";

            DAO.ExpRecord ex  = db.Database.SqlQuery <DAO.ExpRecord>(string.Format(expSql, orderNum)).FirstOrDefault();
            int?          exp = 0;

            if (ex != null)
            {
                exp = ex.Exp;
            }
            order.order    = o;
            order.opList   = opList;
            order.pimgList = imgList;
            order.exp      = exp == null ? 0 : exp;
            return(order);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        public bool GiveExp(DAO.MemberBase mb, decimal orderPrice, string orderNumber)
        {
            DAO.ExpRecord extModel = new DAO.ExpRecord();
            extModel.Uid        = mb.ID;
            extModel.Source     = "订单";
            extModel.OrderNum   = orderNumber;
            extModel.OrderPrice = orderPrice;
            extModel.Datetime   = DateTime.Now;
            extModel.Status     = 0;
            //判断用户注册类型 计算积分
            if (mb.UpUser == -1)
            {
                //独立注册
                decimal JF = Math.Floor(orderPrice * decimal.Parse(ConfigurationApp.XFJFXS));
                extModel.Exp = Convert.ToInt32(decimal.Parse(ConfigurationApp.SM) * JF);
                if (extModel.Exp > 0)
                {
                    db.ExpRecord.Add(extModel);
                }
            }
            else
            {
                //被推荐注册的
                decimal JF = Math.Floor(orderPrice * decimal.Parse(ConfigurationApp.XFJFXS));
                extModel.Exp = Convert.ToInt32(decimal.Parse(ConfigurationApp.CM) * JF);
                if (extModel.Exp > 0)
                {
                    db.ExpRecord.Add(extModel);
                }
                //给上级积分
                extModel.Uid      = mb.UpUser;
                extModel.Source   = "推广订单";
                extModel.LowerUid = mb.ID;
                extModel.Exp      = Convert.ToInt32(Math.Floor(orderPrice / 100));//每100得到1分
                if (extModel.Exp > 0)
                {
                    db.ExpRecord.Add(extModel);
                }
            }
            int r = db.SaveChanges();

            if (r > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 给上级用户积分
 /// </summary>
 public void GiveUpUserInt(int cuid, int upUser)
 {
     if (upUser != -1)
     {
         ExpRecordBLL  expBll   = new ExpRecordBLL();
         DAO.ExpRecord expModel = new DAO.ExpRecord();
         expModel.Uid      = upUser;
         expModel.Source   = "发展注册";
         expModel.LowerUid = cuid;
         expModel.Exp      = int.Parse(ConfigurationApp.TJJF);
         expModel.Datetime = DateTime.Now;
         expModel.Status   = 1;
         expBll.AddRecord(expModel);
     }
 }
Ejemplo n.º 5
0
 //添加记录
 public void AddRecord(DAO.ExpRecord m)
 {
     db.ExpRecord.Add(m);
     db.SaveChanges();
 }