コード例 #1
0
ファイル: ShipperService.cs プロジェクト: ChainSong/WMS
        public Response <IEnumerable <Vehicle> > GetShipperVehicle(ShipperByIDRequest request)
        {
            Response <IEnumerable <Vehicle> > response = new Response <IEnumerable <Vehicle> >();

            if (request == null || request.ID == 0)
            {
                ArgumentNullException ex = new ArgumentNullException("GetShipperVehicle request");
                LogError(ex);
                response.ErrorCode = ErrorCode.Argument;
                response.Exception = ex;
                return(response);
            }

            try
            {
                response.Result    = new ShipperAccessor().GetShipperVehicle(request.ID);
                response.IsSuccess = true;
            }
            catch (Exception ex)
            {
                LogError(ex);
                response.IsSuccess = false;
                response.ErrorCode = ErrorCode.Technical;
            }

            return(response);
        }
コード例 #2
0
ファイル: ShipperService.cs プロジェクト: ChainSong/WMS
        public Response <Shipper> GetShipperByID(ShipperByIDRequest request)
        {
            Response <Shipper> response = new Response <Shipper>();

            if (request == null || request.ID == 0)
            {
                ArgumentNullException ex = new ArgumentNullException("GetShipperByID request");
                LogError(ex);
                response.ErrorCode = ErrorCode.Argument;
                response.Exception = ex;
                return(response);
            }

            try
            {
                ShipperAccessor accessor = new ShipperAccessor();
                response.Result = accessor.GetShipperById(request.ID);
                if (response.Result != null)
                {
                    response.IsSuccess      = true;
                    response.SuccessMessage = "操作成功!";
                }
                else
                {
                    response.SuccessMessage = "操作失败!";
                    response.IsSuccess      = false;
                    response.ErrorCode      = ErrorCode.DataEffective;
                }
            }
            catch (Exception ex)
            {
                LogError(ex);
                response.SuccessMessage = ex.Message;
                response.IsSuccess      = false;
                response.ErrorCode      = ErrorCode.Technical;
            }

            return(response);
        }