using System;
using System.Drawing;
using System.Globalization;
using DevExpress.XtraReports.UI;
using BeWo.Report.ReportObjects;

namespace BeWo.Report.DefaultReports
{
    public partial class Punktebogen : XtraReport, IBeWoReport<AssessmentSheetRO>
    {
        public Punktebogen()
        {
            InitializeComponent();
        }

        public void SetReportDataSource(AssessmentSheetRO pRO)
        {
            bindingSource1.DataSource = pRO;
        }


        private void Cell_EvaluateBinding(object sender, BindingEventArgs e)
        {
            var cell = sender as XRTableCell;
            

            var sv = e.Value as SheetValue;
            if (sv != null && !String.IsNullOrEmpty(sv.Color))
            {
                int argb = Int32.Parse(sv.Color.Replace("#", ""), NumberStyles.HexNumber);
                Color clr = Color.FromArgb(argb);

                cell.BackColor = clr;
            }
            else
            {
                cell.BackColor = Color.Transparent;
            }
        }
    }
}
