1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Threading;
- using System.Collections;
- namespace IControls_FireManager
- {
- public partial class Form_PointConfig : Form
- {
-
- Form DialogPopup = new Form();
-
- delegate void Cross_Thread();
-
- string ReceiverID = null;
-
- string Type = null;
-
- bool ui_renew = false;
- public Form_PointConfig(_RECEIVER RECEIVER, string Info)
- {
- InitializeComponent();
-
-
-
- this.StartPosition = FormStartPosition.Manual;
- this.Location = new System.Drawing.Point(MousePosition.X, MousePosition.Y);
-
- ReceiverID = RECEIVER.ID;
-
- Type = Info;
-
- this.Text = Info + " 정보 불러오기";
-
-
-
-
- this.FormClosing += new FormClosingEventHandler(CreateForm_FormClosing);
- }
-
- public void CreateForm_FormClosing(object sender, FormClosingEventArgs e)
- {
- }
-
- private void uiButton_ProjectPath_Click(object sender, EventArgs e)
- {
- OpenFileDialog openFileDialog = new OpenFileDialog();
-
- openFileDialog.InitialDirectory = _Data.Project_Path + "\\" + _Data.Project_Name;
-
-
- openFileDialog.Filter = "(*.xls*)|*.xls*";
- if (openFileDialog.ShowDialog() == DialogResult.OK)
- {
- if (_Excel.OpenTest(openFileDialog.FileName) == true)
- {
- this.editBox_ProjectPath.Text = openFileDialog.FileName;
- }
- else
- this.editBox_ProjectPath.Text = null;
- }
- }
-
- private void Delegate_UiProgressBar()
- {
- if (this.InvokeRequired)
- {
- Cross_Thread d = new Cross_Thread(Delegate_UiProgressBar);
- this.Invoke(d, new object[] { });
- }
- else
- {
- UiProgressBar_ExcelImport.Value++;
- }
- }
-
- private void Delegate_UiButton_good()
- {
- if (this.InvokeRequired)
- {
- Cross_Thread d = new Cross_Thread(Delegate_UiButton_good);
- this.Invoke(d, new object[] { });
- }
- else
- {
- label1.Text = "※ 완료되었습니다.";
- UiButton_Apply.Enabled = true;
- UiButton_Close.Enabled = true;
- }
- }
- private void Delegate_UiButton_bad()
- {
- if (this.InvokeRequired)
- {
- Cross_Thread d = new Cross_Thread(Delegate_UiButton_bad);
- this.Invoke(d, new object[] { });
- }
- else
- {
- label1.Text = "※ 실패하였습니다.";
- UiButton_Apply.Enabled = true;
- UiButton_Close.Enabled = true;
- }
- }
-
- private void UiButton_Close_Click(object sender, EventArgs e)
- {
-
- this.Close();
- }
-
- private void UiButton_Apply_Click(object sender, EventArgs e)
- {
-
- if (editBox_ProjectPath.Text.Length == 0)
- {
-
- _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 250, 150, _Text.NotFileChoice, 0);
- return;
- }
-
- if (_Data.Project_ExcelOpenCheck == "1")
- {
-
- if (_Diagnostics.Process_Excute("EXCEL") == true || _Diagnostics.Process_Excute("excel") == true)
- {
-
- _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 450, 150, _Text.ExcelProcessNotuse, 0);
- return;
- }
- }
-
- if (_Data.Enable_Button == false)
- return;
- else
- _Data.Enable_Button = false;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if (Type == _Text.UI_TREE_POINT)
- {
- if (_Excel.Import_Point(this.editBox_ProjectPath.Text) == true)
- {
-
-
- DialogPopup = _Popup.Create(Popup_Type.Dialog, Popup_Style.Normal, _Text.OK, 500, 150, _Text.DeviceInfoDelete_Continue, 0);
-
- _Event.PopupClose_SendMessage_Event += new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event);
- }
- else
- _Data.Enable_Button = true;
- }
- else if (Type == _Text.UI_TREE_OPER_GROUP)
- {
- if (_Excel.Import_Group(this.editBox_ProjectPath.Text) == true)
- {
-
-
- DialogPopup = _Popup.Create(Popup_Type.Dialog, Popup_Style.Normal, _Text.OK, 500, 150, _Text.GroupInfoDelete_Continue, 0);
-
- _Event.PopupClose_SendMessage_Event += new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event);
- }
- else
- _Data.Enable_Button = true;
- }
- else
- {
- if (_Excel.Import_Map(this.editBox_ProjectPath.Text, ReceiverID) == true)
- {
-
-
- DialogPopup = _Popup.Create(Popup_Type.Dialog, Popup_Style.Normal, _Text.OK, 500, 150, _Text.MapInfoDelete_Continue, 0);
-
- _Event.PopupClose_SendMessage_Event += new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event);
- }
- else
- _Data.Enable_Button = true;
- }
- }
-
- public void Excel_Import()
- {
-
- if (Type == _Text.UI_TREE_POINT)
- {
-
-
-
-
-
- if (_Data.LIST_XMLRECEIVER_ID.Count == 1)
- {
-
- foreach (string CodePosition_NAME in _Data.LIST_CodePosition_NAME)
- {
- _Db.ADD("TB_POSITION_CODE",
- "POSITION_NAME=" + CodePosition_NAME +
- ";UPDATE_TIME=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") +
- ";POSITION_CODE=" + ((_Code_Position)_Data.HASH_CodePosition[CodePosition_NAME]).Code_Position_ID);
- }
- }
-
- else
- {
-
- foreach (string CodePosition_NAME in _Data.LIST_CodePosition_NAME)
- {
- string TEMP_Code_Position_ID = ((_Code_Position)_Data.HASH_CodePosition[CodePosition_NAME]).Code_Position_ID;
- DataRowCollection DB_TABLE_TB_POSITION_CODE = _Db.ExecuteRead_SqlDataAdapter(_Sql.SearchAll_Table_Value("TB_POSITION_CODE", "POSITION_CODE", TEMP_Code_Position_ID, null));
-
-
- if (DB_TABLE_TB_POSITION_CODE != null || DB_TABLE_TB_POSITION_CODE.Count != 0)
- {
-
- _Db.Execute(_Sql.Delete_Table("TB_POSITION_CODE", "POSITION_CODE", TEMP_Code_Position_ID, null));
-
- _Db.ADD("TB_POSITION_CODE",
- "POSITION_NAME=" + CodePosition_NAME +
- ";UPDATE_TIME=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") +
- ";POSITION_CODE=" + TEMP_Code_Position_ID);
- }
- else
- {
-
- _Db.ADD("TB_POSITION_CODE",
- "POSITION_NAME=" + CodePosition_NAME +
- ";UPDATE_TIME=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") +
- ";POSITION_CODE=" + TEMP_Code_Position_ID);
- }
- }
- }
-
- foreach (_Code_Event_Type Code_Event_Type in _Data.LIST_CodeEventType)
- {
- _Db.ADD("TB_EVENT_TYPE",
- "EVENT_TYPE=" + Code_Event_Type.EVENT_TYPE +
- ";EVENT_TYPE_NAME=" + Code_Event_Type.EVENT_TYPE_NAME +
- ";UPDATE_USER_ID=" + "FireManager" +
- ";UPDATE_TIME=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
- }
-
- foreach (_Code_Device_Type Table_Device_Type in _Data.LIST_CodeDeviceType)
- {
- _Db.ADD("TB_DEVICE_TYPE",
- "DEVICE_TYPE=" + Table_Device_Type.DEVICE_TYPE +
- ";DEVICE_TYPE_NAME=" + Table_Device_Type.DEVICE_TYPE_NAME +
- ";SYMBOL_TYPE=" + Table_Device_Type.SYMBOL_TYPE +
- ";SEQ_NO=" + Table_Device_Type.SEQ_NO +
- ";USE_FLAG=" + Table_Device_Type.USE_FLAG +
- ";UPDATE_USER_ID=" + "FireManager" +
- ";UPDATE_TIME=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
- }
-
- if (UiProgressBar_ExcelImport.Value <= UiProgressBar_ExcelImport.Maximum)
- Delegate_UiProgressBar();
-
-
-
-
-
- if (_Data.LIST_CodeFireDayTime.Count != 0)
- {
- _Db.ADD("TB_DAYTIME",
- "START_HOUR=" + _Data.LIST_CodeFireDayTime[0].ToString() +
- ";START_MIN=" + _Data.LIST_CodeFireDayTime[1].ToString() +
- ";END_HOUR=" + _Data.LIST_CodeFireDayTime[2].ToString() +
- ";END_MIN=" + _Data.LIST_CodeFireDayTime[3].ToString());
- }
-
-
- int RePeater_Special = 0;
- int RePeater_Special_Point = 0;
-
-
-
-
- foreach (_Excel_Sheet Excel_Sheet in _Data.List_ExcelPoint)
- {
- foreach (_Excel_Repeater Excel_Repeater in Excel_Sheet.List_Repeater)
- {
-
-
-
-
-
-
- string RepeaterType = null;
- if (Excel_Repeater.TYPE.ToString() == POINT_TYPE.REPEATER_2_2.ToString())
- RepeaterType = "1";
- else if (Excel_Repeater.TYPE.ToString() == POINT_TYPE.REPEATER_4_4.ToString())
- RepeaterType = "2";
- else if (Excel_Repeater.TYPE.ToString() == POINT_TYPE.ANALOG_SMOKE.ToString())
- RepeaterType = "4";
- else if (Excel_Repeater.TYPE.ToString() == POINT_TYPE.ANALOG_HEAT.ToString())
- RepeaterType = "5";
-
-
- if (Excel_Sheet.BOARD_ID == "1" &&
- (Excel_Repeater.REPEATER_ID == "124"
- || Excel_Repeater.REPEATER_ID == "125"
- || Excel_Repeater.REPEATER_ID == "126"
- || Excel_Repeater.REPEATER_ID == "127")
- )
- RePeater_Special++;
-
- _Db.ADD("TB_REPEATER",
- "RECEIVER_ID=" + ReceiverID +
- ";COMM_ID=" + "1" +
- ";BOARD_ID=" + Excel_Sheet.BOARD_ID +
- ";LOOP_NO=" + (Int32.Parse(Excel_Sheet.LOOP_NO) - 1) +
- ";REPEATER_ID=" + Excel_Repeater.REPEATER_ID +
- ";REPEATER_TYPE=" + RepeaterType +
- ";REPEATER_NAME=" + Excel_Repeater.NAME +
- ";CUT_FLAG=" + "N" +
- ";USE_FLAG=" + "Y" +
- ";POSITION_CODE=" + ((_Code_Position)_Data.HASH_CodePosition[_Excel.Code_Position_Name_Create(Excel_Repeater.Excel_Position.Building, Excel_Repeater.Excel_Position.Stair, Excel_Repeater.Excel_Position.Floor)]).Code_Position_ID +
- ";UPDATE_TIME=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
- foreach (_Excel_Point Excel_Point in Excel_Repeater.List_Point)
- {
-
- if (Excel_Sheet.BOARD_ID == "1" &&
- (Excel_Repeater.REPEATER_ID == "124"
- || Excel_Repeater.REPEATER_ID == "125"
- || Excel_Repeater.REPEATER_ID == "126"
- || Excel_Repeater.REPEATER_ID == "127")
- )
- RePeater_Special_Point++;
-
- _Db.ADD("TB_DEVICE",
- "RECEIVER_ID=" + ReceiverID +
- ";COMM_ID=" + "1" +
- ";BOARD_ID=" + Excel_Sheet.BOARD_ID +
- ";LOOP_NO=" + (Int32.Parse(Excel_Sheet.LOOP_NO) - 1) +
- ";REPEATER_ID=" + Excel_Repeater.REPEATER_ID +
- ";DEVICE_ID=" + Excel_Point.PortNum +
- ";INOUT_TYPE=" + Excel_Point.TYPE +
- ";DEVICE_NAME=" + Excel_Point.NAME +
- ";DEVICE_TYPE=" + Excel_Point.Code_Type +
- ";POSITION_CODE=" + ((_Code_Position)_Data.HASH_CodePosition[_Excel.Code_Position_Name_Create(Excel_Point.Excel_Position.Building, Excel_Point.Excel_Position.Stair, Excel_Point.Excel_Position.Floor)]).Code_Position_ID +
- ";CUT_FLAG=" + "N" +
- ";UPDATE_TIME=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
-
- if (Excel_Point.Code_Name == "일반화재입력" || Excel_Point.Code_Name == "축적화재입력" || Excel_Point.Code_Name == "열감지기입력" || Excel_Point.Code_Name == "연감지기입력")
- {
-
-
-
-
-
-
-
-
- string Emergency_Code = ((_Code_Position)_Data.HASH_CodePosition[_Excel.Code_Position_Name_Create(Excel_Point.Excel_Position.Building, Excel_Point.Excel_Position.Stair, Excel_Point.Excel_Position.Floor)]).Code_Emergency_ID;
- string AREA_CODE = Emergency_Code.Substring(0, 2);
- string STAIR_CODE = Emergency_Code.Substring(2, 2);
- string FLOOR_CODE = Emergency_Code.Substring(4, 2);
- _Db.ADD("TB_EMERGENCY_BROADCASTION",
- "RECEIVER_ID=" + ReceiverID +
- ";COMM_ID=" + "1" +
- ";BOARD_ID=" + Excel_Sheet.BOARD_ID +
- ";LOOP_NO=" + (Int32.Parse(Excel_Sheet.LOOP_NO) - 1) +
- ";REPEATER_ID=" + Excel_Repeater.REPEATER_ID +
- ";DEVICE_ID=" + Excel_Point.PortNum +
- ";INOUT_TYPE=" + Excel_Point.TYPE +
- ";AREA_CODE=" + AREA_CODE +
- ";STAIR_CODE=" + STAIR_CODE +
- ";FLOOR_CODE=" + FLOOR_CODE +
- ";UPDATE_TIME=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
- }
-
-
- if (RepeaterType == "4" && _Data.LIST_CodeAnalogLevel_Smoke.Count == 4)
- {
-
- _Db.ADD("TB_ANALOG_DEVICE_2",
- "RECEIVER_ID=" + ReceiverID +
- ";COMM_ID=" + "1" +
- ";BOARD_ID=" + Excel_Sheet.BOARD_ID +
- ";LOOP_NO=" + (Int32.Parse(Excel_Sheet.LOOP_NO) - 1) +
- ";REPEATER_ID=" + Excel_Repeater.REPEATER_ID +
- ";DEVICE_ID=" + Excel_Point.PortNum +
- ";INOUT_TYPE=" + Excel_Point.TYPE +
- ";FAULT_VALUE=" + _Data.LIST_CodeAnalogLevel_Smoke[0].ToString() +
- ";PREFIRE_VALUE=" + _Data.LIST_CodeAnalogLevel_Smoke[1].ToString() +
- ";FIRED_VALUE=" + _Data.LIST_CodeAnalogLevel_Smoke[2].ToString() +
- ";FIREN_VALUE=" + _Data.LIST_CodeAnalogLevel_Smoke[3].ToString() +
- ";UPDATE_TIME=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
- }
- if (RepeaterType == "5" && _Data.LIST_CodeAnalogLevel_Heat.Count == 4)
- {
-
- _Db.ADD("TB_ANALOG_DEVICE_2",
- "RECEIVER_ID=" + ReceiverID +
- ";COMM_ID=" + "1" +
- ";BOARD_ID=" + Excel_Sheet.BOARD_ID +
- ";LOOP_NO=" + (Int32.Parse(Excel_Sheet.LOOP_NO) - 1) +
- ";REPEATER_ID=" + Excel_Repeater.REPEATER_ID +
- ";DEVICE_ID=" + Excel_Point.PortNum +
- ";INOUT_TYPE=" + Excel_Point.TYPE +
- ";FAULT_VALUE=" + _Data.LIST_CodeAnalogLevel_Heat[0].ToString() +
- ";PREFIRE_VALUE=" + _Data.LIST_CodeAnalogLevel_Heat[1].ToString() +
- ";FIRED_VALUE=" + _Data.LIST_CodeAnalogLevel_Heat[2].ToString() +
- ";FIREN_VALUE=" + _Data.LIST_CodeAnalogLevel_Heat[3].ToString() +
- ";UPDATE_TIME=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
- }
- }
-
- if (UiProgressBar_ExcelImport.Value <= UiProgressBar_ExcelImport.Maximum)
- Delegate_UiProgressBar();
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if (UiProgressBar_ExcelImport.Value <= UiProgressBar_ExcelImport.Maximum)
- Delegate_UiProgressBar();
-
- bool result = Add_IOBoard_Device();
-
- if (result == false)
- {
-
- ui_renew = true;
-
- Delegate_UiButton_bad();
-
- _Data.ProJect_Save_Complete = false;
-
- _Data.Enable_Button = true;
-
-
-
- if (((_RECEIVER)_Data.HASH_RECEIVER[ReceiverID]).MODEL != "IFC3300")
- _Popup.MessageBoxPopup(MessageBoxButtons.OK, _Text.ExceptionError5, _Text.OK);
- if (((_RECEIVER)_Data.HASH_RECEIVER[ReceiverID]).MODEL == "IFC3300")
- _Popup.MessageBoxPopup(MessageBoxButtons.OK, _Text.ExceptionError7, _Text.OK);
- return;
- }
-
- if (UiProgressBar_ExcelImport.Value <= UiProgressBar_ExcelImport.Maximum)
- Delegate_UiProgressBar();
-
-
-
-
-
- _Data.Hash_ImportPoint.Clear();
-
- foreach (string pRECEIVER_ID in _Data.LIST_XMLRECEIVER_ID)
- {
- _ImportPoint ImportPoint = new _ImportPoint();
-
- if (((_RECEIVER)_Data.HASH_RECEIVER[pRECEIVER_ID]).MODEL == "IFC3300")
- {
-
- ImportPoint.IN_Points = _Db.ExecuteRead_SqlDataAdapter(
- _Sql.Search_DEVICETable_With_EMERGENCY_BigReceiver("1", "I", "", "", "", "", "", "", pRECEIVER_ID, "", "", "", false));
-
- ImportPoint.OUT_Points = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_DEVICETable_NoneBoardID_BigReceiver("1", "O", "", "", "", "", "", pRECEIVER_ID));
- }
- else
- {
-
- ImportPoint.IN_Points = _Db.ExecuteRead_SqlDataAdapter(
- _Sql.Search_DEVICETable_With_EMERGENCY("1", "I", "15", "", "", "", "", "", pRECEIVER_ID, "", "", "", false));
-
- ImportPoint.OUT_Points = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_DEVICETable("1", "O", "15", "", "", "", "", "", pRECEIVER_ID));
- }
-
- _Hash.Add(_Data.Hash_ImportPoint, pRECEIVER_ID, ImportPoint);
- }
-
- for (int i = 0; i < 50; i++)
- {
-
- if (UiProgressBar_ExcelImport.Value <= UiProgressBar_ExcelImport.Maximum)
- Delegate_UiProgressBar();
- }
- }
- else if (Type == _Text.UI_TREE_OPER_GROUP)
- {
-
-
-
- foreach (_Excel_Group Excel_Group in _Data.List_ExcelGroup)
- {
-
- _Db.ADD("TB_GROUP",
- "RECEIVER_ID=" + ReceiverID +
- ";GROUP_ID=" + Excel_Group.Group_ID +
- ";GROUP_NAME=" + Excel_Group.Group_Name +
- ";UPDATE_TIME=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
- if (UiProgressBar_ExcelImport.Value <= UiProgressBar_ExcelImport.Maximum)
- Delegate_UiProgressBar();
- }
- }
- else
- {
-
- Hashtable Group_ReceiverID_Table = new Hashtable();
- DataRowCollection DB_TABLE_GROUP = _Db.ExecuteRead_SqlDataAdapter(_Sql.SearchAll_Table_Value("TB_GROUP", null));
- if (DB_TABLE_GROUP != null && DB_TABLE_GROUP.Count != 0)
- {
- foreach (DataRow dr in DB_TABLE_GROUP)
- {
- if (Group_ReceiverID_Table.ContainsKey(dr["GROUP_ID"].ToString()) == false)
- Group_ReceiverID_Table.Add(dr["GROUP_ID"].ToString(), dr["RECEIVER_ID"].ToString());
- }
- }
-
-
-
- foreach (_Excel_Map Excel_Map in _Data.List_ExcelMap)
- {
-
-
-
- _Db.ADD("TB_MAP",
- "RECEIVER_ID=" + ReceiverID +
- ";MAP_NO=" + Excel_Map.Map_ID.Remove(0, 1) +
- ";MAP_ID=" + Excel_Map.Map_ID +
- ";MAP_NAME=" + Excel_Map.Map_Name +
- ";USE_FLAG=" + "Y" +
- ";UPDATE_TIME=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
-
-
-
-
- if (Excel_Map.Groups != _Text.Null)
- {
- string[] Group = Excel_Map.Groups.Split(':');
- for (int i = 0; i < Group.Count(); i++)
- {
-
- try
- {
-
-
-
- _Db.ADD("TB_MAP_PROCESS",
- "MAP_RECEIVER_ID=" + ReceiverID +
- ";MAP_NO=" + Excel_Map.Map_ID.Remove(0, 1) +
- ";MAP_TYPE=" + "O" +
- ";SEQ_NO=" + (i + 1) +
- ";PROCESS_TYPE=" + "G" +
- ";GROUP_ID=" + Group[i] +
- ";RECEIVER_ID=" + Group_ReceiverID_Table[Group[i]].ToString() +
- ";COMM_ID=" + null +
- ";BOARD_ID=" + null +
- ";LOOP_NO=" + null +
- ";REPEATER_ID=" + null +
- ";DEVICE_ID=" + null +
- ";INOUT_TYPE=" + null +
- ";USE_FLAG=" + "Y");
- }
- catch
- {
-
- ui_renew = true;
-
- Delegate_UiButton_bad();
-
- _Data.ProJect_Save_Complete = false;
-
- _Data.Enable_Button = true;
- MessageBox.Show(_Text.ExceptionError1);
- return;
- }
- }
- }
-
- if (Excel_Map.InDevices != _Text.Null)
- {
- string[] InDevice = Excel_Map.InDevices.Split(':');
- for (int i = 0; i < InDevice.Count(); i++)
- {
-
- string[] Value = InDevice[i].Split('-');
-
-
-
- _Db.ADD("TB_MAP_PROCESS",
- "MAP_RECEIVER_ID=" + ReceiverID +
- ";MAP_NO=" + Excel_Map.Map_ID.Remove(0, 1) +
- ";MAP_TYPE=" + "I" +
- ";SEQ_NO=" + (i + 1) +
- ";PROCESS_TYPE=" + "D" +
- ";GROUP_ID=" + null +
- ";RECEIVER_ID=" + ReceiverID +
- ";COMM_ID=" + "1" +
- ";BOARD_ID=" + Int32.Parse(Value[1]) +
- ";LOOP_NO=" + Int32.Parse(Value[2]) +
- ";REPEATER_ID=" + Int32.Parse(Value[3]) +
- ";DEVICE_ID=" + Int32.Parse(Value[4]) +
- ";INOUT_TYPE=" + "I" +
- ";USE_FLAG=" + "Y");
- }
- }
- if (UiProgressBar_ExcelImport.Value <= UiProgressBar_ExcelImport.Maximum)
- Delegate_UiProgressBar();
- }
- }
-
- ui_renew = true;
-
- Delegate_UiButton_good();
-
- _Data.ProJect_Save_Complete = false;
-
- _Data.Enable_Button = true;
- }
-
- public bool Add_IOBoard_Device()
- {
- foreach (_Code_IO_Board Code_IO_Board in _Data.LIST_CodeIOBoard)
- {
-
-
-
-
- if (((_RECEIVER)_Data.HASH_RECEIVER[ReceiverID]).MODEL == "IFC3300")
- {
- if (Code_IO_Board.IOBOARD_COM_PORT == "1")
- if (Code_IO_Board.IOBOARD_BOARD_ID != "0")
- return false;
- }
-
-
- if (((_RECEIVER)_Data.HASH_RECEIVER[ReceiverID]).MODEL != "IFC3300")
- {
- if (Code_IO_Board.IOBOARD_COM_PORT == "1")
- if (Code_IO_Board.IOBOARD_BOARD_ID != "15")
- return false;
- }
-
- DB_ADD_IOBoard_Device(ReceiverID,
- Code_IO_Board.IOBOARD_COM_PORT,
- Code_IO_Board.IOBOARD_BOARD_ID,
- Code_IO_Board.IOBOARD_LOOP_NO,
- Code_IO_Board.IOBOARD_REPEATER_ID,
- Code_IO_Board.IOBOARD_DEVICE_ID,
- Code_IO_Board.IOBOARD_INOUT,
- Code_IO_Board.IOBOARD_NAME,
- "000000",
- "N");
-
- if (Code_IO_Board.IOBOARD_ADDREPEATER_YN == "Y")
- {
-
- DB_ADD_Repeater(ReceiverID,
- Code_IO_Board.IOBOARD_COM_PORT,
- Code_IO_Board.IOBOARD_BOARD_ID,
- Code_IO_Board.IOBOARD_LOOP_NO,
- Code_IO_Board.IOBOARD_REPEATER_ID,
- Code_IO_Board.IOBOARD_ADDREPEATER_TYPE == "2*2" ? "1" : "2",
- "중계기");
- }
- }
- return true;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
-
- public void DB_ADD_IOBoard_Device(string RECEIVER_ID, string COMM_ID, string BOARD_ID, string LOOP_NO, string REPEATER_ID, string DEVICE_ID, string INOUT_TYPE, string DEVICE_NAME, string POSITION_CODE, string CUT_FLAG)
- {
- _Db.ADD("TB_DEVICE",
- "RECEIVER_ID=" + ReceiverID +
- ";COMM_ID=" + COMM_ID +
- ";BOARD_ID=" + BOARD_ID +
- ";LOOP_NO=" + LOOP_NO +
- ";REPEATER_ID=" + REPEATER_ID +
- ";DEVICE_ID=" + DEVICE_ID +
- ";INOUT_TYPE=" + INOUT_TYPE +
- ";DEVICE_NAME=" + DEVICE_NAME +
- ";POSITION_CODE=" + POSITION_CODE +
- ";CUT_FLAG=" + CUT_FLAG +
- ";UPDATE_TIME=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
- }
-
- public void DB_ADD_Repeater(string RECEIVER_ID, string COMM_ID, string BOARD_ID, string LOOP_NO, string REPEATER_ID, string REPEATER_TYPE, string REPEATER_NAME)
- {
- _Db.ADD("TB_REPEATER",
- "RECEIVER_ID=" + ReceiverID +
- ";COMM_ID=" + COMM_ID +
- ";BOARD_ID=" + BOARD_ID +
- ";LOOP_NO=" + LOOP_NO +
- ";REPEATER_ID=" + REPEATER_ID +
- ";REPEATER_TYPE=" + REPEATER_TYPE +
- ";REPEATER_NAME=" + REPEATER_NAME +
- ";CUT_FLAG=" + "N" +
- ";USE_FLAG=" + "Y" +
- ";POSITION_CODE=" + "000000" +
- ";UPDATE_TIME=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
- }
-
- public void _Event_PopupClose_SendMessage_Event(object sender, object etc)
- {
-
- Form popup = (Form)sender;
- if (DialogPopup.Name == popup.Name && etc.ToString() == _Text.OK)
- {
-
- Timer_Renew.Start();
- int ProgressBar_TotalCount = 0;
-
- UiButton_Apply.Enabled = false;
- UiButton_Close.Enabled = false;
-
- if (Type == _Text.UI_TREE_POINT)
- {
-
-
-
-
-
-
- if (_Data.LIST_XMLRECEIVER_ID.Count == 1)
- _Db.Execute(_Sql.Delete_Table("TB_POSITION_CODE", null));
-
- _Db.Execute(_Sql.Delete_Table("TB_EVENT_TYPE", null));
-
- _Db.Execute(_Sql.Delete_Table("TB_DEVICE_TYPE", null));
-
- _Db.Execute(_Sql.Delete_Table("TB_DEVICE", ReceiverID));
-
- _Db.Execute(_Sql.Delete_Table("TB_REPEATER", ReceiverID));
-
- _Db.Execute(_Sql.Delete_Table("TB_EMERGENCY_BROADCASTION", ReceiverID));
-
-
-
-
-
-
-
-
-
- DataRowCollection DB_TABLE_TB_DAYTIME = _Db.ExecuteRead_SqlDataAdapter(_Sql.Table_Exist("TB_DAYTIME"));
- if (DB_TABLE_TB_DAYTIME != null && DB_TABLE_TB_DAYTIME.Count != 0)
- {
-
- _Db.Execute(_Sql.Delete_Table("TB_DAYTIME", null));
- }
- else
- {
-
- _Db.Execute(_Sql.Create_TB_DAYTIME());
- }
-
- DataRowCollection DB_TABLE_TB_ANALOG_DEVICE_2 = _Db.ExecuteRead_SqlDataAdapter(_Sql.Table_Exist("TB_ANALOG_DEVICE_2"));
- if (DB_TABLE_TB_ANALOG_DEVICE_2 != null && DB_TABLE_TB_ANALOG_DEVICE_2.Count != 0)
- {
-
- _Db.Execute(_Sql.Delete_Table("TB_ANALOG_DEVICE_2", ReceiverID));
- }
- else
- {
-
- _Db.Execute(_Sql.Create_TB_ANALOG_DEVICE_2());
- }
-
- ProgressBar_TotalCount = 3 + 50;
-
- foreach (_Excel_Sheet Excel_Sheet in _Data.List_ExcelPoint)
- {
- ProgressBar_TotalCount = ProgressBar_TotalCount + Excel_Sheet.List_Repeater.Count;
- }
- }
- else if (Type == _Text.UI_TREE_OPER_GROUP)
- {
-
- _Db.Execute(_Sql.Delete_Table("TB_GROUP", ReceiverID));
-
-
-
- ProgressBar_TotalCount = _Data.List_ExcelGroup.Count;
- }
- else
- {
-
- _Db.Execute(_Sql.Delete_Table("TB_MAP", ReceiverID));
- _Db.Execute(_Sql.Delete_Table("TB_MAP_PROCESS", "MAP_RECEIVER_ID", ReceiverID, null));
-
-
- ProgressBar_TotalCount = _Data.List_ExcelMap.Count;
- }
-
- UiProgressBar_ExcelImport.Maximum = ProgressBar_TotalCount;
-
- UiProgressBar_ExcelImport.Value = 0;
-
- Thread WorkingThread = new Thread(new ThreadStart(Excel_Import));
-
- WorkingThread.Start();
- }
- else
- _Data.Enable_Button = true;
-
- _Event.PopupClose_SendMessage_Event -= new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event);
- }
-
- private void Timer_Renew_Tick(object sender, EventArgs e)
- {
- if (ui_renew == true)
- {
- if (Type == _Text.UI_TREE_POINT)
- {
- _Event.WorkViewPageName_SendMessage_Write(ReceiverID, Object_Type.POINT, null, null);
- }
- else if (Type == _Text.UI_TREE_OPER_GROUP)
- {
-
- _Event.WorkViewPageName_SendMessage_Write(ReceiverID, Object_Type.OPER_GROUP, null, null);
- }
- else
- {
-
- _Event.WorkViewPageName_SendMessage_Write(ReceiverID, Object_Type.OPER_SET, null, null);
- }
-
- ui_renew = false;
-
- Timer_Renew.Stop();
- }
- }
- }
- }
|