コード例 #1
0
ファイル: frmEditDate.cs プロジェクト: jack-liaojie/EQ_C-
        private void btnX_Del_Click(object sender, EventArgs e)
        {
            if (DevComponents.DotNetBar.MessageBoxEx.Show(
                    LocalizationRecourceManager.GetString(OVRMatchScheduleModule.GetSectionName(),
                                                          "OVRMatchSchedule_DateFrom_DelTip"),
                    "", MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }

            DataGridViewSelectedRowCollection l_Rows = this.dgv_Date.SelectedRows;

            foreach (DataGridViewRow r in l_Rows)
            {
                int nRow    = r.Index;
                int nReturn = this.DelDate(this.dgv_Date.Rows[nRow].Cells["F_DisciplineDateID"].Value.ToString());
                if (nReturn == 0)
                {
                    string strSectionName = OVRMatchScheduleModule.GetSectionName();
                    string strText        = LocalizationRecourceManager.GetString(strSectionName, "OVRMatchSchedule_DateFrom_DelFailed");
                    DevComponents.DotNetBar.MessageBoxEx.Show(strText, null, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (nReturn == -2)
                {
                    string strSectionName = OVRMatchScheduleModule.GetSectionName();
                    string strText        = LocalizationRecourceManager.GetString(strSectionName, "OVRMatchSchedule_DateFrom_DelFailed_F2");
                    DevComponents.DotNetBar.MessageBoxEx.Show(strText, null, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            this.Update_DateGrid();
        }
コード例 #2
0
ファイル: frmEditDate.cs プロジェクト: jack-liaojie/EQ_C-
        private void btnX_Add_Click(object sender, EventArgs e)
        {
            string strDate = dateTimeInput1.Value.ToString("yyyy-MM-dd");

            if (strDate == "0001-01-01")
            {
                strDate = "";
            }

            if (strDate.Length == 0)
            {
                return;
            }

            int nReturn = this.AddDate(strDate);

            if (nReturn == 0)
            {
                string strSectionName = OVRMatchScheduleModule.GetSectionName();
                string strText        = LocalizationRecourceManager.GetString(strSectionName, "OVRMatchSchedule_DateFrom_AddFailed");
                DevComponents.DotNetBar.MessageBoxEx.Show(strText, null, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (nReturn == -1)
            {
                string strSectionName = OVRMatchScheduleModule.GetSectionName();
                string strText        = LocalizationRecourceManager.GetString(strSectionName, "OVRMatchSchedule_DateFrom_AddFailed_F1");
                DevComponents.DotNetBar.MessageBoxEx.Show(strText, null, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            this.Update_DateGrid();
        }
コード例 #3
0
ファイル: frmEditSession.cs プロジェクト: jack-liaojie/EQ_C-
        private void Localization()
        {
            string strSectionName = OVRMatchScheduleModule.GetSectionName();

            this.Text             = LocalizationRecourceManager.GetString(strSectionName, "OVRMatchSchedule_SessionFrom_txtTitle");
            this.btnX_Add.Tooltip = LocalizationRecourceManager.GetString(strSectionName, "OVRMatchSchedule_SessionFrom_btnXAdd");
            this.btnX_Del.Tooltip = LocalizationRecourceManager.GetString(strSectionName, "OVRMatchSchedule_SessionFrom_btnXDel");
        }
コード例 #4
0
ファイル: frmEditRound.cs プロジェクト: jack-liaojie/EQ_C-
        private void btnX_Add_Click(object sender, EventArgs e)
        {
            string strEventID = cbEx_Event.SelectedValue.ToString();

            if (strEventID == "All")
            {
                strEventID = "";
            }
            if (strEventID.Length == 0)
            {
                return;
            }

            m_strEventID = strEventID;
            if (!this.AddRound(m_strEventID))
            {
                string strSectionName = OVRMatchScheduleModule.GetSectionName();
                string strText        = LocalizationRecourceManager.GetString(strSectionName, "OVRMatchSchedule_RoundFrom_AddFailed");
                DevComponents.DotNetBar.MessageBoxEx.Show(strText, null, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            this.Update_RoundGrid();
        }
コード例 #5
0
ファイル: frmEditSession.cs プロジェクト: jack-liaojie/EQ_C-
        private void btnX_Add_Click(object sender, EventArgs e)
        {
            string strDate = "";

            strDate = cbEx_Date.Text.ToString();
            if (strDate == "All")
            {
                strDate = "";
            }
            if (strDate.Length == 0)
            {
                return;
            }
            m_strDate = strDate;

            if (!this.AddSession(m_strDate))
            {
                string strSectionName = OVRMatchScheduleModule.GetSectionName();
                string strText        = LocalizationRecourceManager.GetString(strSectionName, "OVRMatchSchedule_SessionFrom_AddFailed");
                DevComponents.DotNetBar.MessageBoxEx.Show(strText, null, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            this.Update_SessionGrid();
        }
コード例 #6
0
        private void MenuSetMatchOIR_Click(object sender, EventArgs e)
        {
            string strSectionName = OVRMatchScheduleModule.GetSectionName();
            OrderInRoundSettingForm frmOrderInRoundSetting = new OrderInRoundSettingForm(strSectionName);

            frmOrderInRoundSetting.DatabaseConnection = this.m_matchScheduleModule.DatabaseConnection;
            frmOrderInRoundSetting.ShowDialog();

            if (frmOrderInRoundSetting.DialogResult != DialogResult.OK || this.dgv_Scheduled.SelectedRows.Count < 1)
            {
                return;
            }

            DataGridViewSelectedRowCollection l_Rows = this.dgv_Scheduled.SelectedRows;

            int[] arSelIndex = new int[l_Rows.Count];
            int   i          = 0;

            foreach (DataGridViewRow r in l_Rows)
            {
                arSelIndex[i++] = r.Index;
            }
            Array.Sort(arSelIndex);

            List <OVRDataChanged> changedList = new List <OVRDataChanged>();

            int iRowIdx = 0;

            foreach (int iSelIndex in arSelIndex)
            {
                try
                {
                    string strOldData = "";
                    if (dgv_Scheduled.Rows[iSelIndex].Cells["O.I.R"].Value != null)
                    {
                        strOldData = dgv_Scheduled.Rows[iSelIndex].Cells["O.I.R"].Value.ToString();
                    }
                    string strNewData = "";

                    int iCode = frmOrderInRoundSetting.StartNumber;
                    if (iCode > -1)
                    {
                        iCode     += iRowIdx * frmOrderInRoundSetting.Step;
                        strNewData = iCode.ToString();
                    }
                    int iLength = frmOrderInRoundSetting.CodeLength;
                    if (iLength < 1)
                    {
                        strNewData = "";
                    }

                    iRowIdx++;

                    if (strNewData == strOldData)
                    {
                        continue;
                    }

                    string strOrderInRound = strNewData;

                    dgv_Scheduled.Rows[iSelIndex].Cells["O.I.R"].Value = strOrderInRound;

                    string strMatchID = this.dgv_Scheduled.Rows[iSelIndex].Cells["F_MatchID"].Value.ToString();
                    this.UpdateMatchOrderInRound(strMatchID, strOrderInRound);

                    int iMatchID = Convert.ToInt32(strMatchID);
                    changedList.Add(new OVRDataChanged(OVRDataChangedType.emMatchOrderInRound, -1, -1, -1, iMatchID, iMatchID, null));
                }
                catch (Exception ex)
                {
                    DevComponents.DotNetBar.MessageBoxEx.Show(ex.Message);
                }
            }
        }
コード例 #7
0
        private void MenuSetMatchCourt_Click(object sender, EventArgs e)
        {
            string strSectionName = OVRMatchScheduleModule.GetSectionName();
            MatchCourtSettingForm frmMatchCourtSetting = new MatchCourtSettingForm(strSectionName);

            frmMatchCourtSetting.DatabaseConnection = this.m_matchScheduleModule.DatabaseConnection;
            frmMatchCourtSetting.m_strDisciplineID  = m_strDisciplineID;
            frmMatchCourtSetting.m_strLanguageCode  = m_strActiveLanguageCode;
            frmMatchCourtSetting.ShowDialog();

            if (frmMatchCourtSetting.DialogResult != DialogResult.OK || this.dgv_Scheduled.SelectedRows.Count < 1)
            {
                return;
            }

            List <OVRDataChanged> changedList = new List <OVRDataChanged>();

            DataGridViewSelectedRowCollection l_Rows = this.dgv_Scheduled.SelectedRows;

            foreach (DataGridViewRow r in l_Rows)
            {
                try
                {
                    string strOldData = "";
                    if (dgv_Scheduled.Rows[r.Index].Cells["F_CourtID"].Value != null)
                    {
                        strOldData = dgv_Scheduled.Rows[r.Index].Cells["F_CourtID"].Value.ToString();
                    }
                    string strNewData = frmMatchCourtSetting.m_strCourtID;

                    if (strNewData == strOldData)
                    {
                        continue;
                    }

                    string strVenueID = frmMatchCourtSetting.m_strVenueID;
                    string strCourtID = strNewData;
                    string strVenue   = frmMatchCourtSetting.m_strVenue;
                    string strCourt   = frmMatchCourtSetting.m_strCourt;

                    if (strVenueID.Length == 0)
                    {
                        dgv_Scheduled.Rows[r.Index].Cells["F_VenueID"].Value = DBNull.Value;
                        dgv_Scheduled.Rows[r.Index].Cells["Venue"].Value     = DBNull.Value;
                    }
                    else
                    {
                        dgv_Scheduled.Rows[r.Index].Cells["F_VenueID"].Value = strVenueID;
                        dgv_Scheduled.Rows[r.Index].Cells["Venue"].Value     = strVenue;
                    }
                    if (strCourtID.Length == 0)
                    {
                        dgv_Scheduled.Rows[r.Index].Cells["F_CourtID"].Value = DBNull.Value;
                        dgv_Scheduled.Rows[r.Index].Cells["Court"].Value     = DBNull.Value;
                    }
                    else
                    {
                        dgv_Scheduled.Rows[r.Index].Cells["F_CourtID"].Value = strCourtID;
                        dgv_Scheduled.Rows[r.Index].Cells["Court"].Value     = strCourt;
                    }

                    string strMatchID = this.dgv_Scheduled.Rows[r.Index].Cells["F_MatchID"].Value.ToString();
                    UpdateMatchVenue(strMatchID, strVenueID);
                    UpdateMatchCourt(strMatchID, strCourtID);

                    int iMatchID    = Convert.ToInt32(strMatchID);
                    int iOldCourtID = -1;
                    if (strOldData.Length != 0)
                    {
                        iOldCourtID = Convert.ToInt32(strOldData);
                    }
                    int iNewCourtID = -1;
                    if (strNewData.Length != 0)
                    {
                        iNewCourtID = Convert.ToInt32(strNewData);
                    }

                    changedList.Add(new OVRDataChanged(OVRDataChangedType.emMatchInfo, -1, -1, -1, iMatchID, iOldCourtID, null));
                    if (strOldData.Length != 0)
                    {
                        changedList.Add(new OVRDataChanged(OVRDataChangedType.emMatchCourtReset, -1, -1, -1, iMatchID, iOldCourtID, null));
                    }
                    changedList.Add(new OVRDataChanged(OVRDataChangedType.emMatchCourtSet, -1, -1, -1, iMatchID, iNewCourtID, null));
                }
                catch (Exception ex)
                {
                    DevComponents.DotNetBar.MessageBoxEx.Show(ex.Message);
                }
            }

            if (changedList.Count > 0)
            {
                m_matchScheduleModule.DataChangedNotify(changedList);
            }
        }
コード例 #8
0
        private void MenuSetMatchEndTime_Click(object sender, EventArgs e)
        {
            string strSectionName = OVRMatchScheduleModule.GetSectionName();
            MatchEndTimeSettingForm frmMatchEndTimeSetting = new MatchEndTimeSettingForm(strSectionName);

            frmMatchEndTimeSetting.DatabaseConnection = this.m_matchScheduleModule.DatabaseConnection;
            frmMatchEndTimeSetting.ShowDialog();

            if (frmMatchEndTimeSetting.DialogResult != DialogResult.OK || this.dgv_Scheduled.SelectedRows.Count < 1)
            {
                return;
            }

            DataGridViewSelectedRowCollection l_Rows = this.dgv_Scheduled.SelectedRows;

            int[] arSelIndex = new int[l_Rows.Count];
            int   i          = 0;

            foreach (DataGridViewRow r in l_Rows)
            {
                arSelIndex[i++] = r.Index;
            }
            Array.Sort(arSelIndex);

            List <OVRDataChanged> changedList = new List <OVRDataChanged>();

            int iRowIdx = 0;

            foreach (int iSelIndex in arSelIndex)
            {
                try
                {
                    string strOldEndTime = "";
                    if (dgv_Scheduled.Rows[iSelIndex].Cells["EndTime"].Value != null)
                    {
                        strOldEndTime = dgv_Scheduled.Rows[iSelIndex].Cells["EndTime"].Value.ToString();
                    }
                    string strNewEndTime = "";

                    string strEndTime  = frmMatchEndTimeSetting.m_strEndTime;
                    string strSpanTime = frmMatchEndTimeSetting.m_strSpanTime;

                    if (strEndTime.Length == 0 &&
                        strSpanTime.Length == 0)
                    {
                        strNewEndTime = "";
                    }
                    else
                    {
                        if (strEndTime.Length == 0)
                        {
                            strEndTime = "00:00:00";
                        }
                        if (strSpanTime.Length == 0)
                        {
                            strSpanTime = "00:00:00";
                        }
                        DateTime tEndTime = DateTime.Parse(strEndTime);
                        TimeSpan tsSpan   = TimeSpan.Parse(strSpanTime);
                        for (int n = 0; n < iRowIdx; n++)
                        {
                            tEndTime += tsSpan;
                        }
                        strNewEndTime = tEndTime.ToString("HH:mm");
                    }
                    iRowIdx++;

                    if (strNewEndTime == strOldEndTime)
                    {
                        continue;
                    }

                    dgv_Scheduled.Rows[iSelIndex].Cells["EndTime"].Value = strNewEndTime;

                    string strMatchID = this.dgv_Scheduled.Rows[iSelIndex].Cells["F_MatchID"].Value.ToString();
                    UpdateMatchEndTime(strMatchID, strNewEndTime);

                    int iMatchID = Convert.ToInt32(strMatchID);
                    changedList.Add(new OVRDataChanged(OVRDataChangedType.emMatchInfo, -1, -1, -1, iMatchID, iMatchID, null));
                }
                catch (Exception ex)
                {
                    DevComponents.DotNetBar.MessageBoxEx.Show(ex.Message);
                }
            }

            if (changedList.Count > 0)
            {
                m_matchScheduleModule.DataChangedNotify(changedList);
            }
        }
コード例 #9
0
        private void MenuSetRaceNumber_Click(object sender, EventArgs e)
        {
            string strSectionName = OVRMatchScheduleModule.GetSectionName();
            RaceNumberSettingForm frmRaceNumberSetting = new RaceNumberSettingForm(strSectionName);

            frmRaceNumberSetting.DatabaseConnection = this.m_matchScheduleModule.DatabaseConnection;
            frmRaceNumberSetting.ShowDialog();

            if (frmRaceNumberSetting.DialogResult != DialogResult.OK || this.dgv_Scheduled.SelectedRows.Count < 1)
            {
                return;
            }

            DataGridViewSelectedRowCollection l_Rows = this.dgv_Scheduled.SelectedRows;

            int[] arSelIndex = new int[l_Rows.Count];
            int   i          = 0;

            foreach (DataGridViewRow r in l_Rows)
            {
                arSelIndex[i++] = r.Index;
            }
            Array.Sort(arSelIndex);

            List <OVRDataChanged> changedList = new List <OVRDataChanged>();

            if (!frmRaceNumberSetting.m_bChkSortByTime)
            {
                int iRowIdx = 0;
                foreach (int iSelIndex in arSelIndex)
                {
                    try
                    {
                        string strOldData = "";
                        if (dgv_Scheduled.Rows[iSelIndex].Cells["R.Num"].Value != null)
                        {
                            strOldData = dgv_Scheduled.Rows[iSelIndex].Cells["R.Num"].Value.ToString();
                        }
                        string strNewData = "";

                        string strPreFix = frmRaceNumberSetting.PreFix;
                        int    iCode     = frmRaceNumberSetting.StartNumber;
                        if (iCode > -1)
                        {
                            iCode     += iRowIdx * frmRaceNumberSetting.Step;
                            strNewData = iCode.ToString();
                        }
                        int iLength = frmRaceNumberSetting.CodeLength;
                        if (iLength > 0)
                        {
                            strNewData = strPreFix + strNewData.PadLeft(iLength, '0');
                        }
                        else
                        {
                            strNewData = "";
                        }

                        iRowIdx++;

                        if (strNewData == strOldData)
                        {
                            continue;
                        }

                        string strRaceNumber = strNewData;

                        dgv_Scheduled.Rows[iSelIndex].Cells["R.Num"].Value = strRaceNumber;

                        string strMatchID = this.dgv_Scheduled.Rows[iSelIndex].Cells["F_MatchID"].Value.ToString();
                        UpdateRaceNumber(strMatchID, strRaceNumber);

                        int iMatchID = Convert.ToInt32(strMatchID);
                        changedList.Add(new OVRDataChanged(OVRDataChangedType.emMatchInfo, -1, -1, -1, iMatchID, iMatchID, null));
                    }
                    catch (Exception ex)
                    {
                        DevComponents.DotNetBar.MessageBoxEx.Show(ex.Message);
                    }
                }
            }
            else
            {
                string strMatchIDList = "";
                foreach (int iSelIndex in arSelIndex)
                {
                    string strMatchID = dgv_Scheduled.Rows[iSelIndex].Cells["F_MatchID"].Value.ToString();
                    strMatchIDList += strMatchID;
                    strMatchIDList += ",";

                    int iMatchID = Convert.ToInt32(strMatchID);
                    changedList.Add(new OVRDataChanged(OVRDataChangedType.emMatchInfo, -1, -1, -1, iMatchID, iMatchID, null));
                }
                if (strMatchIDList.Length != 0)
                {
                    strMatchIDList = strMatchIDList.Substring(0, strMatchIDList.Length - 1);

                    try
                    {
                        string strPreFix    = frmRaceNumberSetting.PreFix;
                        int    nStartNumber = frmRaceNumberSetting.StartNumber;
                        int    nStep        = frmRaceNumberSetting.Step;
                        int    nLength      = frmRaceNumberSetting.CodeLength;

                        if (this.SetRaceNumByTime(strMatchIDList, strPreFix, nStartNumber, nStep, nLength))
                        {
                            this.Update_ScheduledGrid();
                        }
                    }
                    catch (Exception ex)
                    {
                        DevComponents.DotNetBar.MessageBoxEx.Show(ex.Message);
                    }
                }
            }

            if (changedList.Count > 0)
            {
                m_matchScheduleModule.DataChangedNotify(changedList);
            }
        }