void COrderManageDlg::InitOrder() { //当前用户单子 bool bHasOrder = false; COrder order; CString strCustomer = m_pCustomerCombo->GetText(); if (!strCustomer.IsEmpty() && COrderManager::Instance()->GetOrder(strCustomer, order)) { bHasOrder = true; } //添加号码 for (int i=1; i<=12; i++) { for (int j=0; j<=4; j++) { int nCode = i+j*12; if (nCode > COrder::CODE_NUMBER) { continue; } DuiLib::CControlUI* pCodeMoney = FindCode(nCode); if (pCodeMoney == NULL) //还没有添加一个 { pCodeMoney = AddCode(nCode); if (pCodeMoney == NULL) { continue; } } if (bHasOrder && order.Money(nCode)>0) { pCodeMoney->SetText(CStringUtil::Int64ToStr(order.Money(nCode))); } else { pCodeMoney->SetText(_T("")); } } } //总共下注数 16=%s总共下注%I64d CString strTotal; strTotal.Format(CLanguageManager::Instance()->LoadString(16), strCustomer, bHasOrder?order.GetTotalBuyMoney():0); m_pTotalInfoLabel->SetText(strTotal); //显示删除单子按钮 和 删除所有单子按钮 m_pDeleteOrderBtn->SetVisible(bHasOrder); m_pDeleteAllOrderBtn->SetVisible(COrderManager::Instance()->IsHasOrder()); }
void COrderManageDlg::OnNewCustomer(const CString& strCustomer) { DuiLib::CDialogBuilder builder; DuiLib::CControlUI* pControl = builder.Create(_T("item_list_label_element.xml")); if (pControl == NULL) { return; } pControl->SetText(strCustomer); m_pCustomerCombo->Add(pControl); m_pCustomerCombo->SelectItem(m_pCustomerCombo->GetCount()-1); m_pNoCustomerContainer->SetVisible(false); }
void COrderManageDlg::AddGroup(DuiLib::CContainerUI* pContainer, int nGroupID) { DuiLib::CDialogBuilder builder; DuiLib::CControlUI* pControl = builder.Create(_T("item_group.xml"), NULL, NULL, &m_pm); if (pControl == NULL) { return; } CCodeGroup group(nGroupID); pControl->SetText(group.Name()); pControl->SetTag(nGroupID); //group id保存在此 pContainer->Add(pControl); }
void COrderManageDlg::InitCustomer() { m_pCustomerCombo->RemoveAll(); vector<CUSTOMER> customerVec = CCustomerManager::Instance()->GetCustomerList(); for (vector<CUSTOMER>::const_iterator it=customerVec.begin(); it!=customerVec.end(); it++) { DuiLib::CDialogBuilder builder; DuiLib::CControlUI* pControl = builder.Create(_T("item_list_label_element.xml")); if (pControl == NULL) { continue; } pControl->SetText(it->strName); m_pCustomerCombo->Add(pControl); } m_pCustomerCombo->SelectItem(0); m_pNoCustomerContainer->SetVisible(customerVec.size()<=0); }
LRESULT RemoteKeyboard::OnUpdateStatus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & bHandle) { static bool _last_enabled = true; bool _enable = (wParam != 0); unsigned int _check_value = (unsigned int)(lParam); TCHAR name[32]; if (_last_enabled != _enable) { _last_enabled = _enable; for (int i = 1;; ++i) { _stprintf_s(name, sizeof(name) / sizeof(TCHAR), _T("rkbc_%02d"), i); if (!EnableControl(name, _last_enabled)) break; } } if (_last_enabled) { unsigned int _recode_status = _check_value & 0x3; unsigned int _ch_status = (_check_value >> 2) & 0xf; unsigned int _director_status = (_check_value >> 6) & 0x3; for (int i = 1; i < 14; ++i) { _stprintf_s(name, sizeof(name) / sizeof(TCHAR), _T("rkbc_%02d"), i); if (i < 4) { EnableControl(name, _recode_status != i); } else if (i < 12) { EnableControl(name, _ch_status != i - 3); } else { EnableControl(name, _director_status != i - 11); } } } auto _GetExtendInfoWrap = [this](byte* &pBuf, long &nSize) -> boolean { boolean ret = false; RpcTryExcept ret = rkbc_GetExtendInfo(m_hwBinding, kExtendType_LessionInfo, __int64(m_lession_info_checksum), &pBuf, &nSize); RpcExcept(1) ret = false; RpcEndExcept return ret; }; /* 如果同步排课界面不处于显示状态,则不刷新 */ if (!m_PaintManager.FindControl(_T("sync_panel"))->IsVisible()) return 0; byte *pBuf = 0; long nSize = 0; if (_enable && _GetExtendInfoWrap(pBuf, nSize) && pBuf) { auto const &items = g_LessionMappingTable; pugi::xml_document doc; if (doc.load(LPCTSTR(pBuf))) { pugi::xml_node elem = doc.child(_T("lesson")); if (elem) { for (int i = 0; i < _countof(items); ++i) { DuiLib::CControlUI *ctrl; if (ctrl = m_PaintManager.FindControl(items[i].name)) ctrl->SetText(elem.attribute(items[i].attr).as_string()); } m_lession_info = LPCTSTR(pBuf); boost::crc_32_type result; result.process_bytes(reinterpret_cast<const byte *>(m_lession_info.data()), (m_lession_info.size() + 1) * sizeof(wchar_t)); m_lession_info_checksum = result.checksum(); } } midl_user_free(pBuf); } return LRESULT(); }