| #include "stdafx.h" |
| #include "klienci2.h" |
| #include "assignmentsView.h" |
| #include "assignments_MULTI.h" |
| #include "klienci2Doc.h" |
| #include "OurConstants.h" |
| #include "MainFrm.h" |
| |
| |
| IMPLEMENT_DYNCREATE(CassignmentsView, CRecordView) |
| |
| BEGIN_MESSAGE_MAP(CassignmentsView, CRecordView) |
| ON_BN_CLICKED(IDC_POWROT, &CassignmentsView::OnPowrot) |
| ON_WM_CTLCOLOR() |
| END_MESSAGE_MAP() |
| |
| CassignmentsView::CassignmentsView():CRecordView(CassignmentsView::IDD),m_pSet(NULL) |
| , m_koszty(0) |
| { |
| m_brBrush.CreateSolidBrush(RGB(255, 255, 255)); |
| } |
| |
| |
| |
| #ifdef DEBUG |
| void CassignmentsView::AssertValid() const |
| { |
| CRecordView::AssertValid(); |
| } |
| void CassignmentsView::Dump(CDumpContext& dc) const |
| { |
| CRecordView::Dump(dc); |
| } |
| #endif //DEBUG |
| |
| void CassignmentsView::DoDataExchange(CDataExchange *pDX) |
| { |
| CRecordView::DoDataExchange(pDX); |
| m_koszty=0; |
| m_pSet->MoveFirst(); |
| while(!m_pSet->IsEOF()) |
| { |
| m_koszty+=m_pSet->m_tariffsvalue; |
| m_pSet->MoveNext(); |
| } |
| m_koszty+=m_pSet->m_tariffsvalue; |
| DDX_Text(pDX, IDC_KOSZTY, m_koszty); |
| } |
| |
| Cassignments_MULTI* CassignmentsView::GetRecordset() |
| { |
| ASSERT(m_pSet != NULL); |
| return m_pSet; |
| } |
| |
| CRecordset* CassignmentsView::OnGetRecordset() |
| { |
| return m_pSet; |
| } |
| |
| void CassignmentsView::OnInitialUpdate() |
| { |
| //GetDlgItem(IDC_STATIC1)->ShowWindow(FALSE); |
| BeginWaitCursor(); |
| Cklienci2Doc* pDoc = static_cast<Cklienci2Doc*>(GetDocument()); |
| m_pSet= &pDoc->m_assignmentsMULTI; |
| m_pSet->m_pDatabase=pDoc->m_klienci2Set.m_pDatabase; |
| m_pSet->m_CustomerIDparam= pDoc->m_klienci2Set.m_id; |
| m_pSet->m_strFilter= "[assignments].[customerid]=? AND [assignments].[tariffid]=[tariffs].[id]"; |
| CRecordView::OnInitialUpdate(); |
| EndWaitCursor(); |
| } |
| |
| |
| void CassignmentsView::OnPowrot() |
| { |
| // TODO: Add your control notification handler code here |
| static_cast<CMainFrame*>(GetParentFrame())->SelectView(KLIENCI2_VIEW); |
| } |
| |
| void CassignmentsView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView) |
| { |
| |
| // TODO: Add your specialized code here and/or call the base class |
| if (bActivate) |
| { |
| Cklienci2Doc* pDoc = GetDocument(); |
| CMainFrame* pMFrame= static_cast<CMainFrame*>(GetParentFrame()); |
| if (pMFrame->m_CurrentViewID==KLIENCI2_VIEW) |
| { |
| if(!m_pSet->IsOpen()) |
| return; |
| m_pSet->m_CustomerIDparam=pDoc->m_klienci2Set.m_id; |
| m_pSet->Requery(); |
| if(m_pSet->IsEOF()) |
| AfxMessageBox(L" Brak zobowiązań klienta"); |
| } |
| CString strTitle=_T("Table Name; "); |
| CString strTable=m_pSet->GetTableName(); |
| if(!strTable.IsEmpty()) |
| strTitle+=strTable; |
| else |
| strTitle+=_T("Orders - Multiple Tables"); |
| pDoc->SetTitle(strTitle); |
| CRecordView::OnInitialUpdate(); |
| } |
| CRecordView::OnActivateView(bActivate, pActivateView, pDeactiveView); |
| } |
| |
| |
| BOOL CassignmentsView::PreCreateWindow(CREATESTRUCT& cs) |
| { |
| // TODO: Add your specialized code here and/or call the base class |
| |
| return CRecordView::PreCreateWindow(cs); |
| } |
| |
| HBRUSH CassignmentsView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) |
| { |
| return m_brBrush; |
| } |