Пример #1
0
        void AddDelSystem(int rowIndex)
        {
            SelectSystemsForm selectSystemsForm  = new SelectSystemsForm(lblCountry.Text, null);
            List <string>     checkedSystemNames = new List <string>();

            foreach (string systemName in dgvConditionalFormatting.Rows[rowIndex].Cells[colSystemsToApply.Name].Value.ToString().Split(_separator.First()))
            {
                checkedSystemNames.Add(systemName.Trim());
            }
            selectSystemsForm.CheckSystems(checkedSystemNames);
            if (selectSystemsForm.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            string applySystemNames = string.Empty;

            foreach (CountryConfig.SystemRow systemRow in selectSystemsForm.GetSelectedSystemRows())
            {
                applySystemNames += systemRow.Name + _separator;
            }
            if (applySystemNames != string.Empty)
            {
                applySystemNames = applySystemNames.Substring(0, applySystemNames.Length - 1);
            }
            dgvConditionalFormatting.Rows[rowIndex].Cells[colSystemsToApply.Name].Value = applySystemNames;
        }
        void dgvAssign_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.ColumnIndex != colAssign.Index)
            {
                return;
            }

            List <string> checkedSystemNames = new List <string>();

            checkedSystemNames.Add(dgvAssign.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());

            SelectSystemsForm selectSystemsForm = new SelectSystemsForm(txCopyCountry.Text);

            selectSystemsForm.CheckSystems(checkedSystemNames);
            selectSystemsForm.SetSingleSelectionMode(false);
            if (selectSystemsForm.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            if (selectSystemsForm.GetSelectedSystemRows().Count > 0)
            {
                dgvAssign.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = selectSystemsForm.GetSelectedSystemRows().First().Name;
                dgvAssign.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag   = selectSystemsForm.GetSelectedSystemRows().First().ID;
            }
            else
            {
                dgvAssign.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = _labelNotAssigned;
                dgvAssign.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag   = _labelNotAssigned;
            }
        }
Пример #3
0
        void dgvBaseSystemFormatting_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            if (e.ColumnIndex == colBackColorBaseSystemFormatting.Index || e.ColumnIndex == colForeColorBaseSystemFormatting.Index)
            {
                SetBackOrTextColor(dgvBaseSystemFormatting, e.RowIndex, e.ColumnIndex);
            }

            if (e.ColumnIndex != colBaseSystem.Index)
            {
                return;
            }

            List <string> noShowSystemsIDs = new List <string>();

            noShowSystemsIDs.Add(_countryConfigFacade.GetSystemRowByName(dgvBaseSystemFormatting.Rows[e.RowIndex].Cells[colSystem.Name].Value.ToString()).ID);
            List <string> checkedSystemNames = new List <string>();

            checkedSystemNames.Add(dgvBaseSystemFormatting.Rows[e.RowIndex].Cells[colBaseSystem.Name].Value.ToString());

            SelectSystemsForm selectSystemsForm = new SelectSystemsForm(lblCountry.Text, noShowSystemsIDs);

            selectSystemsForm.CheckSystems(checkedSystemNames);
            selectSystemsForm.SetSingleSelectionMode(false);
            if (selectSystemsForm.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            dgvBaseSystemFormatting.Rows[e.RowIndex].Cells[colBaseSystem.Name].Value = string.Empty;
            if (selectSystemsForm.GetSelectedSystemRows().Count > 0)
            {
                dgvBaseSystemFormatting.Rows[e.RowIndex].Cells[colBaseSystem.Name].Value = selectSystemsForm.GetSelectedSystemRows().First().Name;
            }
        }