Exemple #1
0
        public void Create(CreateAdjustmentInput input)
        {
            if (_adjustmentManager.AdjustmentExist(input.RequestDocumentNumber, input.Id, input.CompanyName))
            {
                throw new UserFriendlyException("Existe una solicitud con el mismo numero de Solicitud Fisica.");
            }
            TypeAdjustment temp = (TypeAdjustment)input.TypeAdjustmentValue;


            var requestNumber = GetNextRequestNumber(input.CompanyName);

            var @entityAdjustment = Adjustment.Create(requestNumber, requestNumber.ToString(), input.Notes,
                                                      input.CellarId, AdjustmentStatus.Active, temp, input.CreatorGuidId.Value, _dateTime.Now, input.PersonInCharge, input.CompanyName);

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


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

            _adjustmentManager.Create(@entityAdjustment, @details);
        }
        public ActionResult SearchArticulos(IList <string> jsonDetallesList, string q, Guid cellarId, string typeAdjustment, int?page)
        {
            SearchStockInput newList = new SearchStockInput();

            ViewBag.Query            = q;
            ViewBag.cellarId         = cellarId;
            ViewBag.JsonDetallesList = jsonDetallesList;
            int            type = Convert.ToInt32(typeAdjustment);
            TypeAdjustment temp = (TypeAdjustment)type;

            newList.Entities       = _adjustmentsService.GetAllStocks(q, cellarId, temp, _defaultPageSize, page, _currentUser.CompanyName);
            newList.TotalItem      = _adjustmentsService.GetTotalItem(q, cellarId, temp, _currentUser.CompanyName);
            newList.Query          = q;
            newList.TypeAdjustment = typeAdjustment;
            newList.CellarId       = cellarId;
            return(PartialView("_searchAssetPartial", newList));
        }
        public static Adjustment Create(int requestNumber, string requestDocumentNumber, string notes,
                                        Guid?cellarId, AdjustmentStatus adjustmentStatus, TypeAdjustment typeAdjustment, Guid creatorid, DateTime createDateTime, string personInCharge, string companyName)
        {
            var @adjustment = new Adjustment
            {
                Id                    = Guid.NewGuid(),
                RequestNumber         = requestNumber,
                RequestDocumentNumber = requestDocumentNumber,
                Notes                 = notes,
                CellarId              = cellarId,
                Status                = adjustmentStatus,
                TypeAdjustment        = typeAdjustment,
                CreationTime          = createDateTime,
                CreatorUserId         = creatorid,
                PersonInCharge        = personInCharge,
                IsDeleted             = false,
                CompanyName           = companyName
            };

            return(@adjustment);
        }