144 lines
3.2 KiB
C++
144 lines
3.2 KiB
C++
// StatusDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "sp.h"
|
|
#include "StatusDlg.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CStatusDlg dialog
|
|
|
|
|
|
CStatusDlg::CStatusDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CStatusDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CStatusDlg)
|
|
// NOTE: the ClassWizard will add member initialization here
|
|
//}}AFX_DATA_INIT
|
|
m_pApp= (CSpApp*)AfxGetApp();
|
|
/*
|
|
rs=new GZRset("Error: Record status screen");
|
|
rs->SetConnect(m_pApp->strConnectString);
|
|
*/
|
|
//Initialize recordset pointer
|
|
|
|
rs=m_pApp->rsPool->GetRS("CStatusDlg");
|
|
}
|
|
|
|
|
|
|
|
CStatusDlg::~CStatusDlg()
|
|
{
|
|
m_pApp->rsPool->ReleaseRS(&rs->m_nID);
|
|
}
|
|
|
|
void CStatusDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CStatusDlg)
|
|
DDX_Control(pDX, IDC_STATUSMSG, m_Status);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CStatusDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CStatusDlg)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CStatusDlg message handlers
|
|
|
|
BOOL CStatusDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
//Security();
|
|
|
|
m_Status.SetFontName("Tahoma");
|
|
m_Status.SetFontSize(12);
|
|
m_Status.SetFontBold(FALSE);
|
|
m_Status.SetTextColor(RGB(0,0,0));
|
|
Display();
|
|
|
|
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
//****************************************************8
|
|
void CStatusDlg::SetValues(CString *creator, CString *modifier, COleDateTime *created, COleDateTime *modified)
|
|
{
|
|
m_pCreator=creator;
|
|
m_pModifier=modifier;
|
|
m_pCreated=created;
|
|
m_pModified=modified;
|
|
|
|
}
|
|
|
|
void CStatusDlg::Display()
|
|
{
|
|
CString q,strData,strRecStatus;
|
|
|
|
|
|
|
|
q.Format("SELECT [first] & \" \" & [last] AS fullname "
|
|
"FROM users WHERE (((users.id)=%s));",*m_pCreator);
|
|
|
|
rs->Query(q);
|
|
if(rs->IsEmpty())
|
|
strData="unknown";
|
|
else
|
|
rs->FetchField("fullname",&strData);
|
|
|
|
strRecStatus="This record was originally created by " + strData;
|
|
|
|
strRecStatus=strRecStatus+" on:\r\n" + m_pCreated->Format();
|
|
|
|
|
|
q.Format("SELECT [first] & \" \" & [last] AS fullname "
|
|
"FROM users WHERE (((users.id)=%s));",*m_pModifier);
|
|
|
|
rs->Query(q);
|
|
if(rs->IsEmpty())
|
|
strData="unknown";
|
|
else
|
|
rs->FetchField("fullname",&strData);
|
|
strRecStatus= strRecStatus + "\r\n\r\nand last modified by " + strData;
|
|
strRecStatus=strRecStatus+" on:\r\n" + m_pModified->Format();
|
|
|
|
strRecStatus=strRecStatus + ".";
|
|
m_Status.SetWindowText(strRecStatus);
|
|
|
|
}
|
|
|
|
|
|
////Added v1.9.4.4 follows wo security since there is no separate one for status
|
|
//void CStatusDlg::Security()
|
|
//{
|
|
// m_bReadOnly=false;
|
|
// int x=m_pApp->Allowed(RWORKORDER,true);
|
|
// if(x==0)//no access allowed
|
|
// {
|
|
// m_pApp->SecurityWarning();
|
|
// CDialog::OnCancel();
|
|
// }
|
|
// if(x==2)//read only
|
|
// {
|
|
// m_bReadOnly=true;
|
|
// m_btnAdd.ShowWindow(FALSE);
|
|
// m_btnDelete.ShowWindow(FALSE);
|
|
// m_ckActive.EnableWindow(FALSE);
|
|
// m_edDescription.SetReadOnly(TRUE);
|
|
// m_edName.SetReadOnly(TRUE);
|
|
//
|
|
//
|
|
// }
|
|
//}
|