1164b72117f51a8fa50d194dfbaa82c35f99c8a4.svn-base 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using Janus.Windows.GridEX;
  10. using System.Collections;
  11. using Janus.Windows.GridEX.EditControls;
  12. namespace IControls_FireManager
  13. {
  14. //
  15. // 기존의 Form_AddDevice.cs 를 복사하여 사용
  16. // 비상방송 편집을 위한 별도의 폼이 필요함
  17. // 컬럼을 추가하여 사용하기로 함 - 2015.6.2
  18. //
  19. public partial class Form_AddDevice_Emergency : Form
  20. {
  21. //** 대화 팝업용
  22. Form DialogPopup_Del = new Form();
  23. Form DialogPopup_Save = new Form();
  24. //** CheckedComboBox_DeviceType콤보박스에 체크되어 있는 것만 알기 위해서 사용되는 ArrayList
  25. ArrayList DeviceType = new ArrayList();
  26. //** 어레이리스트를 만들어 시컨스 정보만 저장하여 가장 큰 Value를 찾아낸다
  27. ArrayList Sequence = new ArrayList();
  28. //** 나중에 DB에 출력그룹을 ADD할 때 수신기 ID도 알아야 한다
  29. string Receiver_ID = null;
  30. //** 어느 버튼에서 이 폼을 실행시켰는지 알기 위해서 저장
  31. string form_type = null;
  32. //** 현재폼이 생성될 때 In디바이스만 출력할 것인지 Out디바이스만 출력 할것인지 결정해준다
  33. // 그 디바이스 타입 정보를 받아서 저장하기 위해서 생성
  34. string device_type = null;
  35. public Form_AddDevice_Emergency(string RECEIVER_ID, string Form_Type, string InOutType)
  36. {
  37. InitializeComponent();
  38. // 수신기 아이디 저장
  39. Receiver_ID = RECEIVER_ID;
  40. //** 어느 버튼에서 이 폼을 실행시켰는지 알기 위해서 저장
  41. form_type = Form_Type;
  42. //** 여기서 해당 디바이스 타입 정보를 저장
  43. device_type = InOutType;
  44. //** 폼 텍스트 변경
  45. if (device_type == "I")
  46. this.Text = "입력 회로조회";
  47. if (device_type == "O")
  48. this.Text = "출력 회로조회";
  49. //** 초기값 셋팅
  50. UI_Initialize();
  51. // 이전 값을 불러온다
  52. this.EditBox_Position.Text = _Data.Temp_Position;
  53. this.EditBox_DeviceName.Text = _Data.Temp_DeviceName;
  54. ///
  55. /// 폼이 생성되는 위치
  56. ///
  57. this.StartPosition = FormStartPosition.CenterScreen;
  58. this.Location = new System.Drawing.Point(MousePosition.X, MousePosition.Y);
  59. // 비상방송 편집의 경우 IO 보드 내용은 필요없다
  60. this.uiTabPage_IOboard.TabVisible = false;
  61. }
  62. //** 초기값 셋팅
  63. public void UI_Initialize()
  64. {
  65. // 해당 수신기를 수신기 콤보박스에 띄움
  66. UiComboBox_Board_Receiver.Text = Receiver_ID;
  67. UiComboBox_IO_Receiver.Text = Receiver_ID;
  68. // 입력 회로조회일 경우, 수신기 콤보박스를 disable 처리
  69. if (device_type == "I")
  70. {
  71. UiComboBox_Board_Receiver.Enabled = false;
  72. UiComboBox_IO_Receiver.Enabled = false;
  73. }
  74. // 출력 그룹에서 출력 디바이스를 추가할 경우, 수신기 콤보박스를 disable 처리
  75. if (device_type == "O" && form_type == "Group")
  76. {
  77. UiComboBox_Board_Receiver.Enabled = false;
  78. UiComboBox_IO_Receiver.Enabled = false;
  79. }
  80. //** CheckedComboBox_DeviceType 콤보박스 셋팅
  81. // 먼저 CheckedComboBox_DeviceType 콤보박스를 클리어시킴
  82. CheckedComboBox_DeviceType.Clear();
  83. // TB_DEVICE_TYPE테이블에 접근
  84. DataRowCollection DB_TABLE_DEVICE_TYPE = _Db.ExecuteRead_SqlDataAdapter(_Sql.SearchAll_Table_Value("TB_DEVICE_TYPE", null));
  85. if (DB_TABLE_DEVICE_TYPE != null && CheckedComboBox_DeviceType.DropDownList != null)
  86. {
  87. foreach (DataRow dr in DB_TABLE_DEVICE_TYPE)
  88. {
  89. // GridEx에 내용 채우기
  90. GridEXRow row;
  91. row = CheckedComboBox_DeviceType.DropDownList.AddItem();
  92. row.BeginEdit();
  93. row.Cells["Device_Type"].Value = dr["DEVICE_TYPE_NAME"].ToString();
  94. row.EndEdit();
  95. }
  96. }
  97. }
  98. //** 폼 클로우즈
  99. private void Form_AddDevice_FormClosed(object sender, FormClosedEventArgs e)
  100. {
  101. if (form_type == "Group")
  102. {
  103. //** 선택모드를 멀티로 전환하라고 맵설정 폼으로 보내줌
  104. _Event.Form_AddDevice_SendMessage_Write(DEVICE_EVENT.GROUP_SELECTIONMODE);
  105. }
  106. else if (form_type == "Map")
  107. {
  108. //** 선택모드를 멀티로 전환하라고 맵설정 폼으로 보내줌
  109. _Event.Form_AddDevice_SendMessage_Write(DEVICE_EVENT.MAP_SELECTIONMODE);
  110. }
  111. }
  112. //** 조회 버튼
  113. private void UiButton_Search_Click(object sender, EventArgs e)
  114. {
  115. // 이전 값을 저장해둔다
  116. _Data.Temp_Position = this.EditBox_Position.Text;
  117. _Data.Temp_DeviceName = this.EditBox_DeviceName.Text;
  118. //
  119. //** uiTabPage_board 탭이 선택되어 있을 경우
  120. //
  121. if (uiTabPage_board.Selected == true)
  122. {
  123. // 그리드이엑스 클리어 시키고 다시 조회
  124. GridEX_Device.ClearItems();
  125. // No.를 출력하기 위해서
  126. int i = 1;
  127. // 아래와 같이 하는 이유는 통신보드를 1~14까지만 조회하기 위해서다
  128. // 조회하려는 통신보드에 값이 없으면 if문을 타고 값이 있으면 else 문을 탄다. SQL문이 달라지는 것이다
  129. DataRowCollection DB_TABLE_DEVICE = null;
  130. // cyim 2016.12.05 : 수신기 모델별 내부 로직 변경
  131. if (((_RECEIVER)_Data.HASH_RECEIVER[Receiver_ID]).MODEL == "IFC3300")
  132. {
  133. DB_TABLE_DEVICE = _Db.ExecuteRead_SqlDataAdapter(
  134. _Sql.Search_DEVICETable_With_EMERGENCY_BigReceiver("1", device_type, UiComboBox_Board.Text, _Data.UI_CH_TO_LOOP(UiComboBox_Channel.Text), UiComboBox_Repeater.Text, EditBox_Position.Text, "", EditBox_DeviceName.Text, UiComboBox_Board_Receiver.Text, editBoxArea.Text, editBoxStair.Text, editBoxFloor.Text, this.uiCheckBox_Emergency.Checked));
  135. }
  136. else
  137. {
  138. if (UiComboBox_Board.Text.Length == 0)
  139. {
  140. // 통신보드를 선택하지 않았으면, 15번 통신보드만 빼고 모든 통신보드의 디바이스를 다 보여준다
  141. DB_TABLE_DEVICE = _Db.ExecuteRead_SqlDataAdapter(
  142. _Sql.Search_DEVICETable_With_EMERGENCY("1", device_type, "15", _Data.UI_CH_TO_LOOP(UiComboBox_Channel.Text), UiComboBox_Repeater.Text, EditBox_Position.Text, "", EditBox_DeviceName.Text, UiComboBox_Board_Receiver.Text, editBoxArea.Text, editBoxStair.Text, editBoxFloor.Text, this.uiCheckBox_Emergency.Checked));
  143. }
  144. else
  145. {
  146. // 통신보드를 선택했으면, 특정 통신보드의 디바이스를 다 보여준다
  147. DB_TABLE_DEVICE = _Db.ExecuteRead_SqlDataAdapter(
  148. _Sql.Search_DEVICETable_With_EMERGENCY("1", device_type, UiComboBox_Board.Text, _Data.UI_CH_TO_LOOP(UiComboBox_Channel.Text), UiComboBox_Repeater.Text, EditBox_Position.Text, "", EditBox_DeviceName.Text, UiComboBox_Board_Receiver.Text, editBoxArea.Text, editBoxStair.Text, editBoxFloor.Text, this.uiCheckBox_Emergency.Checked));
  149. }
  150. }
  151. if (DB_TABLE_DEVICE != null)
  152. {
  153. foreach (DataRow dr in DB_TABLE_DEVICE)
  154. {
  155. try
  156. {
  157. if (_Convert.Exception_Into_object(dr[3], dr[4], dr[5], dr[6], dr[7]) == true)
  158. {
  159. // 디바이스 타입에 관계없이 모두 출력
  160. if (DeviceType.Count == 0)
  161. {
  162. // 매개변수 순서 => COMM_ID, BOARD_ID, LOOP_NO, REPEATER_ID, DEVICE_ID, INOUT_TYPE
  163. MskDeviceIDString dev_s = new MskDeviceIDString(
  164. _Convert.Null_to_IntZero(dr[3].ToString()),
  165. _Convert.Null_to_IntZero(dr[4].ToString()),
  166. _Convert.Null_to_IntZero(dr[5].ToString()),
  167. _Convert.Null_to_IntZero(dr[6].ToString()),
  168. _Convert.Null_to_IntZero(dr[7].ToString()),
  169. dr[8].ToString(), dr[9].ToString()); // cyim 2016.12.05 : 수신기 모델별 내부 로직 변경
  170. GridEXRow row;
  171. row = GridEX_Device.AddItem();
  172. row.BeginEdit();
  173. row.Cells["Number"].Value = i++;
  174. row.Cells["ID"].Value = dev_s.MskId;
  175. row.Cells["DeviceType"].Value = dr[0].ToString();
  176. row.Cells["Position"].Value = dr[1].ToString();
  177. row.Cells["DeviceName"].Value = dr[2].ToString();
  178. row.Cells["Receiver_ID"].Value = dr[9].ToString();
  179. // 비상방송
  180. row.Cells["Emergency"].Value = dr[10].ToString() + "-" + dr[11].ToString() + "-" + dr[12].ToString();
  181. row.EndEdit();
  182. }
  183. else // 조회문에 있는 디바이스 타입만 출력
  184. {
  185. if (DeviceType.Contains(dr[0].ToString()) == true)
  186. {
  187. // 매개변수 순서 => COMM_ID, BOARD_ID, LOOP_NO, REPEATER_ID, DEVICE_ID, INOUT_TYPE
  188. MskDeviceIDString dev_s = new MskDeviceIDString(
  189. _Convert.Null_to_IntZero(dr[3].ToString()),
  190. _Convert.Null_to_IntZero(dr[4].ToString()),
  191. _Convert.Null_to_IntZero(dr[5].ToString()),
  192. _Convert.Null_to_IntZero(dr[6].ToString()),
  193. _Convert.Null_to_IntZero(dr[7].ToString()),
  194. dr[8].ToString(), dr[9].ToString()); // cyim 2016.12.05 : 수신기 모델별 내부 로직 변경
  195. GridEXRow row;
  196. row = GridEX_Device.AddItem();
  197. row.BeginEdit();
  198. row.Cells["Number"].Value = i++;
  199. row.Cells["ID"].Value = dev_s.MskId;
  200. row.Cells["DeviceType"].Value = dr[0].ToString();
  201. row.Cells["Position"].Value = dr[1].ToString();
  202. row.Cells["DeviceName"].Value = dr[2].ToString();
  203. row.Cells["Receiver_ID"].Value = dr[9].ToString();
  204. // 비상방송
  205. row.Cells["Emergency"].Value = dr[10].ToString() + "-" + dr[11].ToString() + "-" + dr[12].ToString();
  206. row.EndEdit();
  207. }
  208. }
  209. }
  210. }
  211. catch (Exception Err1)
  212. {
  213. // LOG
  214. _Event.DebugView_SendMessage_Write(Err1.ToString());
  215. // 정보를 가지고 오는데 문제가 발생하였습니다
  216. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 250, 150, _Text.ProblemMessage, 0);
  217. }
  218. }
  219. }
  220. }
  221. //
  222. // uiTabPage_IOboard 탭이 선택되어 있을 경우
  223. //
  224. if (uiTabPage_IOboard.Selected == true)
  225. {
  226. // 그리드이엑스 클리어 시키고 다시 조회
  227. GridEX_Device.ClearItems();
  228. // No.를 출력하기 위해서
  229. int i = 1;
  230. // UiComboBox_IOBoard 콤보박스의 텍스트가 null이면 전체조회
  231. if (UiComboBox_IOBoard.Text.Length == 0)
  232. {
  233. DataRowCollection DB_TABLE_DEVICE = null;
  234. // cyim 2016.12.05 : 수신기 모델별 내부 로직 변경
  235. if (((_RECEIVER)_Data.HASH_RECEIVER[Receiver_ID]).MODEL == "IFC3300")
  236. {
  237. DB_TABLE_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_DEVICETable_NoneBoardID_BigReceiver("3", device_type, "", "", "", "", "", UiComboBox_IO_Receiver.Text));
  238. }
  239. else
  240. {
  241. DB_TABLE_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_DEVICETable("3", device_type, "15", "", "", "", "", "", UiComboBox_IO_Receiver.Text));
  242. }
  243. if (DB_TABLE_DEVICE != null)
  244. {
  245. foreach (DataRow dr in DB_TABLE_DEVICE)
  246. {
  247. try
  248. {
  249. if (_Convert.Exception_Into_object(dr[3], dr[4], dr[5], dr[6], dr[7]) == true)
  250. {
  251. // 매개변수 순서 => COMM_ID, BOARD_ID, LOOP_NO, REPEATER_ID, DEVICE_ID, INOUT_TYPE
  252. MskDeviceIDString dev_s = new MskDeviceIDString(
  253. _Convert.Null_to_IntZero(dr[3].ToString()),
  254. _Convert.Null_to_IntZero(dr[4].ToString()),
  255. _Convert.Null_to_IntZero(dr[5].ToString()),
  256. _Convert.Null_to_IntZero(dr[6].ToString()),
  257. _Convert.Null_to_IntZero(dr[7].ToString()),
  258. dr[8].ToString(), dr[9].ToString()); // cyim 2016.12.05 : 수신기 모델별 내부 로직 변경
  259. GridEXRow row;
  260. row = GridEX_Device.AddItem();
  261. row.BeginEdit();
  262. row.Cells["Number"].Value = i++;
  263. row.Cells["ID"].Value = dev_s.MskId;
  264. row.Cells["DeviceType"].Value = dr[0].ToString();
  265. row.Cells["Position"].Value = dr[1].ToString();
  266. row.Cells["DeviceName"].Value = dr[2].ToString();
  267. row.Cells["Receiver_ID"].Value = dr[9].ToString();
  268. // 비상방송
  269. row.Cells["Emergency"].Value = dr[10].ToString() + "-" + dr[11].ToString() + "-" + dr[12].ToString();
  270. row.EndEdit();
  271. }
  272. }
  273. catch (Exception Err3)
  274. {
  275. // LOG
  276. _Event.DebugView_SendMessage_Write(Err3.ToString());
  277. // 정보를 가지고 오는데 문제가 발생하였습니다
  278. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 250, 150, _Text.ProblemMessage, 0);
  279. }
  280. }
  281. }
  282. }
  283. // UiComboBox_IOBoard 콤보박스의 텍스트를 이용해 조회
  284. else
  285. {
  286. DataRowCollection DB_TABLE_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_DeviceTable("3", device_type, UiComboBox_IOBoard.Text, "", "", "", "", "", UiComboBox_IO_Receiver.Text));
  287. if (DB_TABLE_DEVICE != null)
  288. {
  289. foreach (DataRow dr in DB_TABLE_DEVICE)
  290. {
  291. try
  292. {
  293. if (_Convert.Exception_Into_object(dr[3], dr[4], dr[5], dr[6], dr[7]) == true)
  294. {
  295. // 매개변수 순서 => COMM_ID, BOARD_ID, LOOP_NO, REPEATER_ID, DEVICE_ID, INOUT_TYPE
  296. MskDeviceIDString dev_s = new MskDeviceIDString(
  297. _Convert.Null_to_IntZero(dr[3].ToString()),
  298. _Convert.Null_to_IntZero(dr[4].ToString()),
  299. _Convert.Null_to_IntZero(dr[5].ToString()),
  300. _Convert.Null_to_IntZero(dr[6].ToString()),
  301. _Convert.Null_to_IntZero(dr[7].ToString()),
  302. dr[8].ToString(), dr[9].ToString()); // cyim 2016.12.05 : 수신기 모델별 내부 로직 변경
  303. GridEXRow row;
  304. row = GridEX_Device.AddItem();
  305. row.BeginEdit();
  306. row.Cells["Number"].Value = i++;
  307. row.Cells["ID"].Value = dev_s.MskId;
  308. row.Cells["DeviceType"].Value = dr[0].ToString();
  309. row.Cells["Position"].Value = dr[1].ToString();
  310. row.Cells["DeviceName"].Value = dr[2].ToString();
  311. row.Cells["Receiver_ID"].Value = dr[9].ToString();
  312. // 비상방송
  313. row.Cells["Emergency"].Value = dr[10].ToString() + "-" + dr[11].ToString() + "-" + dr[12].ToString();
  314. row.EndEdit();
  315. }
  316. }
  317. catch (Exception Err4)
  318. {
  319. // LOG
  320. _Event.DebugView_SendMessage_Write(Err4.ToString());
  321. // 정보를 가지고 오는데 문제가 발생하였습니다
  322. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 250, 150, _Text.ProblemMessage, 0);
  323. }
  324. }
  325. }
  326. }
  327. }
  328. }
  329. //** 디바이스 추가버튼
  330. //private void UiButton_AddDevice_Click(object sender, EventArgs e)
  331. //{
  332. // int SelectRowCount = GridEX_Device.SelectedItems.Count;
  333. // //** 선택한 행이 하나도 없다면....
  334. // if (SelectRowCount == 0)
  335. // {
  336. // // 회로를 선택해 주세요
  337. // _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 250, 150, _Text.DeviceNotChoice, 0);
  338. // return;
  339. // }
  340. // // 프로젝트 수정
  341. // _Data.ProJect_Save_Complete = false;
  342. // for (int number = 0; number < SelectRowCount; number++)
  343. // {
  344. // GridEXRow row = GridEX_Device.SelectedItems[number].GetRow();
  345. // string Real_RECEIVER_ID = row.Cells["Receiver_ID"].Value.ToString();
  346. // string Device_ID = row.Cells["ID"].Value.ToString();
  347. // // MI-##-#-###-# :M(구분 M-중계기,O-출력그룹)I,O(회로구분)-##(보드ID)-##(회로ID)
  348. // MskDeviceIDString device_id = new MskDeviceIDString(Device_ID);
  349. // //
  350. // //** 그룹설정에서 출력을 그룹으로 묶을때 사용
  351. // //
  352. // if (form_type == "Group")
  353. // {
  354. // //** 회로추가나 그룹추가폼을 띄워둔 상태에서 그룹명이나 맵명을 추가하거나 삭제하면 selected 된 행이 없어진다.
  355. // // 하지만 회로추가나 그룹추가는 할 수 있으므로 이를 방지해야한다
  356. // if (_Data.Group_ID != null)
  357. // {
  358. // // COMM_ID, BOARD_ID, LOOP_NO, REPEATER_ID, DEVICE_ID, INOUT_TYPE
  359. // DataRowCollection DB_TABLE_GROUP_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.SearchAll_Table_Value(
  360. // "TB_GROUP_DEVICE", "GROUP_ID", _Data.Group_ID, "COMM_ID", device_id.Comm_id, "BOARD_ID", device_id.Board_id,
  361. // "LOOP_NO", device_id.Loop_no, "REPEATER_ID", device_id.Repeater_id,
  362. // "DEVICE_ID", device_id.Device_id, "INOUT_TYPE", device_id.Inout_type, "GROUP_RECEIVER_ID", Receiver_ID, Real_RECEIVER_ID));
  363. // if (DB_TABLE_GROUP_DEVICE != null)
  364. // {
  365. // //** 저장되어 있지 않다면 DB에 ADD
  366. // if (DB_TABLE_GROUP_DEVICE.Count == 0)
  367. // {
  368. // // "TB_GROUP"에 DB 삽입
  369. // _Db.ADD("TB_GROUP_DEVICE",
  370. // "GROUP_RECEIVER_ID=" + Receiver_ID +
  371. // ";GROUP_ID=" + _Data.Group_ID +
  372. // ";RECEIVER_ID=" + Real_RECEIVER_ID +
  373. // ";COMM_ID=" + device_id.Comm_id +
  374. // ";BOARD_ID=" + device_id.Board_id +
  375. // ";LOOP_NO=" + device_id.Loop_no +
  376. // ";REPEATER_ID=" + device_id.Repeater_id +
  377. // ";DEVICE_ID=" + device_id.Device_id +
  378. // ";INOUT_TYPE=" + device_id.Inout_type +
  379. // ";USE_FLAG=" + "Y");
  380. // }
  381. // }
  382. // ////** 해당 그룹의 디바이스 변경되었다고 알려줌
  383. // //_Event.Form_AddDevice_SendMessage_Write(DEVICE_EVENT.GROUP);
  384. // }
  385. // else
  386. // {
  387. // // 그룹을 선택해 주세요
  388. // _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 250, 150, _Text.GroupNameNotChoice, 0);
  389. // return;
  390. // }
  391. // }
  392. // //
  393. // //** 연동설정에 있는 입력 및 출력회로를 추가 할때 사용
  394. // //
  395. // else if (form_type == "Map")
  396. // {
  397. // //** 회로추가나 그룹추가폼을 띄워둔 상태에서 그룹명이나 맵명을 추가하거나 삭제하면 selected 된 행이 없어진다.
  398. // // 하지만 회로추가나 그룹추가는 할 수 있으므로 이를 방지해야한다
  399. // if (_Data.Map_No != null)
  400. // {
  401. // int MaxValue = 1;
  402. // // 시컨스 결정하기
  403. // DataRowCollection DB_TABLE_MAP_PROCESS = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_MapProcess_MaxValue("TB_MAP_PROCESS", "MAP_NO", _Data.Map_No, "MAP_TYPE", device_type, Receiver_ID));
  404. // if (DB_TABLE_MAP_PROCESS != null)
  405. // {
  406. // foreach (DataRow Record in DB_TABLE_MAP_PROCESS)
  407. // {
  408. // // 시컨스
  409. // if (Record[0] == null || Record[0].ToString().Trim().Length == 0) MaxValue = 1;
  410. // else MaxValue = Int32.Parse(Record[0].ToString()) + 1;
  411. // }
  412. // }
  413. // // COMM_ID, BOARD_ID, LOOP_NO, REPEATER_ID, DEVICE_ID, INOUT_TYPE
  414. // DataRowCollection DB_TABLE_GROUP_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.SearchAll_Table_Value(
  415. // "TB_MAP_PROCESS", "MAP_NO", _Data.Map_No, "COMM_ID", device_id.Comm_id, "BOARD_ID", device_id.Board_id,
  416. // "LOOP_NO", device_id.Loop_no, "REPEATER_ID", device_id.Repeater_id,
  417. // "DEVICE_ID", device_id.Device_id, "INOUT_TYPE", device_id.Inout_type, "MAP_RECEIVER_ID", Receiver_ID, Real_RECEIVER_ID));
  418. // if (DB_TABLE_GROUP_DEVICE != null)
  419. // {
  420. // //** 저장되어 있지 않다면 DB에 ADD
  421. // if (DB_TABLE_GROUP_DEVICE.Count == 0)
  422. // {
  423. // // "TB_GROUP"에 DB 삽입
  424. // _Db.ADD("TB_MAP_PROCESS",
  425. // "MAP_RECEIVER_ID=" + Receiver_ID +
  426. // ";MAP_NO=" + _Data.Map_No +
  427. // ";MAP_TYPE=" + device_type +
  428. // ";SEQ_NO=" + MaxValue +
  429. // ";PROCESS_TYPE=" + "D" +
  430. // ";GROUP_ID=" + null +
  431. // ";RECEIVER_ID=" + Real_RECEIVER_ID +
  432. // ";COMM_ID=" + device_id.Comm_id +
  433. // ";BOARD_ID=" + device_id.Board_id +
  434. // ";LOOP_NO=" + device_id.Loop_no +
  435. // ";REPEATER_ID=" + device_id.Repeater_id +
  436. // ";DEVICE_ID=" + device_id.Device_id +
  437. // ";INOUT_TYPE=" + device_id.Inout_type +
  438. // ";USE_FLAG=" + "Y");
  439. // }
  440. // }
  441. // ////** 해당 그룹의 디바이스 변경되었다고 알려줌
  442. // //_Event.Form_AddDevice_SendMessage_Write(DEVICE_EVENT.MAP);
  443. // }
  444. // else
  445. // {
  446. // // 맵명을 선택해 주세요
  447. // _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 250, 150, _Text.MapChoice, 0);
  448. // return;
  449. // }
  450. // }
  451. // }
  452. // // 이벤트로 한번만 알려주면 된다(수정)
  453. // if (SelectRowCount != 0)
  454. // {
  455. // if (form_type == "Group")
  456. // {
  457. // //** 해당 그룹의 디바이스 변경되었다고 알려줌
  458. // _Event.Form_AddDevice_SendMessage_Write(DEVICE_EVENT.GROUP);
  459. // }
  460. // else if (form_type == "Map")
  461. // {
  462. // //** 해당 그룹의 디바이스 변경되었다고 알려줌
  463. // _Event.Form_AddDevice_SendMessage_Write(DEVICE_EVENT.MAP);
  464. // }
  465. // }
  466. //}
  467. //** CheckedComboBox_DeviceType콤보박스에 체크가 변경될때마다 발생하는 이벤트
  468. private void CheckedComboBox_DeviceType_CheckedValuesChanged(object sender, EventArgs e)
  469. {
  470. //** DeviceType을 ArrayList에 저장하기 위해서
  471. DeviceType.Clear();
  472. //** sender을 이용하는 이유는 clear를 했을때를 알기 위해서
  473. CheckedComboBox checkedcombobox = (CheckedComboBox)sender;
  474. //** 이렇게 하는 이유는 clear버튼을 사용해 텍스트를 클리어 했을 때에, 콤보박스는 이전에 선택했을 값을 가지고 있다고 여김
  475. // 그래서 아래의 속성으로 clear버튼을 클릭했을 때에는 해당 루틴을 타지 못하게 함
  476. if (checkedcombobox.Text.Length != 0)
  477. {
  478. // 아래와 같이 포커스를 주는 이유는 야누스 콤포넌트의 에러 때문이다
  479. UiButton_Search.Focus();
  480. // 콤보박스에 체크되어 있는 것만 알기 위해서
  481. GridEXRow[] GridEx_Rows = this.CheckedComboBox_DeviceType.DropDownList.GetRows();
  482. foreach (GridEXRow row in GridEx_Rows)
  483. {
  484. if (row.Cells["Check"].Value.ToString() == "True")
  485. DeviceType.Add(row.Cells["Device_Type"].Value.ToString());
  486. }
  487. }
  488. }
  489. //** 탭 전환시 발생하는 이벤트
  490. private void uiTab_Device_SelectedTabChanged(object sender, Janus.Windows.UI.Tab.TabEventArgs e)
  491. {
  492. // 그리드이엑스 클리어 시키고 다시 조회
  493. GridEX_Device.ClearItems();
  494. // 클리어
  495. // 통신보드
  496. UiComboBox_Board.Text = null;
  497. UiComboBox_Channel.Text = null;
  498. UiComboBox_Repeater.Text = null;
  499. EditBox_Position.Text = null;
  500. CheckedComboBox_DeviceType.Text = null;
  501. EditBox_DeviceName.Text = null;
  502. //IO보드
  503. UiComboBox_IOBoard.Text = null;
  504. }
  505. // 수신기 콤보박스를 드라핑다운
  506. private void UiComboBox_Board_Receiver_DroppingDown(object sender, CancelEventArgs e)
  507. {
  508. // 사용하는 수신기를 콤보박스에 추가한다
  509. UiComboBox_Board_Receiver.Items.Clear();
  510. UiComboBox_Board_Receiver.Items.Add(_Text.Null);
  511. foreach (string receive in _Data.LIST_XMLRECEIVER_ID)
  512. {
  513. UiComboBox_Board_Receiver.Items.Add(receive);
  514. }
  515. // 수신기를 선택했으니까 나머지는 다시 클리어
  516. UiComboBox_Board.Text = null;
  517. UiComboBox_Channel.Text = null;
  518. UiComboBox_Repeater.Text = null;
  519. }
  520. // 통신보드 콤보박스 드라핑다운
  521. private void UiComboBox_Board_DroppingDown(object sender, CancelEventArgs e)
  522. {
  523. // 일단 무조건 클리어
  524. UiComboBox_Board.Text = null;
  525. UiComboBox_Board.Items.Clear();
  526. // 수신기를 선택하지 않았으면 리턴
  527. if (UiComboBox_Board_Receiver.Text.Length == 0) return;
  528. UiComboBox_Board.Items.Clear();
  529. DataRowCollection DB_TABLE_BOARD = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_BoardTable("1", "", "Y", UiComboBox_Board_Receiver.Text));
  530. if (DB_TABLE_BOARD != null)
  531. {
  532. // 공백도 하나 넣어둠
  533. UiComboBox_Board.Items.Add("");
  534. foreach (DataRow dr in DB_TABLE_BOARD)
  535. {
  536. // UiComboBox_Board 콤보박스에 아이템 ADD
  537. UiComboBox_Board.Items.Add(dr["BOARD_ID"]);
  538. }
  539. }
  540. // 통신보드를 선택했으니까 나머지는 다시 클리어
  541. UiComboBox_Channel.Text = null;
  542. UiComboBox_Repeater.Text = null;
  543. }
  544. // 채널 콤보박스 드라핑다운
  545. private void UiComboBox_Channel_DroppingDown(object sender, CancelEventArgs e)
  546. {
  547. // 일단 무조건 클리어
  548. UiComboBox_Channel.Text = null;
  549. UiComboBox_Channel.Items.Clear();
  550. // 통신보드를 선택하지 않았으면 리턴
  551. if (UiComboBox_Board.Text.Length == 0) return;
  552. // 채널 콤보박스 클리어
  553. UiComboBox_Channel.Items.Clear();
  554. DataRowCollection DB_TABLE_BOARD = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_BoardTable("1", UiComboBox_Board.Text, "Y", UiComboBox_Board_Receiver.Text));
  555. if (DB_TABLE_BOARD != null)
  556. {
  557. // 공백도 하나 넣어둠
  558. if (UiComboBox_Channel.Items.Contains("") == false) UiComboBox_Channel.Items.Add("");
  559. foreach (DataRow dr in DB_TABLE_BOARD)
  560. {
  561. if (dr["LOOP0_USE_FLAG"].ToString() == "Y")
  562. {
  563. if (UiComboBox_Channel.Items.Contains("0") == false)
  564. UiComboBox_Channel.Items.Add("CH1");
  565. }
  566. if (dr["LOOP1_USE_FLAG"].ToString() == "Y")
  567. {
  568. if (UiComboBox_Channel.Items.Contains("1") == false)
  569. UiComboBox_Channel.Items.Add("CH2");
  570. }
  571. if (((_RECEIVER)_Data.HASH_RECEIVER[Receiver_ID]).MODEL == "IFC3300")
  572. {
  573. if (dr["LOOP2_USE_FLAG"].ToString() == "Y")
  574. {
  575. if (UiComboBox_Channel.Items.Contains("2") == false)
  576. UiComboBox_Channel.Items.Add("CH3");
  577. }
  578. if (dr["LOOP3_USE_FLAG"].ToString() == "Y")
  579. {
  580. if (UiComboBox_Channel.Items.Contains("3") == false)
  581. UiComboBox_Channel.Items.Add("CH4");
  582. }
  583. }
  584. }
  585. }
  586. // 채널을 선택했으니까 나머지는 다시 클리어
  587. UiComboBox_Repeater.Text = null;
  588. }
  589. // 중계기 콤보박스 드라핑다운
  590. private void UiComboBox_Repeater_DroppingDown(object sender, CancelEventArgs e)
  591. {
  592. // 일단 무조건 클리어
  593. UiComboBox_Repeater.Text = null;
  594. UiComboBox_Repeater.Items.Clear();
  595. // 채널을 선택하지 않았으면 리턴
  596. if (UiComboBox_Channel.Text.Length == 0) return;
  597. DataRowCollection DB_TABLE_TB_REPEATER = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_RepeaterTable("1", UiComboBox_Board.Text, _Data.UI_CH_TO_LOOP(UiComboBox_Channel.Text), UiComboBox_Board_Receiver.Text));
  598. if (DB_TABLE_TB_REPEATER != null)
  599. {
  600. // 공백도 하나 넣어둠
  601. if (UiComboBox_Repeater.Items.Contains("") == false) UiComboBox_Repeater.Items.Add("");
  602. foreach (DataRow dr in DB_TABLE_TB_REPEATER)
  603. {
  604. if (UiComboBox_Repeater.Items.Contains(dr["REPEATER_ID"].ToString()) == false)
  605. UiComboBox_Repeater.Items.Add(dr["REPEATER_ID"].ToString());
  606. }
  607. }
  608. }
  609. // 수신기 콤보박스를 드라핑다운
  610. private void UiComboBox_IO_Receiver_DroppingDown(object sender, CancelEventArgs e)
  611. {
  612. // 사용하는 수신기를 콤보박스에 추가한다
  613. UiComboBox_IO_Receiver.Items.Clear();
  614. UiComboBox_IO_Receiver.Items.Add(_Text.Null);
  615. foreach (string receive in _Data.LIST_XMLRECEIVER_ID)
  616. {
  617. UiComboBox_IO_Receiver.Items.Add(receive);
  618. }
  619. // 수신기를 선택했으니까 나머지는 다시 클리어
  620. UiComboBox_IOBoard.Text = null;
  621. }
  622. // IO보드 콤보박스 드라핑다운
  623. private void UiComboBox_IOBoard_DroppingDown(object sender, CancelEventArgs e)
  624. {
  625. // 일단 무조건 클리어
  626. UiComboBox_IOBoard.Text = null;
  627. UiComboBox_IOBoard.Items.Clear();
  628. // 수신기를 선택하지 않았으면 리턴
  629. if (UiComboBox_IO_Receiver.Text.Length == 0) return;
  630. DataRowCollection DB_TABLE_IOBOARD = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_BoardTable("3", "", "Y", UiComboBox_IO_Receiver.Text));
  631. if (DB_TABLE_IOBOARD != null)
  632. {
  633. // 공백도 하나 넣어둠
  634. UiComboBox_IOBoard.Items.Add("");
  635. foreach (DataRow dr in DB_TABLE_IOBOARD)
  636. {
  637. // cyim 2016.12.05 : 수신기 모델별 내부 로직 변경
  638. if (
  639. (((_RECEIVER)_Data.HASH_RECEIVER[Receiver_ID]).MODEL == "IFC3300" && dr["BOARD_ID"].ToString() != "0")
  640. || (((_RECEIVER)_Data.HASH_RECEIVER[Receiver_ID]).MODEL != "IFC3300" && dr["BOARD_ID"].ToString() != "15")
  641. )
  642. //if (dr["BOARD_ID"].ToString() != "0")
  643. {
  644. if (UiComboBox_IOBoard.Items.Contains(dr["BOARD_ID"].ToString()) == false)
  645. UiComboBox_IOBoard.Items.Add(dr["BOARD_ID"]);
  646. //// COMM_ID, BOARD_ID, LOOP_NO, REPEATER_ID, DEVICE_ID, INOUT_TYPE
  647. //DataRowCollection DB_TABLE_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.SearchAll_Table_Value(
  648. // "TB_DEVICE", "COMM_ID", "3", "BOARD_ID", dr["BOARD_ID"].ToString(),
  649. // "LOOP_NO", "0", "REPEATER_ID", "0",
  650. // "INOUT_TYPE", device_type, Receiver_ID));
  651. //if (DB_TABLE_DEVICE != null)
  652. //{
  653. // //** 위의 조건에 만족하는 IO출력디바이스가 TB_DEVICE에 있으면 UiComboBox_IOBoard에 추가 할 수 있다
  654. // if (DB_TABLE_DEVICE.Count != 0)
  655. // {
  656. // // UiComboBox_Board 콤보박스에 아이템 ADD
  657. // UiComboBox_IOBoard.Items.Add(dr["BOARD_ID"]);
  658. // }
  659. //}
  660. }
  661. }
  662. }
  663. }
  664. //** 클리어 버튼
  665. private void UiButton_Clear_Click(object sender, EventArgs e)
  666. {
  667. // 통신보드
  668. UiComboBox_Board_Receiver.Text = "";
  669. UiComboBox_Board.Text = "";
  670. UiComboBox_Channel.Text = "";
  671. UiComboBox_Repeater.Text = "";
  672. EditBox_Position.Text = "";
  673. CheckedComboBox_DeviceType.Text = "";
  674. EditBox_DeviceName.Text = "";
  675. //IO보드
  676. UiComboBox_IO_Receiver.Text = "";
  677. UiComboBox_IOBoard.Text = "";
  678. // 비상방송
  679. editBoxArea.Text = "";
  680. editBoxStair.Text = "";
  681. editBoxFloor.Text = "";
  682. uiCheckBox_Emergency.Checked = false;
  683. }
  684. //** 닫기 버튼
  685. private void UiButton_Close_Click(object sender, EventArgs e)
  686. {
  687. this.Close();
  688. }
  689. // 비상방송 삭제 버튼
  690. private void UiButton_DelDevice_Click(object sender, EventArgs e)
  691. {
  692. //** GridEX_InDevice에서 선택한 행의 갯수를 알기 위해서
  693. int SelectRowCount = GridEX_Device.SelectedItems.Count;
  694. //** 선택한 행이 없으면 팝업을 띄운다
  695. if (SelectRowCount == 0)
  696. {
  697. // 먼저 입력디바이스를 선택해 주세요
  698. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 250, 150, _Text.InDeviceNotChoice, 0);
  699. return;
  700. }
  701. // 비상방송코드를 삭제하시겠습니까?
  702. DialogPopup_Del = _Popup.Create(Popup_Type.Dialog, Popup_Style.Normal, _Text.OK, 300, 150, _Text.BroadcastionInfo_Delete_Continue, 0);
  703. // 대화 팝업은 특별처리
  704. _Event.PopupClose_SendMessage_Event += new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event_DeletBroadcastion);
  705. }
  706. public void _Event_PopupClose_SendMessage_Event_DeletBroadcastion(object sender, object etc)
  707. {
  708. // 대화 팝업 주체
  709. Form popup = (Form)sender;
  710. if (DialogPopup_Del.Name == popup.Name && etc.ToString() == _Text.OK)
  711. {
  712. // 프로젝트 수정
  713. _Data.ProJect_Save_Complete = false;
  714. //** GridEX_InDevice에서 선택한 행의 갯수를 알기 위해서
  715. int SelectRowCount = GridEX_Device.SelectedItems.Count;
  716. for (int number = 0; number < SelectRowCount; number++)
  717. {
  718. GridEXRow row = GridEX_Device.SelectedItems[number].GetRow();
  719. string Broadcation_Receiver = row.Cells["Receiver_ID"].Value.ToString();
  720. string Device_ID = row.Cells["ID"].Value.ToString();
  721. // MI-##-#-###-# :M(구분 M-중계기,O-출력그룹)I,O(회로구분)-##(보드ID)-##(회로ID)
  722. MskDeviceIDString device_id = new MskDeviceIDString(Device_ID, Broadcation_Receiver); // cyim 2016.12.05 : 수신기 모델별 내부 로직 변경
  723. int COMM_ID = device_id.Comm_id;
  724. int BOARD_ID = device_id.Board_id;
  725. int LOOP_NO = device_id.Loop_no;
  726. int REPEATER_ID = device_id.Repeater_id;
  727. int DEVICE_ID = device_id.Device_id;
  728. string INOUT_TYPE = device_id.Inout_type;
  729. // 비상방송 코드 삭제
  730. _Db.Execute(_Sql.Delete_Table("TB_EMERGENCY_BROADCASTION", "RECEIVER_ID", Receiver_ID, "COMM_ID", COMM_ID, "BOARD_ID", BOARD_ID,
  731. "LOOP_NO", LOOP_NO, "REPEATER_ID", REPEATER_ID, "DEVICE_ID", DEVICE_ID, "INOUT_TYPE", INOUT_TYPE, Broadcation_Receiver));
  732. // UI 편집
  733. row.BeginEdit();
  734. // 비상방송
  735. row.Cells["Emergency"].Value = "-" + "-";
  736. row.EndEdit();
  737. }
  738. // cyim 2016.12.05 : 수신기 모델별 내부 로직 변경
  739. if (((_RECEIVER)_Data.HASH_RECEIVER[Receiver_ID]).MODEL == "IFC3300")
  740. {
  741. // IN_Points , 즉 워크뷰에서 보여지는 정보를 업데이트 한다
  742. ((_ImportPoint)_Data.Hash_ImportPoint[Receiver_ID]).IN_Points = _Db.ExecuteRead_SqlDataAdapter(
  743. _Sql.Search_DEVICETable_With_EMERGENCY_BigReceiver("1", "I", "", "", "", "", "", "", Receiver_ID, "", "", "", false));
  744. }
  745. else
  746. {
  747. // IN_Points , 즉 워크뷰에서 보여지는 정보를 업데이트 한다
  748. ((_ImportPoint)_Data.Hash_ImportPoint[Receiver_ID]).IN_Points = _Db.ExecuteRead_SqlDataAdapter(
  749. _Sql.Search_DEVICETable_With_EMERGENCY("1", "I", "15", "", "", "", "", "", Receiver_ID, "", "", "", false));
  750. }
  751. // 워크뷰의 내용을 입출력 포인트 전부 보이는 화면으로 전환
  752. _Event.EmergencyCodeEdit_SendMessage_Write(Receiver_ID);
  753. // 삭제되었습니다
  754. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 250, 150, _Text.DelInform, 0);
  755. }
  756. // 대화 팝업은 특별처리
  757. _Event.PopupClose_SendMessage_Event -= new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event_DeletBroadcastion);
  758. }
  759. // 비상방송 추가 버튼
  760. private void UiButton_AddDevice_Click(object sender, EventArgs e)
  761. {
  762. //** GridEX_InDevice에서 선택한 행의 갯수를 알기 위해서
  763. int SelectRowCount = GridEX_Device.SelectedItems.Count;
  764. //** 선택한 행이 없으면 팝업을 띄운다
  765. if (SelectRowCount == 0)
  766. {
  767. // 먼저 입력디바이스를 선택해 주세요
  768. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 250, 150, _Text.InDeviceNotChoice, 0);
  769. return;
  770. }
  771. if (EditBox_Area.Text.Length == 0)
  772. {
  773. // 비상방송코드 AREA를 입력해 주세요
  774. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 250, 150, _Text.AreaNotInput, 0);
  775. return;
  776. }
  777. if (EditBox_Area.Text.Length != 2)
  778. {
  779. // 비상방송코드 AREA를 2자리로 입력해 주세요
  780. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 250, 150, _Text.AreaProblemInput, 0);
  781. return;
  782. }
  783. if (EditBox_Stair.Text.Length == 0)
  784. {
  785. // 비상방송코드 STAIR를 입력해 주세요
  786. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 250, 150, _Text.StairNotInput, 0);
  787. return;
  788. }
  789. if (EditBox_Stair.Text.Length != 2)
  790. {
  791. // 비상방송코드 STAIR를 2자리로 입력해 주세요
  792. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 250, 150, _Text.StairProblemInput, 0);
  793. return;
  794. }
  795. if (EditBox_Floor.Text.Length == 0)
  796. {
  797. // 비상방송코드 FLOOR를 입력해 주세요
  798. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 250, 150, _Text.FloorNotInput, 0);
  799. return;
  800. }
  801. if (EditBox_Floor.Text.Length != 2)
  802. {
  803. // 비상방송코드 FLOOR를 2자리로 입력해 주세요
  804. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 250, 150, _Text.FloorProblemInput, 0);
  805. return;
  806. }
  807. // 변경된 코드정보를 적용하시겠습니까?
  808. DialogPopup_Save = _Popup.Create(Popup_Type.Dialog, Popup_Style.Normal, _Text.OK, 300, 150, _Text.BroadcastionInfo_Update_Continue, 0);
  809. // 대화 팝업은 특별처리
  810. _Event.PopupClose_SendMessage_Event += new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event_AddBroadcastion);
  811. }
  812. public void _Event_PopupClose_SendMessage_Event_AddBroadcastion(object sender, object etc)
  813. {
  814. // 대화 팝업 주체
  815. Form popup = (Form)sender;
  816. if (DialogPopup_Save.Name == popup.Name && etc.ToString() == _Text.OK)
  817. {
  818. // 프로젝트 수정
  819. _Data.ProJect_Save_Complete = false;
  820. //** GridEX_InDevice에서 선택한 행의 갯수를 알기 위해서
  821. int SelectRowCount = GridEX_Device.SelectedItems.Count;
  822. for (int number = 0; number < SelectRowCount; number++)
  823. {
  824. GridEXRow row = GridEX_Device.SelectedItems[number].GetRow();
  825. string Broadcation_Receiver = row.Cells["Receiver_ID"].Value.ToString();
  826. string Device_ID = row.Cells["ID"].Value.ToString();
  827. // MI-##-#-###-# :M(구분 M-중계기,O-출력그룹)I,O(회로구분)-##(보드ID)-##(회로ID)
  828. MskDeviceIDString device_id = new MskDeviceIDString(Device_ID, Broadcation_Receiver); // cyim 2016.12.05 : 수신기 모델별 내부 로직 변경
  829. int COMM_ID = device_id.Comm_id;
  830. int BOARD_ID = device_id.Board_id;
  831. int LOOP_NO = device_id.Loop_no;
  832. int REPEATER_ID = device_id.Repeater_id;
  833. int DEVICE_ID = device_id.Device_id;
  834. string INOUT_TYPE = device_id.Inout_type;
  835. // UPDATE로 해결하자
  836. //_Db.UPDATE("TB_EMERGENCY_BROADCASTION",
  837. // "RECEIVER_ID=" + Broadcation_Receiver + ";COMM_ID=" + COMM_ID + ";BOARD_ID=" + BOARD_ID +
  838. // ";LOOP_NO=" + LOOP_NO + ";REPEATER_ID=" + REPEATER_ID + ";DEVICE_ID=" + DEVICE_ID + ";INOUT_TYPE=" + INOUT_TYPE,
  839. // "AREA_CODE=" + EditBox_Area.Text + ";STAIR_CODE=" + EditBox_Stair.Text + ";FLOOR_CODE=" + EditBox_Floor.Text);
  840. // UPDATE 로 처리루틴은 여기서 제외함, 기존의 루틴대로라면 비상방송을 삭제한 후에 새로 저장을 하려면 할수가 없다
  841. // 비상방송 코드 삭제
  842. _Db.Execute(_Sql.Delete_Table("TB_EMERGENCY_BROADCASTION", "RECEIVER_ID", Receiver_ID, "COMM_ID", COMM_ID, "BOARD_ID", BOARD_ID,
  843. "LOOP_NO", LOOP_NO, "REPEATER_ID", REPEATER_ID, "DEVICE_ID", DEVICE_ID, "INOUT_TYPE", INOUT_TYPE, Broadcation_Receiver));
  844. // 비상방송 코드 추가
  845. _Db.ADD("TB_EMERGENCY_BROADCASTION",
  846. "RECEIVER_ID=" + Receiver_ID +
  847. ";COMM_ID=" + COMM_ID +
  848. ";BOARD_ID=" + BOARD_ID +
  849. ";LOOP_NO=" + LOOP_NO +
  850. ";REPEATER_ID=" + REPEATER_ID +
  851. ";DEVICE_ID=" + DEVICE_ID +
  852. ";INOUT_TYPE=" + INOUT_TYPE +
  853. ";AREA_CODE=" + EditBox_Area.Text +
  854. ";STAIR_CODE=" + EditBox_Stair.Text +
  855. ";FLOOR_CODE=" + EditBox_Floor.Text +
  856. ";UPDATE_TIME=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  857. // UI 편집
  858. row.BeginEdit();
  859. // 비상방송
  860. row.Cells["Emergency"].Value = EditBox_Area.Text + "-" + EditBox_Stair.Text + "-" + EditBox_Floor.Text;
  861. row.EndEdit();
  862. }
  863. // cyim 2016.12.05 : 수신기 모델별 내부 로직 변경
  864. if (((_RECEIVER)_Data.HASH_RECEIVER[Receiver_ID]).MODEL == "IFC3300")
  865. {
  866. // IN_Points , 즉 워크뷰에서 보여지는 정보를 업데이트 한다
  867. ((_ImportPoint)_Data.Hash_ImportPoint[Receiver_ID]).IN_Points = _Db.ExecuteRead_SqlDataAdapter(
  868. _Sql.Search_DEVICETable_With_EMERGENCY_BigReceiver("1", "I", "", "", "", "", "", "", Receiver_ID, "", "", "", false));
  869. }
  870. else
  871. {
  872. // IN_Points , 즉 워크뷰에서 보여지는 정보를 업데이트 한다
  873. ((_ImportPoint)_Data.Hash_ImportPoint[Receiver_ID]).IN_Points = _Db.ExecuteRead_SqlDataAdapter(
  874. _Sql.Search_DEVICETable_With_EMERGENCY("1", "I", "15", "", "", "", "", "", Receiver_ID, "", "", "", false));
  875. }
  876. // 워크뷰의 내용을 입출력 포인트 전부 보이는 화면으로 전환
  877. _Event.EmergencyCodeEdit_SendMessage_Write(Receiver_ID);
  878. // 저장하였습니다
  879. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 250, 150, _Text.SaveInform, 0);
  880. }
  881. // 대화 팝업은 특별처리
  882. _Event.PopupClose_SendMessage_Event -= new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event_AddBroadcastion);
  883. }
  884. }
  885. }