applicazione, le autorizzazione supplementari di CGAUT. git-svn-id: svn://10.65.10.50/trunk@1879 c028cbd2-c16b-5b4b-a496-9718f37d4682
105 lines
2.4 KiB
C++
Executable File
105 lines
2.4 KiB
C++
Executable File
|
|
#include <applicat.h>
|
|
#include <tabapp.h>
|
|
#include <strings.h>
|
|
#include <stdtypes.h>
|
|
#include <tabutil.h>
|
|
#include <utility.h>
|
|
#include <modaut.h>
|
|
#include <prefix.h>
|
|
|
|
#include "batbpdb.h"
|
|
|
|
class Tabanabil_application : public Tab_application
|
|
{
|
|
private:
|
|
TMask* _msk;
|
|
TString _tabname;
|
|
|
|
public:
|
|
bool user_create();
|
|
const char * extra_modules() const { return format("%d",CGAUT); }
|
|
|
|
static bool giorno_handler(TMask_field& f, KEY k);
|
|
static bool mese_handler (TMask_field& f, KEY k);
|
|
|
|
Tabanabil_application() {}
|
|
virtual ~Tabanabil_application() {}
|
|
};
|
|
|
|
HIDDEN inline Tabanabil_application& app() {return (Tabanabil_application&) main_app();}
|
|
|
|
bool Tabanabil_application::giorno_handler(TMask_field& f, KEY k)
|
|
{
|
|
if (k == K_TAB && f.mask().is_running())
|
|
{
|
|
int giorno = atoi(f.get());
|
|
|
|
if (giorno > 31)
|
|
return f.warning_box("Valore non valido per il giorno");
|
|
|
|
int mese = (f.dlg() == F_GIORNO_INI ? f.mask().get_int(F_MESE_INI) : f.mask().get_int(F_MESE_FINE));
|
|
|
|
if (mese == 2)
|
|
if (giorno > 29)
|
|
return f.warning_box("Valore non valido per il giorno");
|
|
|
|
if (mese == 11 || mese == 4 || mese == 6 || mese == 9)
|
|
if (giorno > 30)
|
|
return f.warning_box("Valore non valido per il giorno");
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
bool Tabanabil_application::mese_handler(TMask_field& f, KEY k)
|
|
{
|
|
if (k == K_TAB && f.mask().is_running())
|
|
{
|
|
int mese = atoi(f.get());
|
|
|
|
if (mese < 1 || mese > 12)
|
|
return f.warning_box("Valore non valido per il mese");
|
|
|
|
int giorno = (f.dlg() == F_MESE_INI ? f.mask().get_int(F_GIORNO_INI) : f.mask().get_int(F_GIORNO_FINE));
|
|
|
|
if (mese == 2)
|
|
if (giorno > 29)
|
|
return f.warning_box("Valore non valido per il giorno");
|
|
|
|
if (mese == 11 || mese == 4 || mese == 6 || mese == 9)
|
|
if (giorno > 30)
|
|
return f.warning_box("Valore non valido per il giorno");
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
bool Tabanabil_application::user_create()
|
|
{
|
|
Tab_application::user_create();
|
|
|
|
_msk = get_mask();
|
|
_tabname = get_tabname();
|
|
|
|
if (_tabname == "%PDB")
|
|
{
|
|
_msk->set_handler(F_GIORNO_INI, giorno_handler);
|
|
_msk->set_handler(F_MESE_INI, mese_handler);
|
|
_msk->set_handler(F_GIORNO_FINE, giorno_handler);
|
|
_msk->set_handler(F_MESE_FINE, mese_handler);
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
ab0100(int argc, char* argv[])
|
|
{
|
|
Tabanabil_application a;
|
|
|
|
a.run(argc,argv, "Tabelle");
|
|
return 0;
|
|
}
|
|
|
|
|