public ActionResult QuotePrint(long?projectId, long?quoteId, bool?withCostPrices)
        {
            QuotePrintModel model = new QuotePrintModel();

            model.WithCostPrices = withCostPrices ?? false;

            var projectResponse = new ProjectServices().GetProjectModel(this.CurrentUser, projectId.Value);

            if (ProcessServiceResponse(projectResponse))
            {
                model.Project = projectResponse.Model as ProjectModel;

                var quoteResponse = quoteService.GetQuoteModel(this.CurrentUser, projectId.Value, quoteId);


                if (ProcessServiceResponse(quoteResponse))
                {
                    model.Quote = quoteResponse.Model as QuoteModel;

                    var commissionResponse = new CommissionRequestServices().GetCommissionRequestModel(this.CurrentUser,
                                                                                                       new CommissionRequestModel {
                        CommissionRequestId = model.Quote.CommissionRequestId, ProjectId = model.Project.ProjectId, QuoteId = model.Quote.QuoteId
                    });

                    model.CommissionRequest = commissionResponse.Model as CommissionRequestModel;

                    var itemsRepsonse = quoteService.GetQuoteItemListModel(this.CurrentUser, quoteId.Value);

                    if (ProcessServiceResponse(itemsRepsonse))
                    {
                        var items      = itemsRepsonse.Model as List <QuoteItemListModel>;
                        var pagedItems = new PagedList <QuoteItemListModel>(items, new Search {
                            Page = 1, PageSize = Constants.DEFAULT_PAGESIZE_RETURN_ALL
                        });
                        model.QuoteItems = new QuoteItemsModel {
                            Items = pagedItems
                        };

                        model.QuoteItems.WithCostPrice = model.WithCostPrices;
                    }
                }
            }

            this.RouteData.Values["action"] = "QuotePrint";

            return(View("QuotePrint", model));
        }
Пример #2
0
 public CommissionMultiplierController()
     : base()
 {
     this.commissionRequestService = new CommissionRequestServices();
 }