using SwanCSharp;
using SwanCSharp.DataAccess;
using SwanCSharp.Reporting;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;

namespace Report
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
        }

        private void mnuReportOne_Click(object sender, EventArgs e)
        {
            DataConnection lobjConnection = new DataConnection("Database.mdb", "", "", DatabaseManager.Access);
            DataTable ldatData = lobjConnection.SQLSelectExecute("SELECT * FROM Staff");
            lobjConnection.CloseConnection();

            // Format One
            ReportRowData[] lobjReportRowData = new ReportRowData[4];

            lobjReportRowData[0].DataTableFieldName = "";
            lobjReportRowData[0].BoldDataField = false;
            lobjReportRowData[0].UnderlineDataField = false;
            lobjReportRowData[0].PreviousConstantText = "Staff Data -- ";
            lobjReportRowData[0].BoldPreviousConstant = false;
            lobjReportRowData[0].UnderlinePreviousConstant = false;
            lobjReportRowData[0].LaterConstantText = "";
            lobjReportRowData[0].BoldLaterConstant = false;
            lobjReportRowData[0].UnderlineLaterConstant = false;

            lobjReportRowData[1].DataTableFieldName = "IDPerson";
            lobjReportRowData[1].BoldDataField = true;
            lobjReportRowData[1].UnderlineDataField = false;
            lobjReportRowData[1].PreviousConstantText = "Person ID: ";
            lobjReportRowData[1].BoldPreviousConstant = false;
            lobjReportRowData[1].UnderlinePreviousConstant = false;
            lobjReportRowData[1].LaterConstantText = " -- ";
            lobjReportRowData[1].BoldLaterConstant = false;
            lobjReportRowData[1].UnderlineLaterConstant = false;

            lobjReportRowData[2].DataTableFieldName = "Name";
            lobjReportRowData[2].BoldDataField = true;
            lobjReportRowData[2].UnderlineDataField = false;
            lobjReportRowData[2].PreviousConstantText = "Name: ";
            lobjReportRowData[2].BoldPreviousConstant = false;
            lobjReportRowData[2].UnderlinePreviousConstant = false;
            lobjReportRowData[2].LaterConstantText = " -- ";
            lobjReportRowData[2].BoldLaterConstant = false;
            lobjReportRowData[2].UnderlineLaterConstant = false;

            lobjReportRowData[3].DataTableFieldName = "LastName";
            lobjReportRowData[3].BoldDataField = true;
            lobjReportRowData[3].UnderlineDataField = false;
            lobjReportRowData[3].PreviousConstantText = "Last Name: ";
            lobjReportRowData[3].BoldPreviousConstant = false;
            lobjReportRowData[3].UnderlinePreviousConstant = false;
            lobjReportRowData[3].LaterConstantText = "";
            lobjReportRowData[3].BoldLaterConstant = false;
            lobjReportRowData[3].UnderlineLaterConstant = false;

            ReportRowData[] lobjReportRowDetailData = new ReportRowData[2];

            lobjReportRowDetailData[0].DataTableFieldName = "Comments";
            lobjReportRowDetailData[0].BoldDataField = false;
            lobjReportRowDetailData[0].UnderlineDataField = false;
            lobjReportRowDetailData[0].PreviousConstantText = "Comments Location: ";
            lobjReportRowDetailData[0].BoldPreviousConstant = true;
            lobjReportRowDetailData[0].UnderlinePreviousConstant = true;
            lobjReportRowDetailData[0].LaterConstantText = "";
            lobjReportRowDetailData[0].BoldLaterConstant = false;
            lobjReportRowDetailData[0].UnderlineLaterConstant = false;

            lobjReportRowDetailData[1].DataTableFieldName = "Comments2";
            lobjReportRowDetailData[1].BoldDataField = false;
            lobjReportRowDetailData[1].UnderlineDataField = false;
            lobjReportRowDetailData[1].PreviousConstantText = "General Comments: ";
            lobjReportRowDetailData[1].BoldPreviousConstant = true;
            lobjReportRowDetailData[1].UnderlinePreviousConstant = true;
            lobjReportRowDetailData[1].LaterConstantText = "";
            lobjReportRowDetailData[1].BoldLaterConstant = false;
            lobjReportRowDetailData[1].UnderlineLaterConstant = false;

            ReportRowStandard lobjReportRowStandard;
            lobjReportRowStandard.RowData = lobjReportRowData;
            lobjReportRowStandard.ShowBorder = true;
            lobjReportRowStandard.RowAlingment = ReportRowAlignment.Center;

            ReportRowDetail lobjReportRowDetail;
            lobjReportRowDetail.RowData = lobjReportRowDetailData;
            lobjReportRowDetail.ShowBorder = true;
            lobjReportRowDetail.RowAlingment = ReportRowAlignment.Left;
            lobjReportRowDetail.RowDetailOrientation = ReportDetailOrientation.Horizontal;

            ReportObjects lobjReportObjects;
            lobjReportObjects.ReportRows = new object[2];
            lobjReportObjects.ReportRows[0] = lobjReportRowStandard;
            lobjReportObjects.ReportRows[1] =lobjReportRowDetail;

            GenerateHTMLReport lobjGenerate = new GenerateHTMLReport(ldatData, lobjReportObjects, "Report", "", "Test of Report", "SwanCSharp.png", "", SwanCSharp.Reporting.InterfaceLanguage.English, ReportViewWindowSize.Medium, true, true);
        }

        private void mnuReportTwo_Click(object sender, EventArgs e)
        {
            DataConnection lobjConnection = new DataConnection("Database.mdb", "", "", DatabaseManager.Access);
            DataTable ldatData = lobjConnection.SQLSelectExecute("SELECT * FROM Staff");
            lobjConnection.CloseConnection();

            // Format Two
            ReportRowData[] lobjReportRowDataFirstBox = new ReportRowData[2];

            lobjReportRowDataFirstBox[0].DataTableFieldName = "";
            lobjReportRowDataFirstBox[0].BoldDataField = false;
            lobjReportRowDataFirstBox[0].UnderlineDataField = false;
            lobjReportRowDataFirstBox[0].PreviousConstantText = "Staff Data -- ";
            lobjReportRowDataFirstBox[0].BoldPreviousConstant = false;
            lobjReportRowDataFirstBox[0].UnderlinePreviousConstant = false;
            lobjReportRowDataFirstBox[0].LaterConstantText = "";
            lobjReportRowDataFirstBox[0].BoldLaterConstant = false;
            lobjReportRowDataFirstBox[0].UnderlineLaterConstant = false;

            lobjReportRowDataFirstBox[1].DataTableFieldName = "IDPerson";
            lobjReportRowDataFirstBox[1].BoldDataField = true;
            lobjReportRowDataFirstBox[1].UnderlineDataField = false;
            lobjReportRowDataFirstBox[1].PreviousConstantText = "Person ID: ";
            lobjReportRowDataFirstBox[1].BoldPreviousConstant = false;
            lobjReportRowDataFirstBox[1].UnderlinePreviousConstant = false;
            lobjReportRowDataFirstBox[1].LaterConstantText = "";
            lobjReportRowDataFirstBox[1].BoldLaterConstant = false;
            lobjReportRowDataFirstBox[1].UnderlineLaterConstant = false;

            ReportRowData[] lobjReportRowDataSecondBox = new ReportRowData[2];

            lobjReportRowDataSecondBox[0].DataTableFieldName = "Name";
            lobjReportRowDataSecondBox[0].BoldDataField = true;
            lobjReportRowDataSecondBox[0].UnderlineDataField = false;
            lobjReportRowDataSecondBox[0].PreviousConstantText = "Name: ";
            lobjReportRowDataSecondBox[0].BoldPreviousConstant = false;
            lobjReportRowDataSecondBox[0].UnderlinePreviousConstant = false;
            lobjReportRowDataSecondBox[0].LaterConstantText = " -- ";
            lobjReportRowDataSecondBox[0].BoldLaterConstant = false;
            lobjReportRowDataSecondBox[0].UnderlineLaterConstant = false;

            lobjReportRowDataSecondBox[1].DataTableFieldName = "LastName";
            lobjReportRowDataSecondBox[1].BoldDataField = true;
            lobjReportRowDataSecondBox[1].UnderlineDataField = false;
            lobjReportRowDataSecondBox[1].PreviousConstantText = "Last Name: ";
            lobjReportRowDataSecondBox[1].BoldPreviousConstant = false;
            lobjReportRowDataSecondBox[1].UnderlinePreviousConstant = false;
            lobjReportRowDataSecondBox[1].LaterConstantText = "";
            lobjReportRowDataSecondBox[1].BoldLaterConstant = false;
            lobjReportRowDataSecondBox[1].UnderlineLaterConstant = false;

            ReportRowData[] lobjReportRowDetailData = new ReportRowData[2];

            lobjReportRowDetailData[0].DataTableFieldName = "Comments";
            lobjReportRowDetailData[0].BoldDataField = false;
            lobjReportRowDetailData[0].UnderlineDataField = false;
            lobjReportRowDetailData[0].PreviousConstantText = "Comments Location: ";
            lobjReportRowDetailData[0].BoldPreviousConstant = true;
            lobjReportRowDetailData[0].UnderlinePreviousConstant = true;
            lobjReportRowDetailData[0].LaterConstantText = "";
            lobjReportRowDetailData[0].BoldLaterConstant = false;
            lobjReportRowDetailData[0].UnderlineLaterConstant = false;

            lobjReportRowDetailData[1].DataTableFieldName = "Comments2";
            lobjReportRowDetailData[1].BoldDataField = false;
            lobjReportRowDetailData[1].UnderlineDataField = false;
            lobjReportRowDetailData[1].PreviousConstantText = "General Comments: ";
            lobjReportRowDetailData[1].BoldPreviousConstant = true;
            lobjReportRowDetailData[1].UnderlinePreviousConstant = true;
            lobjReportRowDetailData[1].LaterConstantText = "";
            lobjReportRowDetailData[1].BoldLaterConstant = false;
            lobjReportRowDetailData[1].UnderlineLaterConstant = false;

            ReportRowDoubleBox lobjReportRowDoubleBox;
            lobjReportRowDoubleBox.RowDataFirstBox = lobjReportRowDataFirstBox;
            lobjReportRowDoubleBox.RowAlingmentFirstBox = ReportRowAlignment.Center;
            lobjReportRowDoubleBox.ShowBorderFirstBox = true;
            lobjReportRowDoubleBox.CellWidthFirstBox = 30;
            lobjReportRowDoubleBox.RowDataSecondBox = lobjReportRowDataSecondBox;
            lobjReportRowDoubleBox.RowAlingmentSecondBox = ReportRowAlignment.Left;
            lobjReportRowDoubleBox.ShowBorderSecondBox = true;

            ReportRowDetail lobjReportRowDetail;
            lobjReportRowDetail.RowData = lobjReportRowDetailData;
            lobjReportRowDetail.ShowBorder = true;
            lobjReportRowDetail.RowAlingment = ReportRowAlignment.Left;
            lobjReportRowDetail.RowDetailOrientation = ReportDetailOrientation.Vertical;

            ReportObjects lobjReportObjects;
            lobjReportObjects.ReportRows = new object[2];
            lobjReportObjects.ReportRows[0] = lobjReportRowDoubleBox;
            lobjReportObjects.ReportRows[1] = lobjReportRowDetail;

            GenerateHTMLReport lobjGenerate = new GenerateHTMLReport(ldatData, lobjReportObjects, "Report", "", "Test of Report II", "SwanCSharp.png", "", SwanCSharp.Reporting.InterfaceLanguage.English, ReportViewWindowSize.Medium, true, true);
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
        }
    }
}