- 1
- 2
- 3
- 4
- 5
- 6
- 7
RepaymentEvent e = DatabaseHelper.GetString("event_type", pReader) == "RBLE"
? new BadLoanRepaymentEvent {Id = DatabaseHelper.GetInt32("rpe_id", pReader)}
: (DatabaseHelper.GetString("event_type", pReader) == "RRLE"
? new RescheduledLoanRepaymentEvent {Id = DatabaseHelper.GetInt32("rpe_id", pReader)}
:(DatabaseHelper.GetString("event_type", pReader).StartsWith("P")
? new PendingRepaymentEvent (DatabaseHelper.GetString("event_type", pReader)) {Id = DatabaseHelper.GetInt32("rpe_id", pReader)}
: new RepaymentEvent {Id = DatabaseHelper.GetInt32("rpe_id", pReader)}));
Вот такую "элегантную" строчку нашел сегодня коллега в коде нашего проекта :)
Создаем событие пойди разбери какое :)
abatishchev 02.03.2011 10:49 # +1
_Ru55_ 02.03.2011 11:00 # +2
switch (DatabaseHelper.GetString("event_type", pReader))
{
case "RBLE":
{
e = new BadLoanRepaymentEvent {Id = DatabaseHelper.GetInt32("rpe_id", pReader)};
break;
}
case "RRLE":
{
e = new RescheduledLoanRepaymentEvent {Id = DatabaseHelper.GetInt32("rpe_id", pReader)};
break;
}
case "ROWO":
{
e = new RepaymentOverWriteOffEvent { Id = DatabaseHelper.GetInt32("rpe_id", pReader) };
break;
}
case "PRLR":
{
e = new PendingRepaymentEvent(DatabaseHelper.Get String("event_type", pReader))
{Id = DatabaseHelper.GetInt32("rpe_id", pReader)};
break;
}
case "PBLR":
{
e = new PendingRepaymentEvent(DatabaseHelper.Get String("event_type", pReader))
{Id = DatabaseHelper.GetInt32("rpe_id", pReader)};
break;
}
case "PRWO":
{
e = new PendingRepaymentEvent(DatabaseHelper.Get String("event_type", pReader))
{Id = DatabaseHelper.GetInt32("rpe_id", pReader)};
break;
}
case "PERE":
{
e = new PendingRepaymentEvent(DatabaseHelper.Get String("event_type", pReader))
{Id = DatabaseHelper.GetInt32("rpe_id", pReader)};
break;
}
}
_Ru55_ 02.03.2011 11:02 # 0
SadKo 02.03.2011 11:56 # 0
_Ru55_ 02.03.2011 11:57 # 0
zooz13 02.03.2011 12:09 # +3
Lure Of Chaos 02.03.2011 13:28 # +1
guest8 06.04.2019 16:32 # −999
guest8 06.04.2019 16:32 # −999