Exemplo n.º 1
0
        private int GetMatchStatusID()
        {
            int iStatus = -1;

            try
            {
                string strSQL = string.Format("SELECT F_MatchStatusID FROM TS_Match WHERE F_MatchID = {0}", m_nCurMatchID);

                SqlCommand SqlCommand = new SqlCommand();
                SqlCommand.Connection  = SHCommon.g_DataBaseCon;
                SqlCommand.CommandText = strSQL;

                if (SHCommon.g_DataBaseCon.State == System.Data.ConnectionState.Closed)
                {
                    SHCommon.g_DataBaseCon.Open();
                }
                SqlDataReader reader = SqlCommand.ExecuteReader();
                while (reader.Read())
                {
                    iStatus = SHCommon.Str2Int(reader[0]);
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(ex.Message);
            }

            return(iStatus);
        }
Exemplo n.º 2
0
        private int GetRegisterIDByBib(string strBib)
        {
            int iRegister = -1;

            try
            {
                string strSQL = string.Format("select F_RegisterID FROM TS_Match_Result AS M LEFT JOIN TR_Register AS R ON M.F_RegisterID = R.F_RegisterID WHERE M.F_MatchID = {0} AND R.F_Bib = {1} "
                                              , m_nCurMatchID, strBib);

                SqlCommand SqlCommand = new SqlCommand();
                SqlCommand.Connection  = SHCommon.g_DataBaseCon;
                SqlCommand.CommandText = strSQL;

                if (SHCommon.g_DataBaseCon.State == System.Data.ConnectionState.Closed)
                {
                    SHCommon.g_DataBaseCon.Open();
                }

                SqlDataReader reader = SqlCommand.ExecuteReader();
                while (reader.Read())
                {
                    string strRegisterID = reader[0].ToString();
                    iRegister = SHCommon.Str2Int(strRegisterID);
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(ex.Message);
            }


            return(iRegister);
        }
Exemplo n.º 3
0
        public void GetShotCount()
        {
            try
            {
                string strSQL = string.Format("SELECT DBO.Func_SH_GetShotCount({0})", m_nCurMatchID);

                SqlCommand SqlCommand = new SqlCommand();
                SqlCommand.Connection  = SHCommon.g_DataBaseCon;
                SqlCommand.CommandText = strSQL;

                if (SHCommon.g_DataBaseCon.State == System.Data.ConnectionState.Closed)
                {
                    SHCommon.g_DataBaseCon.Open();
                }
                SqlDataReader reader = SqlCommand.ExecuteReader();
                while (reader.Read())
                {
                    m_nShotCount = SHCommon.Str2Int(reader[0]);
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(ex.Message);
            }
        }
Exemplo n.º 4
0
        private void textSeries_TextChanged(object sender, EventArgs e)
        {
            if (textSeries.Text == "")
            {
                return;
            }

            string strShotValue = textScore.Text;
            int    iShotIndex   = SHCommon.Str2Int(textSeries.Text);

            if (iShotIndex > m_nShotCount)
            {
                MessageBox.Show("ShotIndex Valid ");
                return;
            }

            int   icol     = SHCommon.Str2Int(textSeries.Text) + iHeaderCount - 1;
            Color oldColor = dgv_List.Rows[0].Cells[0].Style.SelectionBackColor;

            for (int i = 0; i < dgv_List.Rows[m_nCurRow].Cells.Count; i++)
            {
                dgv_List.Rows[m_nCurRow].Cells[i].Style.SelectionBackColor = oldColor;
            }
            dgv_List.Rows[m_nCurRow].Cells[icol].Style.SelectionBackColor = Color.Red;
        }
Exemplo n.º 5
0
        private void textFp_TextChanged(object sender, EventArgs e)
        {
            if (textFp.Text == "")
            {
                return;
            }

            int iRegisterID = GetRegisterIDByFP(textRelay.Text, textFp.Text);

            for (int i = 0; i < dgv_List.RowCount; i++)
            {
                string regid = string.Empty;
                if (dgv_List.Rows[i].Cells[0].Value != null)
                {
                    regid = dgv_List.Rows[i].Cells[0].Value.ToString();
                    if (SHCommon.Str2Int(regid) == iRegisterID)
                    {
                        dgv_List.Rows[i].Selected = true;
                        m_nCurRow = i;
                    }
                    else
                    {
                        dgv_List.Rows[i].Selected = false;
                    }
                }
            }
        }
Exemplo n.º 6
0
        private int GetRegisterIDByFP(string strRelay, string strFP)
        {
            int iRegisterID = -1;

            int iFP = SHCommon.Str2Int(strFP);

            if (iFP <= 0)
            {
                MessageBox.Show("Invalid FirePoint");
                return(iRegisterID);
            }

            int iRelay = SHCommon.Str2Int(strRelay);

            if (iRelay <= 0)
            {
                MessageBox.Show("Invalid Relay");
                return(iRegisterID);
            }

            try
            {
                string strSQL = string.Format("select F_RegisterID FROM TS_Match_Result WHERE F_MatchID = {0} AND F_CompetitionPositionDes1 = {1} AND F_CompetitionPositionDes2 = {1}", m_nCurMatchID, iRelay, iFP);

                SqlCommand SqlCommand = new SqlCommand();
                SqlCommand.Connection  = SHCommon.g_DataBaseCon;
                SqlCommand.CommandText = strSQL;

                if (SHCommon.g_DataBaseCon.State == System.Data.ConnectionState.Closed)
                {
                    SHCommon.g_DataBaseCon.Open();
                }

                SqlDataReader reader = SqlCommand.ExecuteReader();
                while (reader.Read())
                {
                    string strRegisterid = reader[0].ToString();
                    iRegisterID = SHCommon.Str2Int(strRegisterid);
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(ex.Message);
            }


            return(iRegisterID);
        }
Exemplo n.º 7
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (m_strPhaseCode == "1")
            {
                MessageBox.Show("Final Match can't be put here ");
                return;
            }

            if (textSeries.Text == "" || textFp.Text == "" || textRelay.Text == "")
            {
                MessageBox.Show("ShotIndex Valid ");
                return;
            }

            int iRegisterid = GetRegisterIDByFP(textRelay.Text, textFp.Text);

            if (iRegisterid <= 0)
            {
                return;
            }

            int iShotIndex = SHCommon.Str2Int(textSeries.Text);

            if (iShotIndex > m_nShotCount)
            {
                MessageBox.Show("ShotIndex Valid ");
                return;
            }

            int iShotTypeNormal = 10; //正常成绩
            int iShotTypeInx    = 20; //内10环成绩

            int iquestion = 6;

            if (PlayerScoreIsExit(iRegisterid, iShotIndex))
            {
                DialogResult r1 = MessageBox.Show("Data already exit, override it ?", "Input information", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                iquestion = (int)r1;
            }

            if (iquestion != 6)
            {
                return;
            }

            int iShotValue = -1;
            int iInxValue  = -1;

            if (textScore.Text != "")
            {
                iShotValue = SHCommon.Str2Int(textScore.Text);
            }
            if (textInx.Text != "")
            {
                iInxValue = SHCommon.Str2Int(textInx.Text);
            }

            UpdateOneShot(iRegisterid, iShotTypeNormal, iShotIndex, iShotValue);
            UpdateOneShot(iRegisterid, iShotTypeInx, iShotIndex, iInxValue);
            UpdateRecord(iRegisterid);
            ShowMatchResult();

            m_oPlugin.DataChangedNotify(OVRDataChangedType.emSplitResult, -1, -1, -1, m_nCurMatchID, m_nCurMatchID, null);


            textFp.Focus();
        }
Exemplo n.º 8
0
        private void ThreadReceive()
        {
            while (bTcpIsConnect)
            {
                Byte[]        data            = new Byte[1024];
                NetworkStream ns              = tc.GetStream();
                int           irec            = ns.Read(data, 0, data.Length);
                string        strMessage      = System.Text.Encoding.ASCII.GetString(data, 0, irec);
                int           iBegin          = strMessage.IndexOf('_');
                int           iEnd            = strMessage.IndexOf("\r\n", iBegin + 1);
                string[]      strMessageArray = strMessage.Split('_');
                foreach (string strOneMessage in strMessageArray)
                {
                    string[] strSplit = strOneMessage.Split(';');
                    if (strSplit.Length > 15)
                    {
                        string strFlag             = strSplit[0];
                        string strBib              = strSplit[3];
                        string strShotOwn          = strSplit[7];
                        string strShotAttribute    = strSplit[9];
                        string strPirmaryScore     = strSplit[10];
                        string strSecondScore      = strSplit[11];
                        string strLogicTargetIndex = strSplit[12];
                        string strShotNumber       = strSplit[13];
                        string strCroodinateX      = strSplit[14];
                        string strCroodinateY      = strSplit[15];

                        if (strFlag == "SHOT")
                        {
                            int iRegisterID = GetRegisterIDByBib(strBib);
                            int iShotIndex  = SHCommon.Str2Int(strShotNumber);

                            int iShotAttr = SHCommon.Str2Int(strShotAttribute);

                            if (strFlag == "SHOT" && iRegisterID > 0 &&
                                iShotIndex <= m_nShotCount &&
                                m_strEventCode != "25R" &&
                                strShotOwn == "3" &&
                                (iShotAttr & 0x0020) == 0)
                            {
                                if (strPirmaryScore == "")
                                {
                                    UpdateOneShot(iRegisterID, 10, iShotIndex, -1);
                                }
                                else
                                {
                                    int iScore = (int)SHCommon.Str2Int(strPirmaryScore);

                                    UpdateOneShot(iRegisterID, 10, iShotIndex, iScore);
                                }

                                UpdateRecord(iRegisterID);
                                ShowMatchResult();

                                m_oPlugin.DataChangedNotify(OVRDataChangedType.emSplitResult, -1, -1, -1, m_nCurMatchID, m_nCurMatchID, null);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 9
0
        private void CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            string strRegisterID = "-1";
            string strShotValue  = "";
            int    iShotType     = 10;//not use
            int    iShotIndex    = e.ColumnIndex - iHeaderCount + 1;

            if (dgv_List.Rows[e.RowIndex].Cells["REG_ID"].Value != null)
            {
                strRegisterID = dgv_List.Rows[e.RowIndex].Cells["REG_ID"].Value.ToString();
            }

            if (dgv_List.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
            {
                strShotValue = dgv_List.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
            }

            if (e.ColumnIndex >= iHeaderCount && e.ColumnIndex < iHeaderCount + m_nShotCount)
            {
                if (strShotValue == "")
                {
                    UpdateOneShot(SHCommon.Str2Int(strRegisterID), iShotType, iShotIndex, -1);
                }
                else
                {
                    int iScore = -1;
                    if (m_strPhaseCode == "1")
                    {
                        iScore = (int)(10 * SHCommon.Str2Double(strShotValue));
                    }
                    else
                    {
                        iScore = (int)(10 * SHCommon.Str2Double(strShotValue));
                    }
                    UpdateOneShot(SHCommon.Str2Int(strRegisterID), iShotType, iShotIndex, iScore);
                }
            }

            if (dgv_List.Columns[e.ColumnIndex].HeaderText == "Soff")
            {
                int iOffScore = -1;

                if (dgv_List.Rows[e.RowIndex].Cells["Soff"].Value != null)
                {
                    string strOffvalue = dgv_List.Rows[e.RowIndex].Cells["Soff"].Value.ToString();
                    if (strOffvalue != "")
                    {
                        iOffScore = (int)(10 * SHCommon.Str2Double(strOffvalue));
                    }
                }

                UpdateOneShot(SHCommon.Str2Int(strRegisterID), 30, 1, iOffScore);
            }

            if (dgv_List.Columns[e.ColumnIndex].HeaderText == "CB")
            {
                int iOffScore = -1;

                if (dgv_List.Rows[e.RowIndex].Cells["CB"].Value != null)
                {
                    string strOffvalue = dgv_List.Rows[e.RowIndex].Cells["CB"].Value.ToString();
                    if (strOffvalue != "")
                    {
                        iOffScore = (int)(10 * SHCommon.Str2Double(strOffvalue));
                    }
                }

                UpdateOneShot(SHCommon.Str2Int(strRegisterID), 20, 1, iOffScore);
            }

            if (e.ColumnIndex == m_nRemarkIndex)
            {
                if (SHCommon.Str2Int(strRegisterID) > 0)
                {
                    UpdateIRM(SHCommon.Str2Int(strRegisterID), strShotValue);
                }
            }

            UpdateRecord(SHCommon.Str2Int(strRegisterID));

            ShowMatchResult();

            m_oPlugin.DataChangedNotify(OVRDataChangedType.emSplitResult, -1, -1, -1, m_nCurMatchID, m_nCurMatchID, null);
        }