Esempio n. 1
0
        private void showNoticeResultFromDB(string[] tempMsg)// ntime†content†nmode†title†안읽은사람1:안읽은사람2:...
        {

            logWrite("showNoticeResultFromDB 실행"); 
            string noticetime = "";
            string title = "";
            string content = "";
            string mode = "";
            ArrayList notreader = new ArrayList();


            try
            {
                if (isMadeNoticeResult == false)
                {
                    if (noticeresultform != null)
                        noticeresultform.Close();
                    noticeresultform = new NoticeResultForm();
                    noticeresultform.listView1.Click += new EventHandler(listView1_Click);
                    noticeresultform.FormClosing += new FormClosingEventHandler(noticeresultform_FormClosing);
                    noticeresultform.FormClosed += new FormClosedEventHandler(noticeresultform_FormClosed);

                    foreach (string strarr in tempMsg)
                    {
                        logWrite(strarr);
                        string[] itemarr = strarr.Split('†');

                        if (itemarr.Length > 3)
                        {
                            noticetime = itemarr[0];
                            content = itemarr[1];
                            mode = itemarr[2];
                            title = itemarr[3];
                            string[] readers = itemarr[4].Split(':');
                            foreach (string readerid in readers)
                            {
                                if (readerid.Trim().Length > 0)
                                {
                                    notreader.Add(readerid.Trim());
                                }
                            }

                            //발송 공지 항목을 리스트에 추가
                            ListViewItem item = noticeresultform.listView1.Items.Add(noticetime, "자세히", null);
                            item.Tag = noticetime;
                            item.SubItems.Add(noticetime);
                            if (mode.Equals("e"))
                            {
                                item.SubItems.Add("긴급");
                            }
                            else
                            {
                                item.SubItems.Add("일반");
                            }
                            item.SubItems.Add(title);
                            item.SubItems.Add(content);

                            //발송 공지 항목 각각의 상세 확인 리스트폼 생성
                            NoticeDetailResultForm noticedetailresultform = new NoticeDetailResultForm();
                            noticedetailresultform.FormClosing += new FormClosingEventHandler(noticedetailresultform_FormClosing);
                            foreach (DictionaryEntry de in MemberInfoList)
                            {
                                string receiver = de.Value.ToString() + "(" + de.Key.ToString() + ")";
                                ListViewItem ditem = noticedetailresultform.listView1.Items.Add(de.Key.ToString(), receiver, null);

                                if (notreader.Contains(de.Key.ToString()))
                                {
                                    ditem.ForeColor = Color.Red;
                                    ListViewItem.ListViewSubItem subitem = ditem.SubItems.Add("확인안함");
                                }
                                else
                                {
                                    ditem.ForeColor = Color.Blue;
                                    ListViewItem.ListViewSubItem subitem = ditem.SubItems.Add("읽음");
                                }
                            }

                            NoticeDetailForm[noticetime] = noticedetailresultform;
                        }
                    }
                }
                else
                {
                    foreach (string strarr in tempMsg)
                    {
                        string[] itemarr = strarr.Split('†');

                        if (itemarr.Length > 3)
                        {
                            noticetime = itemarr[0];
                            content = itemarr[1];
                            mode = itemarr[2];
                            title = itemarr[3];
                            string[] readers = itemarr[4].Split(':');

                            foreach (string readerid in readers)
                            {
                                if (readerid.Trim().Length > 0)
                                {
                                    notreader.Add(readerid.Trim());
                                }
                            }

                            ListView.ListViewItemCollection collection = noticeresultform.listView1.Items;
                            bool isexist = false;

                            foreach (ListViewItem row in collection)
                            {
                                if (noticetime.Equals(row.Tag.ToString().Trim()))
                                {
                                    isexist = true;
                                    break;
                                }
                            }

                            if (isexist == false)
                            {
                                ListViewItem item = noticeresultform.listView1.Items.Add(noticetime, "자세히", null);
                                item.Tag = noticetime;
                                item.SubItems.Add(noticetime);
                                item.SubItems.Add(mode);
                                item.SubItems.Add(title);
                                item.SubItems.Add(content);

                                NoticeDetailResultForm noticedetailresultform = new NoticeDetailResultForm();
                                noticedetailresultform.FormClosing += new FormClosingEventHandler(noticedetailresultform_FormClosing);
                                foreach (DictionaryEntry de in MemberInfoList)
                                {
                                    string receiver = de.Value.ToString() + "(" + de.Key.ToString() + ")";
                                    ListViewItem ditem = noticedetailresultform.listView1.Items.Add(de.Key.ToString(), receiver, null);

                                    if (notreader.Contains(de.Key.ToString()))
                                    {
                                        ditem.ForeColor = Color.Red;
                                        ListViewItem.ListViewSubItem subitem = ditem.SubItems.Add("확인안함");
                                    }
                                    else
                                    {
                                        ditem.ForeColor = Color.Blue;
                                        ListViewItem.ListViewSubItem subitem = ditem.SubItems.Add("읽음");
                                    }
                                }
                                NoticeDetailForm[noticetime] = noticedetailresultform;
                            }

                        }
                    }
                }

                noticeresultform.Show();
            }
            catch (Exception e)
            {
                logWrite(e.ToString());
            }
        }
Esempio n. 2
0
        private void MakeNoticeResult(string noticetime, string title, string content, string mode)
        {
            try
            {
                if (isMadeNoticeResult == false)
                {
                    if (noticeresultform != null)
                        noticeresultform.Close();
                    noticeresultform = new NoticeResultForm();
                    noticeresultform.listView1.Click += new EventHandler(listView1_Click);
                    noticeresultform.FormClosing += new FormClosingEventHandler(noticeresultform_FormClosing);
                    noticeresultform.FormClosed += new FormClosedEventHandler(noticeresultform_FormClosed);

                    ListViewItem item = noticeresultform.listView1.Items.Add(noticetime, "자세히", null);
                    item.Tag = noticetime;
                    item.SubItems.Add(noticetime);
                    item.SubItems.Add(mode);
                    item.SubItems.Add(title);
                    item.SubItems.Add(content);

                    NoticeDetailResultForm noticedetailresultform = new NoticeDetailResultForm();
                    noticedetailresultform.FormClosing += new FormClosingEventHandler(noticedetailresultform_FormClosing);
                    foreach (DictionaryEntry de in MemberInfoList)
                    {
                        string receiver = de.Value.ToString() + "(" + de.Key.ToString() + ")";
                        ListViewItem ditem = noticedetailresultform.listView1.Items.Add(de.Key.ToString(), receiver, null);
                        ditem.ForeColor = Color.Red;
                        ListViewItem.ListViewSubItem subitem = ditem.SubItems.Add("확인 안함");
                    }
                    isMadeNoticeResult = true;
                    NoticeDetailForm[noticetime] = noticedetailresultform;
                }
                else
                {
                    ListViewItem item = noticeresultform.listView1.Items.Add(noticetime, "자세히", null);
                    item.Tag = noticetime;
                    item.SubItems.Add(noticetime);
                    item.SubItems.Add(mode);
                    item.SubItems.Add(title);
                    item.SubItems.Add(content);

                    NoticeDetailResultForm noticedetailresultform = new NoticeDetailResultForm();
                    noticedetailresultform.FormClosing += new FormClosingEventHandler(noticedetailresultform_FormClosing);
                    foreach (DictionaryEntry de in MemberInfoList)
                    {
                        string receiver = de.Value.ToString() + "(" + de.Key.ToString() + ")";
                        ListViewItem ditem = noticedetailresultform.listView1.Items.Add(de.Key.ToString(), receiver, null);
                        ditem.ForeColor = Color.Red;
                        ditem.SubItems.Add("확인 안함");
                    }
                    NoticeDetailForm[noticetime] = noticedetailresultform;
                }
            }
            catch (Exception e)
            {
                logWrite(e.ToString());
            }
        }