Beispiel #1
0
        public ServiceResponse PostOrder(OrderViewModelLight model)
        {
            if (model.CurrentUser == null)
            {
                model.CurrentUser = this.CurrentUser;
            }

            if (model.CreatedByUserId == 0)
            {
                model.CreatedByUserId = model.CurrentUser.UserId;
            }

            if (model.UpdatedByUserId == 0)
            {
                model.UpdatedByUserId = model.CurrentUser.UserId;
            }

            var discountRequestVM = new DiscountRequestModel();

            using (var discountRequestService = new DiscountRequestServices())
            {
                this.ServiceResponse = discountRequestService.GetDiscountRequestModel(this.CurrentUser, model.ProjectId, model.QuoteId);
                discountRequestVM    = ServiceResponse.Model as DiscountRequestModel;
            }

            if (model.ERPAccountId != null)
            {
                ServiceResponse = _erpSvcProvider.CheckPONumberExist(model.ERPAccountId, model.PONumber);
            }
            else
            {
                ServiceResponse.Messages.AddError(Resources.ResourceModelBusiness.BM010);
            }

            if (ServiceResponse.IsOK)
            {
                ServiceResponse = _orderServices.PostModel(this.CurrentUser, model);
            }

            return(ServiceResponse);
        }