124 lines
3.0 KiB
C++
124 lines
3.0 KiB
C++
// ---------------------------------------------------------------------------
|
|
|
|
#include <vcl.h>
|
|
#pragma hdrstop
|
|
#include "GlobalUnit.h"
|
|
|
|
#include "VerifyStylesFormUnit.h"
|
|
// ---------------------------------------------------------------------------
|
|
#pragma package(smart_init)
|
|
#pragma resource "*.dfm"
|
|
TVerifyStylesForm *VerifyStylesForm;
|
|
|
|
// ---------------------------------------------------------------------------
|
|
__fastcall TVerifyStylesForm::TVerifyStylesForm(TComponent* Owner)
|
|
: TForm(Owner) {
|
|
m_iStyleId = 0;
|
|
m_bCheckedPass = false;
|
|
}
|
|
// ---------------------------------------------------------------------------
|
|
|
|
void __fastcall TVerifyStylesForm::btnCancelClick(TObject *Sender) {
|
|
ModalResult = mrCancel;
|
|
}
|
|
// ---------------------------------------------------------------------------
|
|
|
|
void __fastcall TVerifyStylesForm::btnOkClick(TObject *Sender) {
|
|
|
|
if(!CheckStyleIsPass())
|
|
return;
|
|
|
|
AnsiString strMsg;
|
|
int score = 0;
|
|
|
|
if( m_bCheckedPass ){
|
|
score = ( m_cbScore->ItemIndex + 6 ) * 100;
|
|
}
|
|
else{
|
|
strMsg = mtDescript->Text.Trim();
|
|
strMsg = GBToUTF8(strMsg.c_str()).c_str();
|
|
}
|
|
|
|
HRESULT hr = f_CS_CheckStyle(m_iStyleId, g_infoUser.accountInfo.ID, score, strMsg.c_str() );
|
|
|
|
//Debug test information
|
|
String strDbgInfo = L"";
|
|
|
|
if(0 == hr){
|
|
m_iRetCheckStyle = 0;
|
|
strDbgInfo = L"审核成功";
|
|
MessageBox(Handle,strDbgInfo.c_str(),L"提示信息",MB_ICONINFORMATION|MB_OK);
|
|
}
|
|
else{
|
|
/*
|
|
e_InvalidUserID, //Check
|
|
e_InvalidAuthority, //无操作权限 -- //Check
|
|
e_CheckedAlready, //风格已被审核 -- //Check
|
|
*/
|
|
m_iRetCheckStyle = -2;
|
|
strDbgInfo = L"审核失败,错误码:" + IntToStr((int)hr);
|
|
MessageBox(Handle,strDbgInfo.c_str(),L"提示信息",MB_ICONERROR|MB_OK);
|
|
}
|
|
|
|
OutputDebugString(strDbgInfo.c_str());
|
|
|
|
ModalResult = mrOk;
|
|
//End test
|
|
}
|
|
// ---------------------------------------------------------------------------
|
|
void __fastcall TVerifyStylesForm::OnSelectVerifyStyleClick(TObject *Sender)
|
|
{
|
|
if( rdCheckPass==Sender ){
|
|
mtDescript->Enabled = false;
|
|
mtDescript->Text = "";
|
|
|
|
m_cbScore->ItemIndex = 0;
|
|
m_cbScore->Enabled = true;
|
|
|
|
m_bCheckedPass = true;
|
|
}
|
|
else{
|
|
mtDescript->Enabled = true;
|
|
|
|
m_cbScore->ItemIndex = -1;
|
|
m_cbScore->Enabled = false;
|
|
|
|
m_bCheckedPass = false;
|
|
}
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
bool TVerifyStylesForm::CheckStyleIsPass()
|
|
{
|
|
bool bRet = true;
|
|
|
|
if( rdCheckNotPass->Checked && mtDescript->Text.Trim()==L"" ){
|
|
MessageBox(Handle,L"请输入审核未通过的描述?",L"提示信息",MB_ICONWARNING|MB_OK);
|
|
mtDescript->SetFocus();
|
|
bRet = false;
|
|
}
|
|
|
|
return bRet;
|
|
}
|
|
|
|
void __fastcall TVerifyStylesForm::FormCreate(TObject *Sender)
|
|
{
|
|
m_iRetCheckStyle = -1;
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TVerifyStylesForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
|
|
|
|
{
|
|
switch( Key ){
|
|
case VK_RETURN:
|
|
// btnOkClick(NULL);
|
|
break;
|
|
|
|
case VK_ESCAPE:
|
|
ModalResult = mrCancel;
|
|
break;
|
|
}
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|