コード例 #1
0
        public static InRequest Create(int requestNumber, string requestDocumentNumber, string purchaseOrderNumber, string notes, Guid?projectId,
                                       Guid cellarId, InRequestStatus status, TypeInRequest typeInRequest, Guid creatorid,
                                       DateTime createDateTime, string personInCharge, string companyName, string comment)
        {
            var @inRequest = new InRequest
            {
                Id                    = Guid.NewGuid(),
                RequestNumber         = requestNumber,
                RequestDocumentNumber = requestDocumentNumber,
                Notes                 = notes,
                ProjectId             = projectId,
                CellarId              = cellarId,
                Comment               = comment,
                Status                = status,
                TypeInRequest         = typeInRequest,
                CreationTime          = createDateTime,
                ActivationDate        = createDateTime,
                CreatorUserId         = creatorid,
                PurchaseOrderNumber   = purchaseOrderNumber,
                PersonInCharge        = personInCharge,
                CompanyName           = companyName,
                IsDeleted             = false,
            };

            return(@inRequest);
        }
コード例 #2
0
 public void ChangeStatus(InRequest inRequest, IList <Detail> updateDetails, IList <Stock> newstocks, IList <Stock> updatestocks, IList <Movement> movements, IList <PriceChange> pricechanges)
 {
     _inRequestRepository.Update(inRequest);
     foreach (var detail in updateDetails)
     {
         detail.InRequestId = inRequest.Id;
         _detailRepository.Update(detail);
     }
     foreach (var stock in updatestocks)
     {
         _stockRepository.Update(stock);
     }
     foreach (var stock in newstocks)
     {
         _stockRepository.Insert(stock);
     }
     foreach (var item in movements)
     {
         _movementRepository.Insert(item);
     }
     foreach (var item in pricechanges)
     {
         _priceChangeRepository.Insert(item);
     }
 }
コード例 #3
0
 public void Create(InRequest inRequest, IList <Detail> details)
 {
     _inRequestRepository.Insert(inRequest);
     foreach (var detail in details)
     {
         _detailRepository.Insert(detail);
     }
 }
コード例 #4
0
 public void Delete(InRequest inRequest, IList <Detail> details)
 {
     _inRequestRepository.Update(inRequest);
     foreach (var detail in details)
     {
         detail.InRequestId = inRequest.Id;
         _detailRepository.Update(detail);
     }
 }
コード例 #5
0
 public void Update(InRequest inRequest, IList <Detail> newDetails, IList <Detail> updateDetails)
 {
     _inRequestRepository.Update(inRequest);
     foreach (var detail in updateDetails)
     {
         detail.InRequestId = inRequest.Id;
         _detailRepository.Update(detail);
     }
     foreach (var detail in newDetails)
     {
         detail.InRequestId = inRequest.Id;
         _detailRepository.Insert(detail);
     }
 }
コード例 #6
0
        public void Create(CreateInRequestInput input)
        {
            //if (_inRequestManager.InRequestExist(input.RequestDocumentNumber, input.Id, input.CompanyName))
            //{
            //    throw new UserFriendlyException("Existe una solicitud con el mismo numero de Solicitud Fisica.");
            //}
            TypeInRequest   temp = (TypeInRequest)input.TypeInRequestValue;
            InRequestStatus temp1;

            temp1 = InRequestStatus.Active;

            var requestNumber = GetNextRequestNumber(input.CompanyName);

            var @entityInRequest = InRequest.Create(requestNumber, requestNumber.ToString(), input.PurchaseOrderNumber, input.Notes, null,
                                                    input.CellarId, temp1, temp, input.CreatorGuidId.Value, _dateTime.Now, input.PersonInCharge, input.CompanyName, input.Comment);

            IList <Detail> @details = new List <Detail>();

            foreach (var item in input.DetailsRequest)
            {
                var @entityDetail = Detail.Create(@entityInRequest.Id, null, null, item.AssetId, item.NameAsset, item.StockAsset, Double.Parse(item.Price),
                                                  input.CreatorGuidId.Value, _dateTime.Now, input.CompanyName);
                @details.Add(@entityDetail);
            }

            if (HasFile(input.Image1))
            {
                string folderPath = "~/InRequestImages/";
                string fileName   = input.Image1.FileName;//input.Id + ".png"

                var mappedPath = HostingEnvironment.MapPath(folderPath) + fileName;
                var directory  = new DirectoryInfo(HostingEnvironment.MapPath(folderPath));
                if (directory.Exists == false)
                {
                    directory.Create();
                }
                string folderPathRelative = "../../InRequestImages/";
                input.ImagePath1 = folderPathRelative + fileName;
                input.Image1.SaveAs(mappedPath);

                @entityInRequest.SetImage1(input.ImagePath1);
            }

            if (HasFile(input.Image2))
            {
                string folderPath = "~/InRequestImages/";
                string fileName   = input.Image2.FileName;//input.Id + ".png"

                var mappedPath = HostingEnvironment.MapPath(folderPath) + fileName;
                var directory  = new DirectoryInfo(HostingEnvironment.MapPath(folderPath));
                if (directory.Exists == false)
                {
                    directory.Create();
                }
                string folderPathRelative = "../../InRequestImages/";
                input.ImagePath2 = folderPathRelative + fileName;
                input.Image2.SaveAs(mappedPath);

                @entityInRequest.SetImage2(input.ImagePath2);
            }
            if (!string.IsNullOrEmpty(input.SignatureData))
            {
                @entityInRequest.SetSignatureData(input.SignatureData);
            }

            _inRequestManager.Create(@entityInRequest, @details);
        }