private
void
radGridView1_ValueChanging(
object
sender, ValueChangingEventArgs e)
{
bool
refresh =
false
;
GridViewRowInfo currentRow =
null
;
int
columnIndex = -1;
if
(sender
is
BaseGridEditor)
{
BaseGridEditor x = sender
as
BaseGridEditor;
if
(x !=
null
&& x.EditorManager
is
GridViewEditManager)
{
GridViewEditManager gridElement = x.EditorManager
as
GridViewEditManager;
if
(gridElement !=
null
)
{
currentRow = gridElement.GridViewElement.CurrentRow;
columnIndex = gridElement.GridViewElement.CurrentColumn.Index;
}
}
}
if
(sender
is
GridViewCellInfo)
{
GridViewCellInfo cell = (GridViewCellInfo)sender;
currentRow = cell.RowInfo;
columnIndex = cell.ColumnInfo.Index;
}
if
(columnIndex >= 0)
{
if
(columnIndex == radGridView1.Columns[
"Anwesenheit"
].Index)
{
gridOnLoad =
true
;
if
(!(
bool
)e.NewValue)
{
currentRow.Cells[
"StimmeJa"
].Value =
false
;
currentRow.Cells[
"StimmeNein"
].Value =
false
;
currentRow.Cells[
"StimmeEnth"
].Value =
false
;
currentRow.Cells[
"Stimmrechtsausschluss"
].Value =
false
;
currentRow.Cells[
"Vollmacht"
].Value =
false
;
currentRow.Cells[
"VertretenDurch"
].Value = 0;
}
currentRow.Cells[
"Anwesenheit"
].Value = (
bool
)e.NewValue;
gridOnLoad =
false
;
refresh =
true
;
}
else
if
(columnIndex == radGridView1.Columns[
"StimmeJa"
].Index)
{
gridOnLoad =
true
;
if
((
bool
)e.NewValue)
{
currentRow.Cells[
"StimmeNein"
].Value =
false
;
currentRow.Cells[
"StimmeEnth"
].Value =
false
;
}
currentRow.Cells[
"StimmeJa"
].Value = (
bool
)e.NewValue;
gridOnLoad =
false
;
refresh =
true
;
}
else
if
(columnIndex == radGridView1.Columns[
"StimmeNein"
].Index)
{
gridOnLoad =
true
;
if
((
bool
)e.NewValue)
{
currentRow.Cells[
"StimmeJa"
].Value =
false
;
currentRow.Cells[
"StimmeEnth"
].Value =
false
;
}
currentRow.Cells[
"StimmeNein"
].Value = (
bool
)e.NewValue;
gridOnLoad =
false
;
refresh =
true
;
}
else
if
(columnIndex == radGridView1.Columns[
"StimmeEnth"
].Index)
{
gridOnLoad =
true
;
if
((
bool
)e.NewValue)
{
currentRow.Cells[
"StimmeJa"
].Value =
false
;
currentRow.Cells[
"StimmeNein"
].Value =
false
;
}
currentRow.Cells[
"StimmeEnth"
].Value = (
bool
)e.NewValue;
gridOnLoad =
false
;
refresh =
true
;
}
else
if
(columnIndex == radGridView1.Columns[
"Stimmrechtsausschluss"
].Index)
{
gridOnLoad =
true
;
if
((
bool
)e.NewValue)
{
currentRow.Cells[
"StimmeJa"
].Value =
false
;
currentRow.Cells[
"StimmeNein"
].Value =
false
;
currentRow.Cells[
"StimmeEnth"
].Value =
false
;
}
currentRow.Cells[
"Stimmrechtsausschluss"
].Value = (
bool
)e.NewValue;
gridOnLoad =
false
;
refresh =
true
;
}
else
if
(columnIndex == radGridView1.Columns[
"Vollmacht"
].Index)
{
gridOnLoad =
true
;
if
((
bool
)currentRow.Cells[
"Anwesenheit"
].Value ==
false
&& (
bool
)e.NewValue ==
true
)
{
currentRow.Cells[
"Anwesenheit"
].Value =
true
;
}
currentRow.Cells[
"Vollmacht"
].Value = (
bool
)e.NewValue;
gridOnLoad =
false
;
refresh =
true
;
}
else
if
(columnIndex == radGridView1.Columns[
"VertretenDurch"
].Index)
{
gridOnLoad =
true
;
currentRow.Cells[
"VertretenDurch"
].Value = (
byte
)e.NewValue;
gridOnLoad =
false
;
refresh =
true
;
}
}
if
(refresh)
{
this
.radGridView1.TableElement.Update(GridUINotifyAction.DataChanged);
radGridView1.Update();
}
}