| 389 | } |
| 390 | |
| 391 | void RedisDataUI::OnCommit(TNotifyUI& msg) |
| 392 | { |
| 393 | if (m_pList->GetCurSel() < 0) |
| 394 | { |
| 395 | UserMessageBox(GetHWND(), 20002, NULL, MB_ICONINFORMATION); |
| 396 | return; |
| 397 | } |
| 398 | CListTextElementUI* textElement = dynamic_cast<CListTextElementUI*>(m_pList->GetItemAt(m_pList->GetCurSel())); |
| 399 | std::string curPageStr = Base::CharacterSet::UnicodeToANSI(m_pPageCur->GetText().GetData()); |
| 400 | int curPage = atoi(curPageStr.c_str()); |
| 401 | int idx = (curPage-1)*m_iPageSize + m_pList->GetCurSel(); |
| 402 | std::string key = Base::CharacterSet::UnicodeToANSI(m_pKeyEdit->GetText().GetData()); |
| 403 | std::string oldValue = Base::CharacterSet::UnicodeToANSI(textElement->GetText(0)); |
| 404 | std::string field; |
| 405 | if (m_pList->GetHeader()->GetCount() > 1) |
| 406 | { |
| 407 | field = Base::CharacterSet::UnicodeToANSI(textElement->GetText(0)); |
| 408 | oldValue = Base::CharacterSet::UnicodeToANSI(textElement->GetText(1)); |
| 409 | } |
| 410 | std::string newValue = Base::CharacterSet::UnicodeToANSI(m_pRichEdit->GetText().GetData()); |
| 411 | //if (!RedisClient::GetInstance().UpdateData(key, oldValue, newValue, idx, field)) |
| 412 | if (Env()->GetDBClient() && Env()->GetDBClient()->UpdateData(key, oldValue, newValue, idx, field)) |
| 413 | { |
| 414 | /// todo 此处应该提示错误详情 |
| 415 | CDuiString err(Base::CharacterSet::ANSIToUnicode(Env()->GetDBClient()->GetLastError()).c_str()); |
| 416 | UserMessageBox(GetHWND(), 10031, err, MB_ICONERROR); |
| 417 | return; |
| 418 | } |
| 419 | |
| 420 | int valueIdx = m_pList->GetHeader()->GetCount() > 1 ? 1 : 0 ; |
| 421 | textElement->SetText(valueIdx, m_pRichEdit->GetText().GetData()); |
| 422 | } |
| 423 | |
| 424 | void RedisDataUI::DoRefreshDBWork() |
| 425 | { |
nothing calls this directly
no test coverage detected