// GET: TenderManage public ActionResult BidGather(int id) { var data_BidManage = BLLContainer.Resolve <IData_BidManageService>().GetModels(p => p.ID == id).FirstOrDefault(); ViewBag.data_BidManage = data_BidManage; ViewBag.productName = ProductTypeBusiness.GetProductName(ViewBag.data_BidManage.ProductType); var userInfoCacheModel = Session["loginUser"] as UserInfoCacheModel; ViewBag.userId = userInfoCacheModel.ID; int productType = (int)userInfoCacheModel.ProductType; int userLvl = (int)userInfoCacheModel.UserLvl; ViewBag.MaxAmount = getMaxAmount((decimal)data_BidManage.EstimateAmount, productType, userLvl); ViewBag.flw_BiddingInfoList = getFlw_BiddingInfoList(id); var flw_BiddingInfo = new Flw_BiddingInfo(); flw_BiddingInfo.BidID = id; double timeleft = 0; getTimeLeft(data_BidManage, id, out timeleft); ViewBag.timeleft = (timeleft <= 0) ? 0 : timeleft; return(View(flw_BiddingInfo)); }
public ActionResult BidGather(Flw_BiddingInfo flw_BiddingInfo) { var json = new JsonHelper() { Msg = "录入成功", Status = "n" }; try { var bidId = flw_BiddingInfo.BidID; if (bidId == null || bidId == 0) { json.Msg = "竞价项目Id为空"; return(Json(json, JsonRequestBehavior.AllowGet)); } var userInfo = Session["loginUser"] as UserInfoCacheModel; if (userInfo == null || !UserBusiness.IsEffectiveUser(userInfo.ID)) { json.Msg = "客户信息无效"; return(Json(json, JsonRequestBehavior.AllowGet)); } if (userInfo.UserLvl == null || userInfo.UserLvl == 0) { json.Msg = "未审核客户不能参与竞价"; return(Json(json, JsonRequestBehavior.AllowGet)); } IData_BidManageService data_BidManageService = BLLContainer.Resolve <IData_BidManageService>(); var data_BidManage = data_BidManageService.GetModels(p => p.ID == bidId).FirstOrDefault(); if (data_BidManage == null) { json.Msg = "该竞价项目不存在"; return(Json(json, JsonRequestBehavior.AllowGet)); } double timeleft = 0; if (!getTimeLeft(data_BidManage, (int)bidId, out timeleft)) { json.Msg = "获取剩余时间失败"; return(Json(json, JsonRequestBehavior.AllowGet)); } if (timeleft <= 0) { json.Msg = "该项目竞价已结束"; return(Json(json, JsonRequestBehavior.AllowGet)); } var errMsg = string.Empty; if (!CheckAmountMin(data_BidManage.AmountMin, flw_BiddingInfo.BidAmount, out errMsg)) { json.Msg = errMsg; return(Json(json, JsonRequestBehavior.AllowGet)); } if (!CheckPrice(data_BidManage.CurrentPriceLower, data_BidManage.CurrentPriceUpper, flw_BiddingInfo.BidPrice, out errMsg)) { json.Msg = errMsg; return(Json(json, JsonRequestBehavior.AllowGet)); } if (!CheckCount(data_BidManage.ID, userInfo.ID, data_BidManage.BidCount, out errMsg)) { json.Msg = errMsg; return(Json(json, JsonRequestBehavior.AllowGet)); } if (!CheckAmountTotal(data_BidManage.ID, userInfo.ID, data_BidManage.ProductType, data_BidManage.EstimateAmount, (int)userInfo.UserLvl, (decimal)flw_BiddingInfo.BidAmount, out errMsg)) { json.Msg = errMsg; return(Json(json, JsonRequestBehavior.AllowGet)); } var userId = userInfo.ID; flw_BiddingInfo.UserID = userId; flw_BiddingInfo.BidTime = DateTime.Now; IFlw_BiddingInfoService flw_BiddingInfoService = BLLContainer.Resolve <IFlw_BiddingInfoService>(); if (!flw_BiddingInfoService.Add(flw_BiddingInfo)) { json.Msg = "更新数据库失败"; return(Json(json, JsonRequestBehavior.AllowGet)); } json.Status = "y"; } catch (Exception e) { json.Msg = e.Message; } return(Json(json, JsonRequestBehavior.AllowGet)); }