示例#1
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || textBox2.Text == "")
            {
                MessageBox.Show("경기결과를 입력해 주십시오");
            }
            else
            {
                this.m_pre_result      = new previous_result();
                this.m_pre_result.Type = (int)PacketType.이전경기결과제출;
                judgeID();
                this.m_pre_result.myTeam  = this.Tname;
                this.m_pre_result.opTeam  = this.OPTeam;
                this.m_pre_result.myScore = int.Parse(textBox1.Text);
                this.m_pre_result.OPScore = int.Parse(textBox2.Text);
                this.m_pre_result.time    = this.time;
                this.m_pre_result.date    = this.date;
                this.m_pre_result.loginID = parent.returnID();

                Packet.Serialize(this.m_pre_result).CopyTo(this.sendBuf, 0);
                this.m_networkstream = m_client.GetStream();
                this.Send();
            }
            initial();
            getResult();
        }
示例#2
0
        private void pre_result(int n)
        {
            // 현재 날짜 기준 이전경기 결과 존재 확인
            this.m_pre_result         = new previous_result();
            this.m_pre_result.Type    = (int)PacketType.이전경기결과확인;
            this.m_pre_result.myTeam  = ID_txtBox.Text;
            this.m_pre_result.curDate = DateTime.Today.ToShortDateString();

            Packet.Serialize(this.m_pre_result).CopyTo(this.sendBuffer, 0);
            this.stream = clientSocket.GetStream();
            this.Send();

            this.Recv();
            Packet packet3 = (Packet)Packet.Deserialize(this.readBuffer);

            if ((int)packet3.Type == (int)PacketType.이전경기결과확인)
            {
                this.m_pre_result = (previous_result)Packet.Deserialize(this.readBuffer);
                if ((int)m_pre_result.pre_result == 1)
                {
                    Result myResult = new Result(this);

                    if (myResult.ShowDialog() == DialogResult.OK)
                    {
                        MessageBox.Show("Completed!", "Success",
                                        MessageBoxButtons.OK, MessageBoxIcon.None); //성공 메시지 띄우기
                    }
                }
                else if (n == -1)
                {
                    MessageBox.Show("입력하실 경기 결과가 없습니다.");
                }
            }
        }
示例#3
0
        public void getResult()
        {
            this.m_pre_result        = new previous_result();
            this.m_pre_result.Type   = (int)PacketType.이전경기결과;
            this.m_pre_result.myTeam = Tname;
            this.m_pre_result.date   = DateTime.Today.ToShortDateString();

            Packet.Serialize(this.m_pre_result).CopyTo(this.sendBuf, 0);
            this.m_networkstream = m_client.GetStream();
            this.Send();

            this.Recv();
            Packet packet = (Packet)Packet.Deserialize(this.readBuf);

            if ((int)packet.Type == (int)PacketType.이전경기결과)
            {
                this.m_pre_result = (previous_result)Packet.Deserialize(this.readBuf);
                if (m_pre_result.pre_result != 0)
                {
                    //////////////수정/////////////
                    this.Tname  = m_pre_result.myTeam;
                    this.OPTeam = m_pre_result.opTeam;
                    this.date   = m_pre_result.date;
                    this.time   = m_pre_result.time;


                    label5.Text = this.Tname;
                    label4.Text = this.OPTeam;
                    label1.Text = this.date;
                    label2.Text = parent.returnTime(this.time);
                    ////////////////////////////////
                }
                else
                {
                    this.DialogResult = DialogResult.OK;
                }
            }
        }
示例#4
0
        /// <summary>
        /// ////////////////////////////// 수정 ///////////////////////////////
        /// </summary>
        private void my_result()
        {
            previous_result r = new previous_result();

            r.Type    = (int)PacketType.최근결과;
            r.loginID = ID_txtBox.Text;

            Packet.Serialize(r).CopyTo(this.sendBuffer, 0);
            this.stream = clientSocket.GetStream();
            this.Send();
            int count = 0;

            while (true)
            {
                this.Recv();
                Packet packet = (Packet)Packet.Deserialize(this.readBuffer);
                if ((int)packet.Type == (int)PacketType.최근결과)
                {
                    r = (previous_result)Packet.Deserialize(this.readBuffer);
                    count++;

                    if (r.myScore == -1)
                    {
                        break;
                    }

                    string    date   = r.date;
                    string    t1     = r.myTeam;
                    string    t2     = r.opTeam;
                    int       s1     = r.myScore;
                    int       s2     = r.OPScore;
                    int       res    = 0; // 1 : 승, -1 : 패, 0 : 무
                    string    dlabel = "res_date" + count;
                    Control[] con    = this.Controls.Find(dlabel, true);
                    Label     date1  = (Label)con[0];
                    date1.Text = date;
                    //MessageBox.Show(t1 + " "+t2);
                    string lt1  = "a" + count;
                    string lt2  = "b" + count;
                    string pic  = "p" + count;
                    string pic1 = "d" + count;

                    con = this.Controls.Find(lt1, true);
                    Label a1 = (Label)con[0];

                    con = this.Controls.Find(lt2, true);
                    Label b1 = (Label)con[0];

                    con = this.Controls.Find(pic, true);
                    PictureBox c1 = (PictureBox)con[0];

                    con = this.Controls.Find(pic1, true);
                    PictureBox d1 = (PictureBox)con[0];

                    if (t1 == ID_txtBox.Text)
                    {
                        if (s1 > s2)
                        {
                            //c1.Image = Image.FromFile("win.png");
                            c1.BringToFront();
                        }

                        a1.Text = t1 + "  " + s1;
                        b1.Text = s2 + "  " + t2;
                        a1.BringToFront();
                        b1.BringToFront();
                        d1.BringToFront();
                    }
                    else
                    {
                        if (s1 < s2)
                        {
                            //c1.Image = Image.FromFile("win.png");
                            c1.BringToFront();
                        }
                        a1.Text = t2 + "  " + s2;
                        b1.Text = s1 + "  " + t1;
                        a1.BringToFront();
                        b1.BringToFront();
                        d1.BringToFront();
                    }
                }
            }
        }
示例#5
0
        private void Login_btn_Click(object sender, EventArgs e)
        {
            if (ID_txtBox.Text != "")
            {
                if (PW_txtBox.Text != "")
                {
                    //팀이름 정보 서버에 보내기
                    this.m_Team_Info        = new Team_Info();
                    this.m_Team_Info.Type   = (int)PacketType.팀이름확인;
                    this.m_Team_Info.t_name = ID_txtBox.Text;

                    Packet.Serialize(this.m_Team_Info).CopyTo(this.sendBuffer, 0);
                    this.stream = clientSocket.GetStream();
                    this.Send();

                    //(정상인지 오류인지) 해당 팀 이름이 이미 사용중인지 아닌지 정보 받기
                    this.Recv();
                    Packet packet = (Packet)Packet.Deserialize(this.readBuffer);

                    if ((int)packet.Type == (int)PacketType.팀이름확인)
                    {
                        this.m_Team_Info = (Team_Info)Packet.Deserialize(this.readBuffer);
                        if ((int)m_Team_Info.Error == (int)PacketSendERROR.에러)     //이미 존재하는 팀이름
                        {
                            //패스워드 정보 서버에 보내기
                            this.m_Team_Info        = new Team_Info();
                            this.m_Team_Info.Type   = (int)PacketType.패스워드확인;
                            this.m_Team_Info.t_name = ID_txtBox.Text;
                            this.m_Team_Info.pw     = PW_txtBox.Text;

                            Packet.Serialize(this.m_Team_Info).CopyTo(this.sendBuffer, 0);
                            this.stream = clientSocket.GetStream();
                            this.Send();

                            //(정상인지 오류인지) 해당 패스워드가 맞는지 확인하는 정보 받기
                            this.Recv();
                            Packet packet2 = (Packet)Packet.Deserialize(this.readBuffer);
                            if ((int)packet2.Type == (int)PacketType.패스워드확인)
                            {
                                this.m_Team_Info = (Team_Info)Packet.Deserialize(this.readBuffer);
                                if ((int)m_Team_Info.Error == (int)PacketSendERROR.정상)     //패스워드정상
                                {
                                    // 현재 날짜 기준 이전경기 결과 존재 확인
                                    this.m_pre_result         = new previous_result();
                                    this.m_pre_result.Type    = (int)PacketType.이전경기결과확인;
                                    this.m_pre_result.myTeam  = ID_txtBox.Text;
                                    this.m_pre_result.curDate = DateTime.Today.ToShortDateString();

                                    Packet.Serialize(this.m_pre_result).CopyTo(this.sendBuffer, 0);
                                    this.stream = clientSocket.GetStream();
                                    this.Send();

                                    this.Recv();
                                    Packet packet3 = (Packet)Packet.Deserialize(this.readBuffer);

                                    if ((int)packet3.Type == (int)PacketType.이전경기결과확인)
                                    {
                                        this.m_pre_result = (previous_result)Packet.Deserialize(this.readBuffer);
                                        if ((int)m_pre_result.pre_result == 1)
                                        {
                                            Result myResult = new Result(this);

                                            if (myResult.ShowDialog() == DialogResult.OK)
                                            {
                                                MessageBox.Show("Completed!", "Success",
                                                                MessageBoxButtons.OK, MessageBoxIcon.None); //성공 메시지 띄우기
                                            }
                                        }
                                    }

                                    pn_reser.Controls.Add(picker);
                                    unVisible();
                                    res_inform();
                                    pn_menu.Visible     = true;
                                    pn_sideMenu.Visible = true;
                                    update_msg_panel();
                                    pn_reser.Visible          = true;
                                    btn_reser.BackgroundImage = Image.FromFile("onReservation.png");
                                    pn_sideMenu.BringToFront();     // sideMenu Panel 맨 앞으로
                                    this.Text = ID_txtBox.Text;
                                }
                                else if ((int)m_Team_Info.Error == (int)PacketSendERROR.존재)
                                {
                                    MessageBox.Show("Existing Client!", "Failed",
                                                    MessageBoxButtons.OK, MessageBoxIcon.None); //에러 메시지 띄우기
                                }
                                else if ((int)m_Team_Info.Error == (int)PacketSendERROR.에러)
                                {
                                    MessageBox.Show("Password Incorrect!", "Failed",
                                                    MessageBoxButtons.OK, MessageBoxIcon.None); //에러 메시지 띄우기
                                }
                            }
                        }
                        else if ((int)m_Team_Info.Error == (int)PacketSendERROR.정상)//존재하지 않음
                        {
                            MessageBox.Show("Team Name Incorrect!\n If you don't have your Team Name, Just Please Join, First!", "Failed",
                                            MessageBoxButtons.OK, MessageBoxIcon.None); //에러 메시지 띄우기
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Input your Password!", "Failed",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error); //에러 메시지 띄우기
                }
            }
            else
            {
                MessageBox.Show("Input your Team Name!", "Failed",
                                MessageBoxButtons.OK, MessageBoxIcon.Error); //에러 메시지 띄우기
            }
        }