Beispiel #1
0
 private string CreateOrderDesc(Common.Order_Type OType, Bis_Gift GiftEntity, decimal?Amount)
 {
     if (OType == Common.Order_Type.Consume)
     {
         return(string.Format(@"【中猎国际俱乐部】商品名称:{0},商品描述:{1}", GiftEntity.GiftName, GiftEntity.Description));
     }
     //return string.Format(@"【中猎国际俱乐部】<br/>商品名称:{0} <br/> 商品描述:{1}", GiftEntity.GiftName, GiftEntity.Description);
     else
     {
         return(string.Format(@"【中猎国际俱乐部】充值金额:{0}", Amount));
     }
 }
Beispiel #2
0
 /// <summary>
 /// 提交消费订单
 /// </summary>
 /// <param name="GiftEntity"></param>
 /// <param name="GoodList"></param>
 /// <returns></returns>
 public ResultModel <Bis_Record> SubmitOrder(Bis_Gift GiftEntity, List <Bis_Goods> GoodList, string UserID)
 {
     try
     {
         var UserAccount  = new UserAccountService().SelectByFilter(string.Format(@" UserID='{0}'", UserID)).FirstOrDefault();
         var recordEntity = new Bis_Record
         {
             RecordID    = Utils.CreateGUID(),
             Amount      = GiftEntity.Price ?? 0,
             CreateTime  = DateTime.Now,
             Description = CreateOrderDesc(Common.Order_Type.Consume, GiftEntity, null),
             OrderNo     = DateTime.Now.ToString("yyyyMMddHHmmssfff"),
             Status      = (int)Common.Order_Status.NotPay,
             Type        = (int)Common.Order_Type.Consume,
             UserID      = UserID,
             AccountID   = UserAccount != null ? UserAccount.AccountID : string.Empty,
         };
         var recordDetail = new List <Bis_RecordDetail>();
         var tmpGoodList  = GoodList.Where(A => A.IsChecked == true).ToList();
         foreach (var item in tmpGoodList)
         {
             recordDetail.Add(new Bis_RecordDetail
             {
                 ID       = Utils.CreateGUID(),
                 RecordID = recordEntity.RecordID,
                 GoodID   = item.GoodID
             });
         }
         if (base.Insert(recordEntity))
         {
             if (recordDetail.Count > 0)
             {
                 if (new RecordDetailService().Insert(recordDetail))
                 {
                     return(Common.MessageRes.OperateSuccess.SetResult <Bis_Record>(recordEntity));
                 }
             }
             else
             {
                 return(Common.MessageRes.OperateSuccess.SetResult <Bis_Record>(recordEntity));
             }
         }
         return(Common.MessageRes.OperateFailed.SetResult <Bis_Record>(null));
     }
     catch (Exception ex)
     {
         Common.MYLog.Error("提交消费订单:" + Common.SessionTools.UserName, ex.ToString());
         return((Common.MessageRes.OperateException + ex.ToString()).SetResult <Bis_Record>(null));
     }
 }
Beispiel #3
0
        public ResultModel <List <Bis_Goods> > GetGoodData(Bis_Gift GiftEntity)
        {
            try
            {
                List <Bis_Goods> resultData = null;
                if (string.IsNullOrEmpty(GiftEntity.GiftID))
                {
                    resultData = base.SelectAll();
                }
                else
                {
                    var GGFilter = string.Format(@" GiftID='{0}' ", GiftEntity.GiftID);
                    var GGResult = new GiftGoodService().SelectByFilter(GGFilter);
                    var GGIDList = GGResult.GroupBy(G => G.GoodID).Select(A => A.Key).ToArray();
                    var GGIDS    = string.Join("','", GGIDList);

                    var Filter = string.Format(@" GoodID IN ('{0}') ", GGIDS);
                    resultData = base.SelectByFilter(Filter);
                }

                if (resultData != null)
                {
                    // 枪支数量
                    var gunCount = resultData.Where(A => A.Type == (int)Common.Good_Type.Gun).Count();
                    foreach (var item in resultData)
                    {
                        // 该选项是否可选
                        if ((item.Type == (int)Common.Good_Type.Gun && gunCount > GiftEntity.Type1Count) ||
                            item.Type == (int)Common.Good_Type.Distance)
                        {
                            item.CanCheck = true;
                        }
                        else
                        {
                            item.CanCheck  = false;
                            item.IsChecked = true;
                        }
                    }
                }
                return(Common.MessageRes.OperateSuccess.SetResult <List <Bis_Goods> >(resultData));
            }
            catch (Exception ex)
            {
                Common.MYLog.Error("获取礼包下的商品列表:" + Common.SessionTools.UserName, ex.ToString());
                return((Common.MessageRes.OperateException + ex.ToString()).SetResult <List <Bis_Goods> >(null));
            }
        }