Ejemplo n.º 1
0
        private void dgvPositionCell_beginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            DataGridView dgv = sender as DataGridView;

            if (!(dgv.Columns[e.ColumnIndex] is DGVCustomComboBoxColumn) || e.RowIndex < 0)
            {
                return;
            }
            DataTable dtPos = BDCommon.g_ManageDB.GetPositionList();
            DGVCustomComboBoxColumn dgvCol = dgv.Columns[e.ColumnIndex] as DGVCustomComboBoxColumn;

            dgvCol.FillComboBoxItems(dtPos, "F_PositionCode", "F_PositionID");
        }
Ejemplo n.º 2
0
        private void InitMatchResult(int iMatchID)
        {
            try
            {
                string strSQL = string.Format("exec Proc_SH_GetMatchResult {0} ", iMatchID);

                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 sdr = SqlCommand.ExecuteReader();
                OVRDataBaseUtils.FillDataGridViewWithCmb(dgv_List, sdr, "Remark");
                sdr.Close();
            }
            catch (Exception ex)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(ex.Message);
            }

            int iColumn = dgv_List.Columns.Count;

            if (iColumn <= 0)
            {
                return;
            }


            for (int i = 0; i < iColumn; i++)
            {
                dgv_List.Columns[i].ReadOnly = true;
                dgv_List.Columns[i].HeaderCell.Style.BackColor = Color.AliceBlue;
                if (dgv_List.Columns[i].HeaderText == "Soff" || dgv_List.Columns[i].HeaderText == "CB")
                {
                    dgv_List.Columns[i].ReadOnly = false;
                }
            }


            dgv_List.Columns[0].Width   = 30;
            dgv_List.Columns[0].Visible = false;
            dgv_List.Columns[1].Width   = 30;
            dgv_List.Columns[2].Width   = 40;

            if (iColumn >= (iHeaderCount + m_nShotCount))
            {
                for (int i = iHeaderCount; i < iHeaderCount + m_nShotCount; i++)
                {
                    dgv_List.Columns[i].ReadOnly = false;
                    dgv_List.Columns[i].HeaderCell.Style.BackColor = Color.Yellow;
                    dgv_List.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
                    dgv_List.Columns[i].Width    = 40;
                }
            }

            dgv_List.Columns["Remark"].HeaderCell.Style.BackColor = Color.Yellow;
            dgv_List.Columns["Remark"].ReadOnly = false;
            m_nRemarkIndex = dgv_List.Columns["Remark"].Index;

            // Add DNS,DSQ,.. Combobox
            DGVCustomComboBoxColumn TypeCmbCol = (DGVCustomComboBoxColumn)dgv_List.Columns["Remark"];

            if (TypeCmbCol != null)
            {
                DataTable TypeCmbContent = new DataTable();
                TypeCmbContent.Columns.Add();
                TypeCmbContent.Rows.Add("");
                TypeCmbContent.Rows.Add("DNS");
                TypeCmbContent.Rows.Add("DSQ");
                TypeCmbContent.Rows.Add("DNF");
                TypeCmbCol.FillComboBoxItems(TypeCmbContent, 0, 0);
            }

            UpdateMatchStatus();
        }