private void SavePayLog(ViewModel.PaymentViewModel model) { var paylog = new PayLog(); paylog.OrderId = model.OrderModel.OrderId; //paylog.TransactionId = model.OrderModel.TradeNo; paylog.UserId = model.OrderModel.UserId; paylog.PayWay = (int)PayWay.UnionPay; paylog.PayMoney = model.OrderModel.Total; paylog.PayUrl = ""; paylog.BackUrl = model.BackCallbackUrl; paylog.PayResult = "前往支付"; paylog.CreateTime = DateTime.Now; _uow.PayLogService.Add(paylog); _uow.Commit(); }
public ActionResult UnionDonations(ChariGameViewModel cgvm) { ViewData[SessionKey.VwUserMenu] = "uniondonation"; LoveChange old_lc = _uow.LoveChangeService.Get(o => o.UnionOrder == cgvm.DonationId && o.Amount == cgvm.DonationAmount); UserInfo usr = base.CurrentUser; if (old_lc == null) { ModelState.AddModelError("NotExistDonation", "无法帮定捐赠单"); var list = _uow.LoveChangeService.GetQueryList(o => o.UserId == usr.Id).OrderByDescending(o => o.CreateTime); cgvm.PageList = new Common.Helper.PageList <LoveChange>(list, cgvm.PageIndex, cgvm.PageCount); return(View(cgvm)); } if (old_lc.UserId != null) { ModelState.AddModelError("BindedDonation", "此捐赠单已经绑定"); var list = _uow.LoveChangeService.GetQueryList(o => o.UserId == usr.Id).OrderByDescending(o => o.CreateTime); cgvm.PageList = new Common.Helper.PageList <LoveChange>(list, cgvm.PageIndex, cgvm.PageCount); return(View(cgvm)); } old_lc.UserId = usr.Id; if (string.IsNullOrWhiteSpace(old_lc.TrueName)) { old_lc.TrueName = usr.TrueName; } _uow.Commit(); base.RenderTip(null); return(RedirectToAction("UnionDonations")); }
public void UpdateUserInfo() { if (Request.UserHostAddress != System.Configuration.ConfigurationManager.AppSettings["SyncRequestIp"]) { return; } var lotUserId = Request.Form["lotUserId"]; var trueName = Request.Form["tn"]; var idCardNo = Request.Form["cardno"]; var email = Request.Form["email"]; var lid = 0L; long.TryParse(lotUserId, out lid); if (lid <= 0) { var err = string.Format("彩票频道更新用户信息失败,彩票用户ID:{0}", lid); _log.Error(err); Response.Write(err); return; } try { var oldUser = _uow.UserInfoService.GetQueryList(t => t.LotteryUserId == lid).Single(); oldUser.TrueName = trueName; oldUser.IdentityCardNo = idCardNo; oldUser.Email = email; oldUser.UpdateTime = DateTime.Now; _uow.Commit(); Response.Write("1"); } catch (InvalidOperationException ex) { var err = string.Format("彩票频道更新用户信息失败,{0},彩票用户ID:{1}", ex.Message, lid); _log.Error(err); Response.Write(err); return; } }
public ActionResult EditUser(CustomerEditModel usr) { if (ModelState.IsValid) { if (usr.Id != 0) { UserInfo old_usr = _uow.UserInfoService.Get(o => o.Id == usr.Id); if (old_usr != null && old_usr.Id == usr.Id && !string.IsNullOrWhiteSpace(usr.UserName)) { old_usr.UserName = usr.UserName; old_usr.Email = usr.Email; old_usr.TrueName = usr.TrueName; old_usr.IdentityCardNo = usr.IdentityCardNo; old_usr.Tel = usr.Tel; old_usr.Phone = usr.Phone; old_usr.UpdateTime = DateTime.Now; _uow.Commit(); return(RedirectToAction("Users"));; } } } ModelState.AddModelError("", "Error Editing User"); return(View(usr)); }
public void GoPay(decimal amount, string tradeNo) { if (amount <= 0) { return; } //如果tradeno有值,则是从用户中心过来 if (string.IsNullOrEmpty(tradeNo)) { var user = Session[SessionKey.User] as UserInfo; //创建捐款订单 var order = new Order(); order.OrderId = System.Guid.NewGuid(); order.TradeNo = WebUtils.GenTradeNo(new Random()); order.OrderType = (int)Ichari.Model.Enum.OrderType.Donation; if (user != null) { order.UserId = user.Id; } else { order.UserId = StaticKey.AnonymousUserId; } order.Total = amount; order.PayWay = (int)Ichari.Model.Enum.PayWay.UnionPay; order.Ip = Request.UserHostAddress; order.Status = (int)Ichari.Model.Enum.OrderState.Create; order.CreateTime = DateTime.Now; //订单明细 order.OrderDetail.Add(new OrderDetail() { OrderId = order.OrderId, ProductId = VirtualProduct.Donation, ProductName = StaticKey.VirtualProdDonation, Price = amount, ProductCount = 1 }); _uow.OrderService.Add(order); _uow.Commit(); Response.Redirect(string.Format( WebUtils.GetAppSettingValue(StaticKey.PayUrlFormatter) , order.OrderId, order.TradeNo, PaySource.Donation) ); } var oldOrder = _uow.OrderService.Get(t => t.TradeNo == tradeNo); if (oldOrder == null) { return; } Response.Redirect(string.Format( WebUtils.GetAppSettingValue(StaticKey.PayUrlFormatter) , oldOrder.OrderId, oldOrder.TradeNo, PaySource.Donation) ); }