📄 laborcostrank.cpp
字号:
#include "stdafx.h"
#include "LaborCostRank.h"
using namespace FAP;
void LaborCostRank::InitGrid(int iLanguage){
DataGridTextBoxColumn *oRank;
DataGridTextBoxColumn *oName;
DataGridTextBoxColumn *oCost;
DataGridTextBoxColumn *oComment;
DataGridTableStyle* oTableStyle;
oTableStyle = new DataGridTableStyle();
oTableStyle->MappingName = S"LaborCost";
//oRank
oRank = new DataGridTextBoxColumn();
oRank->MappingName = S"RANK";
oRank->HeaderText = infLaborCost->sa_Rank[iLanguage];
oRank->Alignment = HorizontalAlignment::Left;
oRank->Width = 100;
oRank->NullText = S"";
oRank->ReadOnly =true;
//oName
oName = new DataGridTextBoxColumn();
oName->MappingName = S"NAME";
oName->HeaderText = infLaborCost->sa_Name[iLanguage];
oName->Alignment = HorizontalAlignment::Left;
oName->Width = 550 ;
oName->NullText = S"";
oName->ReadOnly =true;
//oCost
oCost = new DataGridTextBoxColumn();
oCost->MappingName = S"COST";
oCost->HeaderText = infLaborCost->sa_Cost[iLanguage];
oCost->Alignment = HorizontalAlignment::Right;
oCost->Width = 100;
oCost->NullText = S"";
oCost->ReadOnly =false;
//oComment
oComment = new DataGridTextBoxColumn();
oComment->MappingName = S"MEMO";
oComment->HeaderText = infLaborCost->sa_Comm[iLanguage];
oComment->Alignment = HorizontalAlignment::Center;
oComment->Width = 100;
oComment->NullText = S"";
oComment->ReadOnly =true;
oTableStyle->GridColumnStyles->Add(oRank);
oTableStyle->GridColumnStyles->Add(oName);
oTableStyle->GridColumnStyles->Add(oCost);
oTableStyle->GridColumnStyles->Add(oComment);
dGridStock->TableStyles->Add(oTableStyle);
}
void LaborCostRank::GetGrid(){
String *strSQL;
DataSet *dsetTmp ;
DataView *dViewTmp;
DataTable *dTblTmp;
strSQL = S"select RANK, NAME,COST,MEMO from LABOR_COST_RANK order by RANK";
dsetTmp = dbLaborCost->dSetSQL_Select(strSQL,S"LaborCost",0);
dTblTmp = dsetTmp->Tables->Item[S"LaborCost"];
dViewTmp = new DataView(dTblTmp);
dViewTmp->AllowDelete = false;
dViewTmp->AllowNew = false;
dGridStock->DataSource = dViewTmp;
}
bool LaborCostRank::UpdateGrid(){
String * strSQL;
Single sngTmp;
String *strRank;
DataGridCell dCellTmp ;
DataGridCell dCellRank;
dCellTmp.ColumnNumber = 2;
dCellRank.ColumnNumber = 0;
for (int i = 0; i< __try_cast<DataView *>(dGridStock->DataSource)->Count;i++) {
dCellTmp.RowNumber = i;
dCellRank.RowNumber = i;
try{
sngTmp = Single::Parse(dGridStock->Item[dCellTmp]->ToString());
}
catch (...) {
MessageBox::Show(S"请输入数字!");
return false;
}
strRank = dGridStock->Item[dCellRank]->ToString();
strSQL = S"update labor_cost_rank set cost = ";
strSQL = String::Concat(strSQL,sngTmp.ToString());
strSQL = String::Concat(strSQL,S" where rank = '",strRank,S"'");
//MessageBox::Show(strSQL);
if (!dbLaborCost->blnSQL_Execute(strSQL)){
//MessageBox::Show(S"更新失败!");
return false;
}
}
return true;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -