new.~cpp

来自「脑电信号分析软件」· ~CPP 代码 · 共 117 行

~CPP
117
字号
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop
#include "log.h"
#include "new.h"
#include "eegwave.h"
#include "Main.h"
#include "print.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm_New *Form_New;
//---------------------------------------------------------------------------
__fastcall TForm_New::TForm_New(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm_New::Button_SampleClick(TObject *Sender)
{
      MainForm->Show();
      Form_New->Close();
}
//---------------------------------------------------------------------------


//---------------------------------------------------------------------------

void __fastcall TForm_New::Button_CancelClick(TObject *Sender)
{

 Close();        
}
//---------------------------------------------------------------------------


void __fastcall TForm_New::Button_SaveClick(TObject *Sender)
{  AnsiString sex;
  if(RadioButton_man->Checked ==true)
    {sex="男";
    }
   else
   {sex="女" ;
   }
  if(ADOConnection1->Connected ==false)
    {ADOConnection1->Connected ==true;
    }
    ADOQuery1->Active=false;
    ADOQuery1->SQL->Clear();
    String strTmp;
    strTmp="Select *from Pinfo where (编号='"+Edit_bh->Text.Trim()+"')";
    ADOQuery1->SQL->Add(strTmp);
    ADOQuery1->Open();
    if (ADOQuery1->RecordCount!=0 )
      {  //ADOQuery1->Close() ;
        Application->MessageBox("该编号已存在,请重新设定!","新建提示",MB_OK);
        goto Jump;
        //break;
      }
    if(Edit_bh->Text.Trim()=="")
     { Application->MessageBox("编号必须填写!","新建提示",MB_OK);
       goto Jump;
     }
     if(Edit_xm->Text.Trim()=="")
     { Application->MessageBox("编号必须填写!","新建提示",MB_OK);
       goto Jump;
     }
      if(Edit_qssj->Text.Trim()=="")
     { Application->MessageBox("起始时间必须填写!","新建提示",MB_OK);
       goto Jump;
     }
      if(ComboBox_dls->Text.Trim()=="")
     { Application->MessageBox("导联数必须选择!","新建提示",MB_OK);
       goto Jump;
     }
    ADOTable1->Active=true;
    ADOTable1->Append();
    ADOTable1->FieldByName("编号")->AsString=Edit_bh->Text.Trim();
    ADOTable1->FieldByName("姓名")->AsString=Edit_xm->Text.Trim();
    ADOTable1->FieldByName("日期")->AsDateTime=DateTimePicker1_rq->Date;
    ADOTable1->FieldByName("时间")->AsDateTime=Edit_qssj->Text.Trim();
    ADOTable1->FieldByName("性别")->AsString=sex;
    ADOTable1->FieldByName("年龄")->AsString=Edit_nl->Text.Trim();
    ADOTable1->FieldByName("科室")->AsString=ComboBox_ks->Text.Trim();
    ADOTable1->FieldByName("门诊号")->AsString=ComboBox__mzh->Text.Trim();
    ADOTable1->FieldByName("住院号")->AsString=ComboBox_zyh->Text.Trim();
    ADOTable1->FieldByName("病房号")->AsString=ComboBox_bfh->Text.Trim();
    ADOTable1->FieldByName("导联数")->AsString=ComboBox_dls->Text.Trim();
    ADOTable1->FieldByName("左/右利")->AsString=ComboBox_zy->Text.Trim();
    ADOTable1->FieldByName("检查前服药")->AsString=ComboBox_jcqfy->Text.Trim();
    ADOTable1->FieldByName("检查时神志")->AsString=ComboBox_jcssz->Text.Trim();
    ADOTable1->FieldByName("医师")->AsString=Edit_ys->Text.Trim();
    ADOTable1->Post();
    //Close();
    Application->MessageBox("成功保存档案!","新建提示",MB_OK);
    QRListForm->ID =Edit_bh->Text.Trim();
Jump:
   //if (ADOQuery1->RecordCount!=0 )
   //{Application->MessageBox("该编号已存在,请重新设定!","新建提示",MB_OK);
   // }
}
//---------------------------------------------------------------------------


void __fastcall TForm_New::FormCreate(TObject *Sender)
{
  
  String  databasepath;
  databasepath= ExtractFilePath(Application->ExeName)+"dangan.mdb";
  ADOConnection1->ConnectionString ="Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=" + databasepath + ";Mode=Share Deny None;Extended Properties="";Persist Security Info=False;Jet OLEDB:System database="";Jet OLEDB:Registry Path="";Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False";
      
}
//---------------------------------------------------------------------------


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?