FireDesk_FormLogView.cs 155 KB

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