コード例 #1
0
        public ResponseMessage DispatchTransferPrice(DispatchTransferPrice scanComp)
        {
            ResponseMessage response = new ResponseMessage();

            response = _siteDispatchRepository.DispatchTransferPrice(scanComp);
            return(response);
        }
コード例 #2
0
        public ResponseMessage DispatchTransferPrice(DispatchTransferPrice dispTrnsfer)
        {
            // siteDispScan.fromProjId
            try {
                ResponseMessage     res     = new ResponseMessage();
                DispatchRequirement dispReq = _context.DispatchRequirement.Include(c => c.Servicetype).Where(x => x.Id == dispTrnsfer.dispReqId).FirstOrDefault();
                if (dispReq == null)
                {
                    throw new ValueNotFoundException("Dispatch ID doesnt exists.");
                }

                if (dispReq.Servicetype.Name != commonEnum.ServiceType.Reuse.ToString())
                {
                    throw new ValueNotFoundException("Not valid service type");
                }
                if (dispReq.Status != Util.GetDescription(Util.GetDescription(commonEnum.SiteDispatchSatus.CMPCAPPROVED)).ToString())
                {
                    throw new ValueNotFoundException("Dispatch not allowed to approve");
                }
                dispReq.TransferPrice  = dispTrnsfer.transferPrice;
                dispReq.Status         = Util.GetDescription(commonEnum.SiteDispatchSatus.FAAAPPROVED).ToString();
                dispReq.StatusInternal = Util.GetDescription(commonEnum.SiteDispatchSatus.FAAAPPROVED).ToString();
                _context.SaveChanges();
                res.Message = "Transfer Price updated successfully";
                return(res);
            } catch (Exception ex) {
                throw ex;
            }
        }