Пример #1
0
        //공지사항 보기이벤트
        private void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            String noticeNum = string.Empty;

            if (lv_notice.SelectedItems.Count == 1)
            {
                ListView.SelectedListViewItemCollection items = lv_notice.SelectedItems;

                foreach (ListViewItem item in items)
                {
                    noticeNum = item.SubItems[0].Text;
                }
            }

            NoticeView nv = new NoticeView(noticeNum);

            nv.Show();
        }
Пример #2
0
        //공지사항
        //처음 로그인 시에만 않읽은 공지사항이 있으면 팝업처리한다.
        public void ShowBoard(Boolean initFg)
        {
            lv_notice.Items.Clear();

            lv_notice.View = View.Details;

            lv_notice.GridLines     = true;
            lv_notice.FullRowSelect = true;

            Hashtable _param = new Hashtable();

            _param.Add("MESSAGE_KB", "0");
            IList <Hashtable> _list = _sel.GetListHashData(_param, "getBoarderList");

            if (_list.Count > 0)
            {
                foreach (Hashtable _item in _list)
                {
                    String[] _boardItem =
                    {
                        _cu.rtnHtS(_item["C_INDEX"]),
                        _cu.rtnHtS(_item["TITLE"]),
                        _cu.rtnHtS(_item["NAME"]),
                        _cu.ToYYYYMMDD(_cu.rtnHtS(_item["REGI_DT"]),true),
                        _cu.rtnHtS(_item["REGI_ID"])
                    };
                    ListViewItem _itemList = new ListViewItem(_boardItem);

                    lv_notice.Items.Add(_itemList);
                }
            }

            //새로운 공지사항을 팝업으로 띄운다.
            if (initFg)
            {
                IList <Hashtable> _newnoticeList = _list.Where(w => !_cu.rtnHtS(w["ID_READER"]).Split(',').Contains(MainProg.GetUserId())).ToList <Hashtable>();

                foreach (Hashtable _item in _newnoticeList)
                {
                    NoticeView nv = new NoticeView(_cu.rtnHtS(_item["C_INDEX"]));
                    nv.Show();
                }
            }
        }
Пример #3
0
        //데이터 받았을 때 발생하는 이벤트
        void OnReceive(Client sender, int msgType, byte[] buff)
        {
            string  s        = System.Text.Encoding.UTF8.GetString(buff);
            JObject jObject  = JObject.Parse(s);
            int     packetID = (int)jObject["PacketID"];

            PacketResponse response = new PacketResponse((PacketID)packetID, s);

            if (packetID == (int)PacketID.PacketID_Connect_Req)
            {
                PacketData_ConnectReq req = response.Parsing <PacketData_ConnectReq>();
                String _connetedUsers     = String.Empty;
                Invoke((MethodInvoker) delegate
                {
                    //처음 실행시 가져오는 전체유저정보취득
                    MainProg.Instance.getUserLIst(req.userList);

                    //처음 실행시 가져오는 공지사항
                    if (req.noticeList != null)
                    {
                        ShowBoard(true, req.noticeList);
                    }

                    //처음 실행시 가져오는 읽지 않은 메세지
                    if (req.messageList != null)
                    {
                        getReadMessage(req.messageList);
                    }

                    //로그인한 사람 저장
                    presentSessionList = req.presentSessionList;
                });
                foreach (String users in presentSessionList)
                {
                    _connetedUsers += "F" + users + "^";
                }

                //로그인하면 화면 처리(로그인한사람)
                this.Invoke(new Action(() => { webBrowser1.Document.InvokeScript("onLineMark", new object[] { _connetedUsers }); }));
            }
            else if (packetID == (int)PacketID.PacketID_DisConnect_Req)
            {
                PacketData_DisConnectReq req = response.Parsing <PacketData_DisConnectReq>();
                String _connetedUsers        = String.Empty;

                _connetedUsers += "F" + req.userId + "^";

                //로그아웃이나 종료하면 화면 처리(로그인한사람)
                this.Invoke(new Action(() => { webBrowser1.Document.InvokeScript("offLineMark", new object[] { _connetedUsers }); }));
            }
            //공지사항 보기
            else if (packetID == (int)PacketID.PacketID_Notice_Detail)
            {
                PacketData_NoticeDetail req = response.Parsing <PacketData_NoticeDetail>();
                Invoke((MethodInvoker) delegate
                {
                    //ShowBoard(false);
                    //수정을 눌렀을 때
                    if (req.noticeProcess.Equals("U"))
                    {
                        NoticeWrite ni = new NoticeWrite(req.noticeDetail, req.noticeNum);
                        //    ni.DataPushEvent_Sub += new NoticeWrite.Sub_DataPushEventHandler(ShowBoard);
                        ni.Show();
                    }
                    else
                    {
                        NoticeView nv = new NoticeView(req.noticeDetail);
                        nv.Show();
                    }
                });
            }
            //공지사항 등록 및 수정시
            else if (packetID == (int)PacketID.PacketID_Send_Notice)
            {
                PacketData_SendNotice req = response.Parsing <PacketData_SendNotice>();
                Invoke((MethodInvoker) delegate
                {
                    if (req.noticeProcess.Equals("D"))
                    {
                        ShowBoard(false, req.noticeList);
                    }
                    else
                    {
                        ShowBoard(true, req.noticeList);
                    }

                    //NoticeView nv = new NoticeView(req.boardNo.ToString());
                    //nv.Show();
                });
            }
            //공지사항 찾기
            else if (packetID == (int)PacketID.PacketID_Notice_Find)
            {
                PacketData_NoticeFind req = response.Parsing <PacketData_NoticeFind>();
                Invoke((MethodInvoker) delegate
                {
                    ShowBoard(false, req.noticeList);
                });
            }
            //메세지 관리함 보기
            else if (packetID == (int)PacketID.PacketID_Message_Mng)
            {
                PacketData_MessageMng req = response.Parsing <PacketData_MessageMng>();
                Invoke((MethodInvoker) delegate
                {
                    Form fc = Application.OpenForms["MessageMng"];

                    if (fc != null)
                    {
                        DataSendMessageEvent(req.messageList, null, "1");
                    }
                    else
                    {
                        MessageMng mv = new MessageMng(req.messageList);

                        this.DataSendMessageEvent += new DataPushMessageEventHandler(mv.SetActiveValue);
                        mv.DataSendMessageEvent   += new DataGetMessageEventHandlder(this.DataMessageAction);
                        mv.ShowDialog();
                    }
                });
            }
            //메세지 상세보기
            else if (packetID == (int)PacketID.PacketID_Message_Detail)
            {
                PacketData_MessageDetail req = response.Parsing <PacketData_MessageDetail>();
                Invoke((MethodInvoker) delegate
                {
                    DataSendMessageEvent(req.messageDetail, req.messageReaderDetail, null);
                });
            }
            //메세지 찾기
            else if (packetID == (int)PacketID.PacketID_Message_Search)
            {
                PacketData_MessageSearch req = response.Parsing <PacketData_MessageSearch>();
                Invoke((MethodInvoker) delegate
                {
                    DataSendMessageEvent(req.messageList, null, "1");
                });
            }
            //메세지 회신쓰기
            else if (packetID == (int)PacketID.PacketID_Message_ReWrite)
            {
                PacketData_MessageReWrite req = response.Parsing <PacketData_MessageReWrite>();
                Invoke((MethodInvoker) delegate
                {
                    //DataSendMessageEvent(req.messageDetail, null, "1");
                    MessageFormBox mfb = new MessageFormBox(req.rcvUser, null, req.messageDetail);
                    mfb.Show();
                });
            }

            //메세지 받기
            else if (packetID == (int)PacketID.PacketID_Send_Msg)
            {
                PacketData_SendMessage req = response.Parsing <PacketData_SendMessage>();
                Invoke((MethodInvoker) delegate
                {
                    //MessageView mv = new MessageView(req.boardNo.ToString());
                    Form fc = Application.OpenForms["MessageMng"];

                    if (fc != null)
                    {
                        PacketData_MessageMng req_2 = new PacketData_MessageMng();
                        Hashtable _param            = new Hashtable();
                        _param.Add("MESSAGE_KB", "1");
                        _param.Add("REGI_ID", MainProg.GetUserId());
                        req_2.criInfo = _param;
                        req_2.process = "1";
                        MainProg.client.Send(req_2);
                    }

                    MessageView mv = new MessageView(req.messageDetail, req.userId, req.boardNo);
                    mv.Show();
                });
            }
            //채팅방 만들기
            else if (packetID == (int)PacketID.PacketID_Make_Room)
            {
                PacketData_MakeRoom req = response.Parsing <PacketData_MakeRoom>();
                Invoke((MethodInvoker) delegate
                {
                    if (!_userId.Equals(req.makeUserId))
                    {
                        ChatForm cf = new ChatForm(false, req, _userId, null);

                        this.DataSendEvent += new DataPushEventHandler(cf.SetActiveValue);
                        cf.DataSendEvent   += new DataGetEventHandlder(this.DataAction);

                        cf.Show();
                    }
                });
            }
            //방없애기
            else if (packetID == (int)PacketID.PacketID_Close_Room)
            {
                PacketData_CloseRoom req = response.Parsing <PacketData_CloseRoom>();
                Invoke((MethodInvoker) delegate
                {
                    DataSendEvent("close_theRoom", req.roomNo, req.userId);
                });
            }
            //방채팅
            else if (packetID == (int)PacketID.PacketID_Room_Msg)
            {
                PacketData_SendRoomMessage req = response.Parsing <PacketData_SendRoomMessage>();
                Invoke((MethodInvoker) delegate
                {
                    rb2.Text += req.message;
                    DataSendEvent(req.message, req.roomNo, req.sendUserId);
                });
            }
            //조직도 Reload
            else if (packetID == (int)PacketID.PacketID_ReloadGroup)
            {
                //화면 리로드 처리
                webBrowser1.Refresh();
            }
            //else
            //{
            //    RecvConnectAck(sender, response);
            //}
        }
Пример #4
0
        //데이터 받았을 때 발생하는 이벤트
        void OnReceive(Client sender, int msgType, byte[] buff)
        {
            string  s        = System.Text.Encoding.UTF8.GetString(buff);
            JObject jObject  = JObject.Parse(s);
            int     packetID = (int)jObject["PacketID"];

            PacketResponse response = new PacketResponse((PacketID)packetID, s);

            if (packetID == (int)PacketID.PacketID_Connect_Req)
            {
                PacketData_ConnectReq req = response.Parsing <PacketData_ConnectReq>();
                String _connetedUsers     = String.Empty;
                Invoke((MethodInvoker) delegate
                {
                    //로그인한 사람 저장
                    presentSessionList = req.presentSessionList;
                });
                foreach (String users in presentSessionList)
                {
                    _connetedUsers += "F" + users + "^";
                }

                //로그인하면 화면 처리(로그인한사람)
                this.Invoke(new Action(() => { webBrowser1.Document.InvokeScript("onLineMark", new object[] { _connetedUsers }); }));
            }
            else if (packetID == (int)PacketID.PacketID_DisConnect_Req)
            {
                PacketData_DisConnectReq req = response.Parsing <PacketData_DisConnectReq>();
                String _connetedUsers        = String.Empty;

                _connetedUsers += "F" + req.userId + "^";

                //로그아웃이나 종료하면 화면 처리(로그인한사람)
                this.Invoke(new Action(() => { webBrowser1.Document.InvokeScript("offLineMark", new object[] { _connetedUsers }); }));
            }
            //공지사항 등록 및 수정시
            else if (packetID == (int)PacketID.PacketID_Send_Notice)
            {
                PacketData_SendNotice req = response.Parsing <PacketData_SendNotice>();
                Invoke((MethodInvoker) delegate
                {
                    ShowBoard(false);
                    NoticeView nv = new NoticeView(req.boardNo.ToString());
                    nv.Show();
                });
            }
            //메세지 받기
            else if (packetID == (int)PacketID.PacketID_Send_Msg)
            {
                PacketData_SendMessage req = response.Parsing <PacketData_SendMessage>();
                Invoke((MethodInvoker) delegate
                {
                    MessageView mv = new MessageView(req.boardNo.ToString());
                    mv.Show();
                });
            }
            //채팅방 만들기
            else if (packetID == (int)PacketID.PacketID_Make_Room)
            {
                PacketData_MakeRoom req = response.Parsing <PacketData_MakeRoom>();
                Invoke((MethodInvoker) delegate
                {
                    if (!_userId.Equals(req.makeUserId))
                    {
                        ChatForm cf = new ChatForm(false, req, _userId, null);

                        this.DataSendEvent += new DataPushEventHandler(cf.SetActiveValue);
                        cf.DataSendEvent   += new DataGetEventHandlder(this.DataAction);

                        cf.Show();
                    }
                });
            }
            //방없애기
            else if (packetID == (int)PacketID.PacketID_Close_Room)
            {
                PacketData_CloseRoom req = response.Parsing <PacketData_CloseRoom>();
                Invoke((MethodInvoker) delegate
                {
                    DataSendEvent("close_theRoom", req.roomNo, req.userId);
                });
            }
            //방채팅
            else if (packetID == (int)PacketID.PacketID_Room_Msg)
            {
                PacketData_SendRoomMessage req = response.Parsing <PacketData_SendRoomMessage>();
                Invoke((MethodInvoker) delegate
                {
                    rb2.Text += req.message;
                    DataSendEvent(req.message, req.roomNo, req.sendUserId);
                });
            }
            //조직도 Reload
            else if (packetID == (int)PacketID.PacketID_ReloadGroup)
            {
                //화면 리로드 처리
                webBrowser1.Refresh();
            }
            //else
            //{
            //    RecvConnectAck(sender, response);
            //}
        }