Beispiel #1
0
        /// <summary>
        /// 저장 버튼 클릭 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void saveBtn_Click(object sender, EventArgs e)
        {
            try
            {
                switch (this.ncasButton.Name)
                {
                case "termGroupBtn1":
                    GroupContentMng.LstGroupContent[0].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[0].Title = this.groupNameTextBox.Text;
                    GroupData groupData = null;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[0].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "termGroupBtn2":
                    GroupContentMng.LstGroupContent[1].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[1].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[1].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "termGroupBtn3":
                    GroupContentMng.LstGroupContent[2].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[2].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[2].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "termGroupBtn4":
                    GroupContentMng.LstGroupContent[3].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[3].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[3].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "termGroupBtn5":
                    GroupContentMng.LstGroupContent[4].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[4].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[4].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "termGroupBtn6":
                    GroupContentMng.LstGroupContent[5].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[5].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[5].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "termGroupBtn7":
                    GroupContentMng.LstGroupContent[6].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[6].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[6].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "termGroupBtn8":
                    GroupContentMng.LstGroupContent[7].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[7].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[7].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "termGroupBtn9":
                    GroupContentMng.LstGroupContent[8].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[8].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[8].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "termGroupBtn10":
                    GroupContentMng.LstGroupContent[9].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[9].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[9].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "distGroupBtn1":
                    GroupContentMng.LstGroupContent[10].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[10].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[10].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "distGroupBtn2":
                    GroupContentMng.LstGroupContent[11].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[11].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[11].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;
                }

                MessageBox.Show("그룹 정보가 저장되었습니다.", "그룹 편집", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                NCasLoggingMng.ILoggingException.WriteException("OrderGroupEditForm", "OrderGroupEditForm.saveBtn_Click Method", ex);
                MessageBox.Show("그룹 정보 저장에 실패했습니다.\n다시 시도하세요.", "그룹 편집", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 그룹 정보 로드
        /// </summary>
        public static void LoadGroupContent()
        {
            try
            {
                if (!File.Exists(filePath))
                {
                    #region 그룹 XML파일 생성
                    GroupData groupData = new GroupData();
                    groupData.IsDist = false;
                    GroupContent groupContent = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "단말그룹1";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = false;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "단말그룹2";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = false;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "단말그룹3";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = false;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "단말그룹4";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = false;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "단말그룹5";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = false;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "단말그룹6";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = false;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "단말그룹7";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = false;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "단말그룹8";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = false;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "단말그룹9";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = false;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "단말그룹10";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = true;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "시군그룹1";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = true;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "시군그룹2";
                    GroupContentMng.AddGroupContent(groupContent);
                    #endregion

                    return;
                }

                using (Stream stream = new FileStream(filePath, FileMode.Open))
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(GroupContentContainer));
                    lstGroupContent = (GroupContentContainer)serializer.Deserialize(stream);
                }
            }
            catch (Exception ex)
            {
                NCasLoggingMng.ILoggingException.WriteException("GroupContentMng", "LoadGroupContent() Method", ex);
            }
        }