/// <summary> /// 获取油价表 /// </summary> /// <param name="request"></param> /// <returns></returns> public Response <ABFPriceResponses> GetABFPrice(ABFPriceRequest request) { Response <ABFPriceResponses> response = new Response <ABFPriceResponses>(); response.Result = new ABFPriceResponses(); try { //if (request.PageIndex == 0) //{///若页码为0,则置为1 // request.PageIndex++; //} int PageCount = 0; response.Result.bafPriceInfo = new AdidasAccessor().GetABFPrice(request.BAFStartTime, request.BAFEndTime, request.PageIndex, request.PageSize, out PageCount); response.Result.PageCount = PageCount / request.PageSize + PageCount % request.PageSize > 0 ? 1 : 0; //获取总页数 response.Result.PageIndex = request.PageIndex; response.IsSuccess = true; } catch (Exception ex) { LogError(ex); response.Result.PageCount = request.PageSize; response.Result.PageIndex = 0; response.IsSuccess = false; response.ErrorCode = ErrorCode.Technical; } return(response); }
public ActionResult AddBAF(GetBAFMobile vm) { vm.abfRiceInfo.ProjectID = 1; vm.abfRiceInfo.ProjectName = "Runbow"; vm.abfRiceInfo.TragetID = 1; vm.abfRiceInfo.TragetName = "Adidas"; ABFPriceRequest SearchCondition = new ABFPriceRequest(); SearchCondition.Info = vm.abfRiceInfo; bool response = new AdidasService().addABFPrice(SearchCondition); if (response) { return(Redirect("/POD/Adidas/UpdateBAF")); } else { return(View("添加失败!")); } //new ABFPriceRequest // { //ProjectID = 1, //ProjectName = "Runbow", //TragetID = 1, //TragetName = "Adidas", //BAFPrice = vm.BAFPrice, //BAFStartTime = vm.BAFStartTime, //BAFEndTime = vm.BAFEndTime, //PageIndex = vm.PageIndex, //PageSize = UtilConstants.PAGESIZE ///每页的数据 // }); }
/// <summary> /// 添加油价 /// </summary> /// <param name="request"></param> /// <returns></returns> public bool addABFPrice(ABFPriceRequest request) { Response <ABFPriceResponses> response = new Response <ABFPriceResponses>(); response.Result = new ABFPriceResponses(); bool boo = false; try { BAFPriceInfo BAF = new BAFPriceInfo(); IList <BAFPriceInfo> Price = new List <BAFPriceInfo>(); Price.Add(request.Info); boo = new AdidasAccessor().AddABFPrice(Price); } catch (Exception ex) { LogError(ex); response.Result.PageCount = request.PageSize; response.Result.PageIndex = 0; response.IsSuccess = false; response.ErrorCode = ErrorCode.Technical; } return(boo); }