123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253 |
- 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 Janus.Windows.GridEX;
- using System.Collections;
- namespace IControls_FireManager
- {
- public partial class Form_AddGroup : Form
- {
-
- ArrayList Sequence = new ArrayList();
-
- string Receiver_ID = null;
- public Form_AddGroup(string RECEIVER_ID)
- {
- InitializeComponent();
-
- Receiver_ID = RECEIVER_ID;
-
- UI_ComboBox_ReceiverID_Initialize();
-
- UI_OutDeviceGroup_GridEx_Initialize();
-
- this.EditBox_GroupName.Text = _Data.Temp_GroupName;
-
-
-
- this.StartPosition = FormStartPosition.Manual;
- this.Location = new System.Drawing.Point(MousePosition.X, MousePosition.Y);
- }
-
- public void UI_ComboBox_ReceiverID_Initialize()
- {
- this.UiComboBox_ReceiverID.Items.Clear();
- this.UiComboBox_ReceiverID.Items.Add(_Text.Null);
- foreach (string receive in _Data.LIST_XMLRECEIVER_ID)
- {
- UiComboBox_ReceiverID.Items.Add(receive);
- }
- }
-
- public void UI_OutDeviceGroup_GridEx_Initialize()
- {
-
-
-
-
- GridEX_GroupList.ClearItems();
-
- int i = 1;
-
- DataRowCollection DB_TABLE_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.SearchAll_Table_Value("TB_GROUP", null));
- if (DB_TABLE_DEVICE != null)
- {
- foreach (DataRow dr in DB_TABLE_DEVICE)
- {
- GridEXRow row;
- row = GridEX_GroupList.AddItem();
- row.BeginEdit();
- row.Cells["Number"].Value = i++;
- row.Cells["ReceiverID"].Value = dr[0].ToString();
- row.Cells["ID"].Value = dr[1].ToString();
- row.Cells["Group"].Value = dr[2].ToString();
- row.EndEdit();
- }
- }
- }
-
- private void UiButton_Search_Group_Click(object sender, EventArgs e)
- {
-
- _Data.Temp_GroupName = this.EditBox_GroupName.Text;
-
- GridEX_GroupList.ClearItems();
-
- int i = 1;
-
- DataRowCollection DB_TABLE_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_Table("TB_GROUP", "GROUP_ID", UiComboBox_GroupID.Text, "GROUP_NAME", EditBox_GroupName.Text, this.UiComboBox_ReceiverID.Text));
- if (DB_TABLE_DEVICE != null)
- {
- foreach (DataRow dr in DB_TABLE_DEVICE)
- {
- GridEXRow row;
- row = GridEX_GroupList.AddItem();
- row.BeginEdit();
- row.Cells["Number"].Value = i++;
- row.Cells["ReceiverID"].Value = dr[0].ToString();
- row.Cells["ID"].Value = dr[1].ToString();
- row.Cells["Group"].Value = dr[2].ToString();
- row.EndEdit();
- }
- }
- }
-
- private void UiButton_AddDevice_Click(object sender, EventArgs e)
- {
-
-
- if (_Data.Map_No != null)
- {
-
- Sequence.Clear();
- int MaxValue = 0;
- int SelectRowCount = GridEX_GroupList.SelectedItems.Count;
-
- if (SelectRowCount == 0)
- {
-
- _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 250, 150, _Text.GroupNameNotChoice, 0);
- return;
- }
- for (int number = 0; number < SelectRowCount; number++)
- {
- GridEXRow row = GridEX_GroupList.SelectedItems[number].GetRow();
- string Group_ID = row.Cells["ID"].Value.ToString();
-
- Sequence.Add("0");
-
-
-
- DataRowCollection DB_TABLE_MAP_PROCESS = _Db.ExecuteRead_SqlDataAdapter(_Sql.SearchAll_Table_Value_MAP_RECEIVER_ID("TB_MAP_PROCESS", "MAP_NO", _Data.Map_No, "MAP_TYPE", "O", Receiver_ID));
- if (DB_TABLE_MAP_PROCESS != null)
- {
- foreach (DataRow dr in DB_TABLE_MAP_PROCESS)
- {
- if (dr[3] == null || dr[3].ToString().Trim().Length == 0)
- {
- ;
- }
- else
- Sequence.Add(dr[3].ToString());
- }
- }
- foreach (string Value in Sequence)
- {
- if (MaxValue <= Int32.Parse(Value))
- {
- MaxValue = Int32.Parse(Value) + 1;
- }
- }
-
-
- DataRowCollection DB_TABLE_GROUP_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.SearchAll_Table_Value("TB_MAP_PROCESS", "MAP_NO", _Data.Map_No, "GROUP_ID", Group_ID, null));
- if (DB_TABLE_GROUP_DEVICE != null)
- {
-
- if (DB_TABLE_GROUP_DEVICE.Count == 0)
- {
-
- _Db.ADD("TB_MAP_PROCESS",
- "MAP_RECEIVER_ID=" + Receiver_ID +
- ";MAP_NO=" + _Data.Map_No +
- ";MAP_TYPE=" + "O" +
- ";SEQ_NO=" + MaxValue +
- ";PROCESS_TYPE=" + "G" +
- ";GROUP_ID=" + Group_ID +
- ";RECEIVER_ID=" + row.Cells["ReceiverID"].Value.ToString() +
- ";COMM_ID=" + null +
- ";BOARD_ID=" + null +
- ";LOOP_NO=" + null +
- ";REPEATER_ID=" + null +
- ";DEVICE_ID=" + null +
- ";INOUT_TYPE=" + null +
- ";USE_FLAG=" + "Y");
- }
- }
-
- _Event.Form_AddGroup_SendMessage_Write(DEVICE_EVENT.MAP);
- }
-
- _Data.ProJect_Save_Complete = false;
- }
- else
- {
-
- _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 250, 150, _Text.MapChoice, 0);
- return;
- }
- }
-
- private void UiButton_Close_Click(object sender, EventArgs e)
- {
- this.Close();
- }
-
- private void Form_AddGroup_FormClosed(object sender, FormClosedEventArgs e)
- {
-
- _Event.Form_AddGroup_SendMessage_Write(DEVICE_EVENT.MAP_SELECTIONMODE);
- }
-
- private void UiComboBox_GroupID_DroppingDown(object sender, CancelEventArgs e)
- {
- if (this.UiComboBox_ReceiverID.Text == null || this.UiComboBox_ReceiverID.Text.Length == 0)
- {
- _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 250, 150, _Text.ReceiverIDNotInput, 0);
- return;
- }
- this.UiComboBox_GroupID.Items.Clear();
- this.UiComboBox_GroupID.Items.Add(_Text.Null);
-
-
- DataRowCollection DB_TABLE_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.SearchAll_Table_Value("TB_GROUP", this.UiComboBox_ReceiverID.Text));
- if (DB_TABLE_DEVICE != null && DB_TABLE_DEVICE.Count != 0)
- {
- foreach (DataRow dr in DB_TABLE_DEVICE)
- {
-
- UiComboBox_GroupID.Items.Add(dr[1].ToString());
- }
- }
- }
- }
- }
|