public void Update(ServerItem model) { var target = Find(model.ID); DB_Service.Attach<ServerItem>(target); target.Name = model.Name; target.Description = model.Description; target.HelpUrl = model.HelpUrl; target.ImgUrl = model.ImgUrl; target.Price = model.Price; target.ServerType = model.ServerType; target.TopType = model.TopType; target.VipDiscount = model.VipDiscount; target.VipDiscount2 = model.VipDiscount2; target.IsPayByVMoney = model.IsPayByVMoney; target.IsByCategory = model.IsByCategory; target.IsQuanGuo = model.IsQuanGuo; target.IsByChildCategory = model.IsByChildCategory; target.Money = model.Money; target.Month = model.Month; target.GiftMoney = model.GiftMoney; target.GiftMonth = model.GiftMonth; target.EndTime = model.EndTime; target.MemberID = model.MemberID; target.LastTime = DateTime.Now; DB_Service.Commit(); }
public ActionResult Create(ServerItemViewModel model) { if (ModelState.IsValid) { try { ServerItem item = new ServerItem() { AddTime = DateTime.Now, Description = model.Description, EndTime = model.EndTime, GiftMoney = model.GiftMoney, GiftMonth = model.GiftMonth, ImgUrl = model.ImgUrl, HelpUrl = model.HelpUrl, IsPayByVMoney = model.IsPayByVMoney, IsByCategory = model.IsByCategory, IsByChildCategory = model.IsByChildCategory, IsQuanGuo = model.IsQuanGuo, LastTime = DateTime.Now, MemberID = CookieHelper.MemberID, Money = model.Money, Month = model.Month, Name = model.Name, Price = model.Price, ServerType = model.ServerType, TopType = model.TopType, VipDiscount = model.VipDiscount, VipDiscount2 = model.VipDiscount2 }; ServerItemService.Create(item); return RedirectToAction("index"); } catch (Exception ex) { return View(model); } } else { return View(model); } }
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; }
public void Delete(ServerItem model) { var target = Find(model.ID); DB_Service.Remove<ServerItem>(target); DB_Service.Commit(); }
public void Create(ServerItem model) { DB_Service.Add<ServerItem>(model); DB_Service.Commit(); }