コード例 #1
0
        /// <summary>
        /// 保存仓库
        /// </summary>
        /// <returns></returns>
        public CargoUpdateResponse SaveCargo(CargoUpdateRequest request)
        {
            CargoUpdateResponse response = new CargoUpdateResponse();
            CargoInfo           cargo    = new CargoInfo()
            {
                CargoId       = request.CargoId,
                CargoName     = request.CargoName,
                ShippingOrder = request.ShippingOrder,
                CargoWeight   = request.CargoWeight,
                CargoType     = request.CargoType,
                CargoState    = request.CargoState,
                CargoRemark   = request.CargoRemark
            };

            if (request == null || string.IsNullOrEmpty(request.CargoName))
            {
                response.Status  = false;
                response.Message = "货物名称不能为空";
                return(response);
            }
            //获取名不能为空
            if (request.CargoWeight == 0)
            {
                response.Status  = false;
                response.Message = "重量不能为空";
                return(response);
            }
            //验证货物是否存在
            var shiporder = cdal.IsExistShipping(request.ShippingOrder);

            if (shiporder < 1)
            {
                response.Status  = false;
                response.Message = "货物已存在";
                return(response);
            }
            var res = cdal.SaveCargo(cargo);

            if (res > 0)
            {
                response.IsRegistSuccess = true;
                response.Message         = "保存成功";
            }
            else
            {
                response.Status  = false;
                response.Message = "保存失败";
                return(response);
            }
            return(response);
        }
コード例 #2
0
 public CargoUpdateResponse SaveCargo(CargoUpdateRequest request)
 {
     return(cbll.SaveCargo(request));
 }
コード例 #3
0
 public JsonResult cargoUpdate(CargoUpdateRequest request)
 {
     return(Json(cbll.CargoSave(request)));
 }
コード例 #4
0
 /// <summary>
 /// 保存货物
 /// </summary>
 /// <param name="addRequest"></param>
 /// <returns></returns>
 public CargoUpdateResponse CargoSave(CargoUpdateRequest addRequest)
 {
     return(ApiRequestHelper.Post <CargoUpdateRequest, CargoUpdateResponse>(addRequest));
 }