using System;
using System.Drawing;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using DataDynamics.ActiveReports;
using DataDynamics.ActiveReports.Document;
namespace FPER
{
    /// 
    /// Summary description for rptAlarmLogPost.
    /// 
    public partial class rptAlarmLogPost : DataDynamics.ActiveReports.ActiveReport
    {
        private int index;
        private ArrayList details;
        private int tleReceiverId = 0;
        private string tleFromToDate = "";
        private string tleAlarmType = "전체";
        private string tleAlarmLocation = "전체";
        public int ReceiverId { set { this.tleReceiverId = value; } }
        public string FromToDate { set { this.tleFromToDate = value; } }
        public string AlarmType { set { this.tleAlarmType = value; } }
        public string AlarmLocation { set { this.tleAlarmLocation = value; } }
        public ArrayList Details { set { this.details = value; } }
        public rptAlarmLogPost()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
        }
        /// 
        /// DataInitialize Event
        /// ActiveReports event that is called during the report initalization
        /// procedure. (after .Run is called on your report object)  Normally used
        /// with unbound reporting to establish an active connection to your data
        /// to be used with the FetchData event, or to setup a bound report with a
        /// dynamic database connection at runtime.
        /// This is also where you should include any Fields values that you need to
        /// add for unbound reporting.
        /// 
        private void rptAlarmLogPost_DataInitialize(object sender, System.EventArgs eArgs)
        {
            try
            {
                txtTleReceiverId.Text = this.tleReceiverId.ToString();
                txtTleFromToDate.Text = this.tleFromToDate;
                txtTleAlarmType.Text = this.tleAlarmType;
                txtTleAlarmLocation.Text = this.tleAlarmLocation;
                this.Fields.Add("No");
                this.Fields.Add("AlarmDate");
                this.Fields.Add("AlarmType");
                this.Fields.Add("AlarmLocation");
                //this.Fields.Add("ConfirmYes");
                //this.Fields.Add("ConfirmDate");
                // Init some test data:
                //this.details = new ArrayList();
                //this.details.Add(new ReportDetail("A", 10.00, 2));
                //this.details.Add(new ReportDetail("B", 0.12, 1));
                //this.details.Add(new ReportDetail("C", 5.92, 3));
                this.index = -1;
            }
            catch (Exception ex)
            {
                Util.UErrorMessage(ex, 0, 0);
            }
        }
        /// 
        /// FetchData Event
        /// ActiveReports event that is called during the report run once per
        /// row from the dataset.  This event is usually only used in unbound reporting,
        /// you would set the Fields collection value to the value from your dataset and
        /// advance the next row.  When you run out of data, you should set the
        /// FetchEventArgs argument's EOF field to true to tell the report that the report
        /// is done with the data.
        /// 
        private void rptAlarmLogPost_FetchData(object sender, DataDynamics.ActiveReports.ActiveReport.FetchEventArgs eArgs)
        {
            try
            {
                if (this.index >= this.details.Count - 1)
                {
                    eArgs.EOF = true;
                    return;
                }
                else
                {
                    eArgs.EOF = false;
                }
                AlarmLogPostDetail row = (AlarmLogPostDetail)this.details[++this.index];
                this.Fields["No"].Value = row.no;
                this.Fields["AlarmDate"].Value = row.alarmDate;
                this.Fields["AlarmType"].Value = row.alarmType;
                this.Fields["AlarmLocation"].Value = row.alarmLocation;
                //this.Fields["ConfirmYes"].Value = row.confirmYes;
                //this.Fields["ConfirmDate"].Value = row.confirmDate;
            }
            catch (Exception ex)
            {
                Util.UErrorMessage(ex, 0, 0);
            }
        }
    }
    public class AlarmLogPostDetail
    {
        public int no;
        public string alarmDate;
        public string alarmType;
        public string alarmLocation;
        //public string confirmYes;
        //public string confirmDate;
        public AlarmLogPostDetail(int no, string alarmDate, string alarmType, string alarmLocation/*, string confirmYes, string confirmDate*/)
        {
            try
            {
                this.no = no;
                this.alarmDate = alarmDate;
                this.alarmType = alarmType;
                this.alarmLocation = alarmLocation;
                //this.confirmYes = confirmYes;
                //this.confirmDate = confirmDate;
            }
            catch (Exception ex)
            {
                Util.UErrorMessage(ex, 0, 0);
            }
        }
    }
}