//6楼充值样式 private Model.User Register_6F(User model, RegisterViewModel registerViewModel) { model.UserName = registerViewModel.UserName; model.IPAddress = registerViewModel.IPAddress; model.Password = Util.Security.UEncypt.MD5(registerViewModel.Password); model.Amount = 10000;//默认充值10000元 model.CreateDate = DateTime.Now; model.IsDel = false; model.DepartmentType = registerViewModel.DepartmentType; BLLSession.IUserService.Add(model); //插入充值表,默认10000元 Recharge rechargeModel = new Recharge(); rechargeModel.UserID = model.UserID; rechargeModel.RechargeAmount = 10000; rechargeModel.Status = (int)RechargeStatusEnum.Succeed; rechargeModel.IsDel = false; rechargeModel.CreateDate = DateTime.Now; rechargeModel.OpeningBalance = 0; rechargeModel.CurrentBalance = 10000; rechargeModel.RechargeUserName = "******"; BLLSession.IRechargeService.Add(rechargeModel); //插入数据到消费流水表 BLLSession.IExpendLogService.Add(new ExpendLog() { UserID = model.UserID, ConsumeAmount = 0, RechargeAmount = rechargeModel.RechargeAmount, CreateDate = DateTime.Now, ExpendLogTypeID = rechargeModel.RechargeID, ExpendLogType = (int)ExpendLogTypeEnum.Recharge, Description = "充值完成增加金额" }); return model; }
public ActionResult Register(RegisterViewModel registerViewModel) { if (ModelState.IsValid) { var isExist = BLLSession.IUserService.GetListBy(m => m.UserName == registerViewModel.UserName).Count() > 0; if (isExist) { ModelState.AddModelError("", "该用户名已经存在,请直接登陆."); return View(registerViewModel); } User model = new Model.User(); //判断是否是6楼 if (OperateHelper.Is6F()) { model = Register_6F(model, registerViewModel); } else { model = Register_10F(model, registerViewModel); } //保存信息到Session和写入到Cookies WebHelper.OperateContext.Current.SetUserToSessionAndCookies(model, true); return Redirect("/home"); } return View(registerViewModel); }
//10楼样式 private Model.User Register_10F(User model, RegisterViewModel registerViewModel) { model.UserName = registerViewModel.UserName; model.IPAddress = registerViewModel.IPAddress; model.Password = Util.Security.UEncypt.MD5(registerViewModel.Password); model.Amount = 0; model.CreateDate = DateTime.Now; model.IsDel = false; model.DepartmentType = registerViewModel.DepartmentType; BLLSession.IUserService.Add(model); return model; }
public ActionResult Register() { RegisterViewModel model = new RegisterViewModel(); model.IPAddress = WaiMai.Util.Http.CheckIP.GetIP(); return View(model); }