Esempio n. 1
0
 public ServiceResult UpdateOrder(PayStatusViewModel PayStatus)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         Guid Pay_No = new Guid(PayStatus.Pay_No);
         PayList orderItem = Find(Pay_No);
         DB_Service.Attach<PayList>(orderItem);
         orderItem.Status = PayStatus.Status;
         orderItem.Trade_No = PayStatus.Trade_No;
         orderItem.Buy_Email = PayStatus.Buy_Email;
         orderItem.Buy_ID = PayStatus.Buy_ID;
         orderItem.EndTime = DateTime.Now;
         DB_Service.Commit();
     }
     catch (DbEntityValidationException ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return result;
 }
Esempio n. 2
0
        public ServiceResult PayMoney(int MemberID, PayList PayOrder)
        {
            ServiceResult result = new ServiceResult();
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    PayStatusViewModel PayStatus = new PayStatusViewModel();
                    PayStatus.Pay_No = PayOrder.Pay_No.ToString();
                    PayStatus.Buy_Email = CookieHelper.Email;
                    PayStatus.Buy_ID = CookieHelper.UID;
                    PayStatus.Trade_No = "29038423784523849573247856";
                    PayStatus.Status = Pay_State.ApplyOk.ToString();
                    PayListService.UpdateOrder(PayStatus);

                    Member_MoneyService.AddMoney(MemberID, PayOrder.VMoney.Value, "0204");

                    Member_MoneyService.AddMoney(MemberID, Convert.ToInt32(PayOrder.Money.Value), "0203");

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                result.AddServiceError(Utilities.GetInnerMostException(ex));
            }
            return result;
        }
Esempio n. 3
0
        public ServiceResult PayVIP(int MemberID, ServerItem Server, PayList PayOrder)
        {
            ServiceResult result = new ServiceResult();
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    Member_VIP model = new Member_VIP();
                    var vip = GetMemberVIP(MemberID, true);

                    PayStatusViewModel PayStatus = new PayStatusViewModel();
                    PayStatus.Pay_No = PayOrder.Pay_No.ToString();
                    PayStatus.Buy_Email = CookieHelper.Email;
                    PayStatus.Buy_ID = CookieHelper.UID;

                    PayStatus.Trade_No = "29038423784523849573247856";
                    PayStatus.Status = Pay_State.ApplyOk.ToString();
                    PayListService.UpdateOrder(PayStatus);

                    var Upgrade = false;
                    var MoneyType = "0201";
                    if (vip != null)
                    {
                        Server.Money = Server.Month * 10;
                        MoneyType = "0206";

                        if (vip.EndTime.CompareTo(DateTime.Now) > 0 && Server.ServerType > vip.VipLevel)
                        {
                            Upgrade = true;
                            var day = UIHelper.DateDiff(DateDiffType.Day, DateTime.Now, vip.EndTime);
                            var UpgradeMoney = day * 2;
                            Member_MoneyService.AddMoney(MemberID, Server.Money, "0202");
                        }
                    }
                    else
                    {
                        MoneyType = "0205";
                        Server.Money = Server.Month * 5;
                    }

                    Member_MoneyService.AddMoney(MemberID, Server.Money, MoneyType);

                    if (vip == null)
                    {
                        model.AddTime = DateTime.Now;
                        model.VipLevel = Server.ServerType;
                        model.StartTime = DateTime.Now;
                        model.MemberID = MemberID;
                        model.EndTime = DateTime.Now.AddMonths(Server.Month + Server.GiftMonth);
                        model.Description = PayOrder.ProductType;
                        model.PayTime = 1;
                        Create(model);
                    }
                    else
                    {
                        model.ID = vip.ID;
                        model.MemberID = MemberID;
                        model.VipLevel = Server.ServerType;
                        if (vip.EndTime.CompareTo(DateTime.Now) > 0)
                        {
                            if (Upgrade)
                            {
                                model.EndTime = DateTime.Now.AddMonths(Server.Month + Server.GiftMonth);
                            }
                            else
                            {
                                model.EndTime = vip.EndTime.AddMonths(Server.Month + Server.GiftMonth);
                            }
                        }
                        else
                        {
                            model.EndTime = DateTime.Now.AddMonths(Server.Month + Server.GiftMonth);
                        }

                        Update(model);

                    }
                    Member_MoneyService.AddMoney(MemberID, Server.GiftMoney, "0201");

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                result.AddServiceError(Utilities.GetInnerMostException(ex));
            }
            return result;
        }