📄 fee_type_db.java~4~
字号:
package Financing;
/**
* <p>Title: CowriePixie</p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: xidian</p>
* @author yangyong
* @version 1.0
*/
import javax.microedition.rms.RecordEnumeration;
import javax.microedition.rms.RecordStore;
/*
* 创建日期 2005-9-23
*
* TODO 要更改此生成的文件的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
/**
* @author Administrator
*
* TODO 要更改此生成的类型注释的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
* 初始化程序的全局变量:设置程序以前的设置保存.
*/
public class Fee_Type_DB {
protected RecordStore feetypedb;
protected RecordStore subfeetypedb;
protected RecordStore pswdb;
protected RecordStore ispswdb;
//初始化费用类型和费用明细
protected String feename[][] = {
{
"00", "学生特有费"
}
, {
"01", "通信费"
}
, {
"02", "交通费"
}
, {
"03", "购物费"
}
, {
"04", "娱乐费"
}
, {
"05", "银行帐户"
}
};
protected String subfeename[][] = {
{
"00", "00", "学费"
}
, {
"00", "01", "班费"
}
, {
"00", "02", "社交费"
}
, {
"00", "03", "电子设备维修费费"
}
, {
"00", "04", "宽带上网费"
}
, {
"00", "05", "文体用品费"
}
, {
"00", "06", "其他"
}
, {
"01", "00", "电话费"
}
, {
"01", "01", "手机费"
}
, {
"01", "02", "其他"
}
, {
"02", "00", "公交"
}
, {
"02", "01", "出租车"
}
, {
"02", "02", "地铁"
}
, {
"02", "03", "轻轨"
}
, {
"02", "04", "其他"
}
, {
"03", "00", "穿戴"
}
, {
"03", "01", "食用"
}
, {
"03", "02", "家居"
}
, {
"03", "03", "学习"
}
, {
"03", "04", "其他"
}
, {
"04", "00", "电影"
}
, {
"04", "01", "演唱会"
}
, {
"04", "02", "卡拉OK"
}
, {
"04", "03", "舞会"
}
, {
"04", "04", "餐饮"
}
, {
"04", "05", "其他"
}
, {
"05", "00", "中国建设银行"
}
, {
"05", "01", "中国交通银行"
}
, {
"05", "02", "中国农业银行"
}
, {
"05", "03", "中国邮政"
}
, {
"05", "04", "其他"
}
, {
"05", "05", "其他"
}
};
Fee_Type_DB() {
openfeetype();
opensubfeetype();
openpassword();
openispassword();
}
/**
*
*/
//初始化全局变量ispassword(是否设置密码),将以前的设置赋给全局变量.
private void openispassword() {
// TODO 自动生成方法存根
String filename = "ispsw";
byte ispsw[] = new byte[8];
try {
ispswdb = RecordStore.openRecordStore(filename, true);
}
catch (Exception ex) {
return;
}
try {
if (ispswdb.getNumRecords() == 0) {
String ispswstr = "true";
Financing.ispassword = ispswstr;
ispsw = ispswstr.getBytes();
ispswdb.addRecord(ispsw, 0, ispsw.length);
}
else {
ispsw = ispswdb.getRecord(1);
String temp = new String(ispsw);
Financing.ispassword = temp;
}
}
catch (Exception exception) {}
try {
pswdb.closeRecordStore();
}
catch (Exception exception1) {}
}
// 初始化全局变量password(密码),将以前的设置赋给全局变量.
void openpassword() {
String filename = "psw";
byte psw[] = new byte[8];
try {
pswdb = RecordStore.openRecordStore(filename, true);
}
catch (Exception ex) {
return;
}
try {
if (pswdb.getNumRecords() == 0) {
String pswstr = "123456";
Financing.password = pswstr;
psw = pswstr.getBytes();
pswdb.addRecord(psw, 0, psw.length);
}
else {
psw = pswdb.getRecord(1);
String temp = new String(psw);
Financing.password = temp;
}
}
catch (Exception exception) {}
try {
pswdb.closeRecordStore();
}
catch (Exception exception1) {}
}
//装载费用类型,全局变量: feenamevector
void openfeetype() {
String filename = "fee_type";
try {
feetypedb = RecordStore.openRecordStore(filename, true);
}
catch (Exception ex) {
return;
}
try {
if (feetypedb.getNumRecords() == 0) {
for (int i = 0; i < 6; i++) {
Fee_Type temp = new Fee_Type(feename[i][0], feename[i][1]);
byte field[] = temp.encode();
try {
feetypedb.addRecord(field, 0, field.length);
}
catch (Exception ex) {
return;
}
}
feetypedb.closeRecordStore();
}
else {
byte field[] = new byte[48];
Fee_Type temp;
for (RecordEnumeration re = feetypedb.enumerateRecords(null, null, false);
re.hasPreviousElement(); temp.decode(field)) {
field = re.previousRecord();
temp = new Fee_Type();
}
feetypedb.closeRecordStore();
}
}
catch (Exception ex) {
return;
}
}
// 装载费用明细,全局变量: subfeenamevector
void opensubfeetype() {
String filename = "sub_fee_type";
try {
subfeetypedb = RecordStore.openRecordStore(filename, true);
}
catch (Exception ex) {
return;
}
try {
if (subfeetypedb.getNumRecords() == 0) {
for (int i = 0; i < 32; i++) {
Sub_Fee_Type temp = new Sub_Fee_Type(subfeename[i][0],
subfeename[i][1],
subfeename[i][2]);
byte field[] = temp.encode();
try {
subfeetypedb.addRecord(field, 0, field.length);
}
catch (Exception ex) {
return;
}
}
subfeetypedb.closeRecordStore();
}
else {
byte field[] = new byte[48];
Sub_Fee_Type temp;
for (RecordEnumeration re = subfeetypedb.enumerateRecords(null, null, false);
re.hasPreviousElement(); temp.decode(field)) {
field = re.previousRecord();
temp = new Sub_Fee_Type();
}
subfeetypedb.closeRecordStore();
}
}
catch (Exception ex) {
return;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -