comparison include/marksheet.h @ 27:d21de4693652 v2.2dev v2.3

add hhsname
author pyon@macmini
date Sat, 05 Nov 2011 10:13:41 +0900
parents 5c99c6fa50df
children
comparison
equal deleted inserted replaced
26:5a934c8e1b95 27:d21de4693652
1 // Filename : marksheet.h 1 // Filename : marksheet.h
2 // Last Change: 02-Nov-2011. 2 // Last Change: 05-Nov-2011.
3 // 3 //
4 #ifndef __marksheet__ 4 #ifndef __marksheet__
5 #define __marksheet__ 5 #define __marksheet__
6
7 #include "wx/wxsqlite3.h"
6 8
7 bool IsBlack( int r, int g, int b ) 9 bool IsBlack( int r, int g, int b )
8 { 10 {
9 if ( r == 0 && g == 0 && b == 0 ) { 11 if ( r == 0 && g == 0 && b == 0 ) {
10 return true; 12 return true;
114 return true; 116 return true;
115 } 117 }
116 return false; 118 return false;
117 }; 119 };
118 120
121 wxString GetHhsName( wxString& hhsno )
122 {
123 wxString name;
124
125 wxString gszFile = wxGetCwd() + wxFILE_SEP_PATH + wxT("db") + wxFILE_SEP_PATH + wxT("hhs.db");
126 wxSQLite3Database hhsdb;
127 hhsdb.Open( gszFile );
128
129 wxSQLite3Statement stmt = hhsdb.PrepareStatement("SELECT name FROM hhs_master WHERE hhsno = ?");
130 stmt.Bind( 1, hhsno );
131 wxSQLite3ResultSet q = stmt.ExecuteQuery();
132 if ( !q.IsNull(0) ) {
133 while ( q.NextRow() ) {
134 name = q.GetString(0);
135 }
136 }
137 stmt.Finalize();
138 hhsdb.Close();
139
140 return name;
141 };
142
119 int IsHhsno( wxString& hhsno, wxString& name ) 143 int IsHhsno( wxString& hhsno, wxString& name )
120 { 144 {
121 wxRegEx reHhs(wxT("^0[1238][0-9]{8}$")); // $BHoJ]HV%A%'%C%/(B 145 wxRegEx reHhs(wxT("^0[1238][0-9]{8}$")); // $BHoJ]HV%A%'%C%/(B
122 146
123 if ( reHhs.Matches( hhsno) ) { 147 if ( reHhs.Matches( hhsno) ) {
124 if ( 0 ) { // DB$B$K$"$k(B 148 name = GetHhsName( hhsno );
125 return 2; 149 if ( name.IsEmpty() ) { // DB$B$K$J$$(B
150 return 1;
126 } 151 }
127 return 1; 152 return 2;
128 } 153 }
129 else { 154 else {
130 return 0; 155 return 0;
131 } 156 }
132 }; 157 };