public ActionResult DeleteBid(int id) { string errMsg = string.Empty; #region 验证参数 if (id == 0) { errMsg = "竞价标的Id不能为空"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } #endregion IData_BidManageService data_BidManageService = BLLContainer.Resolve <IData_BidManageService>(); if (data_BidManageService.GetCount(p => p.ID == id) == 0) { errMsg = "该竞价标的不存在"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } var data_BidManage = data_BidManageService.GetModels(p => p.ID == id).FirstOrDefault(); if (!data_BidManageService.Delete(data_BidManage)) { return(RedirectToAction("Index", "BidManage", new { errMsg = "更新数据库失败" })); } return(RedirectToAction("Index", "BidManage", new { errMsg = "删除成功" })); }
// GET: TenderManage public ActionResult BidHistory(string begin_time, string end_time) { if (string.IsNullOrEmpty(begin_time)) { begin_time = DateTime.Now.ToString("yyyy-MM-dd"); } if (string.IsNullOrEmpty(end_time)) { end_time = DateTime.Now.ToString("yyyy-MM-dd"); } ViewData["begin_time"] = begin_time; ViewData["end_time"] = end_time; begin_time = begin_time + " 00:00:00"; end_time = end_time + " 23:59:59"; var bt = Convert.ToDateTime(begin_time); var et = Convert.ToDateTime(end_time); IData_BidManageService data_BidManageService = BLLContainer.Resolve <IData_BidManageService>(); IFlw_BiddingInfoService flw_BiddingInfoService = BLLContainer.Resolve <IFlw_BiddingInfoService>(); var historyBiddingInfoList = data_BidManageService.GetModels(p => p.BidDate >= bt && p.BidDate <= et && p.State == 1).ToList().Select (o => new HistoryBiddingInfoModel { BidID = o.ID, ProductType = o.ProductType, BidDate = o.BidDate, EstimateAmount = o.EstimateAmount, BidPriceMin = flw_BiddingInfoService.GetModels(p => p.BidID == o.ID).Min(m => m.BidPrice), UserIDs = flw_BiddingInfoService.GetModels(p => p.BidID == o.ID).Select(s => s.UserID).ToList(), DealTotalAmount = getFinalBiddingInfoList(o.ID).Sum(m => m.BidAmount), DealTotalPrice = getFinalBiddingInfoList(o.ID).Sum(m => m.BidAmount * m.BidPrice) }); return(View(historyBiddingInfoList)); }
public PartialViewResult BidDetail(int bidId) { IData_BidManageService data_BidManageService = BLLContainer.Resolve <IData_BidManageService>(); var data_BidManage = data_BidManageService.GetModels(p => p.ID == bidId).FirstOrDefault(); ViewBag.productName = ProductTypeBusiness.GetProductName(data_BidManage.ProductType); ViewBag.bidDate = string.Format("{0:yyyy-M-d}", data_BidManage.BidDate); ViewBag.flw_BiddingInfoList = getFinalBiddingInfoList(bidId); return(PartialView()); }
public ActionResult BidVerify(int id) { IData_BidManageService data_BidManageService = BLLContainer.Resolve <IData_BidManageService>(); var data_BidManage = data_BidManageService.GetModels(p => p.ID == id).FirstOrDefault(); ViewBag.productName = ProductTypeBusiness.GetProductName(data_BidManage.ProductType); IFlw_BiddingInfoService flw_BiddingInfoService = BLLContainer.Resolve <IFlw_BiddingInfoService>(); var flw_BiddingInfoList = flw_BiddingInfoService.GetModels(p => p.BidID == id).OrderByDescending(o => o.BidPrice).ThenByDescending(o => o.BidAmount).ThenBy(o => o.BidTime).ToList(); return(View(flw_BiddingInfoList)); }
// GET: TenderManage public ActionResult BidView(int id) { IData_BidManageService data_BidManageService = BLLContainer.Resolve <IData_BidManageService>(); var data_BidManage = data_BidManageService.GetModels(p => p.ID == id).FirstOrDefault(); ViewBag.data_BidManage = data_BidManage; ViewBag.productName = ProductTypeBusiness.GetProductName(data_BidManage.ProductType); ViewBag.bidDate = string.Format("{0:yyyy-M-d}", data_BidManage.BidDate); ViewBag.flw_BiddingInfoList = getFlw_BiddingInfoList(id); return(View()); }
public ActionResult UpdateBid(int id, int productType, string bidDate, string bidStartTime, string bidEndTime, Nullable <decimal> estimateAmount, Nullable <decimal> currentPriceLower, Nullable <decimal> currentPriceUpper, Nullable <int> bidCount, Nullable <decimal> amountMin, Nullable <int> bidManner) { string errMsg = string.Empty; #region 验证参数 if (id == 0) { errMsg = "竞价标的Id不能为空"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } if (productType == 0) { errMsg = "产品类型不能为空"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } if (string.IsNullOrEmpty(bidDate)) { errMsg = "竞价日期不能为空"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } if (string.IsNullOrEmpty(bidStartTime)) { errMsg = "开始时间不能为空"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } if (string.IsNullOrEmpty(bidEndTime)) { errMsg = "结束时间不能为空"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } #endregion IData_BidManageService data_BidManageService = BLLContainer.Resolve <IData_BidManageService>(); if (data_BidManageService.GetCount(p => p.ID == id) == 0) { errMsg = "该竞价标的不存在"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } var data_BidManage = data_BidManageService.GetModels(p => p.ID == id).FirstOrDefault(); data_BidManage.ProductType = productType; data_BidManage.BidDate = Convert.ToDateTime(bidDate); data_BidManage.BidStartTime = Convert.ToDateTime(bidDate + " " + bidStartTime); data_BidManage.BidEndTime = Convert.ToDateTime(bidDate + " " + bidEndTime); data_BidManage.EstimateAmount = estimateAmount; data_BidManage.CurrentPriceLower = currentPriceLower; data_BidManage.CurrentPriceUpper = currentPriceUpper; data_BidManage.BidCount = bidCount; data_BidManage.AmountMin = amountMin; data_BidManage.BidManner = bidManner; if (!data_BidManageService.Update(data_BidManage)) { return(RedirectToAction("Index", "BidManage", new { errMsg = "更新数据库失败" })); } return(RedirectToAction("Index", "BidManage", new { errMsg = "更新成功" })); }
public ActionResult BidVerify(List <Flw_BiddingInfo> flw_BiddingInfos) { var json = new JsonHelper() { Msg = "录入成功", Status = "n" }; try { if (flw_BiddingInfos == null || flw_BiddingInfos.Count == 0) { json.Msg = "无待审核的竞价信息"; return(Json(json, JsonRequestBehavior.AllowGet)); } IData_BidManageService data_BidManageService = BLLContainer.Resolve <IData_BidManageService>(); IFlw_BiddingInfoService flw_BiddingInfoService = BLLContainer.Resolve <IFlw_BiddingInfoService>(); int bidId = (int)flw_BiddingInfos[0].BidID; //开启EF事务 using (TransactionScope ts = new TransactionScope()) { try { var data_BidManage = data_BidManageService.GetModels(p => p.ID == bidId).FirstOrDefault(); if (data_BidManage == null) { json.Msg = "该竞标项目已不存在"; return(Json(json, JsonRequestBehavior.AllowGet)); } data_BidManage.State = 1; if (!data_BidManageService.Update(data_BidManage)) { json.Msg = "更新项目信息失败"; return(Json(json, JsonRequestBehavior.AllowGet)); } foreach (var model in flw_BiddingInfos) { int id = model.ID; var flw_BiddingInfo = flw_BiddingInfoService.GetModels(p => p.ID == id).FirstOrDefault(); if (flw_BiddingInfo == null) { json.Msg = "竞价信息id" + id + "不存在"; return(Json(json, JsonRequestBehavior.AllowGet)); } flw_BiddingInfo.Checked = model.Checked; if (!flw_BiddingInfoService.Update(flw_BiddingInfo)) { json.Msg = "更新竞价信息失败"; return(Json(json, JsonRequestBehavior.AllowGet)); } } ts.Complete(); } catch (Exception ex) { json.Msg = ex.Message; return(Json(json, JsonRequestBehavior.AllowGet)); } } json.Status = "y"; } catch (Exception e) { json.Msg = e.Message; } return(Json(json, JsonRequestBehavior.AllowGet)); }
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)); }