📄 serviceinfo.h
字号:
this->groupBox2->Controls->Add(this->label3);
this->groupBox2->Controls->Add(this->tBoxMemo);
this->groupBox2->Controls->Add(this->tBoxKind);
this->groupBox2->Controls->Add(this->label16);
this->groupBox2->Controls->Add(this->tBoxPinyinShow);
this->groupBox2->Controls->Add(this->label18);
this->groupBox2->Controls->Add(this->tBoxServiceNameShow);
this->groupBox2->Controls->Add(this->label26);
this->groupBox2->Controls->Add(this->tBoxFee);
this->groupBox2->Controls->Add(this->tBoxServiceIDShow);
this->groupBox2->Controls->Add(this->label5);
this->groupBox2->Controls->Add(this->label6);
this->groupBox2->Controls->Add(this->label7);
this->groupBox2->Controls->Add(this->cmbFeeKind);
this->groupBox2->Dock = System::Windows::Forms::DockStyle::Bottom;
this->groupBox2->Location = System::Drawing::Point(0, 333);
this->groupBox2->Name = S"groupBox2";
this->groupBox2->Size = System::Drawing::Size(768, 136);
this->groupBox2->TabIndex = 3;
this->groupBox2->TabStop = false;
//
// label3
//
this->label3->Location = System::Drawing::Point(16, 80);
this->label3->Name = S"label3";
this->label3->Size = System::Drawing::Size(56, 16);
this->label3->TabIndex = 77;
this->label3->Text = S"备注";
//
// tBoxMemo
//
this->tBoxMemo->Location = System::Drawing::Point(16, 96);
this->tBoxMemo->Name = S"tBoxMemo";
this->tBoxMemo->Size = System::Drawing::Size(728, 21);
this->tBoxMemo->TabIndex = 78;
this->tBoxMemo->Text = S"";
//
// tBoxKind
//
this->tBoxKind->Location = System::Drawing::Point(472, 48);
this->tBoxKind->Name = S"tBoxKind";
this->tBoxKind->Size = System::Drawing::Size(112, 21);
this->tBoxKind->TabIndex = 76;
this->tBoxKind->Text = S"";
//
// label16
//
this->label16->Location = System::Drawing::Point(256, 32);
this->label16->Name = S"label16";
this->label16->Size = System::Drawing::Size(56, 11);
this->label16->TabIndex = 66;
this->label16->Text = S"拼音码";
//
// tBoxPinyinShow
//
this->tBoxPinyinShow->Location = System::Drawing::Point(256, 48);
this->tBoxPinyinShow->Name = S"tBoxPinyinShow";
this->tBoxPinyinShow->Size = System::Drawing::Size(112, 21);
this->tBoxPinyinShow->TabIndex = 70;
this->tBoxPinyinShow->Text = S"";
//
// label18
//
this->label18->Location = System::Drawing::Point(472, 32);
this->label18->Name = S"label18";
this->label18->Size = System::Drawing::Size(56, 11);
this->label18->TabIndex = 65;
this->label18->Text = S"病种分类";
//
// tBoxServiceNameShow
//
this->tBoxServiceNameShow->Location = System::Drawing::Point(96, 48);
this->tBoxServiceNameShow->Name = S"tBoxServiceNameShow";
this->tBoxServiceNameShow->Size = System::Drawing::Size(152, 21);
this->tBoxServiceNameShow->TabIndex = 49;
this->tBoxServiceNameShow->Text = S"";
//
// label26
//
this->label26->Location = System::Drawing::Point(592, 32);
this->label26->Name = S"label26";
this->label26->Size = System::Drawing::Size(120, 11);
this->label26->TabIndex = 48;
this->label26->Text = S"费用分类";
//
// tBoxFee
//
this->tBoxFee->Location = System::Drawing::Point(376, 48);
this->tBoxFee->Name = S"tBoxFee";
this->tBoxFee->Size = System::Drawing::Size(88, 21);
this->tBoxFee->TabIndex = 10;
this->tBoxFee->Text = S"";
//
// tBoxServiceIDShow
//
this->tBoxServiceIDShow->Location = System::Drawing::Point(16, 48);
this->tBoxServiceIDShow->Name = S"tBoxServiceIDShow";
this->tBoxServiceIDShow->Size = System::Drawing::Size(72, 21);
this->tBoxServiceIDShow->TabIndex = 2;
this->tBoxServiceIDShow->Text = S"";
//
// label5
//
this->label5->Location = System::Drawing::Point(16, 32);
this->label5->Name = S"label5";
this->label5->Size = System::Drawing::Size(56, 11);
this->label5->TabIndex = 1;
this->label5->Text = S"编号";
//
// label6
//
this->label6->Location = System::Drawing::Point(376, 32);
this->label6->Name = S"label6";
this->label6->Size = System::Drawing::Size(56, 11);
this->label6->TabIndex = 5;
this->label6->Text = S"费用";
//
// label7
//
this->label7->Location = System::Drawing::Point(96, 32);
this->label7->Name = S"label7";
this->label7->Size = System::Drawing::Size(56, 11);
this->label7->TabIndex = 3;
this->label7->Text = S"名称";
//
// cmbFeeKind
//
System::Object* __mcTemp__2[] = new System::Object*[6];
__mcTemp__2[0] = S"化验费";
__mcTemp__2[1] = S"检查费";
__mcTemp__2[2] = S"手术费";
__mcTemp__2[3] = S"治疗费";
__mcTemp__2[4] = S"诊察费";
__mcTemp__2[5] = S"其它";
this->cmbFeeKind->Items->AddRange(__mcTemp__2);
this->cmbFeeKind->Location = System::Drawing::Point(592, 48);
this->cmbFeeKind->Name = S"cmbFeeKind";
this->cmbFeeKind->Size = System::Drawing::Size(152, 20);
this->cmbFeeKind->TabIndex = 7;
//
// ServiceInfo
//
this->AutoScaleBaseSize = System::Drawing::Size(6, 14);
this->ClientSize = System::Drawing::Size(768, 469);
this->Controls->Add(this->dgrdService);
this->Controls->Add(this->groupBox2);
this->Controls->Add(this->groupBox1);
this->Controls->Add(this->toolBar1);
this->Name = S"ServiceInfo";
this->Text = S"收费项目";
this->groupBox1->ResumeLayout(false);
(__try_cast<System::ComponentModel::ISupportInitialize * >(this->dgrdService))->EndInit();
this->groupBox2->ResumeLayout(false);
this->ResumeLayout(false);
}
private:
//----------------设置控件ReadOnly属性------------------------
void SetModify(bool isModifiable)
{
this->tBoxServiceIDShow->ReadOnly = !isModifiable;
this->tBoxServiceNameShow->ReadOnly = !isModifiable;
this->tBoxFee->ReadOnly = !isModifiable;
this->tBoxKind->ReadOnly = !isModifiable;
this->tBoxPinyinShow->ReadOnly = !isModifiable;
this->tBoxMemo->ReadOnly = !isModifiable;
this->cmbFeeKind->Enabled = isModifiable;
this->btnSearch->Enabled = !isModifiable;
this->dgrdService->ReadOnly = !isModifiable;
}
//---------------------设置控件的数据邦定--------------------------
void SetDataBindings()
{
this->tBoxServiceIDShow->DataBindings->Add(S"Text",this->ds->Tables->Item[S"门诊收费项目"],S"编号");
this->tBoxServiceNameShow->DataBindings->Add(S"Text",this->ds->Tables->Item[S"门诊收费项目"],S"名称");
this->tBoxFee->DataBindings->Add(S"Text",this->ds->Tables->Item[S"门诊收费项目"],S"费用");
this->tBoxKind->DataBindings->Add(S"Text",this->ds->Tables->Item[S"门诊收费项目"],S"病种分类");
this->tBoxPinyinShow->DataBindings->Add(S"Text",this->ds->Tables->Item[S"门诊收费项目"],S"拼音码");
this->tBoxMemo->DataBindings->Add(S"Text",this->ds->Tables->Item[S"门诊收费项目"],S"备注");
this->cmbFeeKind->DataBindings->Add(S"Text",this->ds->Tables->Item[S"门诊收费项目"],S"费用分类");
}
//-----------------------设置表格各列的属性-----------------------
void DataGridStateControl()
{
DataGridTableStyle* ts = new DataGridTableStyle();
ts->MappingName = this->ds->Tables->Item[S"门诊收费项目"]->TableName;
DataGridNoActiveCellColumn* aTextColumn;
ts->AllowSorting = false;
ts->AlternatingBackColor = Color::LightGray;
int numCols = this->ds->Tables->Item[S"门诊收费项目"]->Columns->Count;
for(int i = 0;i < numCols;i++)
{
aTextColumn = new DataGridNoActiveCellColumn();
aTextColumn->get_TextBox()->Enabled = false;
aTextColumn->MappingName = this->ds->Tables->Item[S"门诊收费项目"]->Columns->Item[i]->ColumnName;
aTextColumn->HeaderText = this->ds->Tables->Item[S"门诊收费项目"]->Columns->Item[i]->ColumnName;
aTextColumn->NullText = S"";
aTextColumn->Format = S"D";
ts->GridColumnStyles->Add(aTextColumn);
}
this->dgrdService->TableStyles->Add(ts);
}
//-----------------------工具栏按钮-----------------------
private:System::Void toolBar1_ButtonClick(System::Object * sender, System::Windows::Forms::ToolBarButtonClickEventArgs * e)
{
//设置控件属性
this->SetModify(false);
if(String::Compare(e->Button->ToolTipText,S"首记录") == 0)
{
this->dgrdService->UnSelect(this->cmService->Position);
this->cmService->Position = 0;
this->dgrdService->Select(this->cmService->Position);
this->dgrdService->CurrentRowIndex = this->cmService->Position;
}
else if(String::Compare(e->Button->ToolTipText,S"上一记录") == 0)
{
if(this->cmService->Position > 0)
{
this->dgrdService->UnSelect(this->cmService->Position);
this->cmService->Position--;
this->dgrdService->Select(this->cmService->Position);
this->dgrdService->CurrentRowIndex = this->cmService->Position;
}
}
else if(String::Compare(e->Button->ToolTipText,S"下一记录") == 0)
{
if(this->cmService->Position < this->cmService->Count)
{
this->dgrdService->UnSelect(this->cmService->Position);
this->cmService->Position++;
this->dgrdService->Select(this->cmService->Position);
this->dgrdService->CurrentRowIndex = this->cmService->Position;
}
}
else if(String::Compare(e->Button->ToolTipText,S"尾记录") == 0)
{
this->dgrdService->UnSelect(this->cmService->Position);
this->cmService->Position = this->cmService->Count;
this->dgrdService->Select(this->cmService->Position);
this->dgrdService->CurrentRowIndex = this->cmService->Position;
}
else if(String::Compare(e->Button->ToolTipText,S"新增") == 0)
{
this->cmService->AddNew();
this->SetModify(true);
//设置默认值
//设置编号
String* tempSQL = S"Select max(编号) 最大编号 from 门诊收费项目";
SqlCommand* sqlCmd = new SqlCommand(tempSQL,this->MyDataBase->myConnection);
int MaxID = 1;
Object* r = sqlCmd->ExecuteScalar();
if(r != System::DBNull::Value)
MaxID = System::Convert::ToInt32(r) + 1;
this->tBoxServiceIDShow->Text = MaxID.ToString();
}
else if(String::Compare(e->Button->ToolTipText,S"修改") == 0)
{
this->SetModify(true);
}
else if(String::Compare(e->Button->ToolTipText,S"删除") == 0)
{
System::Windows::Forms::DialogResult r = MessageBox::Show(S"确定删除?",S"删除数据",MessageBoxButtons::OKCancel);
if(r == DialogResult::OK)
{
if(this->cmService->Count > 0)
this->cmService->RemoveAt(this->cmService->Position);
else
MessageBox::Show(S"表格已空,无可删除数据",S"提示");
}
}
else if(String::Compare(e->Button->ToolTipText,S"提交") == 0)
{
this->cmService->EndCurrentEdit();
this->MyDataBase->UpdateDataBase(this->ServiceAdapter,this->ds,S"门诊收费项目");
}
else if(String::Compare(e->Button->ToolTipText,S"取消") == 0)
{
try
{
this->cmService->CancelCurrentEdit();
}
catch(Exception* e)
{
MessageBox::Show(e->Message,S"提示");
}
}
else if(String::Compare(e->Button->ToolTipText,S"退出") == 0)
{
this->Close();
}
}
//按条件查询
private: System::Void btnSearch_Click(System::Object * sender, System::EventArgs * e)
{
String* strPinyin = this->tBoxPinyin->Text->Trim();
String* strServiceName = this->tBoxServiceName->Text->Trim();
String* strServiceID = this->tBoxServiceID->Text->Trim();
String* Filter = S"";
if(String::Compare(strPinyin,String::Empty) != 0)
{
Filter = String::Format(S"{0} AND (拼音码 LIKE '%{1}%')",Filter,strPinyin);
}
if(String::Compare(strServiceName,String::Empty) != 0)
{
Filter = String::Format(S"{0} AND (名称 LIKE '%{1}%')",Filter,strServiceName);
}
if(String::Compare(strServiceID,String::Empty) != 0)
{
Filter = String::Format(S"{0} AND (编号 LIKE '%{1}%')",Filter,strServiceID);
}
this->ds->Tables->Item[S"门诊收费项目"]->Clear();
if(String::Compare(Filter,String::Empty) != 0)
{
Filter = Filter->Substring(5,Filter->Length - 5);
//查询门诊收费项目
this->strSQL = String::Format(S"Select * from 门诊收费项目 where {0}",Filter);
this->strTableName = S"门诊收费项目";
this->MyDataBase->SelectDataBase(this->ServiceAdapter,this->ds,this->strSQL,this->strTableName);
}
else
{
//查询门诊收费项目
this->strSQL = S"Select * from 门诊收费项目";
this->strTableName = S"门诊收费项目";
this->MyDataBase->SelectDataBase(this->ServiceAdapter,this->ds,this->strSQL,this->strTableName);
}
}
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -