public IHttpActionResult GetAvailableCouponsList(string openId, decimal amount) { var data = _prizeFacadeService.GetAvailableCouponsList(openId, amount); var result = new TResult <List <AvailableCouponsDto> >(); return(Ok(result.SuccessResult(data))); }
public TResult <LoginUser> Login(UserLoginModel userLoginModel) { var result = new TResult <LoginUser>(); var code = HttpContext.Current.Request.Cookies[SessionKey.ManagerUserLoginCode]; if (code == null || (string.IsNullOrEmpty(code.Value))) { return(result.FailureResult(null, "验证码已过期,请重新输入验证码!")); } if (!String.Equals(code.Value, userLoginModel.Code.Trim(), StringComparison.CurrentCultureIgnoreCase)) { return(result.FailureResult(null, "请输入正确的验证码!")); } var passWord = Md5HashHelper.HashPassword(userLoginModel.PassWord + SessionKey.CloudUserInfo); var adminUser = _otaBusinessUserService.Get(userLoginModel.UserName, passWord); if (adminUser == null) { return(result.FailureResult(null, "用户名或密码不正确!")); } //adminUser.LastLoginTime = DateTime.Now; //_otaBusinessUserService.Update(adminUser); var businesss = _otaBusinessService.Get(adminUser.OtaBusinessId); var userInfo = new LoginUser { Id = adminUser.Id, OtaBusinessId = adminUser.OtaBusinessId, UserName = adminUser.UserName, RealName = businesss.FullName }; HttpContext.Current.Session[SessionKey.ManagerUserInfo] = userInfo; return(result.SuccessResult(userInfo, "登陆成功")); }
public IHttpActionResult PostDrawStart(string openId) { var data = _prizeFacadeService.DrawStart(openId); var result = new TResult <PrizeWinningDto>(); return(Ok(result.SuccessResult(data))); }
/// <summary> /// 注销 /// </summary> /// <returns></returns> public TResult LoginOut() { var result = new TResult(); //清除session System.Web.HttpContext.Current.Session[SessionKey.UserInfo] = null; //清除cookie int limit = System.Web.HttpContext.Current.Request.Cookies.Count; for (int i = 0; i < limit; i++) { string cookieName = System.Web.HttpContext.Current.Request.Cookies[i].Name; if (cookieName.Equals(SessionKey.SaleUserLoginCookie)) { //当前上下文 该cookie失效 HttpCookie aCookie = System.Web.HttpContext.Current.Request.Cookies[i]; aCookie.Expires = DateTime.Now.AddDays(-1); System.Web.HttpContext.Current.Response.Cookies.Add(aCookie); //移除客户端中的cookie System.Web.HttpContext.Current.Request.Cookies.Remove(cookieName); break; } } return(result.SuccessResult()); }
public IHttpActionResult GetPrizeUserForCouponList(string openId, bool isUse) { var data = _prizeFacadeService.GetPrizeUserForCouponList(openId, isUse); var result = new TResult <List <PrizeUserListDto> >(); return(Ok(result.SuccessResult(data))); }
public TResult PayOrder(OrderCreateModel order) { var result = new TResult(); if (order.TicketItem.Count <= 0) { return(result.ErrorResult("请选择您要购买的产品")); } var userInfo = _enterpriseUserService.LoginForSession(); var orderInfo = new OrderInfoCreateModel { PayType = order.PayType, UserId = userInfo.UserId, ValidityDate = order.ValidityDate, Mobile = "", Linkman = "", TicketCategory = (int)TicketCategoryStatus.QrCodePrintTicket, TicketSource = (int)TicketSourceStatus.ScenicSpot, TicketItem = order.TicketItem }; List <int> productIds = orderInfo.TicketItem.Select(a => a.TicketId).ToList(); var tbl_Tickets = _ticketService.GetTickets(productIds); var tbl_Order = _orderService.AddOrder(orderInfo); var tbl_OrderDetails = _orderDetailService.AddOrderDetails(orderInfo, tbl_Order); _orderService.UpdateOrder(tbl_Order, tbl_OrderDetails); var tbl_Ticket_Testings = _ticketTestingService.addTicketTestings(tbl_Order, tbl_OrderDetails); _ticketService.UpdateTicketBySellCount(tbl_Tickets, tbl_OrderDetails); try { _orderService.BeginTran(); _orderService.Add(tbl_Order); _orderDetailService.Add(tbl_OrderDetails); _ticketTestingService.Add(tbl_Ticket_Testings); _saleLogService.Add(tbl_Order); _ticketService.Update(tbl_Tickets); //提交事物 _orderService.CommitTran(); } catch { _orderService.RollbackTran(); return(result.ErrorResult()); } //打印机打印 if (order.IsPrint && !string.IsNullOrEmpty(order.PrintKey)) { var isPrint = _printService.Print(tbl_Order.OrderNo, order.PrintKey); if (!isPrint.Success) { return(result.ErrorResult("门票创建成功," + isPrint.Message)); } } return(result.SuccessResult()); }
public IHttpActionResult GetPrizeConfig(string openId) { var data = _prizeFacadeService.GetPrizeConfig(openId); var result = new TResult <PrizeConfigInfoDto>(); return(Ok(result.SuccessResult(data))); }
/// <summary> /// 保存抽奖配置信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public TResult UpdatePrizeConfig(PrizeConfigDto model) { TResult result = new TResult(); try { var tbl_WeiXinPrizeConfig = _prizeConfigRepository.FirstOrDefault(); if (tbl_WeiXinPrizeConfig == null) { _prizeConfigRepository.Add(new Tbl_PrizeConfig { Frequency = model.Frequency, IsEnable = model.IsEnable, StartDate = model.StartDate, EndDate = model.EndDate }); } else { tbl_WeiXinPrizeConfig.Frequency = model.Frequency; tbl_WeiXinPrizeConfig.IsEnable = model.IsEnable; tbl_WeiXinPrizeConfig.StartDate = model.StartDate; tbl_WeiXinPrizeConfig.EndDate = model.EndDate; _prizeConfigRepository.Update(tbl_WeiXinPrizeConfig); } return(result.SuccessResult("保存成功")); } catch { return(result.FailureResult("保存失败")); } }
/// <summary> /// 注销 /// </summary> /// <returns></returns> //[ActivityLog("注销", "系统管理员进行帐号注销")] public JsonResult LoginOut() { this.ClearSessionAndCookie(); var result = new TResult(); return(Json(result.SuccessResult(), JsonRequestBehavior.AllowGet)); }
public IHttpActionResult GetWxOAuth(string code) { var openId = _wxPayFacadeService.GetOpenId(code); var result = new TResult <string>(); return(Ok(result.SuccessResult(openId))); }
public ActionResult UpdateData(Tbl_MemberType model) { _memberTypeFacadeService.Update(model); var result = new TResult(); return(Json(result.SuccessResult(), JsonRequestBehavior.AllowGet)); }
public IHttpActionResult GetBannerItems() { var data = _bannerFacadeService.GetItems(); var result = new TResult <List <BannerItemDto> >(); return(Ok(result.SuccessResult(data))); }
public JsonResult DetailData(int id) { var result = new TResult <OrderDetailViewModel>(); var data = _orderFacadeService.Get(id); return(Json(result.SuccessResult(data), JsonRequestBehavior.AllowGet)); }
public TResult Print(string orderNo, string printKey) { var result = new TResult(); try { var printConfigData = _printGateway.Get(printKey); if (printConfigData == null) { return(result.FailureResult("打印机编号不存在,请进行补打")); } var tbl_Order = _orderService.Get(orderNo); if (tbl_Order == null) { return(result.FailureResult("订单不存在")); } var tbl_Scenic = _scenicService.Get(tbl_Order.ScenicId); var tbl_OrderDetails = _orderDetailService.GetList(orderNo); foreach (var row in tbl_OrderDetails) { Print(printConfigData, tbl_Scenic, row); } return(result.SuccessResult()); } catch (Exception e) { return(result.FailureResult("打印系统繁忙,请稍后进行补打.")); } }
public TResult Print(int orderDetailId, string printKey) { var result = new TResult(); var printConfigData = _printGateway.Get(printKey); if (printConfigData == null) { return(result.FailureResult("打印机配置不正确")); } var tbl_OrderDetail = _orderDetailService.Get(orderDetailId); if (tbl_OrderDetail == null) { return(result.FailureResult("订单不存在")); } if ((tbl_OrderDetail.OrderStatus == (int)OrderDetailsDataStatus.Activate || tbl_OrderDetail.OrderStatus == (int)OrderDetailsDataStatus.IsTaken) && tbl_OrderDetail.ValidityDateEnd.Date >= DateTime.Now.Date) { var tbl_Scenic = _scenicService.Get(tbl_OrderDetail.ScenicId); var printResult = Print(printConfigData, tbl_Scenic, tbl_OrderDetail); if (!printResult.Success) { return(result.FailureResult(printResult.Message)); } return(result.SuccessResult()); } else { return(result.FailureResult("该订单,不能进行打印")); } }
/// <summary> /// 修改奖品 /// </summary> /// <param name="model"></param> /// <returns></returns> public TResult UpdatePrize(PrizeDto model) { TResult result = new TResult(); try { var tbl_WeiXinPrize = _prizeRepository.Get(model.Id); if (tbl_WeiXinPrize == null) { return(result.FailureResult()); } tbl_WeiXinPrize.Name = model.Name; tbl_WeiXinPrize.PrizeName = model.PrizeName; tbl_WeiXinPrize.PrizeProbability = model.PrizeProbability; tbl_WeiXinPrize.Money = model.Money; tbl_WeiXinPrize.PrizeType = model.PrizeType; tbl_WeiXinPrize.Stock = model.Stock; tbl_WeiXinPrize.IsEnable = model.IsEnable; tbl_WeiXinPrize.MinUseAmount = model.MinUseAmount; tbl_WeiXinPrize.StartDate = model.StartDate; tbl_WeiXinPrize.EndDate = model.EndDate; _prizeRepository.Update(tbl_WeiXinPrize); return(result.SuccessResult()); } catch { return(result.FailureResult()); } }
/// <summary> /// 添加奖品 /// </summary> /// <param name="model"></param> /// <returns></returns> public TResult AddPrize(PrizeDto model) { TResult result = new TResult(); try { _prizeRepository.Add(new Tbl_Prize { Name = model.Name, PrizeName = model.PrizeName, PrizeProbability = model.PrizeProbability, Money = model.Money, PrizeType = model.PrizeType, Stock = model.Stock, IsEnable = model.IsEnable, MinUseAmount = model.MinUseAmount, StartDate = model.StartDate, EndDate = model.EndDate, CreateTime = DateTime.Now, CreateUserId = 0 }); return(result.SuccessResult()); } catch { return(result.FailureResult()); } }
/// <summary> /// 下移 /// </summary> /// <param name="id"></param> /// <returns></returns> public TResult MoveDown(int id) { TResult result = new TResult(); try { var nowBanner = _bannerRepository.Get(id); if (nowBanner == null) { return(result.FailureResult()); } var banner = _bannerRepository.GetOrderByOrFirst(a => a.Order > nowBanner.Order); if (banner == null) { return(result.FailureResult("当前已经是最后一位")); } int bannerOrder = banner.Order; banner.Order = nowBanner.Order; nowBanner.Order = bannerOrder; using (TransactionScope transaction = new TransactionScope()) { _bannerRepository.Update(nowBanner); _bannerRepository.Update(banner); _bannerRepository.SaveChanges(); transaction.Complete(); } return(result.SuccessResult("下移成功")); } catch { return(result.FailureResult()); } }
public TResult Add(OrderAddModel model) { var result = new TResult(); var ticketIds = model.TicketItem.Select(a => a.TicketId).ToList(); if (ticketIds.Count <= 0) { result.FailureResult("请选择您要购买的产品"); } var tickets = _ticketService.GetList(ticketIds); foreach (var row in model.TicketItem) { var ticket = tickets.First(a => a.TicketId == row.TicketId); row.TicketName = ticket.TicketName; row.Price = ticket.SalePrice; } try { _travelAgencyOrderService.BeginTran(); var order = _travelAgencyOrderService.Add(model); _travelAgencyOrderDetailService.Add(model, order); //提交事物 _travelAgencyOrderService.CommitTran(); } catch { _travelAgencyOrderService.RollbackTran(); } return(result.SuccessResult()); }
public IHttpActionResult GetWxConfig(string url) { var data = _wxPayFacadeService.GetJsSDKTicket(url); var result = new TResult <JsSDKResponse>(); return(Ok(result.SuccessResult(data))); }
public ActionResult DeleteData(int id) { _memberTypeFacadeService.Delete(id); var result = new TResult(); return(Json(result.SuccessResult(), JsonRequestBehavior.AllowGet)); }
public IHttpActionResult GetPrizeItem() { var data = _prizeFacadeService.GetPrizeItem(); var result = new TResult <List <SelectItemDto> >(); return(Ok(result.SuccessResult(data))); }
public IHttpActionResult GetOrderDetail(string orderNo) { var orderDetail = _orderDetailFacadeService.Get(orderNo); var orderDetailViewDto = Mapper.Map <List <OrderDetailViewDto> >(orderDetail); var result = new TResult <List <OrderDetailViewDto> >(); return(Ok(result.SuccessResult(orderDetailViewDto))); }
public IHttpActionResult GetOrderTicketList(string openId) { var orders = _orderFacadeService.GetListForTicket(openId); var orderViewDtos = Mapper.Map <List <OrderViewDto> >(orders); var result = new TResult <List <OrderViewDto> >(); return(Ok(result.SuccessResult(orderViewDtos))); }
public TResult <List <TicketTypeViewModel> > GetTicketType() { var result = new TResult <List <TicketTypeViewModel> >(); var userInfo = _enterpriseUserService.LoginForSession(); var data = _ticketTypeService.GetList(userInfo.ScenicId, userInfo.UserId); return(result.SuccessResult(data)); }
public IHttpActionResult GetTicketList(DateTime playTime) { var ticket = _scenicFacadeService.GetTicketList(playTime); var ticketViewDtos = Mapper.Map <List <TicketViewDto> >(ticket); var result = new TResult <List <TicketViewDto> >(); return(Ok(result.SuccessResult(ticketViewDtos))); }
public IHttpActionResult GetIntegralConfig() { var list = _integralFacadeService.GetIntegralConfigList(); var integralConfigViewDtos = Mapper.Map <List <IntegralConfigViewDto> >(list); var result = new TResult <List <IntegralConfigViewDto> >(); return(Ok(result.SuccessResult(integralConfigViewDtos))); }
/// <summary> /// 登录 /// </summary> /// <param name="model"></param> /// <returns></returns> public TResult <EnterpriseUser> Login(EnterpriseUserLoginModel UserModel) { var result = new TResult <EnterpriseUser>(); if (string.IsNullOrEmpty(UserModel.UserName) || string.IsNullOrEmpty(UserModel.PassWord)) { return(result.FailureResult(null, "用户名和密码不能为空!")); } if (string.IsNullOrEmpty(UserModel.Code)) { return(result.FailureResult(null, "请输入验证码!")); } var code = HttpContext.Current.Request.Cookies[SessionKey.ManagerUserLoginCode]; if (code == null || (string.IsNullOrEmpty(code.Value))) { return(result.FailureResult(null, "验证码已过期,请重新输入验证码!")); } if (!String.Equals(code.Value, UserModel.Code.Trim(), StringComparison.CurrentCultureIgnoreCase)) { return(result.FailureResult(null, "请输入正确的验证码!")); } var password = Md5HashHelper.HashPassword(UserModel.PassWord); //当前景区下未停用的售票员 var model = Get(UserModel.UserName, password); if (model != null) { //var tbl_Scenic = Repository.First<Tbl_Scenic>(a => a.ScenicId == model.ScenicId); //UserInfoDTO dto = new UserInfoDTO(model, (int)SystemType.Sale, tbl_Scenic.ScenicName); //model.LastLoginTime = DateTime.Now; //Repository.Update(model); var userInfo = new EnterpriseUser { UserId = model.EnterpriseUserId, UserName = model.UserName, RealName = model.RealName, ScenicId = model.ScenicId }; //设置Session HttpContext.Current.Session[SessionKey.UserInfo] = userInfo; //设置登录信息cookie 1天有效 HttpCookie hc = new HttpCookie(SessionKey.SaleUserLoginCookie); hc.Value = DesHelper.Encrypt(model.UserName + "|" + model.PassWord, SessionKey.ManagerUserLoginCookieKey); //设置cookie信息在第二天凌晨过期 //(用户每天都需要输入密码登录一次,而且不会出现,在某一天中间某一刻时间,突然cookie过期) hc.Expires = DateTime.Now.AddDays(1); HttpContext.Current.Response.Cookies.Add(hc); return(result.SuccessResult(userInfo, "登录成功")); } return(result.FailureResult(null, "用户名或密码错误")); }
public IHttpActionResult PostRefundOrder(OrderRefundDto orderRefundDto) { if (!ModelState.IsValid) { var message = ModelState.BuildErrorMessage(); throw new SimplePromptException(message); } _orderDetailFacadeService.Refund(orderRefundDto.OrderNo); var result = new TResult(); return(Ok(result.SuccessResult())); }
public TResult Delete(int id) { var result = new TResult(); var guide = _travelAgencyGuideRepository.FirstOrDefault(a => a.Id == id); if (guide == null) { return(result.FailureResult()); } _travelAgencyGuideRepository.Delete(guide); return(result.SuccessResult()); }