package Xunjian;
|
import java.util.Iterator;
|
import java.util.List;
|
import java.util.Vector;
|
import DataBase.DatabaseManagement;
|
import Method.GetNowTime;
|
import home.Open_soft_dialog;
|
public class Dell_xunjianset {
|
static Vector<Tb_xunjianset> xjset_vec=new Vector<>();
|
|
/**³õʼ»¯Êý¾Ý*/
|
@SuppressWarnings("rawtypes")
|
public static void chushihua(){
|
Open_soft_dialog.addara("¼ÓÔØtb_xunjianset");
|
Iterator iterator = DatabaseManagement.get_alldate_indatabase("tb_xunjianset").iterator();
|
while (iterator.hasNext()) {//µü´úÆ÷´æÔÚÔªËØ
|
List info = (List) iterator.next();//½«µü´úÆ÷ÀïÃæµÄÔªËØ¸øµ½info¼¯ºÏ
|
Tb_xunjianset xjset=new Tb_xunjianset();
|
xjset.setQuyu((String)info.get(0));
|
xjset.setStartime((String)info.get(1));
|
xjset.setStoptime((String)info.get(2));
|
xjset.setXunshu((String)info.get(3));
|
xjset.setTagid((String)info.get(4));
|
xjset.setNeedstoptime((String)info.get(5));
|
xjset.setCishu((String)info.get(6));
|
xjset.setAddtime((String)info.get(7));
|
xjset_vec.add(xjset);
|
}
|
}
|
|
/**»ñȡÿ¸öѲ¼ìÇøÓòµÄÇøÓòÉèÖõļ¯ºÏ*/
|
public static Vector<Tb_xunjianset> getXjset_vec() {
|
|
return xjset_vec;
|
}
|
|
/**²åÈëÒ»¸öѲ¼ìÇøÓòµÄÉèÖÃ*/
|
public static void insert(String quyu) {
|
Tb_xunjianset xjset=new Tb_xunjianset();
|
xjset.setQuyu(quyu);
|
xjset.setStartime("23:59:00"); //¿ªÊ¼ÉúЧʱ¼ä
|
xjset.setStoptime("ÎÞ"); //½áÊøÊ±¼ä
|
xjset.setXunshu("ÎÞ") ; //ÐòºÅ
|
xjset.setTagid("ËùÓбêÇ©");//±êÇ©id
|
xjset.setNeedstoptime("1"); //ÔÚѲ¼ìÇøÓòÐèҪͣÁôµÄʱ¼ä
|
xjset.setCishu("1");//Ѳ¼ì´ÎÊý
|
xjset.setAddtime(GetNowTime.now());// Ìí¼Óʱ¼ä
|
//Êý¾Ý²åÈëÊý¾Ý¿â
|
String[] ziduan= { "quyu","startime","stoptime","xunshu","tagid","needstoptime","cishu","addtime"};
|
String[] zhi= {quyu,"23:59:00","ÎÞ","ÎÞ","ËùÓбêÇ©","1","1",GetNowTime.now()};
|
DatabaseManagement.insertfast("tb_xunjianset", ziduan, zhi);
|
xjset_vec.add(xjset);
|
}
|
|
/**ÐÞ¸ÄÒ»¸öѲ¼ìÇøÓòÉèÖÃ*/
|
public static void alert(
|
String quyu,
|
String startime,
|
String stoptime,
|
String xunshu,
|
String tagid,
|
String needstoptime,
|
String cishu
|
) {
|
if(get_xjst(quyu) !=null) {
|
get_xjst(quyu).setStartime(startime); //¿ªÊ¼ÉúЧʱ¼ä
|
get_xjst(quyu).setStoptime(stoptime); //½áÊøÊ±¼ä
|
get_xjst(quyu).setXunshu(xunshu) ; //ÐòºÅ
|
get_xjst(quyu).setTagid(tagid);//±êÇ©id
|
get_xjst(quyu).setNeedstoptime(needstoptime); //ÔÚѲ¼ìÇøÓòÐèҪͣÁôµÄʱ¼ä
|
get_xjst(quyu).setCishu(cishu);//Ѳ¼ì´ÎÊý
|
get_xjst(quyu).setAddtime(GetNowTime.now());// Ìí¼Óʱ¼ä
|
String[] ziduan= { "startime","stoptime","xunshu","tagid","needstoptime","cishu","addtime","quyu"};
|
String[] zhi= {startime,stoptime,xunshu,tagid,needstoptime,cishu,GetNowTime.now(),quyu};
|
DatabaseManagement.fast_alert_dbase("tb_xunjianset", ziduan, zhi);
|
}
|
}
|
|
/**ÐÞ¸ÄÒ»¸öѲ¼ìÇøÓòÉèÖúÍÊý¾Ý¿âÎÞ¹Ø*/
|
public static void alert2(
|
String quyu,
|
String startime,
|
String stoptime,
|
String xunshu,
|
String tagid,
|
String needstoptime,
|
String cishu
|
) {
|
if(get_xjst(quyu) !=null) {
|
get_xjst(quyu).setStartime(startime); //¿ªÊ¼ÉúЧʱ¼ä
|
get_xjst(quyu).setStoptime(stoptime); //½áÊøÊ±¼ä
|
get_xjst(quyu).setXunshu(xunshu) ; //ÐòºÅ
|
get_xjst(quyu).setTagid(tagid);//±êÇ©id
|
get_xjst(quyu).setNeedstoptime(needstoptime); //ÔÚѲ¼ìÇøÓòÐèҪͣÁôµÄʱ¼ä
|
get_xjst(quyu).setCishu(cishu);//Ѳ¼ì´ÎÊý
|
get_xjst(quyu).setAddtime(GetNowTime.now());// Ìí¼Óʱ¼ä
|
}
|
}
|
|
|
|
/**ͨ¹ýÇøÓòÃû³ÆÕÒµ½Ä³ÇøÓòµÄÉèÖÃ*/
|
public static Tb_xunjianset get_xjst(String quyu) {
|
Tb_xunjianset tbxjset=null;
|
if(xjset_vec.size() !=0) {
|
for(int i=0;i<xjset_vec.size();i++) {
|
Tb_xunjianset nxjs=xjset_vec.get(i);
|
if(quyu.equals(nxjs.getQuyu())) {
|
tbxjset=nxjs;
|
break;
|
}
|
}
|
}
|
return tbxjset;
|
}
|
|
/**ɾ³ýij¸öѲ¼ìÇøÓòÉèÖÃ*/
|
public static void delete(String quyu) {
|
if(get_xjst(quyu) !=null) {
|
xjset_vec.removeElement(get_xjst(quyu));
|
String deleteSql="DELETE FROM tb_xunjianset WHERE quyu='"+quyu+"'";
|
DatabaseManagement.update(deleteSql);
|
}
|
|
}
|
|
/**ɾ³ýËùÓеÄѲ¼ìÇøÓò¶ÔÏóÉèÖÃ*/
|
public static void deleteall() {
|
xjset_vec.removeAllElements();
|
String deleteSql="TRUNCATE TABLE tb_xunjianset";
|
DatabaseManagement.update(deleteSql);
|
}
|
|
/**»ñÈ¡ËùÓÐѲ¼ìÇøÓòÃû³ÆµÄ¼¯ºÏ*/
|
public static String[] quyuname() {
|
int size=xjset_vec.size();
|
String[] quyue=new String[size+1];
|
quyue[0]="ÇøÓòÑ¡Ôñ";
|
for(int i=0;i<size;i++) {
|
quyue[i+1]=xjset_vec.get(i).getQuyu();
|
}
|
return quyue;
|
}
|
|
/**»ñÈ¡ËùÓÐÇøÓòÐòºÅ¼¯ºÏ*/
|
public static String[] xuhao() {
|
int size=xjset_vec.size();
|
String[] xuhao=new String[size+1];
|
xuhao[0]="ÎÞ";
|
for(int i=0;i<size;i++) {
|
xuhao[i+1]=String.valueOf(i+1);
|
}
|
return xuhao;
|
}
|
|
}
|