FormLogView.cs 177 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using System.Collections;
  9. using System.Threading;
  10. namespace FPER
  11. {
  12. // cyim 2013.9.17 데이타베이스 조회 컨셉변경
  13. //
  14. // 현재 데이타베이스 이력조회의 경우 로딩 속도가 느리다고 판단되어 이를 수정하기 위해 아래와 같이 컨셉을 변경합니다
  15. //
  16. // 현재 이력
  17. // 1) 맨처음 폼이 활성화되면 "전체 기간" -> "오늘 전체" 문구 대체, "기간 설정" -> "시간 설정" 문구 대체
  18. // 2) 기본값은 오늘 전체이며 날짜 정보는 오늘~오늘, 시간정보는 00:00:00 ~ 23:59:59
  19. // 3) 날짜콤보박스 설정은 비활성화 및 시간정보는는 비활성화 속성으로 대체
  20. //
  21. // 과거 이력
  22. // 1) 맨처음 폼이 활성화되면 "전체 기간" 라디오버튼은 비활성화,
  23. // 2) 기본값은 기간 설정이며 날짜정보는 오늘~오늘, 시간정보는 00:00:00 ~ 23:59:59
  24. // 3) 잠시기다려주세요 팝업창이 출력후 진행
  25. // 4) DB_Queary_CountLimit 건을 초과하는 경우 알림팝업창 출력, 이때 DB_Queary_CountLimit 건 이상 요청할지 결정하게 하고, DB_Queary_CountLimit 건이상이라면 최대 30000건
  26. public partial class FormLogView : Form// log preview form class
  27. {
  28. int iUpdateCount = 0; // 데이터 발생후 업데이트 확인을 위한 카운터
  29. const int _UpdateCount = 2; // 데이터 발생한 후 2회 (약 6초)에 걸쳐 데이터 업데이트를 수행한다.
  30. // 최대 데이타베이스 이력조회 건수
  31. int DB_Queary_CountLimit = 1000;
  32. // cyim 2013.10.2 : 발생위치 필터링 기능 추가
  33. DB_Result_Filter FilterMode = DB_Result_Filter.None;
  34. // 크로스 스레드 에러 발생으로 인하여 곧바로 텍스트박스에 접근하지 않도록 함
  35. string FilterMode_Device = "";
  36. string FilterMode_Position = "";
  37. // cyim 2013.10.10 : 1000건 조회 속도 개선 작업 (데이타베이스 조회기간이 변경되면 True 아니라면 False)
  38. bool Edit_Query_Time = false;
  39. // 현재 내역 및 과거 내역 화면은 1개의 폼에서 관리된다
  40. // live 가 true 이면 현재, false 이면 과거
  41. // 만약 현재 내역에서 과거내역으로 전환되는 경우에는 폼생성이 아니라 Select 만 되므로 구현이 주의한다
  42. // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  43. MDIParent mdi;
  44. // cyim 2015.7.6 속도개선작업
  45. Hashtable eventLogInfos; //ArrayList eventLogInfos;
  46. delegate void SetVoidCallback();
  47. delegate void SetStringCallback(String tp);
  48. delegate void deleFormInit();
  49. bool findTime = false;
  50. DateTime findStartTime;
  51. DateTime findEndTime;
  52. List<string> findType = new List<string>();
  53. // 생성자
  54. public FormLogView(bool live)
  55. {
  56. // UI
  57. InitializeComponent();
  58. // cyim 2013.9.17 데이타베이스 조회 컨셉변경 : 항상 생성자를 먼저 실행하는 루틴이므로 불필요하다 (중복제거)
  59. //this.Live = live;
  60. // cyim 2013.7.18 속도개선작업 : 타이머 시작이 기본이고 활성화변수로 제어한다
  61. this.update_flag = false;
  62. iUpdateCount = 0;
  63. this.updatetimer.Start();
  64. }
  65. // init form load
  66. private void FormLogView_Load(object sender, EventArgs e)
  67. {
  68. // cyim 2013.8.1 : 더블버퍼링 적용
  69. SetStyle(ControlStyles.UserPaint, true);
  70. //this.UpdateStyles();
  71. SetStyle(ControlStyles.AllPaintingInWmPaint, true);
  72. //this.UpdateStyles();
  73. SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
  74. this.UpdateStyles();
  75. try
  76. {
  77. mdi = (MDIParent)this.MdiParent;
  78. txtThisReceiverID.Text = string.Format("{0:00}", mdi.myReceiverID);
  79. //이벤트 로그
  80. this.eventLogInfos = mdi.AryEventLogs;
  81. //ComboSetting();
  82. //DataLoadProcess();
  83. //this.mdi.GetDeviceDB();
  84. //this.mdi.GetRepeaterDB();
  85. //this.mdi.GetBoardDB();
  86. this.GetEventTypeDB();
  87. SetColumns();
  88. GridSize();
  89. // cyim 2013.9.17 데이타베이스 조회 컨셉변경 (폼로드 할때 설정되는 루틴 제거)
  90. Init_DateTimePicker();
  91. //dateTimePicker1.Value = DateTime.Now;
  92. //dateTimePicker2.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0, 1);
  93. //dateTimePicker4.Value = DateTime.Now;
  94. //dateTimePicker3.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
  95. //this.radioButtonSelectDate.Checked = true;
  96. this.comboBoxBoard.Items.Clear();
  97. this.LComboBoxBoard.Clear();
  98. this.LComboBoxBoard.Add(new SettingCommboBoxBoard(this.LComboBoxBoard.Count, "전체"));
  99. DacBoardConfig dacBoardConfig = new DacBoardConfig(mdi.myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
  100. DataTable dt = dacBoardConfig.SelectBoard(this.mdi.myReceiverID);
  101. if (dt.Rows.Count > 0)
  102. {
  103. foreach (DataRow dr in dt.Rows)
  104. {
  105. if (dr["USE_FLAG"].ToString() == "Y" && dr["COMM_ID"].ToString() == "1")
  106. {
  107. // cyim 2016.10.31 : 계통정보는 0,1,2,3 으로 변경
  108. if (dr["LOOP0_USE_FLAG"].ToString() == "Y")
  109. {
  110. this.LComboBoxBoard.Add(new SettingCommboBoxBoard(this.LComboBoxBoard.Count, Convert.ToInt32(dr["BOARD_ID"].ToString()), 0, dr["BOARD_NAME"].ToString()));
  111. }
  112. if (dr["LOOP1_USE_FLAG"].ToString() == "Y")
  113. {
  114. this.LComboBoxBoard.Add(new SettingCommboBoxBoard(this.LComboBoxBoard.Count, Convert.ToInt32(dr["BOARD_ID"].ToString()), 1, dr["BOARD_NAME"].ToString()));
  115. }
  116. if (Util.NullToStr(dr["LOOP2_USE_FLAG"]).ToString() == "Y")
  117. {
  118. this.LComboBoxBoard.Add(new SettingCommboBoxBoard(this.LComboBoxBoard.Count, Convert.ToInt32(dr["BOARD_ID"].ToString()), 2, dr["BOARD_NAME"].ToString()));
  119. }
  120. if (Util.NullToStr(dr["LOOP3_USE_FLAG"]).ToString() == "Y")
  121. {
  122. this.LComboBoxBoard.Add(new SettingCommboBoxBoard(this.LComboBoxBoard.Count, Convert.ToInt32(dr["BOARD_ID"].ToString()), 3, dr["BOARD_NAME"].ToString()));
  123. }
  124. }
  125. }
  126. }
  127. this.LComboBoxBoard.Add(new SettingCommboBoxBoard(this.LComboBoxBoard.Count, "기타"));
  128. foreach (SettingCommboBoxBoard sb in this.LComboBoxBoard)
  129. {
  130. this.comboBoxBoard.Items.Add(sb.Name);
  131. }
  132. // cyim 2013.8.8 세부검색 체크시 ShutDown
  133. if (this.comboBoxBoard.Items.Count != 0) this.comboBoxBoard.SelectedIndex = 0;
  134. // cyim 2013.9.17 데이타베이스 조회 컨셉변경
  135. // 라디오버튼 체크시 이벤트 핸들러 등
  136. radioButtonSelectDate.CheckedChanged += new EventHandler(radioButtonSelectDate_CheckedChanged);
  137. // cyim 2013.10.1 : 화면 갱신
  138. this.Update();
  139. // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
  140. mdi.Event.FormLogView_Update_SendMessage_Event += new _Event.FormLogView_Update_SendMessage_Handler(_Event_FormLogView_Update_SendMessage_Event);
  141. }
  142. catch (Exception ex)
  143. {
  144. Util.UErrorMessage(ex, 0, 0);
  145. }
  146. }
  147. // FormClosing
  148. private void FormLogView_FormClosing(object sender, FormClosingEventArgs e)
  149. {
  150. // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
  151. mdi.Event.FormLogView_Update_SendMessage_Event -= new _Event.FormLogView_Update_SendMessage_Handler(_Event_FormLogView_Update_SendMessage_Event);
  152. }
  153. private void FormLogView_Deactivate(object sender, EventArgs e)
  154. {
  155. // deactivate
  156. // list 설정한거 다 정리하자..
  157. findType.Clear();
  158. dataGridView1.Dispose();
  159. LbtnNext.Clear();
  160. LEventLog.Clear();
  161. LComboBoxBoard.Clear();
  162. }
  163. // init form
  164. public void InitFormLogView(bool live)
  165. {
  166. this.Live = live;
  167. }
  168. // 인덱서
  169. bool live_flag = false;
  170. // live log option
  171. public bool Live
  172. {
  173. set
  174. {
  175. this.live_flag = value;
  176. // 세부검색
  177. this.checkBoxSearchDetail.Checked = false;
  178. // 전체검색
  179. this.checkBoxEventTypeAll.Checked = false;
  180. // 화재발생
  181. this.checkBoxFireOn.Checked = false;
  182. // 화재해제
  183. this.checkBoxFireOff.Checked = false;
  184. // 설비동작
  185. this.checkBoxDevOn.Checked = false;
  186. // 설비정지
  187. this.checkBoxDevOff.Checked = false;
  188. // 운영정보
  189. this.checkBoxControlLog.Checked = false;
  190. // 중계기이상
  191. this.checkBoxRepeaterError.Checked = false;
  192. // 회로이상
  193. this.checkBoxDevError.Checked = false;
  194. // 보드이상
  195. this.checkBoxBoardError.Checked = false;
  196. // 이상발생 (미표시)
  197. this.checkBoxErrorOn.Checked = false;
  198. // 이상해제 (미표시)
  199. this.checkBoxErrorOff.Checked = false;
  200. // 내역 리스트
  201. this.dataGridView1.Rows.Clear();
  202. // cyim 2013.10.2 : 발생위치 필터링 기능 추가
  203. this.textBox_DeviceName.Text = "";
  204. this.textBox_PositionName.Text = "";
  205. // 날짜 정보 초기화
  206. Init_DateTimePicker();
  207. if (this.live_flag)
  208. {
  209. // 보이기 속성
  210. this.radioButtonAllDate.Visible = true;
  211. this.radioButtonSelectDate.Visible = false;
  212. // 라디오버튼 (오늘 전체가 기본값)
  213. this.radioButtonAllDate.Checked = true;
  214. // 문구 수정
  215. this.radioButtonAllDate.Text = "기간 설정";
  216. // 활성화
  217. this.dateTimePicker_StartDate.Enabled = false; // 날짜
  218. this.dateTimePicker_EndDate.Enabled = false; // 날짜
  219. this.dateTimePicker_StartTime.Enabled = false; // 시간
  220. this.dateTimePicker_EndTime.Enabled = false; // 시간
  221. // 폼텍스트
  222. this.lblDir.Text = "시작 > 현재내역";
  223. }
  224. else
  225. {
  226. // 보이기 속성
  227. this.radioButtonAllDate.Visible = false;
  228. this.radioButtonSelectDate.Visible = true;
  229. this.radioButtonSelectDate.Location = new Point(9, 20);
  230. // 라디오버튼 (기간 설정이 기본값)
  231. this.radioButtonAllDate.Checked = false;
  232. this.radioButtonSelectDate.Checked = true;
  233. // 문구 수정
  234. this.radioButtonAllDate.Text = "전체 기간";
  235. this.radioButtonSelectDate.Text = "기간 설정";
  236. // 활성화
  237. this.dateTimePicker_StartDate.Enabled = true;
  238. this.dateTimePicker_EndDate.Enabled = true;
  239. this.dateTimePicker_StartTime.Enabled = true;
  240. this.dateTimePicker_EndTime.Enabled = true;
  241. // 폼텍스트
  242. this.lblDir.Text = "시작 > 과거내역";
  243. }
  244. }
  245. get
  246. {
  247. return this.live_flag;
  248. }
  249. }
  250. // cyim 2013.9.17 데이타베이스 조회 컨셉변경
  251. // 라디오 버튼
  252. public void radioButtonSelectDate_CheckedChanged(object sender, EventArgs e)
  253. {
  254. // 날짜 정보 초기화
  255. Init_DateTimePicker();
  256. // 현재 이력에만 라디오 버튼 선택시 활성화 될 UI 가 따로 존재한다
  257. if (this.live_flag == true)
  258. {
  259. if (this.radioButtonAllDate.Checked == true)
  260. {
  261. // 활성화
  262. this.dateTimePicker_StartTime.Enabled = false;
  263. this.dateTimePicker_EndTime.Enabled = false;
  264. }
  265. else
  266. {
  267. // 활성화
  268. this.dateTimePicker_StartTime.Enabled = true;
  269. this.dateTimePicker_EndTime.Enabled = true;
  270. }
  271. }
  272. // 과거 이력
  273. else
  274. {
  275. ; // 실제로 기간 설정 라디오 버튼밖에 없다
  276. }
  277. }
  278. private void Init_DateTimePicker()
  279. {
  280. //시작날짜
  281. dateTimePicker_StartDate.Value = DateTime.Now;
  282. //시작시간
  283. dateTimePicker_StartTime.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0);
  284. // 종료날짜
  285. dateTimePicker_EndDate.Value = DateTime.Now;
  286. // 종료시간
  287. dateTimePicker_EndTime.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
  288. }
  289. // 계통 조건 콤보박스
  290. List<SettingCommboBoxBoard> LComboBoxBoard = new List<SettingCommboBoxBoard>();
  291. // board data set class
  292. class SettingCommboBoxBoard
  293. {
  294. public int index = -1;
  295. public string Name = "";
  296. public int boardID = -1;
  297. public int loopNo = -1;
  298. string boardName = "";
  299. public SettingCommboBoxBoard(int index, int boardID, int loopNo, string boardName)
  300. {
  301. this.index = index;
  302. this.boardID = boardID;
  303. this.loopNo = loopNo;
  304. this.boardName = boardName;
  305. this.Name = string.Format("{0}:{1}계통", boardName, loopNo);
  306. }
  307. public SettingCommboBoxBoard(int index, string Name)
  308. {
  309. this.index = index;
  310. this.Name = Name;
  311. }
  312. }
  313. private void frmAlarmLog_Activated(object sender, EventArgs e) // form active event
  314. {
  315. try
  316. {
  317. this.mdi.SelectMenuIndex = 4;
  318. }
  319. catch (Exception ex)
  320. {
  321. Util.UErrorMessage(ex, 0, 0);
  322. }
  323. }
  324. private void frmAlarmLog_Disposed(object sender, EventArgs e) // form close event
  325. {
  326. try
  327. {
  328. this.mdi.SelectMenuIndex = 0;
  329. }
  330. catch (Exception ex)
  331. {
  332. Util.UErrorMessage(ex, 0, 0);
  333. }
  334. }
  335. // cyim 2015.7.6 속도개선작업
  336. public Hashtable EventLogInfos { set { this.eventLogInfos = value; DataLoadProcess(); } }
  337. //public ArrayList EventLogInfos { set { this.eventLogInfos = value; DataLoadProcess(); } }
  338. //public ArrayList EventLogInfos { set { this.eventLogInfos = value; } }
  339. public void Form_Init() // form init fuintion
  340. {
  341. try
  342. {
  343. if (this.InvokeRequired)
  344. {
  345. deleFormInit d = new deleFormInit(Form_Init);
  346. this.Invoke(d, new object[] { });
  347. }
  348. else
  349. {
  350. //이벤트 로그
  351. this.eventLogInfos = mdi.AryEventLogs;
  352. //ComboSetting();
  353. //DataLoadProcess();
  354. }
  355. }
  356. catch (Exception ex)
  357. {
  358. Util.UErrorMessage(ex, 0, 0);
  359. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.Source), Application.ProductName);
  360. }
  361. }
  362. private void ComboSetting() // search type data set
  363. {
  364. try
  365. {
  366. if (this.InvokeRequired)
  367. {
  368. deleFormInit d = new deleFormInit(getData);
  369. this.Invoke(d, new object[] { });
  370. }
  371. else
  372. {
  373. ArrayList ary = new ArrayList();
  374. ary.Add(new cboitem("", "전체"));
  375. ary.Add(new cboitem("XMXRXIXK", "전체통신이상"));
  376. DacUIProcess dacUIProcess = new DacUIProcess(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
  377. DataTable dt = dacUIProcess.Event_Type_Select(null, mdi); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  378. if (dt.Rows.Count > 0)
  379. {
  380. foreach (DataRow dr in dt.Rows)
  381. {
  382. ary.Add(new cboitem(dr["EVENT_TYPE"].ToString(), dr["EVENT_TYPE_NAME"].ToString()));
  383. }
  384. }
  385. ary.Add(new cboitem("CE", "전체차단리스트"));
  386. Util.ComboSetting(cboEventType, ary, null);
  387. MskDeviceIDString[] Location_devs = new MskDeviceIDString[100];
  388. int Location_devs_count = 0;
  389. ArrayList ary2 = new ArrayList();
  390. ary2.Add(new cboitem(null, "전체"));
  391. // cyim 2015.7.6 속도개선작업
  392. // 해쉬 리스트 구현 방법은 아래와 같다
  393. // 키 : ReceiverID-CommId-BoardNo-LoopNo-RepeaterNo-DeviceId-InoutType-EventType
  394. // 데이타 : EventLogInfo 클래스
  395. // cyim 2016.12.06 : 이벤트 로그 해쉬테이블을 복사본으로 현재내역 조회하도록 함
  396. Hashtable eventLogInfos_temp = (Hashtable)eventLogInfos.Clone();
  397. if (eventLogInfos_temp != null && eventLogInfos_temp.Count != 0)
  398. {
  399. foreach (DictionaryEntry d in eventLogInfos_temp)
  400. {
  401. EventLogInfo eventLogMsg = (EventLogInfo)d.Value;
  402. //EventLogInfo eventLogMsg = (EventLogInfo)this.eventLogInfos[i];
  403. if (eventLogMsg.LiveMsgFlag)
  404. {
  405. MskDeviceIDString device_str = new MskDeviceIDString(eventLogMsg.CommId, eventLogMsg.BoardNo, eventLogMsg.LoopNo
  406. , eventLogMsg.RepeaterNo, eventLogMsg.DeviceId, eventLogMsg.InoutType);
  407. bool deviceOk = false;
  408. for (int j = 0; j < Location_devs_count; j++)
  409. {
  410. if (Location_devs[j] != null)
  411. {
  412. if (Location_devs[j] == device_str)
  413. {
  414. deviceOk = true;
  415. break;
  416. }
  417. }
  418. }
  419. if (!deviceOk)
  420. {
  421. Location_devs[Location_devs_count] = device_str;
  422. Location_devs_count++;
  423. string cboDev = string.Format("{0}-{1}-{2}-{3}-{4}-{5}", device_str.Comm_id, device_str.Board_id, device_str.Loop_no
  424. , device_str.Repeater_id, device_str.Device_id, device_str.Inout_type);
  425. ary2.Add(new cboitem(cboDev, eventLogMsg.DeviceMessage));
  426. }
  427. }
  428. }
  429. }
  430. Util.ComboSetting(cboEventLocation, ary2, null);
  431. }
  432. }
  433. catch (Exception ex)
  434. {
  435. Util.UErrorMessage(ex, 0, 0);
  436. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.Source), Application.ProductName);
  437. }
  438. }
  439. //현재내역 조건 변경
  440. public void SearchType(int type)
  441. {
  442. // search by selected major event type
  443. //Util.UDebugMessage(string.Format("SearchType type = {0}", type), 0, 0);
  444. //try
  445. {
  446. this.checkBoxEventTypeAll.Checked = true;
  447. this.checkBoxEventTypeAll.Checked = false;
  448. switch (type)
  449. {
  450. // 화재
  451. case 0: // fire
  452. this.checkBoxFireOn.Checked = true;
  453. break;
  454. // 설비
  455. case 1: // dev run
  456. this.checkBoxDevOn.Checked = true;
  457. break;
  458. // 통신 (중계기)
  459. case 2: // error
  460. this.checkBoxRepeaterError.Checked = true;
  461. break;
  462. // 단선
  463. case 3: // line cut
  464. this.checkBoxDevError.Checked = true;
  465. break;
  466. // cyim 2014.1.10 : 점검카운터 추가
  467. // 점검
  468. case 4:
  469. this.checkBoxBoardError.Checked = true;
  470. break;
  471. // 모두
  472. default:
  473. this.checkBoxEventTypeAll.Checked = true;
  474. break;
  475. }
  476. this.Search();
  477. }
  478. //catch (Exception ex)
  479. //{
  480. // Util.UErrorMessage(ex, 0, 0);
  481. //}
  482. }
  483. public void SetSearchCondition(String eventType) // search by detail event type
  484. {
  485. //Util.UDebugMessage(string.Format("SetSearchCondition eventType = {0}", eventType), 0, 0);
  486. try
  487. {
  488. if (cboEventType.InvokeRequired)
  489. {
  490. SetStringCallback d = new SetStringCallback(SetSearchCondition);
  491. this.Invoke(d, new object[] { eventType });
  492. }
  493. else
  494. {
  495. switch (eventType)
  496. {
  497. case "OF":
  498. this.checkBoxEventTypeAll.Checked = false;
  499. this.checkBoxFireOn.Checked = true;
  500. break;
  501. case "OE":
  502. this.checkBoxEventTypeAll.Checked = false;
  503. this.checkBoxDevOn.Checked = true;
  504. break;
  505. case "OL":
  506. this.checkBoxEventTypeAll.Checked = false;
  507. this.checkBoxErrorOn.Checked = true;
  508. break;
  509. case "CE":
  510. this.checkBoxEventTypeAll.Checked = false;
  511. this.checkBoxErrorOn.Checked = true;
  512. break;
  513. case "XMXRXIXK":
  514. this.checkBoxEventTypeAll.Checked = false;
  515. //this.checkBoxErrorOn.Checked = true;
  516. break;
  517. case "ALL":
  518. this.checkBoxEventTypeAll.Checked = true;
  519. break;
  520. }
  521. this.Search();//this.UpdateData();
  522. //this.checkBoxSearchDetail.Checked = true;
  523. //this.comboBoxEventType.SelectedValue = eventType;
  524. // cboEventType.SelectedValue = eventType;
  525. }
  526. }
  527. catch (Exception ex)
  528. {
  529. Util.UErrorMessage(ex, 0, 0);
  530. }
  531. }
  532. //화면에 내역표시
  533. public void DataLoadProcess() // data load interface function
  534. {
  535. try
  536. {
  537. if (this.InvokeRequired)
  538. {
  539. SetVoidCallback d = new SetVoidCallback(DataLoadProcess);
  540. this.Invoke(d, new object[] { });
  541. }
  542. else
  543. {
  544. getData();
  545. }
  546. }
  547. catch (Exception ex)
  548. {
  549. Util.UErrorMessage(ex, 0, 0);
  550. }
  551. }
  552. private void getData() // data set , don't use
  553. {
  554. try
  555. {
  556. dataGridView1.Rows.Clear();
  557. DataGridViewCellStyle styCenterRed = new DataGridViewCellStyle();
  558. styCenterRed.Alignment = DataGridViewContentAlignment.MiddleCenter;
  559. styCenterRed.ForeColor = System.Drawing.Color.Red;
  560. DataGridViewCellStyle styCenterYellow = new DataGridViewCellStyle();
  561. styCenterYellow.Alignment = DataGridViewContentAlignment.MiddleCenter;
  562. styCenterYellow.ForeColor = System.Drawing.Color.Purple;
  563. DataGridViewCellStyle styCenterBlue = new DataGridViewCellStyle();
  564. styCenterBlue.Alignment = DataGridViewContentAlignment.MiddleCenter;
  565. styCenterBlue.ForeColor = System.Drawing.Color.Blue;
  566. DataGridViewCellStyle styCenterBlack = new DataGridViewCellStyle();
  567. styCenterBlack.Alignment = DataGridViewContentAlignment.MiddleCenter;
  568. styCenterBlack.ForeColor = System.Drawing.Color.Black;
  569. DataGridViewCellStyle[] styCenter = new DataGridViewCellStyle[4]{
  570. styCenterRed,styCenterYellow,styCenterBlue,styCenterBlack};
  571. DataGridViewCellStyle styLeftRed = new DataGridViewCellStyle();
  572. styLeftRed.Alignment = DataGridViewContentAlignment.MiddleLeft;
  573. styLeftRed.ForeColor = System.Drawing.Color.Red;
  574. DataGridViewCellStyle styLeftYellow = new DataGridViewCellStyle();
  575. styLeftYellow.Alignment = DataGridViewContentAlignment.MiddleLeft;
  576. styLeftYellow.ForeColor = System.Drawing.Color.Purple;
  577. DataGridViewCellStyle styLeftBlue = new DataGridViewCellStyle();
  578. styLeftBlue.Alignment = DataGridViewContentAlignment.MiddleLeft;
  579. styLeftBlue.ForeColor = System.Drawing.Color.Blue;
  580. DataGridViewCellStyle styLeftBlack = new DataGridViewCellStyle();
  581. styLeftBlack.Alignment = DataGridViewContentAlignment.MiddleLeft;
  582. styLeftBlack.ForeColor = System.Drawing.Color.Black;
  583. DataGridViewCellStyle[] styLeft = new DataGridViewCellStyle[4]{
  584. styLeftRed,styLeftYellow,styLeftBlue,styLeftBlack};
  585. // cyim 2015.7.6 속도개선작업
  586. // 해쉬 리스트 구현 방법은 아래와 같다
  587. // 키 : ReceiverID-CommId-BoardNo-LoopNo-RepeaterNo-DeviceId-InoutType-EventType
  588. // 데이타 : EventLogInfo 클래스
  589. // cyim 2016.12.06 : 이벤트 로그 해쉬테이블을 복사본으로 현재내역 조회하도록 함
  590. Hashtable eventLogInfos_temp = (Hashtable)eventLogInfos.Clone();
  591. if (eventLogInfos_temp == null && eventLogInfos_temp.Count != 0) return;
  592. int i = 0;
  593. foreach (DictionaryEntry d in eventLogInfos_temp)
  594. //for (int i = 0; i < eventLogInfos.Count; i++)
  595. {
  596. EventLogInfo eventLogMsg = (EventLogInfo)d.Value;
  597. //EventLogInfo eventLogMsg = (EventLogInfo)this.eventLogInfos[i];
  598. // cyim 2013.7.19 속도개선작업
  599. //string str_Msg = "getData : ";
  600. //str_Msg += string.Format("BoardNo = {0} ", eventLogMsg.BoardNo);
  601. //str_Msg += string.Format("CommId = {0} ", eventLogMsg.CommId);
  602. ////str_Msg += string.Format("Confirm_flag = {0} ", eventLogMsg.Confirm_flag);
  603. ////str_Msg += string.Format("Confirm_person = {0} ", eventLogMsg.Confirm_person);
  604. ////str_Msg += string.Format("Confirm_remark = {0} ", eventLogMsg.Confirm_remark);
  605. ////str_Msg += string.Format("Confirm_time = {0} ", eventLogMsg.Confirm_time);
  606. //str_Msg += string.Format("DataValue = {0} ", eventLogMsg.DataValue);
  607. //str_Msg += string.Format("DeviceId = {0} ", eventLogMsg.DeviceId);
  608. //str_Msg += string.Format("DeviceMessage = {0} ", eventLogMsg.DeviceMessage);
  609. //str_Msg += string.Format("EventId = {0} ", eventLogMsg.EventId);
  610. //str_Msg += string.Format("EventStatus = {0} ", eventLogMsg.EventStatus);
  611. //str_Msg += string.Format("EventTime = {0} ", eventLogMsg.EventTime);
  612. //str_Msg += string.Format("EventType = {0} ", eventLogMsg.EventType);
  613. //str_Msg += string.Format("EventTypeName = {0} ", eventLogMsg.EventTypeName);
  614. //str_Msg += string.Format("InoutType = {0} ", eventLogMsg.InoutType);
  615. //str_Msg += string.Format("LiveMsgFlag = {0} ", eventLogMsg.LiveMsgFlag);
  616. //str_Msg += string.Format("LoopNo = {0} ", eventLogMsg.LoopNo);
  617. //str_Msg += string.Format("Message = {0} ", eventLogMsg.Message);
  618. //str_Msg += string.Format("ReceiverID = {0} ", eventLogMsg.ReceiverID);
  619. //str_Msg += string.Format("RepeaterNo = {0} ", eventLogMsg.RepeaterNo);
  620. //Util.UDebugMessage(str_Msg, 0, 0);
  621. if (eventLogMsg.LiveMsgFlag)
  622. {
  623. bool searchResultOK = true;
  624. //검색조건값 읽기
  625. String EventType = "";
  626. if (cboEventType.SelectedValue != null)
  627. {
  628. EventType = cboEventType.SelectedValue.ToString();
  629. }
  630. bool eventTimeYes = chkEventTime.Checked;
  631. DateTime fromDate = dtFromDate.Value;
  632. DateTime toDate = dtToDate.Value;
  633. if (eventTimeYes)
  634. {
  635. string from_event_time_s = String.Format("{0:yyyy}-{0:MM}-{0:dd} {1}:{2}:00", fromDate
  636. , mskFromTime.Text.Substring(0, 2), mskFromTime.Text.Substring(3, 2));
  637. fromDate = DateTime.Parse(from_event_time_s);
  638. //event_time = String.Format("{0:yyyy}-{0:MM}-{0:dd} {0:HH}:{0:mm}:{0:ss}", eventTime);
  639. string to_event_time_s = String.Format("{0:yyyy}-{0:MM}-{0:dd} {1}:{2}:59", toDate
  640. , mskToTime.Text.Substring(0, 2), mskToTime.Text.Substring(3, 2));
  641. toDate = DateTime.Parse(to_event_time_s);
  642. //event_time = String.Format("{0:yyyy}-{0:MM}-{0:dd} {0:HH}:{0:mm}:{0:ss}", eventTime);
  643. }
  644. String DevicePointSelect = "";
  645. if (cboEventLocation.SelectedValue != null)
  646. {
  647. DevicePointSelect = cboEventLocation.SelectedValue.ToString();
  648. }
  649. String DevicePoint = DevicePointSelect;
  650. int CommID = 0;
  651. int boardID = 0;
  652. int LoopNo = 0;
  653. int RepeaterNo = 0;
  654. int DeviceId = 0;
  655. String InOut = "";
  656. int pos = -1;
  657. if (DevicePointSelect != "")
  658. {
  659. //COMM_ID 추출
  660. pos = DevicePoint.IndexOf("-");
  661. if (pos != -1) CommID = Util.StrToInt(DevicePoint.Substring(0, pos), 0);
  662. DevicePoint = DevicePoint.Substring(pos + 1);
  663. //BOARD_ID 추출
  664. pos = DevicePoint.IndexOf("-");
  665. if (pos != -1) boardID = Util.StrToInt(DevicePoint.Substring(0, pos), 0);
  666. DevicePoint = DevicePoint.Substring(pos + 1);
  667. //LOOP_NO 추출
  668. pos = DevicePoint.IndexOf("-");
  669. if (pos != -1) LoopNo = Util.StrToInt(DevicePoint.Substring(0, pos), 0);
  670. DevicePoint = DevicePoint.Substring(pos + 1);
  671. //REPEATER_ID 추출
  672. pos = DevicePoint.IndexOf("-");
  673. if (pos != -1) RepeaterNo = Util.StrToInt(DevicePoint.Substring(0, pos), 0);
  674. DevicePoint = DevicePoint.Substring(pos + 1);
  675. //DEVICE_ID 추출
  676. pos = DevicePoint.IndexOf("-");
  677. if (pos != -1) DeviceId = Util.StrToInt(DevicePoint.Substring(0, pos), 0);
  678. DevicePoint = DevicePoint.Substring(pos + 1);
  679. //INOUT_TYPE 추출
  680. if (DevicePoint.Length > 0) InOut = DevicePoint;
  681. }
  682. if (!EventType.Equals(""))
  683. {
  684. if (EventType.Length > 2)
  685. {
  686. if ((EventType.IndexOf(eventLogMsg.EventType) % 2) != 0) searchResultOK = false;
  687. }
  688. else
  689. {
  690. if (!EventType.Equals(eventLogMsg.EventType)) searchResultOK = false;
  691. }
  692. }
  693. if (eventTimeYes)
  694. {
  695. if (DateTime.Compare(eventLogMsg.EventTime, fromDate) < 0
  696. || DateTime.Compare(eventLogMsg.EventTime, toDate) > 0) searchResultOK = false;
  697. }
  698. if (DevicePointSelect != "")
  699. {
  700. if (eventLogMsg.CommId != CommID) searchResultOK = false;
  701. if (eventLogMsg.BoardNo != boardID) searchResultOK = false;
  702. if (eventLogMsg.LoopNo != LoopNo) searchResultOK = false;
  703. if (eventLogMsg.RepeaterNo != RepeaterNo) searchResultOK = false;
  704. if (eventLogMsg.DeviceId != DeviceId) searchResultOK = false;
  705. if (!eventLogMsg.InoutType.Equals(InOut)) searchResultOK = false;
  706. }
  707. if (searchResultOK)
  708. {
  709. int colorIdx = 3; //검정색
  710. //if (eventLogMsg.Confirm_flag.Equals("Y"))
  711. //{
  712. // if (eventLogMsg.LiveMsgFlag) colorIdx = 2; //파란색
  713. // else colorIdx = 3; //검정색
  714. //}
  715. //else
  716. {
  717. if (eventLogMsg.LiveMsgFlag) colorIdx = 0; //빨강색
  718. else colorIdx = 1; //노란색
  719. }
  720. DataGridViewRow row = new DataGridViewRow();
  721. //DataGridViewCheckBoxCell checkCell = new DataGridViewCheckBoxCell();
  722. //checkCell.Style = styCenter[colorIdx];
  723. //checkCell.Value = false;
  724. //row.Cells.Add(checkCell);
  725. DataGridViewTextBoxCell textCell_no = new DataGridViewTextBoxCell();
  726. textCell_no.Style = styCenter[colorIdx];
  727. textCell_no.Value = string.Format("{000}", i + 1);
  728. row.Cells.Add(textCell_no);
  729. DataGridViewTextBoxCell textCell_eventid = new DataGridViewTextBoxCell();
  730. textCell_eventid.Style = styLeft[colorIdx];
  731. textCell_eventid.Value = eventLogMsg.EventId;
  732. row.Cells.Add(textCell_eventid);
  733. //string event_time = Util.NullToStr(eventLogMsg.EventTime);
  734. //if (event_time.Length == 19)
  735. //{
  736. // string event_time_s = String.Format("{0}-{1}-{2} {3}:{4}:{5}.{6}", event_time.Substring(0, 4)
  737. // , event_time.Substring(4, 2), event_time.Substring(6, 2), event_time.Substring(8, 2)
  738. // , event_time.Substring(10, 2), event_time.Substring(12, 2), event_time.Substring(14));
  739. // DateTime eventTime = DateTime.Parse(event_time);
  740. // event_time = String.Format("{0:yyyy}-{0:MM}-{0:dd} {0:HH}:{0:mm}:{0:ss}", eventTime);
  741. //}
  742. string event_time = String.Format("{0:yyyy}-{0:MM}-{0:dd} {0:HH}:{0:mm}:{0:ss}", eventLogMsg.EventTime);
  743. DataGridViewTextBoxCell textCell_eventTime = new DataGridViewTextBoxCell();
  744. textCell_eventTime.Style = styLeft[colorIdx];
  745. textCell_eventTime.Value = event_time;
  746. row.Cells.Add(textCell_eventTime);
  747. DataGridViewTextBoxCell textCell_msg = new DataGridViewTextBoxCell();
  748. textCell_msg.Style = styLeft[colorIdx];
  749. string msg = eventLogMsg.Message;
  750. msg = msg.Replace("\n", " ");
  751. textCell_msg.Value = msg;
  752. row.Cells.Add(textCell_msg);
  753. DataGridViewTextBoxCell textCell_devMsg = new DataGridViewTextBoxCell();
  754. textCell_devMsg.Style = styLeft[colorIdx];
  755. textCell_devMsg.Value = eventLogMsg.DeviceMessage;
  756. row.Cells.Add(textCell_devMsg);
  757. //확인,확인시간 빼기로 2010.10.21 장부장님 요청
  758. //DataGridViewTextBoxCell textCell_confirm = new DataGridViewTextBoxCell();
  759. //textCell_confirm.Style = styCenter[colorIdx];
  760. //textCell_confirm.Value = eventLogMsg.Confirm_flag;
  761. //row.Cells.Add(textCell_confirm);
  762. //DataGridViewTextBoxCell textCell_confirmtime = new DataGridViewTextBoxCell();
  763. //textCell_confirmtime.Style = styLeft[colorIdx];
  764. //if (eventLogMsg.Confirm_flag.Equals("Y"))
  765. //{
  766. // textCell_confirmtime.Value = eventLogMsg.Confirm_time;
  767. //}
  768. //else
  769. //{
  770. // textCell_confirmtime.Value = "";
  771. //}
  772. //row.Cells.Add(textCell_confirmtime);
  773. dataGridView1.Rows.Add(row);
  774. }
  775. }
  776. // cyim 2015.7.6 속도개선작업 : 인덱스를 위해 i 를 증가
  777. i++;
  778. }
  779. }
  780. catch (Exception ex)
  781. {
  782. Util.UErrorMessage(ex, 0, 0);
  783. //MessageBox.Show(ex.Message, Application.ProductName);
  784. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
  785. }
  786. }
  787. private void btnWinClose_Click(object sender, EventArgs e) // close form
  788. {
  789. this.Close();
  790. }
  791. private void chkEventTime_CheckedChanged(object sender, EventArgs e) // check event search time
  792. {
  793. try
  794. {
  795. if (chkEventTime.Checked)
  796. {
  797. dtFromDate.Enabled = true;
  798. dtToDate.Enabled = true;
  799. mskFromTime.Enabled = true;
  800. mskToTime.Enabled = true;
  801. }
  802. else
  803. {
  804. dtFromDate.Enabled = false;
  805. dtToDate.Enabled = false;
  806. mskFromTime.Enabled = false;
  807. mskToTime.Enabled = false;
  808. }
  809. }
  810. catch (Exception ex)
  811. {
  812. Util.UErrorMessage(ex, 0, 0);
  813. }
  814. }
  815. public void Search()
  816. { //search event set base data & call live or post log search function
  817. //Util.UDebugMessage(string.Format("+Search"), 0, 0);
  818. this.findTime = this.radioButtonSelectDate.Checked;
  819. if (this.findTime)
  820. {
  821. this.findStartTime = new DateTime(this.dateTimePicker_StartDate.Value.Year, this.dateTimePicker_StartDate.Value.Month, this.dateTimePicker_StartDate.Value.Day,
  822. this.dateTimePicker_StartTime.Value.Hour, this.dateTimePicker_StartTime.Value.Minute, this.dateTimePicker_StartTime.Value.Second);
  823. this.findEndTime = new DateTime(this.dateTimePicker_EndDate.Value.Year, this.dateTimePicker_EndDate.Value.Month, this.dateTimePicker_EndDate.Value.Day,
  824. this.dateTimePicker_EndTime.Value.Hour, this.dateTimePicker_EndTime.Value.Minute, this.dateTimePicker_EndTime.Value.Second);
  825. }
  826. if (this.checkBoxSearchDetail.Checked)
  827. {
  828. }
  829. else
  830. {
  831. //if ((this.checkBoxFireOn.Checked || this.checkBoxFireOff.Checked || this.checkBoxDevOn.Checked || this.checkBoxDevOff.Checked
  832. // || this.checkBoxErrorOn.Checked || this.checkBoxErrorOff.Checked || this.checkBoxControlLog.Checked) == false) {
  833. // this.checkBoxEventTypeAll.Checked = true;
  834. //}
  835. if ((this.checkBoxFireOn.Checked || this.checkBoxBoardError.Checked || this.checkBoxDevOn.Checked
  836. || this.checkBoxRepeaterError.Checked || this.checkBoxDevError.Checked || this.checkBoxControlLog.Checked) == false)
  837. {
  838. this.checkBoxEventTypeAll.Checked = true;
  839. }
  840. findType.Clear();
  841. if (this.checkBoxSearchDetail.Checked)
  842. {
  843. // cyim 2013.8.13 과거이력 및 현재이력 세부검색시 콤보박스 정렬 및 루틴조절
  844. //findType.Add(this.comboBoxEventType.Items[this.comboBoxEventType.SelectedIndex].ToString());
  845. findType.Add(this.comboBoxEventType.Text);
  846. }
  847. else if (this.checkBoxEventTypeAll.Checked)
  848. {
  849. findType.Add("전체");
  850. }
  851. else
  852. {
  853. if (this.checkBoxFireOn.Checked)
  854. {
  855. findType.Add("화재발생");
  856. }
  857. //if (this.checkBoxFireOff.Checked) {
  858. // findType.Add("화재해제");
  859. //}
  860. if (this.checkBoxDevOn.Checked)
  861. {
  862. findType.Add("설비작동");
  863. }
  864. //if (this.checkBoxDevOff.Checked) {
  865. // findType.Add("설비정지");
  866. //}
  867. //if (this.checkBoxErrorOn.Checked) {
  868. // findType.Add("이상발생");
  869. //}
  870. //if (this.checkBoxErrorOff.Checked) {
  871. // findType.Add("이상해제");
  872. //}
  873. if (this.checkBoxControlLog.Checked)
  874. {
  875. findType.Add("운영");
  876. }
  877. if (this.checkBoxBoardError.Checked)
  878. {
  879. findType.Add("보드 이상");
  880. }
  881. if (this.checkBoxRepeaterError.Checked)
  882. {
  883. findType.Add("중계기 이상");
  884. }
  885. if (this.checkBoxDevError.Checked)
  886. {
  887. findType.Add("회로 단선");
  888. }
  889. }
  890. }
  891. if (this.live_flag)
  892. {
  893. //this.GetLogLiveData();
  894. this.LockLiveData();
  895. }
  896. else
  897. {
  898. this.GetLogDBData();
  899. }
  900. //Util.UDebugMessage(string.Format("-Search"), 0, 0);
  901. }
  902. private void btnSearch_Click(object sender, EventArgs e) // search button click
  903. {
  904. try
  905. {
  906. // cyim 2013.10.10 : 시작시간 및 종료시간 예외처리
  907. if (dateTimePicker_StartDate.Value.Date.CompareTo(dateTimePicker_EndDate.Value.Date) > 0)
  908. {
  909. MessageBox.Show("시작날짜와 종료날짜 정보를 다시 확인해주세요");
  910. return;
  911. }
  912. else if (dateTimePicker_StartDate.Value.Date.CompareTo(dateTimePicker_EndDate.Value.Date) == 0)
  913. {
  914. if (dateTimePicker_StartTime.Value.TimeOfDay.CompareTo(dateTimePicker_EndTime.Value.TimeOfDay) > 0)
  915. {
  916. MessageBox.Show("시작시간과 종료시간 정보를 다시 확인해주세요");
  917. return;
  918. }
  919. }
  920. // 필터링 기능중 공백은 허용하지 않음
  921. // cyim 2013.10.2 : 발생위치 필터링 기능 추가
  922. if (this.textBox_DeviceName.Text.Trim().Length != 0 && this.textBox_PositionName.Text.Trim().Length != 0)
  923. FilterMode = DB_Result_Filter.AND;
  924. else if (this.textBox_DeviceName.Text.Trim().Length == 0 && this.textBox_PositionName.Text.Trim().Length == 0)
  925. FilterMode = DB_Result_Filter.None;
  926. else if (this.textBox_DeviceName.Text.Trim().Length != 0)
  927. FilterMode = DB_Result_Filter.Device;
  928. else
  929. FilterMode = DB_Result_Filter.Positon;
  930. // 속도개선 및 크로스에러때문에 이렇게 문자열에 치환해서 사용함
  931. FilterMode_Device = this.textBox_DeviceName.Text.Trim();
  932. FilterMode_Position = this.textBox_PositionName.Text.Trim();
  933. //getData();
  934. this.Search();
  935. // cyim 2013.7.12 디자인개선작업 : 현재내역 및 과거내역
  936. this.panel1.Focus();
  937. }
  938. catch (Exception ex)
  939. {
  940. Util.UErrorMessage(ex, 0, 0);
  941. }
  942. }
  943. // 추가1_시작(lch_13.07.19)
  944. // 팝업 // cyim 2013.8.5 대기 팝업창 클래스 추가
  945. //Form_Popup Popup = null;
  946. // this.LEventLog의 복사본
  947. List<CEventLogData> LEventLog_Copy = new List<CEventLogData>();
  948. // 스레드 선언
  949. public Thread thread = null;
  950. // 이벤트 발생처리
  951. public delegate void Temp(Form form);
  952. public event Temp Thread_End_Event;
  953. // 크로스레드 해결
  954. public delegate void CrossThread_Form(Form form);
  955. // 추가1_끝
  956. private void UpdateLEventLogData()
  957. {
  958. // log data information update
  959. //foreach (CEventLogData elog in this.LEventLog)
  960. //{
  961. // elog.devicePosition = this.GetDevicePositionName(elog);
  962. // elog.deviceName = this.GetDeviceName(elog);
  963. //}
  964. // lch_13.07.19 위내용 주석처리하고 아래로 변경
  965. foreach (CEventLogData elog in LEventLog_Copy)
  966. {
  967. elog.devicePosition = this.GetDevicePositionName(elog);
  968. elog.deviceName = this.GetDeviceName(elog);
  969. }
  970. }
  971. // 추가_(lch_13.07.19)
  972. public void Start_Thread()
  973. {
  974. // cyim 2013.9.24 : 팝업창 출력하는 동안 다른폼을 여는 경우 죽는 문제 발생 수정
  975. try
  976. {
  977. // 복사본 클리어
  978. LEventLog_Copy.Clear();
  979. // 복사본에 복사
  980. LEventLog_Copy = this.LEventLog.GetRange(0, this.LEventLog.Count);
  981. // 오래걸리는 작업은 스레드 처리
  982. this.UpdateLEventLogData();
  983. // 스레드 종료를 알림
  984. this.Thread_End_Event(this);
  985. }
  986. catch (Exception ex)
  987. {
  988. Util.UErrorMessage(ex, 0, 0);
  989. }
  990. }
  991. // 추가_(lch_13.07.19)
  992. // 스레드 종료가 되면 실행되는 함수
  993. public void FTP_Save_Thread_End(Form form)
  994. {
  995. // cyim 2013.9.24 : 팝업창 출력하는 동안 다른폼을 여는 경우 죽는 문제 발생 수정
  996. try
  997. {
  998. if (form.InvokeRequired)
  999. {
  1000. CrossThread_Form d = new CrossThread_Form(FTP_Save_Thread_End);
  1001. form.Invoke(d, new object[] { form });
  1002. }
  1003. else
  1004. {
  1005. AReportLog rpt = new AReportLog(this.live_flag);
  1006. rpt.LEventLog = this.LEventLog;
  1007. rpt.findTime = this.findTime;
  1008. rpt.findType = this.findType;
  1009. rpt.findStartTime = this.findStartTime;
  1010. rpt.findEndTime = this.findEndTime;
  1011. rpt.ReceiverId = this.mdi.myReceiverID;
  1012. FormLogPrint logform = new FormLogPrint();
  1013. logform.Document = rpt.Document;
  1014. logform.Show();
  1015. rpt.Run(false);
  1016. // 최상위창으로 표시
  1017. logform.TopMost = true;
  1018. // 이벤트 해제
  1019. this.Thread_End_Event -= new Temp(FTP_Save_Thread_End);
  1020. // 팝업을 닫자 // cyim 2013.8.5 대기 팝업창 클래스 추가
  1021. mdi.Popup.CommonPopupClose(this); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1022. // cyim 2013.9.23 화면갱신코드 추가
  1023. this.Update();
  1024. // 최상위창으로 표시 해제
  1025. logform.TopMost = false;
  1026. }
  1027. }
  1028. catch (Exception ex)
  1029. {
  1030. Util.UErrorMessage(ex, 0, 0);
  1031. }
  1032. }
  1033. private void btnPrint_Click(object sender, EventArgs e) // print button click
  1034. {
  1035. try
  1036. {
  1037. // cyim 2013.7.12 디자인개선작업 : 현재내역 및 과거내역
  1038. this.panel1.Focus();
  1039. if (dataGridView1.Rows.Count < 1)
  1040. {
  1041. MessageBox.Show("인쇄할 현재내역이 없습니다. 데이터를 확인하시기 바랍니다.", Application.ProductName);
  1042. return;
  1043. }
  1044. // 추가2_시작(lch_13.07.19) // cyim 2013.8.5 대기 팝업창 클래스 추가
  1045. mdi.Popup.CommonPopupShow(this); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1046. // cyim 2013.9.23 화면갱신코드 추가
  1047. this.Update();
  1048. // 스레드를 실행시키전에 이벤트를 등록해준다
  1049. this.Thread_End_Event += new Temp(FTP_Save_Thread_End);
  1050. // 스레드생성
  1051. thread = new Thread(new ThreadStart(Start_Thread));
  1052. // 스레드시작
  1053. thread.Start();
  1054. // 추가2_끝
  1055. //// Create new report object
  1056. //rptAlarmLog rpt = new rptAlarmLog();
  1057. //if (chkEventTime.Checked)
  1058. //{
  1059. // rpt.FromToDate = string.Format("{0} {1} ~ {2} {3}", dtFromDate.Text, mskFromTime.Text, dtToDate.Text, mskToTime.Text);
  1060. //}
  1061. //else
  1062. //{
  1063. // rpt.FromToDate = "전체";
  1064. //}
  1065. //rpt.AlarmType = cboEventType.Text;
  1066. //rpt.ReceiverId = mdi.myReceiverID;
  1067. //rpt.AlarmLocation = cboEventLocation.Text;
  1068. // //LIST DATA ADD
  1069. //int no = 0;
  1070. //ArrayList lst = new ArrayList();
  1071. //foreach (DataGridViewRow row in dataGridView1.Rows)
  1072. //{
  1073. // no = Util.StrToInt(row.Cells[0].Value,0);
  1074. // lst.Add(new AlarmLogDetail(no
  1075. // , Util.NullToStr(row.Cells[2].Value)
  1076. // , Util.NullToStr(row.Cells[3].Value)
  1077. // , Util.NullToStr(row.Cells[4].Value)));
  1078. //}
  1079. //rpt.Details = lst;
  1080. //// Pass the document to show in the viewer form
  1081. //ViewerForm frmViewer = new ViewerForm();
  1082. //frmViewer.Show();
  1083. //frmViewer.Document = rpt.Document;
  1084. //frmViewer.WindowState = FormWindowState.Maximized;
  1085. //rpt.Run(false);
  1086. }
  1087. catch (Exception ex)
  1088. {
  1089. Util.UErrorMessage(ex, 0, 0);
  1090. //MessageBox.Show(ex.Message);
  1091. }
  1092. }
  1093. List<CEventLogData> LEventLog = new List<CEventLogData>();
  1094. string[] m_str_columns = {
  1095. "No.",
  1096. "발생시간",
  1097. "발생위치",
  1098. "장치명",
  1099. "타입",
  1100. "회로번호",
  1101. "상태"
  1102. };
  1103. private void SetColumns()
  1104. { // generate datagridview columns data
  1105. this.dataGridView1.Columns.Clear();
  1106. DataGridViewColumn[] col = new DataGridViewColumn[m_str_columns.Length];
  1107. for (int i = 0; i < m_str_columns.Length; i++)
  1108. {
  1109. col[i] = new DataGridViewColumn();
  1110. col[i].DataPropertyName = string.Format("{0}", i);
  1111. col[i].Name = m_str_columns[i];
  1112. col[i].CellTemplate = new DataGridViewTextBoxCell();
  1113. dataGridView1.Columns.Add(col[i]);
  1114. }
  1115. // cyim 2013.8.8 이벤트 타입명 해쉬테이블로 변환 : 콤보박스에는 별도로 직접 추가한다
  1116. this.comboBoxEventType.Items.Clear();
  1117. foreach (CEventType eventtpe in this.LEventType)
  1118. {
  1119. this.comboBoxEventType.Items.Add(eventtpe.eventTypeName);
  1120. }
  1121. // cyim 2013.8.13 과거이력 및 현재이력 세부검색시 콤보박스 정렬 및 루틴조절
  1122. this.comboBoxEventType.Sorted = true;
  1123. // cyim 2013.8.12 콤보박스 인덱스 조절 루틴 제거
  1124. //_EventTypeName.Combobox_Init_by_EventTypeName(this.comboBoxEventType);
  1125. // cyim 2013.8.8 세부검색 체크시 ShutDown
  1126. if (this.comboBoxEventType.Items.Count != 0) this.comboBoxEventType.SelectedIndex = 0;
  1127. }
  1128. public class CEventType
  1129. {//EVENT_TYPE,EVENT_TYPE_NAME // event type class
  1130. public string eventType = "";
  1131. public string eventTypeName = "";
  1132. }
  1133. List<CEventType> LEventType = new List<CEventType>();
  1134. string GetEvnetTypeName(string type)
  1135. { //get event type name
  1136. string ret = "";
  1137. foreach (CEventType eventType in LEventType)
  1138. {
  1139. if (eventType.eventType == type)
  1140. {
  1141. ret = eventType.eventTypeName;
  1142. break;
  1143. }
  1144. }
  1145. return ret;
  1146. }
  1147. void GetEventTypeDB()
  1148. { // get event type data from DB
  1149. try
  1150. {
  1151. DacUIProcess dacUIProcess = new DacUIProcess(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
  1152. DataTable DBLoacalEventType = dacUIProcess.Event_Type_Select(null, mdi); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1153. if (DBLoacalEventType != null)
  1154. {
  1155. this.LEventType.Clear();
  1156. foreach (DataRow dr in DBLoacalEventType.Rows)
  1157. {
  1158. CEventType eventType = new CEventType();
  1159. eventType.eventType = dr["EVENT_TYPE"].ToString();
  1160. eventType.eventTypeName = dr["EVENT_TYPE_NAME"].ToString();
  1161. this.LEventType.Add(eventType);
  1162. }
  1163. }
  1164. }
  1165. catch (Exception e)
  1166. {
  1167. Util.UErrorMessage(e, 0, 0);
  1168. }
  1169. }
  1170. void GridSize()
  1171. { // set datagridview control size
  1172. //dataGridView1.Location = new Point(0, 120);
  1173. //dataGridView1.Height = this.Height - 150 - (this.panel2.Visible ? this.panel2.Height : 0);
  1174. //dataGridView1.Width = this.Width - 20;
  1175. // cyim 2013.9.24 : 팝업창 출력하는 동안 다른폼을 여는 경우 죽는 문제 발생 수정
  1176. try
  1177. {
  1178. if (dataGridView1.Columns.Count > 0) // cyim 2015.9.10 과거내역 조회시 예외처리
  1179. {
  1180. dataGridView1.Columns[0].Width = 50;
  1181. dataGridView1.Columns[1].Width = 160;
  1182. dataGridView1.Columns[2].Width = 180;
  1183. dataGridView1.Columns[4].Width = 200;
  1184. dataGridView1.Columns[5].Width = 180;
  1185. dataGridView1.Columns[6].Width = 50;
  1186. int sum = 0;
  1187. for (int i = 0; i < m_str_columns.Length; i++)
  1188. {
  1189. sum += dataGridView1.Columns[i].Width;
  1190. }
  1191. sum -= dataGridView1.Columns[3].Width;
  1192. dataGridView1.Columns[3].Width = dataGridView1.Width - sum - 5;
  1193. }
  1194. }
  1195. catch (Exception ex)
  1196. {
  1197. Util.UErrorMessage(ex, 0, 0);
  1198. }
  1199. }
  1200. private void LogViewFrm_Resize(object sender, EventArgs e)
  1201. {
  1202. GridSize();
  1203. }
  1204. bool eventTypeDetail = false;
  1205. string eventTypeD = "";
  1206. bool fireOn = false;
  1207. //bool fireOff = false;
  1208. bool devOn = false;
  1209. //bool devOff = false;
  1210. //bool errorOn = false;
  1211. //bool errorOff = false;
  1212. bool controlLog = false;
  1213. bool boardError = false;
  1214. bool repeaterError = false;
  1215. bool devError = false;
  1216. // 콤보박스가 정렬되면서 이벤트명을 토대로 타입을 조회한다
  1217. private string Get_Combobox_Type(string TypeName)
  1218. {
  1219. foreach (CEventType tempType in this.LEventType)
  1220. {
  1221. if (tempType.eventTypeName == TypeName)
  1222. return tempType.eventType;
  1223. }
  1224. return "";
  1225. }
  1226. // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
  1227. public delegate void Update_Live_Display();
  1228. public void _Event_FormLogView_Update_SendMessage_Event()
  1229. {
  1230. // 현재이력만 업데이트 (네트워크 통신 상태는 데이타베이스에 로그로 남지 않는다, 오로지 현재이력에서만 존재한다)
  1231. if (this.live_flag == true)
  1232. {
  1233. if (this.InvokeRequired)
  1234. {
  1235. Update_Live_Display d = new Update_Live_Display(_Event_FormLogView_Update_SendMessage_Event);
  1236. this.Invoke(d, new object[] { });
  1237. }
  1238. else
  1239. {
  1240. //GetLogLiveData();
  1241. LockLiveData();
  1242. }
  1243. }
  1244. }
  1245. //
  1246. // 현재이력조회
  1247. //
  1248. // 크리티컬 섹션
  1249. public object lockObject = new object();
  1250. public void LockLiveData()
  1251. {
  1252. lock (lockObject)
  1253. {
  1254. GetLogLiveData();
  1255. }
  1256. }
  1257. private void GetLogLiveData()
  1258. {
  1259. // get live log data from main log
  1260. //Util.UDebugMessage(string.Format("+GetLogLiveData"), 0, 0);
  1261. LEventLog.Clear();
  1262. // cyim 2013.11.19 : 현재이력보기 깜빡임 : 코드삭제
  1263. // cyim 2013.11.14 : 현재이력보기 데이타 초기화
  1264. //dataGridView1.Rows.Clear();
  1265. //dataGridView1.Update();
  1266. this.findTime = this.radioButtonSelectDate.Checked;
  1267. if (this.findTime)
  1268. {
  1269. this.findStartTime = new DateTime(this.dateTimePicker_StartDate.Value.Year, this.dateTimePicker_StartDate.Value.Month, this.dateTimePicker_StartDate.Value.Day,
  1270. this.dateTimePicker_StartTime.Value.Hour, this.dateTimePicker_StartTime.Value.Minute, this.dateTimePicker_StartTime.Value.Second);
  1271. this.findEndTime = new DateTime(this.dateTimePicker_EndDate.Value.Year, this.dateTimePicker_EndDate.Value.Month, this.dateTimePicker_EndDate.Value.Day,
  1272. this.dateTimePicker_EndTime.Value.Hour, this.dateTimePicker_EndTime.Value.Minute, this.dateTimePicker_EndTime.Value.Second);
  1273. }
  1274. if (this.checkBoxSearchDetail.Checked)
  1275. {
  1276. eventTypeDetail = true;
  1277. // cyim 2013.8.8 세부검색 체크시 ShutDown
  1278. if (this.LEventType.Count != 0)
  1279. // cyim 2013.8.13 과거이력 및 현재이력 세부검색시 콤보박스 정렬 및 루틴조절
  1280. //eventTypeD = this.LEventType[this.comboBoxEventType.SelectedIndex].eventType;
  1281. eventTypeD = Get_Combobox_Type(this.comboBoxEventType.Text);
  1282. }
  1283. else
  1284. {
  1285. this.fireOn = this.checkBoxFireOn.Checked;
  1286. //fireOff = this.checkBoxFireOff.Checked;
  1287. this.devOn = this.checkBoxDevOn.Checked;
  1288. //devOff = this.checkBoxDevOff.Checked;
  1289. //this.errorOn = this.checkBoxErrorOn.Checked;
  1290. //errorOff = this.checkBoxErrorOff.Checked;
  1291. this.controlLog = this.checkBoxControlLog.Checked;
  1292. this.boardError = this.checkBoxBoardError.Checked;
  1293. this.repeaterError = this.checkBoxRepeaterError.Checked;
  1294. this.devError = this.checkBoxDevError.Checked;
  1295. }
  1296. findType.Clear();
  1297. if (eventTypeDetail)
  1298. {
  1299. // cyim 2013.8.8 세부검색 체크시 ShutDown
  1300. if (this.comboBoxEventType.Items.Count != 0 && this.comboBoxEventType.SelectedIndex > -1)
  1301. {
  1302. // cyim 2013.8.13 과거이력 및 현재이력 세부검색시 콤보박스 정렬 및 루틴조절
  1303. //findType.Add(this.comboBoxEventType.Items[this.comboBoxEventType.SelectedIndex].ToString());
  1304. findType.Add(this.comboBoxEventType.Text);
  1305. }
  1306. }
  1307. else if (this.checkBoxEventTypeAll.Checked)
  1308. {
  1309. findType.Add("전체");
  1310. }
  1311. else
  1312. {
  1313. if (this.checkBoxFireOn.Checked)
  1314. {
  1315. findType.Add("화재발생");
  1316. }
  1317. if (this.checkBoxFireOff.Checked)
  1318. {
  1319. findType.Add("화재해제");
  1320. }
  1321. if (this.checkBoxDevOn.Checked)
  1322. {
  1323. findType.Add("설비작동");
  1324. }
  1325. if (this.checkBoxDevOff.Checked)
  1326. {
  1327. findType.Add("설비정지");
  1328. }
  1329. if (this.checkBoxErrorOn.Checked)
  1330. {
  1331. findType.Add("이상발생");
  1332. }
  1333. if (this.checkBoxErrorOff.Checked)
  1334. {
  1335. findType.Add("이상해제");
  1336. }
  1337. if (this.checkBoxControlLog.Checked)
  1338. {
  1339. findType.Add("운영");
  1340. }
  1341. }
  1342. bool pCondition = false;
  1343. int boardID = -1;
  1344. int loopNo = -1;
  1345. if (this.comboBoxBoard.SelectedIndex > 0)
  1346. {
  1347. pCondition = true;
  1348. //int receiverID = this.mdi.myReceiverID;
  1349. if (this.comboBoxBoard.SelectedIndex == this.LComboBoxBoard.Count - 1)
  1350. {
  1351. }
  1352. else
  1353. {
  1354. boardID = this.LComboBoxBoard[this.comboBoxBoard.SelectedIndex].boardID;
  1355. loopNo = this.LComboBoxBoard[this.comboBoxBoard.SelectedIndex].loopNo;
  1356. }
  1357. }
  1358. // cyim 2013.11.19 : 현재이력보기 깜빡임 : 코드삭제
  1359. // cyim 2013.9.26 : 과거이력 및 현재이력 보완( 데이타가 없다면 진행안함)
  1360. //if (this.eventLogInfos == null || this.eventLogInfos.Count == 0)
  1361. //{
  1362. // // cyim 2013.11.14 : 현재이력보기 데이타없음 경고창 제거
  1363. // // MessageBox.Show("데이타가 없습니다");
  1364. // dataGridView1.Rows.Clear();
  1365. // dataGridView1.Update();
  1366. // return;
  1367. //}
  1368. // cyim 2015.7.6 속도개선작업
  1369. // 해쉬 리스트 구현 방법은 아래와 같다
  1370. // 키 : ReceiverID-CommId-BoardNo-LoopNo-RepeaterNo-DeviceId-InoutType-EventType
  1371. // 데이타 : EventLogInfo 클래스
  1372. // cyim 2016.12.06 : 이벤트 로그 해쉬테이블을 복사본으로 현재내역 조회하도록 함
  1373. Hashtable eventLogInfos_temp = (Hashtable)eventLogInfos.Clone();
  1374. if (eventLogInfos_temp != null && eventLogInfos_temp.Count != 0)
  1375. {
  1376. // lch 수정(19.01.18)
  1377. Hashtable SortedEventLog = new Hashtable();
  1378. foreach (DictionaryEntry d in eventLogInfos_temp)
  1379. {
  1380. EventLogInfo TempeventLogMsg = (EventLogInfo)d.Value;
  1381. if (SortedEventLog.ContainsKey(TempeventLogMsg.EventTime.ToString())) // 있다
  1382. {
  1383. ArrayList Temp_ArrayList = (ArrayList)SortedEventLog[TempeventLogMsg.EventTime.ToString()];
  1384. Temp_ArrayList.Add(d.Key);
  1385. SortedEventLog[TempeventLogMsg.EventTime.ToString()] = Temp_ArrayList;
  1386. }
  1387. else // 없다
  1388. {
  1389. // 에레이를 만들자
  1390. ArrayList Temp_ArrayList = new ArrayList();
  1391. Temp_ArrayList.Add(d.Key);
  1392. SortedEventLog.Add(TempeventLogMsg.EventTime.ToString(), Temp_ArrayList);
  1393. }
  1394. }
  1395. ArrayList sorter = new ArrayList(SortedEventLog.Keys);
  1396. sorter.Sort(); // 소팅
  1397. sorter.Reverse(); // 소팅을 반대로
  1398. ArrayList EventLog = new ArrayList();
  1399. for (int i = 0; i < sorter.Count; i++)
  1400. {
  1401. ArrayList Temp_ArrayList = (ArrayList)SortedEventLog[sorter[i]];
  1402. for (int j = 0; j < Temp_ArrayList.Count; j++)
  1403. {
  1404. EventLog.Add(Temp_ArrayList[j]); // 반대 날짜로 돌려서 전체 순서를 만든다
  1405. }
  1406. }
  1407. for (int i = 0; i < EventLog.Count; i++)
  1408. {
  1409. EventLogInfo eventLogMsg = (EventLogInfo)eventLogInfos_temp[EventLog[i]];
  1410. //EventLogInfo eventLogMsg = (EventLogInfo)this.eventLogInfos[i];
  1411. if (eventLogMsg.LiveMsgFlag)
  1412. {
  1413. bool add = true;
  1414. if (this.findTime)
  1415. {
  1416. if (eventLogMsg.EventTime > this.findStartTime && eventLogMsg.EventTime < this.findEndTime)
  1417. {
  1418. add = true;
  1419. }
  1420. else
  1421. {
  1422. add = false;
  1423. }
  1424. }
  1425. if (add)
  1426. {
  1427. if (pCondition)
  1428. {
  1429. add = false;
  1430. if (boardID > 0)
  1431. {
  1432. if (eventLogMsg.BoardNo == boardID && eventLogMsg.LoopNo == loopNo)
  1433. {
  1434. add = true;
  1435. }
  1436. }
  1437. else
  1438. {
  1439. if (eventLogMsg.EventType != "OM" && eventLogMsg.EventType != "EM" && eventLogMsg.EventType != "OR"
  1440. && eventLogMsg.EventType != "XR" && eventLogMsg.EventType != "OL" && eventLogMsg.EventType != "XL"
  1441. && eventLogMsg.EventType != "FA" && eventLogMsg.EventType != "FN" // cyim 2015.7.9 아날로그 감지기 단선 상태가 리스트에 표시되지 않는 문제
  1442. && eventLogMsg.EventType != "OA" && eventLogMsg.EventType != "XA" && eventLogMsg.EventType != "OF"
  1443. && eventLogMsg.EventType != "WA" && eventLogMsg.EventType != "WN" // cyim 2015.7.9 PreFire 표시 문제
  1444. && eventLogMsg.EventType != "XF" && eventLogMsg.EventType != "OE" && eventLogMsg.EventType != "XE"
  1445. && eventLogMsg.EventType != "XX" && eventLogMsg.EventType != "OX" && eventLogMsg.EventType != "BN"
  1446. && eventLogMsg.EventType != "BA" && eventLogMsg.EventType != "BR")
  1447. {
  1448. add = true;
  1449. }
  1450. }
  1451. }
  1452. }
  1453. if (add)
  1454. {
  1455. add = false;
  1456. if (eventTypeDetail)
  1457. {
  1458. if (eventLogMsg.EventType == eventTypeD)
  1459. {
  1460. add = true;
  1461. }
  1462. }
  1463. else
  1464. {
  1465. if (fireOn)
  1466. {
  1467. if (eventLogMsg.EventType == "OA" || eventLogMsg.EventType == "OF" || eventLogMsg.EventType == "OT" || eventLogMsg.EventType == "WA") // cyim 2015.7.9 PreFire 표시 문제
  1468. {
  1469. add = true;
  1470. }
  1471. }
  1472. //if (fireOff) {
  1473. // if (eventLogMsg.EventType == "XA" || eventLogMsg.EventType == "XF" || eventLogMsg.EventType == "XT") {
  1474. // add = true;
  1475. // }
  1476. //}
  1477. if (devOn)
  1478. {
  1479. if (eventLogMsg.EventType == "OE")
  1480. {
  1481. add = true;
  1482. }
  1483. }
  1484. //if (devOff) {
  1485. // if (eventLogMsg.EventType == "XE") {
  1486. // add = true;
  1487. // }
  1488. //}
  1489. //if (errorOn) {
  1490. // if (eventLogMsg.EventType == "XM" || eventLogMsg.EventType == "XR" || eventLogMsg.EventType == "XI"
  1491. // || eventLogMsg.EventType == "XK" || eventLogMsg.EventType == "OL" || eventLogMsg.EventType == "AV"
  1492. // || eventLogMsg.EventType == "AR" || eventLogMsg.EventType == "AA" || eventLogMsg.EventType == "OD"
  1493. // || eventLogMsg.EventType == "OB" || eventLogMsg.EventType == "OX" || eventLogMsg.EventType == "BA"
  1494. // || eventLogMsg.EventType == "BR" || eventLogMsg.EventType == "XC" ) {
  1495. // add = true;
  1496. // }
  1497. //}
  1498. //if (errorOff) {
  1499. // if (eventLogMsg.EventType == "OM" || eventLogMsg.EventType == "OR" || eventLogMsg.EventType == "OI"
  1500. // || eventLogMsg.EventType == "OK" || eventLogMsg.EventType == "XL" || eventLogMsg.EventType == "NV"
  1501. // || eventLogMsg.EventType == "NR" || eventLogMsg.EventType == "NA" || eventLogMsg.EventType == "XD"
  1502. // || eventLogMsg.EventType == "XB" || eventLogMsg.EventType == "XX" || eventLogMsg.EventType == "BN"
  1503. // || eventLogMsg.EventType == "OC") {
  1504. // add = true;
  1505. // }
  1506. //}
  1507. if (controlLog)
  1508. {
  1509. if (eventLogMsg.EventType == "OP" || eventLogMsg.EventType == "XP" || eventLogMsg.EventType == "SP"
  1510. || eventLogMsg.EventType == "MS" || eventLogMsg.EventType == "LS" || eventLogMsg.EventType == "EB"
  1511. || eventLogMsg.EventType == "RP" || eventLogMsg.EventType == "FR" || eventLogMsg.EventType == "EC"
  1512. || eventLogMsg.EventType == "PO" || eventLogMsg.EventType == "PF" || eventLogMsg.EventType == "CC"
  1513. || eventLogMsg.EventType == "CV" || eventLogMsg.EventType == "V2" || eventLogMsg.EventType == "DC"
  1514. || eventLogMsg.EventType == "CS" || eventLogMsg.EventType == "TK" || eventLogMsg.EventType == "VI"
  1515. || eventLogMsg.EventType == "BF" || eventLogMsg.EventType == "EL" || eventLogMsg.EventType == "BS"
  1516. || eventLogMsg.EventType == "RA" || eventLogMsg.EventType == "OU" || eventLogMsg.EventType == "XU"
  1517. || eventLogMsg.EventType == "DS" || eventLogMsg.EventType == "ED" // cyim 2016.12.09 : IFC3300에서는 예비전원버튼 -> 설비전체연동조작버튼
  1518. )
  1519. {
  1520. add = true;
  1521. }
  1522. }
  1523. if (boardError)
  1524. {
  1525. if (eventLogMsg.EventType == "XM" || eventLogMsg.EventType == "XI" || eventLogMsg.EventType == "XK"
  1526. || eventLogMsg.EventType == "AV" || eventLogMsg.EventType == "AR" || eventLogMsg.EventType == "AA"
  1527. || eventLogMsg.EventType == "OD" || eventLogMsg.EventType == "OB" || eventLogMsg.EventType == "BA"
  1528. || eventLogMsg.EventType == "BR" || eventLogMsg.EventType == "XC"
  1529. || eventLogMsg.EventType == "OM" || eventLogMsg.EventType == "OI" || eventLogMsg.EventType == "OK"
  1530. || eventLogMsg.EventType == "NV" || eventLogMsg.EventType == "NR" || eventLogMsg.EventType == "NA"
  1531. || eventLogMsg.EventType == "XD" || eventLogMsg.EventType == "XB" || eventLogMsg.EventType == "BN"
  1532. || eventLogMsg.EventType == "OC")
  1533. {
  1534. add = true;
  1535. }
  1536. }
  1537. if (repeaterError)
  1538. {
  1539. if (eventLogMsg.EventType == "XR" || eventLogMsg.EventType == "XO"
  1540. || eventLogMsg.EventType == "OX" || eventLogMsg.EventType == "XX")
  1541. {
  1542. add = true;
  1543. }
  1544. }
  1545. if (devError)
  1546. {
  1547. if (eventLogMsg.EventType == "OL" || eventLogMsg.EventType == "XL"
  1548. || eventLogMsg.EventType == "FA" || eventLogMsg.EventType == "FN" // cyim 2015.7.9 아날로그 감지기 단선 상태가 리스트에 표시되지 않는 문제
  1549. )
  1550. {
  1551. add = true;
  1552. }
  1553. }
  1554. }
  1555. }
  1556. if (add)
  1557. {
  1558. //string time = string.Format("{0:D4}{1:D2}{2:D2}{3:D2}{4:D2}{5:D2}", eventLogMsg.EventTime.Year, eventLogMsg.EventTime.Month, eventLogMsg.EventTime.Day,
  1559. //eventLogMsg.EventTime.Hour, eventLogMsg.EventTime.Minute, eventLogMsg.EventTime.Second);
  1560. //CEventLogData elog = new CEventLogData(eventLogMsg.EventId, time, eventLogMsg.EventType, this.mdi.myReceiverID,
  1561. // eventLogMsg.CommId, eventLogMsg.BoardNo, eventLogMsg.LoopNo,
  1562. // eventLogMsg.RepeaterNo, eventLogMsg.DeviceId, eventLogMsg.InoutType, 0, "");
  1563. CEventLogData elog = new CEventLogData(eventLogMsg);
  1564. elog.eventTypeName = eventLogMsg.EventTypeName;
  1565. elog.devicePosition = this.GetDevicePositionName(elog); // 수정(lch_13.08.26) 주석 취소, 이유 : 이벤트를 출력해 보면 발생위치와 장치명이 UI에서 보이는 만큼(25개)만 보여서 전체 다 보여주려고 수정
  1566. elog.deviceName = this.GetDeviceName(elog); // 수정(lch_13.08.26) 주석 취소, 이유 : 이벤트를 출력해 보면 발생위치와 장치명이 UI에서 보이는 만큼(25개)만 보여서 전체 다 보여주려고 수정
  1567. //elog.deviceName = this.mdi.GetDeviceName(eventLogMsg.BoardNo, eventLogMsg.LoopNo, eventLogMsg.RepeaterNo
  1568. // eventLogMsg.DeviceId, eventLogMsg.InoutType);
  1569. //elog.deviceName = this.GetDeviceName(elog);
  1570. //
  1571. // cyim 2015.9.23 프린트 정보와 일치하도록 수정
  1572. //
  1573. // 회로번호
  1574. string temp_Report_EventPostion = "";
  1575. if (elog.EventPositon == null
  1576. || elog.EventPositon.Length == 0
  1577. || elog.ioType == "M"
  1578. || elog.EventPositon.Contains("수신기") == true)
  1579. temp_Report_EventPostion = "없음"; // 만약 수신기 자체 혹은 타수신기 정보라면 회로번호 정보는 표시하지 않는다
  1580. else temp_Report_EventPostion = elog.EventPositon;
  1581. // cyim 2016.01.07 아날로그 감지기 이력 조회시 표시 수정
  1582. string RepeaterType = mdi.GetRepeaterType(elog.boardID, elog.loopNO, elog.repeaterID);
  1583. // '1' = A : 2X2
  1584. // '2' = B : 4X4
  1585. // '4' = C : 아날로그연감지기
  1586. // '5' = D : 아날로그열감지기
  1587. if (RepeaterType == "4" || RepeaterType == "5")
  1588. {
  1589. elog.eventTypeName = elog.eventTypeName.Replace("중계기", "감지기"); // 타입
  1590. temp_Report_EventPostion = temp_Report_EventPostion.Replace("중계기", "감지기"); // 회로번호
  1591. }
  1592. elog.Report_EventPositon = temp_Report_EventPostion;
  1593. // 차단 기능의 경우 특별히 상태값을 알수가 없어서 Remark 정보를 추출해야한다
  1594. if (elog.eventType == "DC")
  1595. {
  1596. string temp = GetRemarkInfo(elog.eventRemark, "STATUS");
  1597. if (temp == "INACTIVE") // 차단 해제
  1598. elog.Report_EventErrorStatus = 0;
  1599. else // 차단 조작
  1600. elog.Report_EventErrorStatus = 2;
  1601. }
  1602. // cyim 2015.9.23 키패드조작에서 발생한 이벤트의 경우 조작과 해제로 구분하여 표시
  1603. // 차단 기능과 마찬가지로 특별히 상태값을 알수가 없어서 Remark 정보를 추출해야한다
  1604. else if (elog.eventType == "MS"
  1605. || elog.eventType == "LS"
  1606. || elog.eventType == "EB"
  1607. || elog.eventType == "RP"
  1608. || elog.eventType == "BF"
  1609. || elog.eventType == "ED" // cyim 2016.12.09 : IFC3300에서는 예비전원버튼 -> 설비전체연동조작버튼
  1610. )
  1611. {
  1612. // KEY PAD MAIN SOUND STOP BUTTON! (OFF)
  1613. string temp = elog.eventRemark;
  1614. int idx1 = temp.LastIndexOf('(');
  1615. int idx2 = temp.LastIndexOf(')');
  1616. string temp1 = temp.Substring(idx1);
  1617. temp1 = temp1.Replace(")", "");
  1618. temp1 = temp1.Replace("(", "");
  1619. if (temp1 == "ON") // 조작
  1620. elog.Report_EventErrorStatus = 0;
  1621. else // 해제
  1622. elog.Report_EventErrorStatus = 2;
  1623. }
  1624. // 상위 루틴과 관련없으면 그대로 레포트를 위한 변수에 저장한다
  1625. else
  1626. elog.Report_EventErrorStatus = elog.EventErrorStatus;
  1627. // cyim 2013.9.26 : 과거이력 및 현재이력 보완 : 필터링
  1628. if (this.checkBoxSearchDetail.Checked == false)
  1629. {
  1630. // cyim 2013.10.2 : 발생위치 필터링 기능 추가
  1631. switch (FilterMode)
  1632. {
  1633. // cyim 2013.11.19 : 현재이력보기 깜빡임 : 데이타가 없으면 처리못함 (이전에는 무조건 디바이스명을 비교하도록 되어있었음, 하단루틴자체에서 문제가 발생함)
  1634. case DB_Result_Filter.None:
  1635. LEventLog.Add(elog);
  1636. break;
  1637. case DB_Result_Filter.AND:
  1638. if (elog.deviceName != null && elog.deviceName.Length != 0)
  1639. if (elog.deviceName.Contains(FilterMode_Device) == true && elog.devicePosition.Contains(FilterMode_Position) == true)
  1640. LEventLog.Add(elog);
  1641. break;
  1642. case DB_Result_Filter.Device:
  1643. if (elog.deviceName != null && elog.deviceName.Length != 0)
  1644. if (elog.deviceName.Contains(FilterMode_Device) == true)
  1645. LEventLog.Add(elog);
  1646. break;
  1647. case DB_Result_Filter.Positon:
  1648. if (elog.deviceName != null && elog.deviceName.Length != 0)
  1649. if (elog.devicePosition.Contains(FilterMode_Position) == true)
  1650. LEventLog.Add(elog);
  1651. break;
  1652. }
  1653. }
  1654. else
  1655. {
  1656. LEventLog.Add(elog);
  1657. }
  1658. }
  1659. }
  1660. }
  1661. }
  1662. dataGridView1.Update();
  1663. dataGridView1.Rows.Clear();
  1664. //Util.UDebugMessage(string.Format("+DataUpdate"), 0, 0);
  1665. DataUpdate();
  1666. //
  1667. // cyim 2014.8.8 통신점검 시나리오 신규 작업 (네트워크 수신기의 통신 상태)
  1668. //
  1669. // 현재이력조회는 항상 리스트를 갱신하면서 보기 때문에 삭제를 생각하지 않아도 된다. 아래와 같이 상태가 변하면 어차피 리스트에 추가하지 않는다
  1670. if (mdi.MonitorDaemon_Enable == true && mdi.MonitorDaemon_IP != null && mdi.MonitorDaemon_IP.Length != 0)
  1671. {
  1672. // 현재이력조회시 모니터데몬에 접속이 안되는 경우
  1673. if (mdi.MonitorDaemon_ComStatus == false)
  1674. {
  1675. Temp_Log_Add_By_MonitorDaemonComErr(null);
  1676. }
  1677. else
  1678. {
  1679. try // cyim 2015.10.23 보완 코드 추가
  1680. {
  1681. // cyim 2014.8.12 네트워크 수신기 통신상태 문제 수정 (해쉬테이블은 DirectionEntry 를 이용하여 데이타를 추출하면 중간에 그 데이타가 변경되면 오류 발생됨)
  1682. // 현재이력조회시 타수신기통신상태가 이상인 경우
  1683. foreach (string ReceiverID in mdi.NetworkReceiver_ID_List) // cyim 2014.8.11 : 해쉬테이블에서 곧바로 처리하지않게 바꿈
  1684. {
  1685. if ((bool)mdi.NetworkReceiver_ID_ComStatus[ReceiverID] == false)
  1686. Temp_Log_Add_By_MonitorDaemonComErr(ReceiverID);
  1687. }
  1688. }
  1689. catch { }
  1690. }
  1691. }
  1692. //Util.UDebugMessage(string.Format("+DataUpdate"), 0, 0);
  1693. dataGridView1.Update();
  1694. this.GridPage = 1;
  1695. this.PageBtnMake(LEventLog.Count, 1);
  1696. this.labelPage.Text = string.Format("검색결과: {0}건 ", LEventLog.Count);
  1697. //this.dataGridView1.Rows.Add();
  1698. //Util.UDebugMessage(string.Format("-GetLogLiveData"), 0, 0);
  1699. }
  1700. //
  1701. // 과거이력조회
  1702. //
  1703. private void GetLogDBData()
  1704. { // get live log data from DB log
  1705. LEventLog.Clear();
  1706. this.findTime = this.radioButtonSelectDate.Checked;
  1707. if (this.findTime)
  1708. {
  1709. this.findStartTime = new DateTime(this.dateTimePicker_StartDate.Value.Year, this.dateTimePicker_StartDate.Value.Month, this.dateTimePicker_StartDate.Value.Day,
  1710. this.dateTimePicker_StartTime.Value.Hour, this.dateTimePicker_StartTime.Value.Minute, this.dateTimePicker_StartTime.Value.Second);
  1711. this.findEndTime = new DateTime(this.dateTimePicker_EndDate.Value.Year, this.dateTimePicker_EndDate.Value.Month, this.dateTimePicker_EndDate.Value.Day,
  1712. this.dateTimePicker_EndTime.Value.Hour, this.dateTimePicker_EndTime.Value.Minute, this.dateTimePicker_EndTime.Value.Second);
  1713. }
  1714. if (this.checkBoxSearchDetail.Checked)
  1715. {
  1716. eventTypeDetail = true;
  1717. // cyim 2013.8.8 세부검색 체크시 ShutDown
  1718. if (this.LEventType.Count != 0)
  1719. {
  1720. // cyim 2013.8.13 과거이력 및 현재이력 세부검색시 콤보박스 정렬 및 루틴조절
  1721. //eventTypeD = this.LEventType[this.comboBoxEventType.SelectedIndex].eventType;
  1722. eventTypeD = Get_Combobox_Type(this.comboBoxEventType.Text);
  1723. }
  1724. }
  1725. else
  1726. {
  1727. this.fireOn = this.checkBoxFireOn.Checked;
  1728. //fireOff = this.checkBoxFireOff.Checked;
  1729. this.devOn = this.checkBoxDevOn.Checked;
  1730. //devOff = this.checkBoxDevOff.Checked;
  1731. //this.errorOn = this.checkBoxErrorOn.Checked;
  1732. //errorOff = this.checkBoxErrorOff.Checked;
  1733. this.controlLog = this.checkBoxControlLog.Checked;
  1734. this.boardError = this.checkBoxBoardError.Checked;
  1735. this.repeaterError = this.checkBoxRepeaterError.Checked;
  1736. this.devError = this.checkBoxDevError.Checked;
  1737. }
  1738. findType.Clear();
  1739. if (eventTypeDetail)
  1740. {
  1741. // cyim 2013.8.13 과거이력 및 현재이력 세부검색시 콤보박스 정렬 및 루틴조절
  1742. //findType.Add(this.comboBoxEventType.Items[this.comboBoxEventType.SelectedIndex].ToString());
  1743. findType.Add(this.comboBoxEventType.Text);
  1744. }
  1745. else if (this.checkBoxEventTypeAll.Checked)
  1746. {
  1747. findType.Add("전체");
  1748. }
  1749. else
  1750. {
  1751. if (this.checkBoxFireOn.Checked)
  1752. {
  1753. findType.Add("화재발생");
  1754. }
  1755. //if (this.checkBoxFireOff.Checked) {
  1756. // findType.Add("화재해제");
  1757. //}
  1758. if (this.checkBoxDevOn.Checked)
  1759. {
  1760. findType.Add("설비작동");
  1761. }
  1762. //if (this.checkBoxDevOff.Checked) {
  1763. // findType.Add("설비정지");
  1764. //}
  1765. //if (this.checkBoxErrorOn.Checked) {
  1766. // findType.Add("이상발생");
  1767. //}
  1768. //if (this.checkBoxErrorOff.Checked) {
  1769. // findType.Add("이상해제");
  1770. //}
  1771. if (this.checkBoxControlLog.Checked)
  1772. {
  1773. findType.Add("운영");
  1774. }
  1775. if (this.checkBoxBoardError.Checked)
  1776. {
  1777. findType.Add("보드 이상");
  1778. }
  1779. if (this.checkBoxRepeaterError.Checked)
  1780. {
  1781. findType.Add("중계기 이상");
  1782. }
  1783. if (this.checkBoxDevError.Checked)
  1784. {
  1785. findType.Add("회로 단선");
  1786. }
  1787. }
  1788. LogType logType = new LogType();
  1789. if (this.comboBoxBoard.SelectedIndex > 0)
  1790. {
  1791. logType.location = true;
  1792. logType.receiverID = this.mdi.myReceiverID;
  1793. if (this.comboBoxBoard.SelectedIndex == this.LComboBoxBoard.Count - 1)
  1794. {
  1795. logType.ioType = "E";
  1796. }
  1797. else
  1798. {
  1799. logType.boardID = this.LComboBoxBoard[this.comboBoxBoard.SelectedIndex].boardID;
  1800. logType.loopNo = this.LComboBoxBoard[this.comboBoxBoard.SelectedIndex].loopNo;
  1801. }
  1802. }
  1803. logType.time = this.radioButtonSelectDate.Checked;
  1804. if (logType.time)
  1805. {
  1806. logType.startTime = new DateTime(this.dateTimePicker_StartDate.Value.Year, this.dateTimePicker_StartDate.Value.Month, this.dateTimePicker_StartDate.Value.Day,
  1807. this.dateTimePicker_StartTime.Value.Hour, this.dateTimePicker_StartTime.Value.Minute, this.dateTimePicker_StartTime.Value.Second);
  1808. logType.endTime = new DateTime(this.dateTimePicker_EndDate.Value.Year, this.dateTimePicker_EndDate.Value.Month, this.dateTimePicker_EndDate.Value.Day,
  1809. this.dateTimePicker_EndTime.Value.Hour, this.dateTimePicker_EndTime.Value.Minute, this.dateTimePicker_EndTime.Value.Second);
  1810. }
  1811. if (this.checkBoxSearchDetail.Checked)
  1812. {
  1813. logType.eventTypeDetail = true;
  1814. // cyim 2013.8.8 세부검색 체크시 ShutDown
  1815. if (this.LEventType.Count != 0)
  1816. {
  1817. // cyim 2013.8.13 과거이력 및 현재이력 세부검색시 콤보박스 정렬 및 루틴조절
  1818. //logType.eventTypeD = this.LEventType[this.comboBoxEventType.SelectedIndex].eventType;
  1819. logType.eventTypeD = Get_Combobox_Type(this.comboBoxEventType.Text);
  1820. }
  1821. }
  1822. else
  1823. {
  1824. logType.fireOn = this.checkBoxFireOn.Checked;
  1825. logType.devOn = this.checkBoxDevOn.Checked;
  1826. logType.controlLog = this.checkBoxControlLog.Checked;
  1827. logType.boardError = this.checkBoxBoardError.Checked;
  1828. logType.repeaterError = this.checkBoxRepeaterError.Checked;
  1829. logType.devError = this.checkBoxDevError.Checked;
  1830. }
  1831. // 기존 이벤트 로그를 지운다.
  1832. LEventLog.Clear();
  1833. // UIProcess DB를 읽는다.
  1834. DacUIProcess dacUIProcess = new DacUIProcess(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
  1835. // cyim 2013.9.17 데이타베이스 조회 컨셉변경
  1836. // 맨처음 개수를 조회한다
  1837. DataTable Temp_dt;
  1838. //if (logType.eventTypeD == "OU" || logType.eventTypeD == "XU" || logType.eventTypeD == "OD" || logType.eventTypeD == "XD" || logType.eventTypeD == "LG")
  1839. //{//프로그램 시작 || 프로그램 종료 || 데몬이상 || 데몬정상 || 수신기 조작 로그
  1840. //Temp_dt = dacUIProcess.SelectSQL(logType.Get_COMMANDLogDB_Count(logType.startTime, logType.endTime));
  1841. //}
  1842. //else
  1843. //{
  1844. Temp_dt = dacUIProcess.SelectSQL(logType.Get_EventLogDB_Count(logType.startTime, logType.endTime));
  1845. //}
  1846. DataRow Temp_dr = Temp_dt.Rows[0];
  1847. int AllCnt = Int32.Parse(Temp_dr[0].ToString());
  1848. // cyim 2013.9.26 : 과거이력 및 현재이력 보완( 데이타가 없다면 진행안함)
  1849. if (AllCnt == 0)
  1850. {
  1851. MessageBox.Show("데이타가 없습니다"); // 과거이력
  1852. return;
  1853. }
  1854. // 데이타가 존재하므로 위에서 가져온 데이타를 스레드에서 사용하기 위해 저장함
  1855. HistoryDisplay_LogType = logType;
  1856. DataTable dt = null;
  1857. // 데이타가 1000개가 넘지 않는다면 그대로 진행하되, 초과시에는 팝업창을 띄운다
  1858. if (AllCnt <= DB_Queary_CountLimit)
  1859. {
  1860. HistoryDisplay_Result = System.Windows.Forms.DialogResult.Yes;
  1861. // cyim 2013.10.10 : 1000건 조회 속도 개선 작업
  1862. Edit_Query_Time = false;
  1863. }
  1864. else
  1865. {
  1866. // 필터링 기능을 추가한다. 문제는 리스트에서 장치명에 해당하는 데이타가 없을수도 있으므로 사전에 공지를 한다
  1867. // 전체검색을 사용하고 필터링 기능을 사용하는 경우에만 해당한다
  1868. // cyim 2013.10.2 : 발생위치 필터링 기능 추가
  1869. if (this.checkBoxSearchDetail.Checked == false && FilterMode != DB_Result_Filter.None)
  1870. {
  1871. DialogResult result = MessageBox.Show(
  1872. "필터링기능을 사용합니다!! 조회된 결과중에 필터링하여 검색합니다! 기본 " + DB_Queary_CountLimit.ToString()
  1873. + "개 이하로 보시겠습니까? 예를 누르면 최근 데이타 순으로 " + DB_Queary_CountLimit.ToString()
  1874. + "개이하만 보여지고, 아니오를 누르면 모든 데이타를 (단, 시간이 오래걸릴수도 있음) 보여줍니다!",
  1875. "확인", MessageBoxButtons.YesNoCancel);
  1876. // 사용자가 취소하면 진행안함
  1877. if (result == System.Windows.Forms.DialogResult.Cancel)
  1878. return;
  1879. // cyim 2013.10.10 : 1000건 조회 속도 개선 작업
  1880. Edit_Query_Time = true;
  1881. // 사용자 선택값 저장
  1882. HistoryDisplay_Result = result;
  1883. }
  1884. else
  1885. {
  1886. DialogResult result = MessageBox.Show(
  1887. "기본 " + DB_Queary_CountLimit.ToString() + "개만 보시겠습니까? 예를 누르면 최근 데이타 순으로 " + DB_Queary_CountLimit.ToString()
  1888. + "개만 보여지고, 아니오를 누르면 모든 데이타를 (단, 시간이 오래걸릴수도 있음) 보여줍니다!",
  1889. "확인", MessageBoxButtons.YesNoCancel);
  1890. // 사용자가 취소하면 진행안함
  1891. if (result == System.Windows.Forms.DialogResult.Cancel)
  1892. return;
  1893. // cyim 2013.10.10 : 1000건 조회 속도 개선 작업
  1894. Edit_Query_Time = true;
  1895. // 사용자 선택값 저장
  1896. HistoryDisplay_Result = result;
  1897. }
  1898. }
  1899. // cyim 2013.9.23 팝업창 적용
  1900. mdi.Popup.CommonPopupShow(this); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1901. // cyim 2013.9.23 화면갱신코드 추가
  1902. this.Update();
  1903. // 스레드를 실행시키전에 이벤트를 등록해준다
  1904. this.Thread_End_Event += new Temp(Thread_HistoryDisplay_End);
  1905. // 스레드생성
  1906. thread = new Thread(new ParameterizedThreadStart(Start_Thread_HistoryDisplay));
  1907. // 스레드시작
  1908. thread.Start(dt);
  1909. }
  1910. //
  1911. // 데이타베이스 쿼리 기간 조절 (무조건 1000 개이상인 경우이므로 날짜를 조절해서 데이타량이 작은 테이블을 반환한다)
  1912. //
  1913. public DataTable Get_DB_EventLog_ByEditTime(LogType logType)
  1914. {
  1915. // UIProcess DB를 읽는다.
  1916. DacUIProcess dacUIProcess = new DacUIProcess(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
  1917. // 임시 결과
  1918. DataTable Temp_dt = null;
  1919. DateTime Temp_StartDate = logType.startTime;
  1920. DateTime Temp_EndDate = new DateTime(logType.startTime.Year, logType.startTime.Month, logType.startTime.Day, 23, 59, 59); // 주의 시작값은 시작날짜와 동일하고, 차츰 늘려간다
  1921. // lch(19.01.17) 주석 처리함 - 날짜를 바꾸면 안된다
  1922. //// 최적의 날짜를 구한다. 카운터 최대개수는 조회날짜의 차이일자
  1923. //while (true)
  1924. //{
  1925. // if (logType.startTime.Date.CompareTo(logType.endTime.Date) == 0)
  1926. // {
  1927. // // 동일한 날짜는 소용없다
  1928. // break;
  1929. // }
  1930. // else if(Temp_EndDate.Date.CompareTo(logType.endTime.Date) == 0)
  1931. // {
  1932. // // 하루씩 증가하다가 종료날짜에 도달하면 의미없으므로 루프가 종료됨
  1933. // break;
  1934. // }
  1935. // else
  1936. // {
  1937. // // 개수를 조회한다
  1938. // Temp_dt = dacUIProcess.SelectSQL(logType.Get_EventLogDB_Count(Temp_StartDate, Temp_EndDate));
  1939. // DataRow Temp_dr = Temp_dt.Rows[0];
  1940. // int AllCnt = Int32.Parse(Temp_dr[0].ToString());
  1941. // // 1000건 미만이라면 날짜를 변경하여 다시 조회하도록 한다
  1942. // if (AllCnt < DB_Queary_CountLimit)
  1943. // {
  1944. // Temp_EndDate = Temp_EndDate.AddDays(1);
  1945. // }
  1946. // else
  1947. // {
  1948. // // 1000건이 넘는 날짜에 도달하면 그대로 루프가 종료됨
  1949. // break;
  1950. // }
  1951. // }
  1952. //}
  1953. // 테이블을 반환한다
  1954. // 실제 1000건 조회됨
  1955. //Temp_dt = dacUIProcess.SelectSQL(HistoryDisplay_LogType.CreateSQL(DB_Queary_CountLimit, logType.startTime, Temp_EndDate)); // 주석 처리함
  1956. Temp_dt = dacUIProcess.SelectSQL(HistoryDisplay_LogType.CreateSQL(DB_Queary_CountLimit, logType.startTime, logType.endTime));
  1957. return Temp_dt;
  1958. }
  1959. //
  1960. // 스레드로 처리하기 위한 변수
  1961. //
  1962. LogType HistoryDisplay_LogType = null;
  1963. DialogResult HistoryDisplay_Result = DialogResult.Cancel;
  1964. // 과거내역 리스트로 표시하는 스레드
  1965. delegate void FormThread_HistoryDisplay(object Data);
  1966. public void Start_Thread_HistoryDisplay(object Data)
  1967. {
  1968. // cyim 2013.9.24 : 팝업창 출력하는 동안 다른폼을 여는 경우 죽는 문제 발생 수정
  1969. try
  1970. {
  1971. DataTable dt = null;
  1972. DacUIProcess dacUIProcess = new DacUIProcess(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
  1973. if (HistoryDisplay_Result == System.Windows.Forms.DialogResult.Yes)
  1974. {
  1975. // cyim 2013.10.10 : 1000건 조회 속도 개선 작업
  1976. // 쿼리자체기간내에 많은 데이타가 있을수록 속도가 오래걸린다. 많은 데이타가 있는 경우에 그 안의 내용을 First 1000 으로 하므로 속도가 빨라질수 없다
  1977. // 데이타량을 줄이는 것으로 해결하자 (결국 시간정보를 조절해서 처리해야될 듯하다)
  1978. // cyim 2013.10.10 : 1000건 조회 속도 개선 작업
  1979. if (Edit_Query_Time == false)
  1980. {
  1981. dt = dacUIProcess.SelectSQL(HistoryDisplay_LogType.CreateSQL(DB_Queary_CountLimit));
  1982. }
  1983. else // 1000건 조회됨
  1984. {
  1985. dt = Get_DB_EventLog_ByEditTime(HistoryDisplay_LogType);
  1986. }
  1987. }
  1988. else // 전체 조회됨
  1989. {
  1990. dt = dacUIProcess.SelectSQL(HistoryDisplay_LogType.CreateSQL());
  1991. }
  1992. // 조회한 데이타를 토대로 리스트 구성
  1993. foreach (DataRow dr in dt.Rows)
  1994. {
  1995. CEventLogData elog = new CEventLogData(
  1996. dr["EVENT_ID"].ToString(), dr["EVENT_TIME"].ToString(), dr["EVENT_TYPE"].ToString(), dr["RECEIVER_ID"].ToString(),
  1997. dr["COMM_ID"].ToString(), dr["BOARD_ID"].ToString(), dr["LOOP_NO"].ToString(), dr["REPEATER_ID"].ToString(),
  1998. dr["DEVICE_ID"].ToString(), dr["INOUT_TYPE"].ToString(), dr["DATA_VALUE"].ToString(), dr["EVENT_REMARK"].ToString()
  1999. );
  2000. elog.eventTypeName = this.GetEvnetTypeName(elog.eventType);
  2001. elog.devicePosition = this.GetDevicePositionName(elog); // 수정(lch_13.08.26) 주석 취소, 이유 : 이벤트를 출력해 보면 발생위치와 장치명이 UI에서 보이는 만큼(25개)만 보여서 전체 다 보여주려고 수정
  2002. elog.deviceName = this.GetDeviceName(elog); // 수정(lch_13.08.26) 주석 취소, 이유 : 이벤트를 출력해 보면 발생위치와 장치명이 UI에서 보이는 만큼(25개)만 보여서 전체 다 보여주려고 수정
  2003. //
  2004. // cyim 2015.9.23 프린트 정보와 일치하도록 수정
  2005. //
  2006. // 회로번호
  2007. string temp_Report_EventPostion = "";
  2008. if (elog.EventPositon == null
  2009. || elog.EventPositon.Length == 0
  2010. || elog.ioType == "M"
  2011. || elog.EventPositon.Contains("수신기") == true)
  2012. temp_Report_EventPostion = "없음"; // 만약 수신기 자체 혹은 타수신기 정보라면 회로번호 정보는 표시하지 않는다
  2013. else temp_Report_EventPostion = elog.EventPositon;
  2014. // cyim 2016.01.07 아날로그 감지기 이력 조회시 표시 수정
  2015. string RepeaterType = mdi.GetRepeaterType(elog.boardID, elog.loopNO, elog.repeaterID);
  2016. // '1' = A : 2X2
  2017. // '2' = B : 4X4
  2018. // '4' = C : 아날로그연감지기
  2019. // '5' = D : 아날로그열감지기
  2020. if (RepeaterType == "4" || RepeaterType == "5")
  2021. {
  2022. elog.eventTypeName = elog.eventTypeName.Replace("중계기", "감지기"); // 타입
  2023. temp_Report_EventPostion = temp_Report_EventPostion.Replace("중계기", "감지기"); // 회로번호
  2024. }
  2025. elog.Report_EventPositon = temp_Report_EventPostion;
  2026. // 차단 기능의 경우 특별히 상태값을 알수가 없어서 Remark 정보를 추출해야한다
  2027. if (elog.eventType == "DC")
  2028. {
  2029. string temp = GetRemarkInfo(elog.eventRemark, "STATUS");
  2030. if (temp == "INACTIVE") // 차단 해제
  2031. elog.Report_EventErrorStatus = 0;
  2032. else // 차단 조작
  2033. elog.Report_EventErrorStatus = 2;
  2034. }
  2035. // cyim 2015.9.23 키패드조작에서 발생한 이벤트의 경우 조작과 해제로 구분하여 표시
  2036. // 차단 기능과 마찬가지로 특별히 상태값을 알수가 없어서 Remark 정보를 추출해야한다
  2037. else if (elog.eventType == "MS"
  2038. || elog.eventType == "LS"
  2039. || elog.eventType == "EB"
  2040. || elog.eventType == "RP"
  2041. || elog.eventType == "BF"
  2042. || elog.eventType == "ED" // cyim 2016.12.09 : IFC3300에서는 예비전원버튼 -> 설비전체연동조작버튼
  2043. )
  2044. {
  2045. // KEY PAD MAIN SOUND STOP BUTTON! (OFF)
  2046. string temp = elog.eventRemark;
  2047. int idx1 = temp.LastIndexOf('(');
  2048. int idx2 = temp.LastIndexOf(')');
  2049. string temp1 = temp.Substring(idx1);
  2050. temp1 = temp1.Replace(")", "");
  2051. temp1 = temp1.Replace("(", "");
  2052. if (temp1 == "ON") // 조작
  2053. elog.Report_EventErrorStatus = 0;
  2054. else // 해제
  2055. elog.Report_EventErrorStatus = 2;
  2056. }
  2057. // 상위 루틴과 관련없으면 그대로 레포트를 위한 변수에 저장한다
  2058. else
  2059. elog.Report_EventErrorStatus = elog.EventErrorStatus;
  2060. // cyim 2013.9.26 : 과거이력 및 현재이력 보완 : 필터링
  2061. if (this.checkBoxSearchDetail.Checked == false)
  2062. {
  2063. // cyim 2013.10.2 : 발생위치 필터링 기능 추가
  2064. switch (FilterMode)
  2065. {
  2066. case DB_Result_Filter.None:
  2067. LEventLog.Add(elog);
  2068. break;
  2069. case DB_Result_Filter.AND:
  2070. if (elog.deviceName != null && elog.deviceName.Length != 0)
  2071. if (elog.deviceName.Contains(FilterMode_Device) == true && elog.devicePosition.Contains(FilterMode_Position) == true)
  2072. LEventLog.Add(elog);
  2073. break;
  2074. case DB_Result_Filter.Device:
  2075. if (elog.deviceName != null && elog.deviceName.Length != 0)
  2076. if (elog.deviceName.Contains(FilterMode_Device) == true)
  2077. LEventLog.Add(elog);
  2078. break;
  2079. case DB_Result_Filter.Positon:
  2080. if (elog.deviceName != null && elog.deviceName.Length != 0)
  2081. if (elog.devicePosition.Contains(FilterMode_Position) == true)
  2082. LEventLog.Add(elog);
  2083. break;
  2084. }
  2085. }
  2086. else
  2087. {
  2088. LEventLog.Add(elog);
  2089. }
  2090. }
  2091. // 스레드 종료를 알림
  2092. this.Thread_End_Event(this);
  2093. }
  2094. catch (Exception ex)
  2095. {
  2096. Util.UErrorMessage(ex, 0, 0);
  2097. }
  2098. }
  2099. public void Thread_HistoryDisplay_End(Form form)
  2100. {
  2101. // cyim 2013.9.24 : 팝업창 출력하는 동안 다른폼을 여는 경우 죽는 문제 발생 수정
  2102. try
  2103. {
  2104. if (form.InvokeRequired)
  2105. {
  2106. CrossThread_Form d = new CrossThread_Form(Thread_HistoryDisplay_End);
  2107. form.Invoke(d, new object[] { form });
  2108. }
  2109. else
  2110. {
  2111. this.GridPage = 1; // cyim 2017.01.19 : 이력보기 창에서 검색시 페이지 번호는 무조건 1로 변경한다
  2112. // cyim 2013.9.17 데이타베이스 조회 컨셉변경 : 중복루틴 제거
  2113. //dataGridView1.Update();
  2114. dataGridView1.Rows.Clear();
  2115. DataUpdate();
  2116. dataGridView1.Update();
  2117. // cyim 2013.9.23 화면갱신코드 추가
  2118. this.Update();
  2119. //this.GridPage = 1; // cyim 2017.01.19 : 이력보기 창에서 검색시 페이지 번호는 무조건 1로 변경한다
  2120. this.PageBtnMake(LEventLog.Count, 1);
  2121. this.labelPage.Text = string.Format("검색결과: {0}건 ", LEventLog.Count);
  2122. //this.dataGridView1.Rows.Add();
  2123. // cyim 2013.9.23 팝업창 적용
  2124. mdi.Popup.CommonPopupClose(this); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  2125. // cyim 2013.9.23 화면갱신코드 추가
  2126. this.Update();
  2127. // 이벤트 해제
  2128. this.Thread_End_Event -= new Temp(Thread_HistoryDisplay_End);
  2129. // cyim 2013.9.26 : 과거이력 및 현재이력 보완
  2130. if (LEventLog.Count == 0 && this.Visible == true)
  2131. {
  2132. MessageBox.Show("데이타가 없습니다"); // 과거이력
  2133. }
  2134. }
  2135. }
  2136. catch (Exception ex)
  2137. {
  2138. Util.UErrorMessage(ex, 0, 0);
  2139. }
  2140. }
  2141. List<Button> LbtnNext = new List<Button>();
  2142. void PageBtnMake(int count, int page)
  2143. {// generate log page button
  2144. if (count > this.maxitem)
  2145. { // make button
  2146. this.panel2.Visible = true;
  2147. this.GridSize();
  2148. int wmargin = 0;
  2149. int btnWidth = 35;
  2150. int btnGap = 10;
  2151. foreach (Button bt in LbtnNext)
  2152. {
  2153. bt.Dispose();
  2154. }
  2155. LbtnNext.Clear();
  2156. int maxPageCNT = ((count - 1) / this.maxitem) + 1;
  2157. int currentPageCNT = (maxPageCNT > (page + 9)) ? 10 : ((maxPageCNT - page) % 10 + 1);
  2158. bool isNextPageSet = (maxPageCNT > (page + 9));
  2159. //Util.UDebugMessage(string.Format("PageBtnMake cnt = {0} , page = {1} , maxPageCNT ={2} ,currentPageCNT = {3} , isNextPageSet = {4}", count, page, maxPageCNT, currentPageCNT, isNextPageSet), 0, 0);
  2160. wmargin = (900 - ((btnWidth + btnGap) * currentPageCNT)) / 2;
  2161. // 전체 페이지수 (count-1 / 100) +1) , 최초 페이지 page , 표시 페이지 수 (count-1 / 100) +1) - page , 남은 페이지 수 ( (count-1 / 100) +1) - page ) % 10
  2162. for (int i = 0; (i < currentPageCNT) && (i < 10); i++)
  2163. {
  2164. Button btn = new Button();
  2165. btn.Parent = this.panel2;
  2166. btn.Location = new Point(wmargin + i * (btnWidth + btnGap), 5);
  2167. btn.Width = btnWidth;
  2168. btn.Height = 25;
  2169. btn.Text = (i + page).ToString();
  2170. if (Int32.Parse(btn.Text) > 99)
  2171. { //2011,12,06, sdkim, if number >= 100 -> font size = 6
  2172. FontFamily ff = btn.Font.FontFamily;
  2173. Font fnt = new Font(ff, 6);
  2174. btn.Font = fnt;
  2175. }
  2176. btn.Tag = (i + page);
  2177. btn.Show();
  2178. LbtnNext.Add(btn);
  2179. btn.MouseClick += new MouseEventHandler(DoAction);
  2180. }
  2181. if (isNextPageSet)
  2182. { // make Next button
  2183. //wmargin = (this.Width - ((btnWidth + btnGap) * 10)) / 2 - 55;
  2184. Button btn = new Button();
  2185. btn.Parent = this.panel2;
  2186. btn.Location = new Point(wmargin + 10 * (btnWidth + btnGap), 5);
  2187. btn.Width = 60;
  2188. btn.Height = 25;
  2189. btn.Text = "다음";
  2190. btn.Tag = page + 10;
  2191. btn.Show();
  2192. LbtnNext.Add(btn);
  2193. btn.MouseClick += new MouseEventHandler(DoAction);
  2194. }
  2195. else
  2196. {
  2197. //wmargin = (this.Width - ((btnWidth + btnGap) * (count / 100))) / 2;
  2198. }
  2199. if (page > 10)
  2200. {
  2201. Button btn = new Button();
  2202. btn.Parent = this.panel2;
  2203. btn.Width = 60;
  2204. btn.Height = 25;
  2205. btn.Location = new Point(wmargin - (btn.Width + btnGap), 5);
  2206. btn.Text = "이전";
  2207. btn.Tag = page - 10;
  2208. btn.Show();
  2209. LbtnNext.Add(btn);
  2210. btn.MouseClick += new MouseEventHandler(DoAction);
  2211. }
  2212. foreach (Button btn in this.LbtnNext)
  2213. {
  2214. btn.BackColor = Color.Ivory;
  2215. }
  2216. LbtnNext[0].BackColor = Color.Red;
  2217. }
  2218. else
  2219. {
  2220. this.panel2.Visible = false;
  2221. this.GridSize();
  2222. }
  2223. }
  2224. void DoAction(object sender, MouseEventArgs e)
  2225. { // log page button click event
  2226. if (e.Button == MouseButtons.Left)
  2227. {
  2228. if (sender is Button)
  2229. {
  2230. foreach (Button btn in this.LbtnNext)
  2231. {
  2232. btn.BackColor = Color.Ivory;
  2233. }
  2234. ((Button)sender).BackColor = Color.Red;
  2235. this.GridPage = (int)(((Button)sender).Tag);
  2236. //dataGridView1.Update();
  2237. dataGridView1.Rows.Clear();
  2238. DataUpdate();
  2239. dataGridView1.Update();
  2240. if (((int)(((Button)sender).Tag) - 1) % 10 == 0)
  2241. {
  2242. ////Util.UDebugMessage(string.Format("this.page = {0} ,{1}", this.GridPage, (this.GridPage - 1) % 10), 0, 0);
  2243. this.PageBtnMake(LEventLog.Count, this.GridPage);
  2244. }
  2245. }
  2246. }
  2247. }
  2248. int GridPage = 1;
  2249. int maxitem = 25;
  2250. //
  2251. // cyim 2014.8.8 통신점검 시나리오 신규 작업 (네트워크 수신기의 통신 상태)
  2252. //
  2253. // 모니터 데몬이 통신이 안된다
  2254. // cyim 2014.8.12 네트워크 수신기 통신상태 문제 수정 (동시에 이벤트 발생시 UI 에서 처리하려면 큐가 아니라서 결국 CriticalSection 으로 처리해야함)
  2255. public object CS_MonitorDaemonComErr = new object();
  2256. public void Temp_Log_Add_By_MonitorDaemonComErr(string Receiver_ID)
  2257. {
  2258. lock (CS_MonitorDaemonComErr)
  2259. {
  2260. DataGridViewRow row;
  2261. row = new DataGridViewRow();
  2262. DataGridViewTextBoxCell[] textCell_no = new DataGridViewTextBoxCell[m_str_columns.Length];
  2263. // NO
  2264. textCell_no[0] = new DataGridViewTextBoxCell();
  2265. textCell_no[0].Value = string.Format("{0}", this.dataGridView1.Rows.Count + 1);
  2266. // 발생시간
  2267. textCell_no[1] = new DataGridViewTextBoxCell();
  2268. textCell_no[1].Value = mdi.MyTime; // DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); // cyim 2015.9.23 시간정보 표시 오류 (갱신을 안함)
  2269. // 발생위치
  2270. textCell_no[2] = new DataGridViewTextBoxCell();
  2271. textCell_no[2].Value = "";
  2272. // 장치명
  2273. textCell_no[3] = new DataGridViewTextBoxCell();
  2274. if (Receiver_ID == null || Receiver_ID.Length == 0)
  2275. textCell_no[3].Value = "모니터데몬";
  2276. else
  2277. textCell_no[3].Value = string.Format("수신기[{0}]", Receiver_ID);
  2278. // 타입
  2279. textCell_no[4] = new DataGridViewTextBoxCell();
  2280. textCell_no[4].Value = "통신에러";
  2281. // 회로번호
  2282. textCell_no[5] = new DataGridViewTextBoxCell();
  2283. textCell_no[5].Value = "없음";
  2284. // 상태
  2285. textCell_no[6] = new DataGridViewTextBoxCell();
  2286. textCell_no[6].Value = string.Format("발생");
  2287. // 색상
  2288. for (int i = 0; i < 6; i++)
  2289. textCell_no[i].Style.BackColor = Color.FromArgb(255, 140, 140);
  2290. textCell_no[6].Style.ForeColor = Color.Red;
  2291. // 추가
  2292. for (int j = 0; j < m_str_columns.Length; j++)
  2293. {
  2294. textCell_no[j].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
  2295. row.Cells.Add(textCell_no[j]);
  2296. }
  2297. this.dataGridView1.Rows.Add(row);
  2298. }
  2299. }
  2300. public void DataUpdate()
  2301. { // display log data
  2302. //if (this.InvokeRequired) {
  2303. //}
  2304. //else
  2305. try
  2306. {
  2307. if (this.dataGridView1 != null && this.dataGridView1.Created == true)
  2308. {
  2309. this.dataGridView1.Rows.Clear();
  2310. // DataGridViewRow row = new DataGridViewRow();
  2311. DataGridViewRow row;
  2312. if (this.LEventLog != null)
  2313. {
  2314. //Util.UDebugMessage("DataUpdate cnt = " + this.LEventLog.Count.ToString(), 0, 0);
  2315. for (int i = (GridPage - 1) * maxitem; i < this.LEventLog.Count && i < (GridPage) * maxitem; i++)
  2316. {
  2317. row = new DataGridViewRow();
  2318. DataGridViewTextBoxCell[] textCell_no = new DataGridViewTextBoxCell[m_str_columns.Length];
  2319. CEventLogData elog = this.LEventLog[i];
  2320. // NO
  2321. textCell_no[0] = new DataGridViewTextBoxCell();
  2322. textCell_no[0].Value = string.Format("{0}", i + 1);
  2323. // 발생시간
  2324. textCell_no[1] = new DataGridViewTextBoxCell();
  2325. textCell_no[1].Value = elog.EventTime;
  2326. //
  2327. // cyim 2014.8.7 이력 표시 1차 보완 (이전코드는 차단, 즉 "DC"만 따로 처리하였으나 개별로 처리함)
  2328. //
  2329. // 발생위치
  2330. textCell_no[2] = new DataGridViewTextBoxCell();
  2331. elog.devicePosition = this.GetDevicePositionName(elog);
  2332. textCell_no[2].Value = elog.devicePosition;
  2333. // 장치명
  2334. textCell_no[3] = new DataGridViewTextBoxCell();
  2335. elog.deviceName = this.GetDeviceName(elog);
  2336. textCell_no[3].Value = elog.deviceName;// elog.deviceName;// this.GetDeviceName(elog);// elog.DeviceName;//string.Format(deviceName);
  2337. // 타입(이벤트명)
  2338. textCell_no[4] = new DataGridViewTextBoxCell();
  2339. textCell_no[4].Value = elog.eventTypeName;// this.GetEventTypeName(elog.eventType);//elog.EventName;//string.Format(eventName);
  2340. //
  2341. // cyim 2015.9.23 프린트 정보와 일치하도록 수정
  2342. //
  2343. // 회로번호
  2344. textCell_no[5] = new DataGridViewTextBoxCell();
  2345. textCell_no[5].Value = elog.Report_EventPositon;//eventPosition;// string.Format("{0}-{1}-{2}-{3}-{4}번 {5}", elog.receiverID, elog.boardID, elog.loopNo, elog.repeaterID, elog.deviceID, elog.inoutType);
  2346. // lch 수정(19.03.28) - 예비전원 이상/정상, 교류전원 이상/정상
  2347. if (elog.eventType == "AR" || elog.eventType == "NR" || elog.eventType == "AA" || elog.eventType == "NA")
  2348. {
  2349. if (elog.Report_EventPositon.Substring(2, 2) == "00") // 수신기 꺼
  2350. {
  2351. }
  2352. else // 중계반 꺼
  2353. {
  2354. // 발생위치
  2355. textCell_no[2].Value = String.Empty; // 0이찍혀서 수정함
  2356. // 장치명
  2357. textCell_no[3].Value = "수신기[" + elog.Report_EventPositon.Substring(0, 1) + "] 중계반[" + elog.Report_EventPositon.Substring(2, 2) + "]";
  2358. }
  2359. }
  2360. // 상태
  2361. textCell_no[6] = new DataGridViewTextBoxCell();
  2362. switch (elog.Report_EventErrorStatus)
  2363. {
  2364. case 0:
  2365. textCell_no[6].Value = string.Format("조작");
  2366. textCell_no[6].Style.ForeColor = Color.Gray;
  2367. break;
  2368. case 1:
  2369. textCell_no[6].Value = string.Format("발생");
  2370. textCell_no[6].Style.ForeColor = Color.Red;
  2371. for (int j = 0; j < 6; j++)
  2372. {
  2373. textCell_no[j].Style.BackColor = Color.FromArgb(255, 140, 140);//Color.Red;
  2374. }
  2375. break;
  2376. case 2:
  2377. textCell_no[6].Value = string.Format("해제");
  2378. textCell_no[6].Style.ForeColor = Color.Blue;
  2379. for (int j = 0; j < 6; j++)
  2380. {
  2381. textCell_no[j].Style.BackColor = Color.FromArgb(255, 140, 140);//Color.Red;
  2382. }
  2383. break;
  2384. case 3:
  2385. textCell_no[6].Value = string.Format("발생");
  2386. textCell_no[6].Style.ForeColor = Color.Red;
  2387. for (int j = 0; j < 6; j++)
  2388. {
  2389. textCell_no[j].Style.BackColor = Color.FromArgb(140, 140, 255);//Color.Blue;
  2390. }
  2391. break;
  2392. case 4:
  2393. textCell_no[6].Value = string.Format("해제");
  2394. textCell_no[6].Style.ForeColor = Color.Blue;
  2395. for (int j = 0; j < 6; j++)
  2396. {
  2397. textCell_no[j].Style.BackColor = Color.FromArgb(140, 140, 255);//Color.Blue;
  2398. }
  2399. break;
  2400. case 5:
  2401. textCell_no[6].Value = string.Format("발생");
  2402. textCell_no[6].Style.ForeColor = Color.Red;
  2403. for (int j = 0; j < 6; j++)
  2404. {
  2405. textCell_no[j].Style.BackColor = Color.FromArgb(220, 220, 220);// Color.Gray;
  2406. }
  2407. break;
  2408. case 6:
  2409. textCell_no[6].Value = string.Format("해제");
  2410. textCell_no[6].Style.ForeColor = Color.Blue;
  2411. for (int j = 0; j < 6; j++)
  2412. {
  2413. textCell_no[j].Style.BackColor = Color.FromArgb(220, 220, 220);// Color.Gray;
  2414. }
  2415. break;
  2416. }
  2417. if (this.live_flag)
  2418. {
  2419. if (elog.Updated)
  2420. {
  2421. }
  2422. else
  2423. {
  2424. //textCell_no[6].Value = string.Format("조회");
  2425. // cyim 2014.1.15 : 현재이력정보중 시간정보가 없는 경우에는 현재시간을 표시한다 : 주석처리
  2426. //textCell_no[1].Value = " - ";
  2427. this.panel2.Visible = true;
  2428. // cyim 2013.9.17 데이타베이스 조회 컨셉변경 : 필요없는 루틴제거
  2429. // this.button2.Visible = true;
  2430. }
  2431. }
  2432. for (int j = 0; j < m_str_columns.Length; j++)
  2433. {
  2434. textCell_no[j].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
  2435. row.Cells.Add(textCell_no[j]);
  2436. }
  2437. //row.Cells.Add(textCell_no[0]);
  2438. //row.Cells.Add(textCell_no[1]);
  2439. //row.Cells.Add(textCell_no[2]);
  2440. //row.Cells.Add(textCell_no[3]);
  2441. //row.Cells.Add(textCell_no[4]);
  2442. //row.Cells.Add(textCell_no[5]);
  2443. //row.Cells.Add(textCell_no[6]);
  2444. row.Tag = elog;
  2445. this.dataGridView1.Rows.Add(row);
  2446. //}
  2447. }
  2448. }
  2449. }
  2450. }
  2451. catch (Exception e)
  2452. {
  2453. Util.UErrorMessage(e, 0, 0);
  2454. }
  2455. }
  2456. // cyim 2014.8.7 이력 표시 1차 보완
  2457. //
  2458. // Remark 정보를 추출한다
  2459. //
  2460. string GetRemarkInfo(string Original, string Attribute)
  2461. {
  2462. try
  2463. {
  2464. string result = "";
  2465. // Attribute 값은 아래와 같다
  2466. // APPLY RANGE
  2467. // DEVICE TYPE
  2468. // STATUS
  2469. ArrayList temp_list = new ArrayList();
  2470. Hashtable temp_hash = new Hashtable();
  2471. // 문자열을 콤마로 구분해서
  2472. string[] temp_1th = Original.Split(',');
  2473. char[] remove_char1 = { '(', ')' };
  2474. char[] remove_char2 = { '[', ']' };
  2475. foreach (string temp in temp_1th)
  2476. {
  2477. // 각 문자열중에 속성이름이 포함되어있다면
  2478. if (temp.Contains(Attribute) == true)
  2479. {
  2480. string[] temp_2st = temp.Split(':');
  2481. result = temp_2st[1].Trim(remove_char1);// 괄호 제거
  2482. return result.Trim(remove_char2);// 대괄호 제거
  2483. }
  2484. }
  2485. return result;
  2486. }
  2487. catch (Exception ex)
  2488. {
  2489. Util.UErrorMessage(ex, 0, 0);
  2490. return "";
  2491. }
  2492. }
  2493. // cyim 2014.8.7 이력 표시 1차 보완
  2494. //
  2495. // 장치명
  2496. //
  2497. string GetDeviceName(CEventLogData eventLog)
  2498. {
  2499. // get device name data
  2500. string ret = "";
  2501. //if (FindReceiver(eventLog.receiverID) >= 0)
  2502. {
  2503. // 수신기 아이디 정보 추가
  2504. string receiverID = string.Format("수신기[{0}]", eventLog.receiverID);
  2505. // 디바이스 타입 정보 추가
  2506. string remark_device_type = GetRemarkInfo(eventLog.eventRemark, "DEVICE TYPE");
  2507. if (remark_device_type.Length != 0) remark_device_type = "-" + remark_device_type;
  2508. //Receiver receiver = this.LReceiver[FindReceiver(eventLog.receiverID)];
  2509. string DefaultValue = receiverID + remark_device_type;
  2510. switch (eventLog.ioType)
  2511. {
  2512. //
  2513. // 마스터 수신기
  2514. //
  2515. case "M":
  2516. {
  2517. ret = "MASTER 수신기" + remark_device_type;
  2518. }
  2519. break;
  2520. //
  2521. // 로컬 수신기
  2522. //
  2523. case "A": // 전체
  2524. if (Convert.ToInt32(eventLog.receiverID) > 0)
  2525. {
  2526. ret = DefaultValue;// receiver.Name;
  2527. //DBAccess.GetReceiverNameFromDB(this.receiverID);
  2528. }
  2529. break;
  2530. case "C": // 통신
  2531. {
  2532. // 설비 차단 즉 DC 의 로그를 분석한 결과 4가지 차단은 총 아래와 같이 5가지 경우이다, 이때 InoutType 은
  2533. // 1.회로차단 I
  2534. // 2.중계기차단 C
  2535. // 3.루프차단 C
  2536. // 4.보드차단 C
  2537. // 5.설비연동 조작 C
  2538. if (eventLog.eventType == "DC")
  2539. {
  2540. // 설비연동 조작
  2541. if (eventLog.boardID == 0 && eventLog.repeaterID == 0 && eventLog.deviceID == 0)
  2542. {
  2543. ret = DefaultValue;
  2544. }
  2545. // 루프 차단
  2546. else if (eventLog.boardID != 0 && eventLog.repeaterID == 0 && eventLog.deviceID == 0)
  2547. {
  2548. ret = this.mdi.GetDeviceName(eventLog.boardID, eventLog.commID);
  2549. if (eventLog.commID == 1)
  2550. {
  2551. ret += string.Format(":{0}계통", eventLog.loopNO.ToString());
  2552. }
  2553. }
  2554. // 중계기 차단
  2555. else if (eventLog.boardID != 0 && eventLog.repeaterID != 0 && eventLog.deviceID == 0)
  2556. {
  2557. ret = this.mdi.GetDeviceName(eventLog.boardID, eventLog.loopNO, eventLog.repeaterID);
  2558. }
  2559. else
  2560. ret = DefaultValue;
  2561. }
  2562. else if (Convert.ToInt32(eventLog.receiverID) > 0)
  2563. {
  2564. ret = DefaultValue;// receiver.Name;
  2565. }
  2566. }
  2567. break;
  2568. case "B": // 보드
  2569. {
  2570. //deviceName = DBAccess.GetBoardNameFromDB(this.receiverID, this.boardID);
  2571. ret = this.mdi.GetDeviceName(eventLog.boardID, eventLog.commID);
  2572. }
  2573. break;
  2574. case "L":// 루프
  2575. {
  2576. //ret = receiver.board[eventLog.boardID - 1].Name;
  2577. ret = this.mdi.GetDeviceName(eventLog.boardID, eventLog.commID);
  2578. if (eventLog.commID == 1)
  2579. {
  2580. ret += string.Format(":{0}계통", eventLog.loopNO.ToString());
  2581. }
  2582. }
  2583. break;
  2584. case "R": //중계기
  2585. {
  2586. //ret = receiver.board[eventLog.boardID - 1].loop[eventLog.loopNO].repeater[eventLog.repeaterID - 1].Name;
  2587. ret = this.mdi.GetDeviceName(eventLog.boardID, eventLog.loopNO, eventLog.repeaterID);
  2588. break;
  2589. }
  2590. case "D": // 장치
  2591. {
  2592. ret = "장치";
  2593. break;
  2594. }
  2595. case "I": //입력회로
  2596. case "O": //출력회로
  2597. {
  2598. // cyim 2015.9.23 키패드조작에서 발생한 이벤트의 경우 회로정보는 null, 장치명은 수신기아이디 표시
  2599. if (eventLog.eventType == "MS"
  2600. || eventLog.eventType == "LS"
  2601. || eventLog.eventType == "EB"
  2602. || eventLog.eventType == "RP"
  2603. || eventLog.eventType == "BF"
  2604. || eventLog.eventType == "ED" // cyim 2016.12.09 : IFC3300에서는 예비전원버튼 -> 설비전체연동조작버튼
  2605. )
  2606. {
  2607. ret = DefaultValue;
  2608. }
  2609. else
  2610. {
  2611. ret = this.mdi.GetDeviceName(eventLog.boardID, eventLog.loopNO, eventLog.repeaterID, eventLog.deviceID, eventLog.ioType);
  2612. }
  2613. break;
  2614. }
  2615. default:
  2616. {
  2617. break;
  2618. }
  2619. }
  2620. // 만약에 정보가 없다면 기본값
  2621. if (ret == null || ret.Length == 0) ret = DefaultValue;
  2622. }
  2623. return ret;
  2624. }
  2625. // cyim 2014.8.7 이력 표시 1차 보완
  2626. //
  2627. // 발생위치
  2628. //
  2629. string GetDevicePositionName(CEventLogData eventLog)
  2630. {
  2631. // get position name data
  2632. string ret = "";
  2633. //if (FindReceiver(eventLog.receiverID) >= 0)
  2634. {
  2635. //Receiver receiver = this.LReceiver[FindReceiver(eventLog.receiverID)];
  2636. // 기본값으로 함
  2637. string DefaultValue = "";// string.Format("방재실[{0}]", eventLog.receiverID);
  2638. switch (eventLog.ioType)
  2639. {
  2640. //
  2641. // 마스터 수신기
  2642. //
  2643. case "M":
  2644. {
  2645. //ret = "Master " + receiverID;
  2646. ret = DefaultValue;
  2647. }
  2648. break;
  2649. //
  2650. // 로컬 수신기
  2651. //
  2652. case "A": // 전체
  2653. //if (Convert.ToInt32(eventLog.receiverID) > 0)
  2654. {
  2655. // receiver.Name;
  2656. //DBAccess.GetReceiverNameFromDB(this.receiverID);
  2657. ret = DefaultValue;
  2658. }
  2659. break;
  2660. case "C": // 통신
  2661. //if (Convert.ToInt32(eventLog.receiverID) > 0)
  2662. {
  2663. // receiver.Name;
  2664. //ret = receiverID + "-통신";
  2665. if (eventLog.eventType == "DC")
  2666. {
  2667. // 설비연동 조작
  2668. if (eventLog.boardID == 0 && eventLog.repeaterID == 0 && eventLog.deviceID == 0)
  2669. {
  2670. ret = DefaultValue;
  2671. }
  2672. // 루프 차단
  2673. else if (eventLog.boardID != 0 && eventLog.repeaterID == 0 && eventLog.deviceID == 0)
  2674. {
  2675. ret = this.mdi.GetDeviceName(eventLog.boardID, eventLog.commID);
  2676. if (eventLog.commID == 1)
  2677. {
  2678. ret += string.Format(":{0}계통", eventLog.loopNO.ToString());
  2679. }
  2680. }
  2681. // 중계기 차단
  2682. else if (eventLog.boardID != 0 && eventLog.repeaterID != 0 && eventLog.deviceID == 0)
  2683. {
  2684. ret = this.mdi.GetDevicePositionName(eventLog.boardID, eventLog.loopNO, eventLog.repeaterID);
  2685. }
  2686. else
  2687. ret = DefaultValue;
  2688. }
  2689. }
  2690. break;
  2691. case "B": // 보드
  2692. {
  2693. //deviceName = DBAccess.GetBoardNameFromDB(this.receiverID, this.boardID);
  2694. //ret = receiverID + "-보드";
  2695. ret = DefaultValue;
  2696. }
  2697. break;
  2698. case "L": // 루프
  2699. {
  2700. //ret = receiver.board[eventLog.boardID - 1].Name;
  2701. //ret += string.Format("{0}보드:{1}계통", eventLog.boardID, eventLog.loopNO.ToString());
  2702. //ret = receiverID + "-루프";
  2703. ret = DefaultValue;
  2704. }
  2705. break;
  2706. case "R": //중계기
  2707. {
  2708. //ret = receiver.board[eventLog.boardID - 1].loop[eventLog.loopNO].repeater[eventLog.repeaterID - 1].Name;
  2709. // ret = "중계기";
  2710. // 중계기와 회로는 각건물내에 위치하므로 수신기 아이디 출력 제외함
  2711. // 데이타베이스에서 조회, 이름이 없다면 코드라도 출력
  2712. ret = this.mdi.GetDevicePositionName(eventLog.boardID, eventLog.loopNO, eventLog.repeaterID);
  2713. }
  2714. break;
  2715. case "D": // 장치
  2716. {
  2717. //ret = "장치";
  2718. //ret = receiverID + "-장치";
  2719. ret = DefaultValue;
  2720. }
  2721. break;
  2722. case "I": //입력회로
  2723. case "O": //출력회로
  2724. {
  2725. // cyim 2015.9.23 키패드조작에서 발생한 이벤트의 경우 회로정보는 null, 장치명은 수신기아이디 표시
  2726. if (eventLog.eventType == "MS"
  2727. || eventLog.eventType == "LS"
  2728. || eventLog.eventType == "EB"
  2729. || eventLog.eventType == "RP"
  2730. || eventLog.eventType == "BF"
  2731. || eventLog.eventType == "ED" // cyim 2016.12.09 : IFC3300에서는 예비전원버튼 -> 설비전체연동조작버튼
  2732. )
  2733. {
  2734. ret = DefaultValue;
  2735. }
  2736. else
  2737. {
  2738. // 중계기와 회로는 각건물내에 위치하므로 수신기 아이디 출력 제외함
  2739. ret = this.mdi.GetDevicePositionName(eventLog.boardID, eventLog.loopNO, eventLog.repeaterID, eventLog.deviceID, eventLog.ioType);
  2740. }
  2741. }
  2742. break;
  2743. default:
  2744. {
  2745. //ret = string.Format("수신기[{0}]", eventLog.receiverID);
  2746. ret = DefaultValue;
  2747. }
  2748. break;
  2749. }
  2750. // 만약에 정보가 없다면 기본값 -> 2014.8.7 소방특성상 위치정보가 불확실하다면 표시안하는게 좋다는 의견 - 장성원부장님
  2751. //if (ret == null || ret.Length == 0) ret = DefaultValue;
  2752. }
  2753. return ret;
  2754. }
  2755. bool checkLock = false;
  2756. void checkBoxEventTypeAll_CheckedChanged(object sender, EventArgs e)
  2757. { // check button changed event
  2758. this.checkLock = true;
  2759. this.checkBoxFireOn.Checked = this.checkBoxEventTypeAll.Checked;
  2760. //this.checkBoxFireOff.Checked = this.checkBoxEventTypeAll.Checked;
  2761. this.checkBoxDevOn.Checked = this.checkBoxEventTypeAll.Checked;
  2762. //this.checkBoxDevOff.Checked = this.checkBoxEventTypeAll.Checked;
  2763. //this.checkBoxErrorOn.Checked = this.checkBoxEventTypeAll.Checked;
  2764. //this.checkBoxErrorOff.Checked = this.checkBoxEventTypeAll.Checked;
  2765. this.checkBoxControlLog.Checked = this.checkBoxEventTypeAll.Checked;
  2766. this.checkBoxBoardError.Checked = this.checkBoxEventTypeAll.Checked;
  2767. this.checkBoxRepeaterError.Checked = this.checkBoxEventTypeAll.Checked;
  2768. this.checkBoxDevError.Checked = this.checkBoxEventTypeAll.Checked;
  2769. this.checkLock = false;
  2770. }
  2771. void checkBoxEventType_CheckedChanged(object sender, EventArgs e)
  2772. {
  2773. if (checkLock == false)
  2774. {
  2775. //if (this.checkBoxFireOn.Checked && this.checkBoxFireOff.Checked && this.checkBoxDevOn.Checked && this.checkBoxDevOff.Checked
  2776. // && this.checkBoxErrorOn.Checked && this.checkBoxErrorOff.Checked && this.checkBoxControlLog.Checked) {
  2777. if (this.checkBoxFireOn.Checked && this.checkBoxDevOn.Checked && this.checkBoxControlLog.Checked
  2778. && this.checkBoxBoardError.Checked && this.checkBoxRepeaterError.Checked && this.checkBoxDevError.Checked)
  2779. {
  2780. this.checkBoxEventTypeAll.Checked = true;
  2781. }
  2782. else
  2783. {
  2784. bool[] checkStatus = new bool[6];
  2785. checkStatus[0] = this.checkBoxFireOn.Checked;
  2786. checkStatus[1] = this.checkBoxDevOn.Checked;
  2787. checkStatus[2] = this.checkBoxControlLog.Checked;
  2788. checkStatus[3] = this.checkBoxBoardError.Checked;
  2789. checkStatus[4] = this.checkBoxRepeaterError.Checked;
  2790. checkStatus[5] = this.checkBoxDevError.Checked;
  2791. this.checkBoxEventTypeAll.Checked = false;
  2792. this.checkBoxFireOn.Checked = checkStatus[0];
  2793. this.checkBoxDevOn.Checked = checkStatus[1];
  2794. this.checkBoxControlLog.Checked = checkStatus[2];
  2795. this.checkBoxBoardError.Checked = checkStatus[3];
  2796. this.checkBoxRepeaterError.Checked = checkStatus[4];
  2797. this.checkBoxDevError.Checked = checkStatus[5];
  2798. }
  2799. }
  2800. }
  2801. private void checkBoxSearchDetail_CheckedChanged(object sender, EventArgs e)
  2802. {// detail check button changed event
  2803. if (this.checkBoxSearchDetail.Checked)
  2804. {
  2805. this.comboBoxEventType.Enabled = true;
  2806. // cyim 2013.8.8 세부검색 체크시 ShutDown
  2807. if (this.comboBoxEventType.Items.Count != 0) this.comboBoxEventType.SelectedIndex = 0;
  2808. this.checkBoxEventTypeAll.Checked = false;
  2809. this.checkBoxFireOn.Checked = false;
  2810. //this.checkBoxFireOff.Checked = false;
  2811. this.checkBoxDevOn.Checked = false;
  2812. //this.checkBoxDevOff.Checked = false;
  2813. //this.checkBoxErrorOn.Checked = false;
  2814. //this.checkBoxErrorOff.Checked = false;
  2815. this.checkBoxControlLog.Checked = false;
  2816. this.checkBoxBoardError.Checked = false;
  2817. this.checkBoxRepeaterError.Checked = false;
  2818. this.checkBoxDevError.Checked = false;
  2819. this.checkBoxEventTypeAll.Enabled = false;
  2820. this.checkBoxFireOn.Enabled = false;
  2821. //this.checkBoxFireOff.Enabled = false;
  2822. this.checkBoxDevOn.Enabled = false;
  2823. //this.checkBoxDevOff.Enabled = false;
  2824. //this.checkBoxErrorOn.Enabled = false;
  2825. //this.checkBoxErrorOff.Enabled = false;
  2826. this.checkBoxControlLog.Enabled = false;
  2827. this.checkBoxBoardError.Enabled = false;
  2828. this.checkBoxRepeaterError.Enabled = false;
  2829. this.checkBoxDevError.Enabled = false;
  2830. // cyim 2013.9.26 : 과거이력 및 현재이력 보완
  2831. this.textBox_DeviceName.Enabled = false;
  2832. // cyim 2013.10.2 : 발생위치 필터링 기능 추가
  2833. this.textBox_PositionName.Enabled = false;
  2834. this.textBox_DeviceName.Text = "";
  2835. this.textBox_PositionName.Text = "";
  2836. }
  2837. else
  2838. {
  2839. this.comboBoxEventType.Enabled = false;
  2840. this.checkBoxEventTypeAll.Enabled = true;
  2841. this.checkBoxFireOn.Enabled = true;
  2842. //this.checkBoxFireOff.Enabled = true;
  2843. this.checkBoxDevOn.Enabled = true;
  2844. //this.checkBoxDevOff.Enabled = true;
  2845. //this.checkBoxErrorOn.Enabled = true;
  2846. //this.checkBoxErrorOff.Enabled = true;
  2847. this.checkBoxControlLog.Enabled = true;
  2848. this.checkBoxBoardError.Enabled = true;
  2849. this.checkBoxRepeaterError.Enabled = true;
  2850. this.checkBoxDevError.Enabled = true;
  2851. // cyim 2013.9.26 : 과거이력 및 현재이력 보완
  2852. this.textBox_DeviceName.Enabled = true;
  2853. // cyim 2013.10.2 : 발생위치 필터링 기능 추가
  2854. this.textBox_PositionName.Enabled = true;
  2855. }
  2856. }
  2857. private void button1_Click(object sender, EventArgs e)
  2858. {// save file button click
  2859. // cyim 2013.7.12 디자인개선작업 : 현재내역 및 과거내역
  2860. this.panel1.Focus();
  2861. // cyim 2013.9.26 : 과거이력 및 현재이력 보완
  2862. if (this.LEventLog == null || this.LEventLog.Count == 0)
  2863. {
  2864. MessageBox.Show("데이타가 없습니다"); // 파일저장
  2865. return;
  2866. }
  2867. this.saveFileDialog1.Filter = "(*.PDF)|*.PDF|(*.XLS)|*.XLS";
  2868. if (this.saveFileDialog1.ShowDialog() == DialogResult.OK)
  2869. {
  2870. bool write = true;
  2871. if (this.saveFileDialog1.CheckFileExists)
  2872. {
  2873. if (MessageBox.Show("파일이 존재합니다. 덮어쓰겠습니까?", "", MessageBoxButtons.OKCancel) == DialogResult.OK)
  2874. {
  2875. write = true;
  2876. }
  2877. else
  2878. {
  2879. write = false;
  2880. }
  2881. }
  2882. if (write)
  2883. {
  2884. // cyim 2013.9.23 팝업창 적용
  2885. mdi.Popup.CommonPopupShow(this); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  2886. // cyim 2013.9.23 화면갱신코드 추가
  2887. this.Update();
  2888. // 스레드를 실행시키전에 이벤트를 등록해준다
  2889. this.Thread_End_Event += new Temp(Thread_FileSave_End);
  2890. // 스레드생성
  2891. thread = new Thread(new ThreadStart(Start_Thread_FileSave));
  2892. // 스레드시작
  2893. thread.Start();
  2894. }
  2895. }
  2896. }
  2897. // 파일 저장 스레드
  2898. delegate void FormThread_FileSave();
  2899. public AReportLog rpt = null;
  2900. public void Start_Thread_FileSave()
  2901. {
  2902. // cyim 2013.9.24 : 팝업창 출력하는 동안 다른폼을 여는 경우 죽는 문제 발생 수정
  2903. try
  2904. {
  2905. this.UpdateLEventLogData();
  2906. rpt = new AReportLog(this.live_flag);
  2907. rpt.LEventLog = this.LEventLog;
  2908. rpt.findTime = this.findTime;
  2909. rpt.findType = this.findType;
  2910. rpt.findStartTime = this.findStartTime;
  2911. rpt.findEndTime = this.findEndTime;
  2912. rpt.ReceiverId = this.mdi.myReceiverID;
  2913. rpt.Run();
  2914. // 스레드 종료를 알림
  2915. this.Thread_End_Event(this);
  2916. }
  2917. catch (Exception ex)
  2918. {
  2919. Util.UErrorMessage(ex, 0, 0);
  2920. }
  2921. }
  2922. public void Thread_FileSave_End(Form form)
  2923. {
  2924. // cyim 2013.9.24 : 팝업창 출력하는 동안 다른폼을 여는 경우 죽는 문제 발생 수정
  2925. try
  2926. {
  2927. if (form.InvokeRequired)
  2928. {
  2929. CrossThread_Form d = new CrossThread_Form(Thread_FileSave_End);
  2930. form.Invoke(d, new object[] { form });
  2931. }
  2932. else
  2933. {
  2934. // cyim 2013.9.23 화면갱신코드 추가
  2935. this.Update();
  2936. if (this.saveFileDialog1.FileName.Substring(this.saveFileDialog1.FileName.Length - 3, 3).ToUpper() == "PDF")
  2937. {
  2938. this.pdfExport1.Export(rpt.Document, this.saveFileDialog1.FileName);
  2939. }
  2940. else if (this.saveFileDialog1.FileName.Substring(this.saveFileDialog1.FileName.Length - 3, 3).ToUpper() == "XLS")
  2941. {
  2942. this.xlsExport1.Export(rpt.Document, this.saveFileDialog1.FileName);
  2943. }
  2944. // cyim 2013.9.23 팝업창 적용
  2945. mdi.Popup.CommonPopupClose(this); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  2946. // cyim 2013.9.23 화면갱신코드 추가
  2947. this.Update();
  2948. // 이벤트 해제
  2949. this.Thread_End_Event -= new Temp(Thread_FileSave_End);
  2950. }
  2951. }
  2952. catch (Exception ex)
  2953. {
  2954. Util.UErrorMessage(ex, 0, 0);
  2955. }
  2956. }
  2957. // cyim 2013.7.18 속도개선작업 : 타이머 카운트와 활성화변수로 처리하도록 한다. this.invoke 는 삭제함
  2958. // 특히 타이머 System.WIndows.Timer 를 사용하는 경우에는 리소스의 속성으로 시작을 결정되므로 this , 즉 전체 폼을 잡고 있으면 안됩니다.
  2959. private bool update_flag = false;
  2960. public void UpdateData()
  2961. {
  2962. // live data update start funtion
  2963. //if (this.InvokeRequired)
  2964. //{
  2965. // deleFormInit d = new deleFormInit(UpdateData);
  2966. // this.Invoke(d, new object[] { });
  2967. //}
  2968. //else
  2969. {
  2970. // cyim 2013.7.18 속도개선작업 : 하단 주석처리
  2971. ////Util.UDebugMessage(string.Format("+UpdateData"), 0, 0);
  2972. this.update_flag = true;
  2973. iUpdateCount = 0;
  2974. //this.updatetimer.Start();
  2975. }
  2976. }
  2977. // cyim 2013.7.18 속도개선작업 : 타이머는 기본이 시작이므로 루틴을 변경한다
  2978. private void updatetimer_Tick(object sender, EventArgs e)
  2979. {
  2980. // live data update using timer
  2981. ////Util.UDebugMessage(string.Format("+updatetimer_Tick"), 0, 0);
  2982. if (update_flag == true)
  2983. {
  2984. if (updatetimer.Enabled)
  2985. {
  2986. if (this.Live)
  2987. {
  2988. ////Util.UDebugMessage(string.Format("++updatetimer_Tick"), 0, 0);
  2989. this.Search();
  2990. iUpdateCount++;
  2991. if (iUpdateCount > _UpdateCount)
  2992. {
  2993. this.update_flag = false;
  2994. //this.updatetimer.Stop();
  2995. }
  2996. // //Util.UDebugMessage(string.Format("--updatetimer_Tick"), 0, 0);
  2997. }
  2998. }
  2999. ////Util.UDebugMessage(string.Format("-updatetimer_Tick"), 0, 0);
  3000. }
  3001. else
  3002. {
  3003. iUpdateCount = 0;
  3004. }
  3005. }
  3006. // cyim 2013.9.26 : 과거이력 및 현재이력 보완 - 필터링 사용중인지 라벨색상표시
  3007. private void textBox_DeviceName_TextChanged(object sender, EventArgs e)
  3008. {
  3009. if (this.textBox_DeviceName.Text != null && this.textBox_DeviceName.Text.Trim().Length != 0)
  3010. {
  3011. this.label_DeviceName.BackColor = Color.Red;
  3012. }
  3013. else
  3014. {
  3015. this.label_DeviceName.BackColor = Color.Transparent;
  3016. }
  3017. this.label_DeviceName.Update();
  3018. }
  3019. // cyim 2013.10.2 : 발생위치 필터링 기능 추가
  3020. private void textBox_PositionName_TextChanged(object sender, EventArgs e)
  3021. {
  3022. if (this.textBox_PositionName.Text != null && this.textBox_PositionName.Text.Trim().Length != 0)
  3023. {
  3024. this.label_PositionName.BackColor = Color.Red;
  3025. }
  3026. else
  3027. {
  3028. this.label_PositionName.BackColor = Color.Transparent;
  3029. }
  3030. this.label_PositionName.Update();
  3031. }
  3032. }
  3033. public class CEventLogData : IDisposable // cyim 2017.01.02 : Memory leak
  3034. {
  3035. // evnet data class
  3036. public string eventID = "";
  3037. public string eventTime = "";
  3038. public string eventType = "";
  3039. public int receiverID = -1;
  3040. public int commID = -1;
  3041. public int boardID = -1;
  3042. public int loopNO = -1;
  3043. public int repeaterID = -1;
  3044. public int deviceID = -1;
  3045. public string ioType = "";
  3046. public int dataValue = -1;
  3047. public string eventRemark = "";
  3048. public string eventTypeName = "";
  3049. public string deviceName = "";
  3050. public string devicePosition = "";
  3051. // cyim 2015.9.23 프린트 정보와 일치하도록 수정
  3052. // 프린트할때와 리스트 정보가 일치하도록 이벤트 로그 자체 정보를 변환한다
  3053. // FireDesk_FormLogView.cs 와 FormLogView.cs 와 AReportLog.cs 모두 하단의 동일 루틴을 적용해야한다
  3054. // Static 클래스로 처리해서 루틴을 편하게 수정하고 싶지만 수신반의 코드가 이미 들어가 있고,
  3055. // 결국 mdi 를 따로 관리하기 때문에 static 처리는 가급적 피하게 코딩되어져야 하므로 우선은 각각 루틴을 동일하게 적용할 수 있도록 한다
  3056. public string Report_EventPositon = "";
  3057. public int Report_EventErrorStatus = 0;
  3058. // cyim 2017.01.02 : Memory leak
  3059. public void Dispose()
  3060. {
  3061. eventID = "";
  3062. eventTime = "";
  3063. eventType = "";
  3064. receiverID = -1;
  3065. commID = -1;
  3066. boardID = -1;
  3067. loopNO = -1;
  3068. repeaterID = -1;
  3069. deviceID = -1;
  3070. ioType = "";
  3071. dataValue = -1;
  3072. eventRemark = "";
  3073. eventTypeName = "";
  3074. deviceName = "";
  3075. devicePosition = "";
  3076. Report_EventPositon = "";
  3077. Report_EventErrorStatus = 0;
  3078. }
  3079. public string EventTime
  3080. { // event time string
  3081. get
  3082. {
  3083. // cyim 2013.7.11 날짜-시간순으로 리스트에 출력
  3084. //return string.Format("{3}:{4}:{5} {0}-{1}-{2}", this.eventTime.Substring(0, 4), this.eventTime.Substring(4, 2)
  3085. // , this.eventTime.Substring(6, 2), this.eventTime.Substring(8, 2), this.eventTime.Substring(10, 2), this.eventTime.Substring(12, 2));
  3086. return string.Format("{0}-{1}-{2} {3}:{4}:{5}", this.eventTime.Substring(0, 4), this.eventTime.Substring(4, 2)
  3087. , this.eventTime.Substring(6, 2), this.eventTime.Substring(8, 2), this.eventTime.Substring(10, 2), this.eventTime.Substring(12, 2));
  3088. }
  3089. }
  3090. public string EventPositon
  3091. { // evnet position string
  3092. get
  3093. {
  3094. string eventPosition = "";
  3095. switch (this.ioType)
  3096. {
  3097. case "A":
  3098. {//전체
  3099. if (Convert.ToInt32(this.receiverID) > 0)
  3100. {
  3101. eventPosition = string.Format("{0}수신기 ", this.receiverID);
  3102. //deviceName = DBAccess.GetReceiverNameFromDB(this.receiverID);
  3103. }
  3104. eventPosition += "전체";
  3105. break;
  3106. }
  3107. case "C":
  3108. {// 통신
  3109. if (Convert.ToInt32(this.receiverID) > 0)
  3110. {
  3111. eventPosition = string.Format("{0}수신기 ", this.receiverID);
  3112. //deviceName = DBAccess.GetReceiverNameFromDB(this.receiverID);
  3113. }
  3114. eventPosition += "통신";
  3115. break;
  3116. }
  3117. case "B":
  3118. {// 보드
  3119. eventPosition = string.Format("{0}-", this.receiverID);
  3120. eventPosition += string.Format("{0:D2}번", this.boardID);
  3121. //deviceName = DBAccess.GetBoardNameFromDB(this.receiverID, this.boardID);
  3122. eventPosition += "통신보드";
  3123. break;
  3124. }
  3125. case "L":
  3126. {// 루프
  3127. eventPosition = string.Format("{0}-", this.receiverID);
  3128. eventPosition += string.Format("{0:D2}-", this.boardID);
  3129. eventPosition += string.Format("{0}번", this.loopNO);
  3130. //deviceName = DBAccess.GetBoardNameFromDB(this.receiverID, this.boardID);
  3131. //deviceName += string.Format(":{0}계통", this.loopNO.ToString());
  3132. eventPosition += "계통";
  3133. break;
  3134. }
  3135. case "R":
  3136. {//중계기
  3137. eventPosition = string.Format("{0}-", this.receiverID);
  3138. eventPosition += string.Format("{0:D2}-", this.boardID);
  3139. eventPosition += string.Format("{0}-", this.loopNO);
  3140. eventPosition += string.Format("{0:D3}번", this.repeaterID);
  3141. eventPosition += "중계기";
  3142. //deviceName = DBAccess.GetRepeaterNameFromDB(this.receiverID, this.boardID, this.loopNO, this.repeaterID);
  3143. break;
  3144. }
  3145. case "D":
  3146. {// 장치
  3147. eventPosition = string.Format("{0}-", this.receiverID);
  3148. eventPosition += string.Format("{0:D2}-", this.boardID);
  3149. eventPosition += string.Format("{0}-", this.loopNO);
  3150. eventPosition += string.Format("{0:D3}-", this.repeaterID);
  3151. eventPosition += string.Format("{0}번", this.deviceID);
  3152. eventPosition += "장치";
  3153. break;
  3154. }
  3155. case "I":
  3156. {//입력회로
  3157. eventPosition = string.Format("{0}-", this.receiverID);
  3158. eventPosition += string.Format("{0:D2}-", this.boardID);
  3159. eventPosition += string.Format("{0}-", this.loopNO);
  3160. eventPosition += string.Format("{0:D3}-", this.repeaterID);
  3161. eventPosition += string.Format("{0}번", this.deviceID);
  3162. eventPosition += "입력";
  3163. //deviceName = DBAccess.GetDeviceNameFromDB((this.receiverID), (this.boardID), (this.loopNO), (this.repeaterID), (this.deviceID), this.ioType);
  3164. break;
  3165. }
  3166. case "O":
  3167. {//출력회로
  3168. eventPosition = string.Format("{0}-", this.receiverID);
  3169. eventPosition += string.Format("{0:D2}-", this.boardID);
  3170. eventPosition += string.Format("{0}-", this.loopNO);
  3171. eventPosition += string.Format("{0:D3}-", this.repeaterID);
  3172. eventPosition += string.Format("{0}번", this.deviceID);
  3173. eventPosition += "출력";
  3174. //deviceName = DBAccess.GetDeviceNameFromDB(this.receiverID, (this.boardID), (this.loopNO), (this.repeaterID), (this.deviceID), this.ioType);
  3175. break;
  3176. }
  3177. default:
  3178. {
  3179. break;
  3180. }
  3181. }
  3182. return eventPosition;
  3183. }
  3184. }
  3185. public int EventErrorStatus
  3186. { // 0 : 운영,기타 , 1: 화재 발생, 2 : 화재 해제 3: 설비 작동 4: 설비 멈춤 5: 이상 발생 6: 이상 해제 // event error status index
  3187. get
  3188. {
  3189. int ret = 0;
  3190. switch (this.eventType)
  3191. {
  3192. case "OA": //화재축적상태 발생
  3193. case "OF": //화재상태 발생
  3194. case "OT": //발신기설정
  3195. case "WA": // 감지기 경고발생 // cyim 2015.7.9 PreFire 표시 문제
  3196. {
  3197. ret = 1;
  3198. break;
  3199. }
  3200. case "XA": //화재축적상태 해제
  3201. case "XF": //화재상태 해제
  3202. case "XT": //발신기해제
  3203. case "WN": // 감지기 경고해제 // cyim 2015.7.9 PreFire 표시 문제
  3204. {
  3205. ret = 2;
  3206. break;
  3207. }
  3208. case "OE": //설비작동상태 발생
  3209. {
  3210. ret = 3;
  3211. break;
  3212. }
  3213. case "XE": //설비작동상태 해제
  3214. {
  3215. ret = 4;
  3216. break;
  3217. }
  3218. case "XM": //통신모듈 통신이상
  3219. case "XR": //중계기 통신이상
  3220. case "XI": //I/O 모듈 통신이상
  3221. case "XK": //키패드모듈 통신이상
  3222. case "OL": //중계기 단선발생
  3223. case "FA": // 감지기 FAULT 발생 // cyim 2015.7.9 아날로그 감지기 단선 상태가 리스트에 표시되지 않는 문제
  3224. case "AV": //출력전압 이상
  3225. case "AR": //예비전원 이상
  3226. case "AA": //교류전원 이상
  3227. case "OD": //데몬연결이상
  3228. case "OB": //DB연결이상
  3229. case "OX": //중계기전원이상
  3230. case "BA": //통신보드루프교류전원이상
  3231. case "BR": //통신보드루프예비전원이상
  3232. case "XC": //비상방송 통신이상
  3233. {
  3234. ret = 5;
  3235. break;
  3236. }
  3237. case "OM": //통신모듈 통신정상
  3238. case "OR": //중계기 통신정상
  3239. case "OI": //I/O 모듈 통신정상
  3240. case "OK": //키패드모듈 통신정상
  3241. case "XL": //중계기 단선복구
  3242. case "FN": // 감지기 FAULT 복구 // cyim 2015.7.9 아날로그 감지기 단선 상태가 리스트에 표시되지 않는 문제
  3243. case "NV": //출력전압 정상
  3244. case "NR": //예비전원 정상
  3245. case "NA": //교류전원 정상
  3246. case "XD": //데몬연결정상
  3247. case "XB": //DB연결정상
  3248. case "XX": //중계기전원이상 해제
  3249. case "BN": //통신보드루프정상
  3250. case "OC": //비상방송 통신정상
  3251. {
  3252. ret = 6;
  3253. break;
  3254. }
  3255. case "OP": //전화설정
  3256. case "XP": //전화해제
  3257. case "SP": //화면좌표설정버튼
  3258. case "MS": //주음향정지버튼
  3259. case "LS": //지구음향정지버튼
  3260. case "EB": //비상방송정지버튼
  3261. case "RP": //예비전원시험버튼
  3262. case "ED": //설비연동조작버튼// cyim 2016.12.09 : IFC3300에서는 예비전원버튼 -> 설비전체연동조작버튼
  3263. case "FR": //화재복구버튼
  3264. case "EC": //설비연동화면버튼
  3265. case "PO": //통신(POLLING) 시작
  3266. case "PF": //통신(POLLING) 종료
  3267. case "CC": //통신상태읽기
  3268. case "CV": //전압상태읽기
  3269. case "V2": //24 전압 변경
  3270. case "DC": //설비작동차단
  3271. case "CS": //환경설정
  3272. case "TK": //키패드테스트
  3273. case "VI": //통신프로그램버전정보
  3274. case "BF": //부저정지
  3275. case "EL": //이벤트리스트
  3276. case "BS": //보드상태
  3277. case "RA": //화재축적상태 재설정
  3278. case "OU": //UI프로그램시작
  3279. case "XU": //UI프로그램종료
  3280. case "DS": //설비작동상태조회
  3281. {
  3282. ret = 0;
  3283. break;
  3284. }
  3285. default:
  3286. {
  3287. break;
  3288. }
  3289. }
  3290. ////Util.UDebugMessage(string.Format("EventErrorStatus = {0} , eventType = {1}", ret, this.eventType), 0, 0);
  3291. return ret;
  3292. }
  3293. }
  3294. public CEventLogData(string eventID, string eventTime, string eventType, string receiverID, string commID, string boardID,
  3295. string loopNo, string repeaterID, string deviceID, string ioType, string dataValue, string eventRemark)
  3296. {
  3297. this.eventID = eventID;
  3298. this.eventTime = eventTime;
  3299. this.eventType = eventType;
  3300. this.receiverID = Convert.ToInt32(receiverID);
  3301. this.commID = Convert.ToInt32(commID);
  3302. this.boardID = Convert.ToInt32(boardID);
  3303. this.loopNO = Convert.ToInt32(loopNo);
  3304. this.repeaterID = Convert.ToInt32(repeaterID);
  3305. this.deviceID = Convert.ToInt32(deviceID);
  3306. this.ioType = ioType;
  3307. this.dataValue = Convert.ToInt32(dataValue);
  3308. this.eventRemark = eventRemark;
  3309. }
  3310. public void SetEventLogData(string eventID, string eventTime, string eventType, string receiverID, string commID, string boardID,
  3311. string loopNo, string repeaterID, string deviceID, string ioType, string dataValue, string eventRemark)
  3312. {
  3313. this.eventID = eventID;
  3314. this.eventTime = eventTime;
  3315. this.eventType = eventType;
  3316. this.receiverID = Convert.ToInt32(receiverID);
  3317. this.commID = Convert.ToInt32(commID);
  3318. this.boardID = Convert.ToInt32(boardID);
  3319. this.loopNO = Convert.ToInt32(loopNo);
  3320. this.repeaterID = Convert.ToInt32(repeaterID);
  3321. this.deviceID = Convert.ToInt32(deviceID);
  3322. this.ioType = ioType;
  3323. this.dataValue = Convert.ToInt32(dataValue);
  3324. this.eventRemark = eventRemark;
  3325. }
  3326. //public CEventLogData(string eventID, string eventTime, string eventType, int receiverID, int commID
  3327. // , int boardID, int loopNO, int repeaterID, int deviceID, string ioType, int dataValue, string eventRemark) {
  3328. // this.eventID = eventID;
  3329. // this.eventTime = eventTime;
  3330. // this.eventType = eventType;
  3331. // this.receiverID = receiverID;
  3332. // this.commID = commID;
  3333. // this.boardID = boardID;
  3334. // this.loopNO = loopNO;
  3335. // this.repeaterID = repeaterID;
  3336. // this.deviceID = deviceID;
  3337. // this.ioType = ioType;
  3338. // this.dataValue = dataValue;
  3339. // this.eventRemark = eventRemark;
  3340. // //Util.UDebugMessage(string.Format("CEventLogData eventType = {0}", this.eventType), 0, 0);
  3341. //}
  3342. private bool updated = true;
  3343. public bool Updated { get { return this.updated; } }
  3344. public CEventLogData(EventLogInfo eventinfo)
  3345. {
  3346. string time = string.Format("{0:D4}{1:D2}{2:D2}{3:D2}{4:D2}{5:D2}", eventinfo.EventTime.Year, eventinfo.EventTime.Month, eventinfo.EventTime.Day,
  3347. eventinfo.EventTime.Hour, eventinfo.EventTime.Minute, eventinfo.EventTime.Second);
  3348. this.eventID = eventinfo.EventId;
  3349. this.eventTime = time;
  3350. this.eventType = eventinfo.EventType;
  3351. this.receiverID = eventinfo.ReceiverID;
  3352. this.commID = eventinfo.CommId;
  3353. this.boardID = eventinfo.BoardNo;
  3354. this.loopNO = eventinfo.LoopNo;
  3355. this.repeaterID = eventinfo.RepeaterNo;
  3356. this.deviceID = eventinfo.DeviceId;
  3357. this.ioType = eventinfo.InoutType;
  3358. this.dataValue = 0;
  3359. this.eventRemark = "";
  3360. this.updated = eventinfo.updated;
  3361. }
  3362. public bool CompareDevice(CEventLogData eventLog)
  3363. { // compare same event
  3364. bool ret = false;
  3365. if (this.receiverID == eventLog.receiverID)
  3366. {
  3367. if (this.ioType == eventLog.ioType)
  3368. {
  3369. if (this.ioType == "A")
  3370. {
  3371. ret = true;
  3372. }
  3373. else if (this.commID == eventLog.commID)
  3374. {
  3375. if (this.ioType == "C")
  3376. {
  3377. ret = true;
  3378. }
  3379. else if (this.boardID == eventLog.boardID)
  3380. {
  3381. if (this.ioType == "B")
  3382. {
  3383. ret = true;
  3384. }
  3385. else if (this.loopNO == eventLog.loopNO)
  3386. {
  3387. if (this.ioType == "L")
  3388. {
  3389. ret = true;
  3390. }
  3391. else if (this.repeaterID == eventLog.repeaterID)
  3392. {
  3393. if (this.ioType == "R")
  3394. {
  3395. ret = true;
  3396. }
  3397. else if (this.deviceID == eventLog.deviceID)
  3398. {
  3399. ret = true;
  3400. }
  3401. }
  3402. }
  3403. }
  3404. }
  3405. }
  3406. }
  3407. return ret;
  3408. }
  3409. }
  3410. // 이벤트 정렬 인터페이스 구현 (미사용)
  3411. public class _EventDataSort : IComparer<CEventLogData>
  3412. {
  3413. public int Compare(CEventLogData Data1, CEventLogData Data2)
  3414. {
  3415. try
  3416. {
  3417. if (Data1.EventTime == null || Data1.EventTime.Length == 0) return 0;
  3418. if (Data2.EventTime == null || Data2.EventTime.Length == 0) return 0;
  3419. DateTime t1 = Convert.ToDateTime(Data1.EventTime);
  3420. DateTime t2 = Convert.ToDateTime(Data2.EventTime);
  3421. // 비교 (최신날짜가 앞으로 오게 수정)
  3422. if (t1.CompareTo(t2) == -1)
  3423. return 1;
  3424. else if (t1.CompareTo(t2) == 1)
  3425. return -1;
  3426. else
  3427. return 0;
  3428. }
  3429. catch (Exception ex)
  3430. {
  3431. Util.UErrorMessage(ex, 0, 0);
  3432. return 0;
  3433. }
  3434. }
  3435. }
  3436. }