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));
        }