private void dgvDetail_CellParsing(object sender, DataGridViewCellParsingEventArgs e)
        {
            if (e.ColumnIndex == 2)
            {
                if (dgvDetail.Rows[e.RowIndex].Tag != null)
                {
                    Project proj = (Project)dgvDetail.Rows[e.RowIndex].Tag;
                    KryptonDataGridViewComboBoxCell comboboxCell = (KryptonDataGridViewComboBoxCell)dgvDetail.Rows[e.RowIndex].Cells[e.ColumnIndex];
                    if (comboboxCell.EditedFormattedValue != null)
                    {
                        string key = comboboxCell.EditedFormattedValue.ToString();

                        if (PersonDict.ContainsKey(key))
                        {
                            Person personObj = PersonDict[key];
                            Unit   unitObj   = ConnectionManager.Context.table("Unit").where ("ID='" + proj.UnitID + "'").select("*").getItem <Unit>(new Unit());
                            if (unitObj != null)
                            {
                                dgvDetail[3, e.RowIndex].Value = personObj.Sex;
                                dgvDetail[4, e.RowIndex].Value = personObj.Birthday;
                                dgvDetail[5, e.RowIndex].Value = personObj.Job;
                                dgvDetail[6, e.RowIndex].Value = personObj.MobilePhone;
                                dgvDetail[7, e.RowIndex].Value = unitObj.UnitName + "," + unitObj.Address;
                            }
                        }
                    }
                }
            }
        }
示例#2
0
        private void ClearFieldData(object sender, EventArgs e)
        {
            ButtonSpecAny b = (ButtonSpecAny)sender;
            KryptonDataGridViewComboBoxCell combo = (KryptonDataGridViewComboBoxCell)b.Owner;

            // FIXME: Значение очищается только после нажатия Enter или потери фокуса
            combo.Value = null;
        }
        private void dgvDetail_CellParsing(object sender, DataGridViewCellParsingEventArgs e)
        {
            if (e.ColumnIndex == 1)
            {
                KryptonDataGridViewComboBoxCell comboboxCell = (KryptonDataGridViewComboBoxCell)dgvDetail.Rows[e.RowIndex].Cells[e.ColumnIndex];
                if (comboboxCell.EditedFormattedValue != null)
                {
                    string key = comboboxCell.EditedFormattedValue.ToString();

                    if (PersonDict.ContainsKey(key))
                    {
                        Person person = PersonDict[key];

                        Unit unitObj = ConnectionManager.Context.table("Unit").where ("ID='" + person.UnitID + "'").select("*").getItem <Unit>(new Unit());
                        if (unitObj != null)
                        {
                            dgvDetail[2, e.RowIndex].Value = unitObj.UnitName;
                            dgvDetail[3, e.RowIndex].Value = person.Job;
                            dgvDetail[4, e.RowIndex].Value = person.Specialty;
                        }
                    }
                }
            }
        }