123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548 |
- using System;
- using System.Drawing;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using DataDynamics.ActiveReports;
- using DataDynamics.ActiveReports.Document;
- using System.Data;
- namespace FPER
- {
- /// <summary>
- /// Summary description for NewActiveReport1.
- /// </summary>
- public partial class AReportLog : DataDynamics.ActiveReports.ActiveReport
- {// ActiveReport Class
- int index = 0;
- private ArrayList details;
- public bool findTime = false;
- public DateTime findStartTime;
- public DateTime findEndTime;
- public List<string> findType = null;
- 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 List<CEventLogData> LEventLog;
- bool live = false;
- public AReportLog(bool live)
- {
- //
- // Required for Windows Form Designer support
- //
- InitializeComponent();
- this.live = live;
- }
- private void AReportLog_DataInitialize(object sender, System.EventArgs eArgs)
- {// data init function
- try
- {
- //txtTleReceiverId.Text = this.tleReceiverId.ToString();
- //txtTleFromToDate.Text = this.tleFromToDate;
- //txtTleAlarmType.Text = this.tleAlarmType;
- //txtTleAlarmLocation.Text = this.tleAlarmLocation;
- if (this.live)
- {
- this.label1.Text = "수신기 이력 보고서 (현재내역)";
- }
- else
- {
- this.label1.Text = "수신기 이력 보고서 (과거내역)";
- }
- if (findTime)
- {
- this.textBox1.Text = string.Format("{0:D4}-{1:D2}-{2:D2} {3:D2}:{4:D2}:{5:D2} ~{6:D4}-{7:D2}-{8:D2} {9:D2}:{10:D2}:{11:D2}",
- this.findStartTime.Year, this.findStartTime.Month, this.findStartTime.Day,
- this.findStartTime.Hour, this.findStartTime.Minute, this.findStartTime.Second,
- this.findEndTime.Year, this.findEndTime.Month, this.findEndTime.Day,
- this.findEndTime.Hour, this.findEndTime.Minute, this.findEndTime.Second);
- }
- else
- {
- this.textBox1.Text = "전체";
- }
- if (findType != null && findType.Count > 0)
- {
- this.textBox2.Text = "";
- foreach (string text in findType)
- {
- this.textBox2.Text += text;
- this.textBox2.Text += ", ";
- }
- this.textBox2.Text = this.textBox2.Text.Substring(0, this.textBox2.Text.Length - 2);
- }
- else
- {
- this.textBox2.Text = "전체";
- }
- this.PageSettings.Margins.Bottom = 0.3F;
- this.PageSettings.Margins.Left = 0.4F;
- this.PageSettings.Margins.Right = 0.3F;
- this.PageSettings.Margins.Top = 1F;
- this.PageSettings.PaperHeight = 11F;
- this.PageSettings.PaperWidth = 8.5F;
- this.Fields.Add("EventNumber");
- this.Fields.Add("EventTime");
- this.Fields.Add("DeviceName");
- this.Fields.Add("EventName");
- this.Fields.Add("EventPosition");
- this.Fields.Add("Circuit");
- this.Fields.Add("EventErrorStatus");
- this.textBox9.Text = string.Format("수신기 : {0}번", this.tleReceiverId);
- //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);
- }
- }
- //private void AReportLog_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["EventNumber"].Value = row.no;
- // this.Fields["EventTime"].Value = row.alarmDate;
- // this.Fields["DeviceName"].Value = row.alarmLocation;
- // this.Fields["EventName"].Value = row.alarmType;
- // this.Fields["EventPosition"].Value = row.alarmLocation;
- // this.Fields["EventErrorStatus"].Value = row.no;
- // this.Fields["EventTime"].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);
- // }
- //}
- private void AReportLog_FetchData(object sender, FetchEventArgs eArgs)
- { // set display data funtion
- if (LEventLog == null || LEventLog.Count <= 0 || index >= LEventLog.Count)
- {
- eArgs.EOF = true;
- }
- else
- {
- if (LEventLog.Count > this.index)
- {
- CEventLogData eventLog = this.LEventLog[this.index];
- //if (FindReceiver(eventLog.receiverID) >= 0)
- {
- //Receiver receiver = this.LReceiver[FindReceiver(eventLog.receiverID)];
- this.Fields["EventNumber"].Value = this.index + 1;
- this.Fields["EventTime"].Value = eventLog.EventTime;
- this.Fields["EventPosition"].Value = eventLog.devicePosition;
- this.Fields["EventName"].Value = eventLog.eventTypeName;//this.GetEventTypeName(eventLog.eventType);//LEventLog[this.index].EventName;
- this.Fields["DeviceName"].Value = eventLog.deviceName;//this.GetDeviceName(eventLog);
- this.Fields["Circuit"].Value = eventLog.Report_EventPositon;//eventLog.EventPositon; // cyim 2015.9.23 프린트 정보와 일치하도록 수정
- switch (eventLog.Report_EventErrorStatus)//switch (eventLog.EventErrorStatus)// cyim 2015.9.23 프린트 정보와 일치하도록 수정
- {// 0 : 운영,기타 , 1: 화재 발생, 2 : 화재 해제 3: 설비 작동 4: 설비 멈춤 5: 이상 발생 6: 이상 해제
- case 0:
- this.Fields["EventErrorStatus"].Value = "조작";
- this.detail.BackColor = Color.White;
- this.textBox8.BackColor = Color.White;
- this.textBox8.ForeColor = Color.Black;
- break;
- case 1:
- this.Fields["EventErrorStatus"].Value = "발생";
- this.detail.BackColor = Color.FromArgb(255, 140, 140);
- this.textBox8.BackColor = Color.White;
- this.textBox8.ForeColor = Color.Red;
- break;
- case 2:
- this.Fields["EventErrorStatus"].Value = "해제";
- this.detail.BackColor = Color.FromArgb(255, 140, 140);
- this.textBox8.BackColor = Color.White;
- this.textBox8.ForeColor = Color.Blue;
- break;
- case 3:
- this.Fields["EventErrorStatus"].Value = "발생";
- this.detail.BackColor = Color.FromArgb(140, 140, 255);
- this.textBox8.BackColor = Color.White;
- this.textBox8.ForeColor = Color.Red;
- break;
- case 4:
- this.Fields["EventErrorStatus"].Value = "해제";
- this.detail.BackColor = Color.FromArgb(140, 140, 255);
- this.textBox8.BackColor = Color.White;
- this.textBox8.ForeColor = Color.Blue;
- break;
- case 5:
- this.Fields["EventErrorStatus"].Value = "발생";
- this.detail.BackColor = Color.FromArgb(220, 220, 220);
- this.textBox8.BackColor = Color.White;
- this.textBox8.ForeColor = Color.Red;
- break;
- case 6:
- this.Fields["EventErrorStatus"].Value = "해제";
- this.detail.BackColor = Color.FromArgb(220, 220, 220);
- this.textBox8.BackColor = Color.White;
- this.textBox8.ForeColor = Color.Blue;
- break;
- }
- this.index++;
- eArgs.EOF = false;
- }
- }
- }
- }
- //private void NewActiveReport1_FetchData(object sender, FetchEventArgs eArgs) {
- // if (LEventLog == null || LEventLog.Count <= 0 || index >= LEventLog.Count) {
- // eArgs.EOF = true;
- // }
- // else {
- // if (LEventLog.Count > this.index) {
- // CEventLogData eventLog = this.LEventLog[this.index];
- // if (FindReceiver(eventLog.receiverID) >= 0) {
- // Receiver receiver = this.LReceiver[FindReceiver(eventLog.receiverID)];
- // this.Fields["EventNumber"].Value = this.index + 1;
- // this.Fields["EventTime"].Value = eventLog.EventTime;
- // this.Fields["EventPosition"].Value = eventLog.EventPositon;
- // this.Fields["EventName"].Value = this.GetEventTypeName(eventLog.eventType);//LEventLog[this.index].EventName;
- // this.Fields["DeviceName"].Value = this.GetDeviceName(eventLog);
- // //switch (eventLog.ioType) {
- // // case "A": {//전체
- // // if (Convert.ToInt32(eventLog.receiverID) > 0) {
- // // this.Fields["DeviceName"].Value = receiver.Name;
- // // //DBAccess.GetReceiverNameFromDB(this.receiverID);
- // // }
- // // break;
- // // }
- // // case "C": {// 통신
- // // if (Convert.ToInt32(eventLog.receiverID) > 0) {
- // // this.Fields["DeviceName"].Value = receiver.Name;
- // // }
- // // break;
- // // }
- // // case "B": {// 보드deviceName = DBAccess.GetBoardNameFromDB(this.receiverID, this.boardID);
- // // break;
- // // }
- // // case "L": {// 루프
- // // this.Fields["DeviceName"].Value = receiver.board[eventLog.boardID - 1].Name;
- // // // this.Fields["DeviceName"].Value = DBAccess.GetBoardNameFromDB(this.receiverID, this.boardID);
- // // this.Fields["DeviceName"].Value += string.Format(":{0}계통", LEventLog[this.index].loopNO.ToString());
- // // break;
- // // }
- // // case "R": {//중계기
- // // this.Fields["DeviceName"].Value = receiver.board[eventLog.boardID - 1].loop[eventLog.loopNO].repeater[eventLog.repeaterID - 1].Name;
- // // //this.Fields["DeviceName"].Value = DBAccess.GetRepeaterNameFromDB(this.receiverID, this.boardID, this.loopNO, this.repeaterID);
- // // break;
- // // }
- // // case "D": {// 장치
- // // break;
- // // }
- // // case "I": {//입력회로
- // // this.Fields["DeviceName"].Value = receiver.GetDeviceName(eventLog.boardID, eventLog.loopNO, eventLog.repeaterID, eventLog.deviceID, 1);
- // // //this.Fields["DeviceName"].Value = DBAccess.GetDeviceNameFromDB((this.receiverID), (this.boardID), (this.loopNO), (this.repeaterID), (this.deviceID), this.ioType);
- // // break;
- // // }
- // // case "O": {//출력회로
- // // this.Fields["DeviceName"].Value = receiver.GetDeviceName(eventLog.boardID, eventLog.loopNO, eventLog.repeaterID, eventLog.deviceID, 2);
- // // //this.Fields["DeviceName"].Value = DBAccess.GetDeviceNameFromDB(this.receiverID, (this.boardID), (this.loopNO), (this.repeaterID), (this.deviceID), this.ioType);
- // // break;
- // // }
- // // default: {
- // // break;
- // // }
- // //}
- // // this.Fields["DeviceName"].Value = LEventLog[this.index].DeviceName;
- // switch (eventLog.EventErrorStatus) {
- // case 0:
- // this.Fields["EventErrorStatus"].Value = "조작";
- // break;
- // case 1:
- // case 3:
- // case 5:
- // this.Fields["EventErrorStatus"].Value = "발생";
- // break;
- // case 2:
- // case 4:
- // case 6:
- // this.Fields["EventErrorStatus"].Value = "해제";
- // break;
- // default:
- // this.Fields["EventErrorStatus"].Value = "기타";
- // break;
- // }
- // this.index++;
- // eArgs.EOF = false;
- // }
- // }
- // }
- //}
- //List<Receiver> LReceiver;
- //List<CEventType> LEventType;
- //public List<CEventLogData> LEventLog;
- //int index = 0;
- //string GetEventTypeName(string eventType) {
- // string ret = "";
- // foreach (CEventType etype in this.LEventType) {
- // if (eventType == etype.eventType) {
- // ret = etype.eventTypeName;
- // break;
- // }
- // }
- // return ret;
- //}
- //public AReportLog(List<Receiver> LReceiver, List<CEventType> LEventType) {
- // //
- // // Required for Windows Form Designer support
- // //
- // InitializeComponent();
- // this.LReceiver = LReceiver;
- // this.LEventType = LEventType;
- //}
- //private void NewActiveReport1_FetchData(object sender, FetchEventArgs eArgs) {
- // if (LEventLog == null || LEventLog.Count <= 0 || index >= LEventLog.Count) {
- // eArgs.EOF = true;
- // }
- // else {
- // if (LEventLog.Count > this.index) {
- // CEventLogData eventLog = this.LEventLog[this.index];
- // if (FindReceiver(eventLog.receiverID) >= 0) {
- // Receiver receiver = this.LReceiver[FindReceiver(eventLog.receiverID)];
- // this.Fields["EventNumber"].Value = this.index + 1;
- // this.Fields["EventTime"].Value = eventLog.EventTime;
- // this.Fields["EventPosition"].Value = eventLog.EventPositon;
- // this.Fields["EventName"].Value = this.GetEventTypeName(eventLog.eventType);//LEventLog[this.index].EventName;
- // this.Fields["DeviceName"].Value = this.GetDeviceName(eventLog);
- // //switch (eventLog.ioType) {
- // // case "A": {//전체
- // // if (Convert.ToInt32(eventLog.receiverID) > 0) {
- // // this.Fields["DeviceName"].Value = receiver.Name;
- // // //DBAccess.GetReceiverNameFromDB(this.receiverID);
- // // }
- // // break;
- // // }
- // // case "C": {// 통신
- // // if (Convert.ToInt32(eventLog.receiverID) > 0) {
- // // this.Fields["DeviceName"].Value = receiver.Name;
- // // }
- // // break;
- // // }
- // // case "B": {// 보드deviceName = DBAccess.GetBoardNameFromDB(this.receiverID, this.boardID);
- // // break;
- // // }
- // // case "L": {// 루프
- // // this.Fields["DeviceName"].Value = receiver.board[eventLog.boardID - 1].Name;
- // // // this.Fields["DeviceName"].Value = DBAccess.GetBoardNameFromDB(this.receiverID, this.boardID);
- // // this.Fields["DeviceName"].Value += string.Format(":{0}계통", LEventLog[this.index].loopNO.ToString());
- // // break;
- // // }
- // // case "R": {//중계기
- // // this.Fields["DeviceName"].Value = receiver.board[eventLog.boardID - 1].loop[eventLog.loopNO].repeater[eventLog.repeaterID - 1].Name;
- // // //this.Fields["DeviceName"].Value = DBAccess.GetRepeaterNameFromDB(this.receiverID, this.boardID, this.loopNO, this.repeaterID);
- // // break;
- // // }
- // // case "D": {// 장치
- // // break;
- // // }
- // // case "I": {//입력회로
- // // this.Fields["DeviceName"].Value = receiver.GetDeviceName(eventLog.boardID, eventLog.loopNO, eventLog.repeaterID, eventLog.deviceID, 1);
- // // //this.Fields["DeviceName"].Value = DBAccess.GetDeviceNameFromDB((this.receiverID), (this.boardID), (this.loopNO), (this.repeaterID), (this.deviceID), this.ioType);
- // // break;
- // // }
- // // case "O": {//출력회로
- // // this.Fields["DeviceName"].Value = receiver.GetDeviceName(eventLog.boardID, eventLog.loopNO, eventLog.repeaterID, eventLog.deviceID, 2);
- // // //this.Fields["DeviceName"].Value = DBAccess.GetDeviceNameFromDB(this.receiverID, (this.boardID), (this.loopNO), (this.repeaterID), (this.deviceID), this.ioType);
- // // break;
- // // }
- // // default: {
- // // break;
- // // }
- // //}
- // // this.Fields["DeviceName"].Value = LEventLog[this.index].DeviceName;
- // switch (eventLog.EventErrorStatus) {
- // case 0:
- // this.Fields["EventErrorStatus"].Value = "조작";
- // break;
- // case 1:
- // case 3:
- // case 5:
- // this.Fields["EventErrorStatus"].Value = "발생";
- // break;
- // case 2:
- // case 4:
- // case 6:
- // this.Fields["EventErrorStatus"].Value = "해제";
- // break;
- // default:
- // this.Fields["EventErrorStatus"].Value = "기타";
- // break;
- // }
- // this.index++;
- // eArgs.EOF = false;
- // }
- // }
- // }
- //}
- //public int FindReceiver(int ReceiverID) {
- // int ret = -1;
- // for (int i = 0; i < LReceiver.Count; i++) {
- // if (this.LReceiver[i] != null && LReceiver[i].ReceiverID == ReceiverID) {
- // ret = i;
- // break;
- // }
- // }
- // return ret;
- //}
- //string GetDeviceName(CEventLogData eventLog) {
- // string ret = "";
- // if (FindReceiver(eventLog.receiverID) >= 0) {
- // Receiver receiver = this.LReceiver[FindReceiver(eventLog.receiverID)];
- // switch (eventLog.ioType) {
- // case "A": {//전체
- // if (Convert.ToInt32(eventLog.receiverID) > 0) {
- // ret = receiver.Name;
- // //DBAccess.GetReceiverNameFromDB(this.receiverID);
- // }
- // break;
- // }
- // case "C": {// 통신
- // if (Convert.ToInt32(eventLog.receiverID) > 0) {
- // ret = receiver.Name;
- // }
- // break;
- // }
- // case "B": {// 보드deviceName = DBAccess.GetBoardNameFromDB(this.receiverID, this.boardID);
- // break;
- // }
- // case "L": {// 루프
- // ret = receiver.board[eventLog.boardID - 1].Name;
- // ret += string.Format(":{0}계통", LEventLog[this.index].loopNO.ToString());
- // break;
- // }
- // case "R": {//중계기
- // ret = receiver.board[eventLog.boardID - 1].loop[eventLog.loopNO].repeater[eventLog.repeaterID - 1].Name;
- // break;
- // }
- // case "D": {// 장치
- // break;
- // }
- // case "I": {//입력회로
- // ret = receiver.GetDeviceName(eventLog.boardID, eventLog.loopNO, eventLog.repeaterID, eventLog.deviceID, 1);
- // break;
- // }
- // case "O": {//출력회로
- // ret = receiver.GetDeviceName(eventLog.boardID, eventLog.loopNO, eventLog.repeaterID, eventLog.deviceID, 2);
- // break;
- // }
- // default: {
- // break;
- // }
- // }
- // }
- // return ret;
- //}
- //public bool findTime = false;
- //public DateTime findStartTime;
- //public DateTime findEndTime;
- //public List<string> findType = null;
- //private void NewActiveReport1_DataInitialize(object sender, EventArgs e) {
- // if (findTime) {
- // this.textBox1.Text = string.Format("{0:D4}-{1:D2}-{2:D2} {3:D2}:{4:D2}:{5:D2} ~{6:D4}-{7:D2}-{8:D2} {9:D2}:{10:D2}:{11:D2}",
- // this.findStartTime.Year, this.findStartTime.Month, this.findStartTime.Day,
- // this.findStartTime.Hour, this.findStartTime.Minute, this.findStartTime.Second,
- // this.findEndTime.Year, this.findEndTime.Month, this.findEndTime.Day,
- // this.findEndTime.Hour, this.findEndTime.Minute, this.findEndTime.Second);
- // }
- // else {
- // this.textBox1.Text = "전체";
- // }
- // if (findType != null && findType.Count > 0) {
- // this.textBox2.Text = "";
- // foreach (string text in findType) {
- // this.textBox2.Text += text;
- // this.textBox2.Text += ", ";
- // }
- // this.textBox2.Text = this.textBox2.Text.Substring(0, this.textBox2.Text.Length - 2);
- // }
- // else {
- // this.textBox2.Text = "전체";
- // }
- ////public DateTime FindStartTime;
- ////public DateTime FindEndTime;
- ////public List<string> FindType;
- // this.PageSettings.Margins.Bottom = 0.3F;
- // this.PageSettings.Margins.Left = 0.4F;
- // this.PageSettings.Margins.Right = 0.3F;
- // this.PageSettings.Margins.Top = 1F;
- // this.PageSettings.PaperHeight = 11F;
- // this.PageSettings.PaperWidth = 8.5F;
- // this.Fields.Add("EventNumber");
- // this.Fields.Add("EventTime");
- // this.Fields.Add("EventPosition");
- // this.Fields.Add("EventName");
- // this.Fields.Add("DeviceName");
- // this.Fields.Add("EventErrorStatus");
- //}
- }
- }
|