public ActionResult QuotePrintHeader(long?projectId, long?quoteId)
        {
            QuotePrintModel model = new QuotePrintModel();

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

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

            return(View("QuotePrintHeader", "_PrintPartialLayout", model));
        }
        public EmptyResult QuotePrintExcel(long?projectId, long?quoteId, bool?withCostPrices)
        {
            QuotePrintModel model = new QuotePrintModel();

            withCostPrices = withCostPrices ?? false;

            var stream = new ProjectServices().QuotePrintExcelFile(this.CurrentUser, projectId.Value, quoteId.Value, withCostPrices.Value);

            this.Response.AddHeader("Content-Disposition", "inline; filename=Quote print.xls");
            this.Response.AddHeader("Cache-Control", "no-cache");
            this.Response.AddHeader("Content-Type", MimeMapping.GetMimeMapping("Quote print.xls"));

            stream.WriteTo(this.Response.OutputStream);

            return(new EmptyResult());
        }
        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));
        }