Files correlati : mg0.exe mg1.exe mg3.exe mg4.exe Ricompilazione Demo : [ ] Commento : Bug 0000134 Implementare la gestione multilingua git-svn-id: svn://10.65.10.50/trunk@12084 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			93 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			93 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
| // **************************************
 | |
| // **************************************
 | |
| // **************************************
 | |
| // *** classi per la libreria 
 | |
| // ***
 | |
| //*****
 | |
| #include <diction.h>
 | |
| #include <tabutil.h>
 | |
| #include "mglib.h"
 | |
| 
 | |
| 
 | |
| // ************************************************
 | |
| // TEMP!!!!!!!!!!!!!!!!
 | |
| 
 | |
| TRegistro_std::TRegistro_std(const char* cod, int year) : TRectype(LF_TAB)
 | |
| {
 | |
|   if (!read(cod, year))
 | |
|     fatal_box(TR("Il codice richiesto non è stato trovato nei registri"));
 | |
|   TTable itl("%ITL");
 | |
|   itl.put("CODTAB",cod_intest());
 | |
|   itl.read();
 | |
|   _intest=itl.get("S0");
 | |
| }
 | |
| 
 | |
| bool TRegistro_std::read(const char* cod, int year)
 | |
| {               
 | |
|   if (year <= 0) 
 | |
|   {
 | |
|     const TDate oggi(TODAY);
 | |
|     year = oggi.year();
 | |
|   }
 | |
| 
 | |
|   int err = ~NOERR;
 | |
|   
 | |
|   TTable reg("REG");
 | |
|   reg.setkey(1);
 | |
|   if (cod && *cod > ' ')
 | |
|   {
 | |
|     TString16 chiave; chiave.format("%04d%s", year, cod);
 | |
|     reg.put("CODTAB", chiave);
 | |
|     err = reg.read(); 
 | |
|   }
 | |
|   *((TRectype *)this) = reg.curr();
 | |
|   
 | |
|   return err == NOERR;
 | |
| }           
 | |
| 
 | |
| bool TRegistro_std::write(bool rewrite) const 
 | |
| {               
 | |
|   int err = ~NOERR;
 | |
|   TTable reg("REG");
 | |
| 
 | |
|   reg.set_curr((TRectype *)this);
 | |
|   if (rewrite)
 | |
|     err = reg.rewrite(); 
 | |
|   else
 | |
|     err = reg.write(); 
 | |
|   return err == NOERR;
 | |
| }           
 | |
| 
 | |
| 
 | |
| 
 | |
| int TRegistro_std::year() const 
 | |
| {                
 | |
|   TString16 anno(get("CODTAB")); 
 | |
|   anno.cut(4);
 | |
|   return atoi(anno);
 | |
| }   
 | |
| 
 | |
| 
 | |
| const TString& TRegistro_std::code() const 
 | |
| { 
 | |
|   return get("CODTAB").mid(4);
 | |
| }
 | |
| 
 | |
| const TString TRegistro_std::intest() const
 | |
| {
 | |
|   return _intest;
 | |
| }
 | |
| 
 | |
| int TRegistro_std::lock()
 | |
| {
 | |
|   TTable reg("REG");
 | |
|   reg.put("CODTAB",this->get("CODTAB"));
 | |
|   return reg.read(_lock); 
 | |
| }
 | |
| 
 | |
| int TRegistro_std::unlock()
 | |
| {
 | |
|   TTable reg("REG");
 | |
|   reg.put("CODTAB",this->get("CODTAB"));
 | |
|   return reg.read(_unlock); 
 | |
| } |