Ejemplo n.º 1
0
    protected void btnReport1_Click(object sender, EventArgs e)
    {
        Button btn = (Button)sender;

        int          ReportType = btn.CommandArgument != string.Empty ? int.Parse(btn.CommandArgument) : 0;
        Model_Users  u          = this.UserActive;
        Model_Orders o          = new Model_Orders();

        switch (ReportType)
        {
        case 0:
            Response.Redirect("Assessmentstep.aspx");
            Response.End();
            break;

        case 1:

            string report = AssessmentController.GetPaperReport1(u);
            byte[] html   = pdfgen.pdfGenerate(report);

            pdfgen.ToClientSave(html, "KEENCareer-Finder-Report");
            break;

        case 2:
            string report2 = AssessmentController.GetPaperReport2(u);
            byte[] html2   = pdfgen.pdfGenerate(report2);

            pdfgen.ToClientSave(html2, "Your-Current-Job-Company-Fit-Report");
            break;

        case 3:

            int intProductID = 1;


            int paid = o.CountIsPaidByProduct(intProductID, u.UserID);

            if (paid > 0)
            {
                string report3 = AssessmentController.GetPaperReport3(u);
                byte[] html3   = pdfgen.pdfGenerate(report3);

                pdfgen.ToClientSave(html3, "The-Right-Job-Functions-Report");
            }
            else
            {
                int orderID = OrderController.MakeOrder(intProductID, u);
                if (orderID > 0)
                {
                    Response.Redirect("Orders.aspx?orderID=" + orderID + "&ProductID=1");
                    Response.End();
                }
            }

            break;

        case 4:

            intProductID = 2;


            paid = o.CountIsPaidByProduct(intProductID, u.UserID);

            if (paid > 0)
            {
                //string report3 = AssessmentController.GetPaperReport3(u);
                //byte[] html3 = pdfgen.pdfGenerate(report3);

                //pdfgen.ToClientSave(html3, "The-Right-Job-Functions-Report");
            }
            else
            {
                int orderID = OrderController.MakeOrder(intProductID, u);
                if (orderID > 0)
                {
                    Response.Redirect("Orders.aspx?orderID=" + orderID + "&ProductID=2");
                    Response.End();
                }
            }

            break;
        }
    }