@ -13,6 +13,16 @@ using API_NetFramework.Models;
using System.Security.Cryptography ;
using edoka_dms ;
using SecuringWebApiUsingApiKey.Middleware ;
using System.Linq.Expressions ;
using System.Data ;
using System.Web.Management ;
using System.Web ;
using System.IO ;
using OnDocAPI_NetFramework.Controllers ;
using Versandstrasse ;
using System.ComponentModel ;
using System.Text ;
using System.Text.Json.Serialization ;
namespace API_NetFramework.Controllers
@ -93,47 +103,334 @@ namespace API_NetFramework.Controllers
}
//[HttpGet]
//[Route("API/SendToOnBase")]
//public IHttpActionResult SendToOnBase(string dokid)
//{
// if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request, tokenfunction) == false)
// {
// return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
// }
// try
// {
// APILogging.Log((HttpRequestMessage)Request, "Start SendToOnBase:" + dokid, LogLevelType.Debug);
// DB db = new DB(connectionstring);
// db.Get_Tabledata("Select * from dokument where dokumentid='" + dokid + "'", false, true);
// if (db.dsdaten.Tables[0].Rows.Count < 1)
// {
// db = null;
// APILogging.Log((HttpRequestMessage)Request, "Ende GetDocument DokumentID:" + dokid, LogLevelType.Debug);
// return BadRequest("Dokument " + dokid + " not found");
// }
// else
// {
// DocGet dg = new DocGet(connectionstring);
// clsdok dok = new clsdok("", "", "");
// dok = dg.GetDocAsPDF(dokid);
// db.Exec_SQL("Update dokument set loeschgrund='Archiviert' where dokumentid='" + dokid + "'");
// db = null;
// APILogging.Log((HttpRequestMessage)Request, "Ende GetDocument DokumentID:" + dokid, LogLevelType.Debug);
// return Ok("Archivierung ausgelöst");
// }
// }
// catch (Exception e)
// {
// APILogging.Log((HttpRequestMessage)Request, e.Message, LogLevelType.Error);
// return Content(HttpStatusCode.InternalServerError, e.Message);
// }
[HttpPost]
[Route("API/CreateDoc")]
public IHttpActionResult CreateDoc ( )
{
if ( SecuringWebApiUsingApiKey . Middleware . ApiKeyMiddleware . Authorized ( ( HttpRequestMessage ) Request , tokenfunction ) = = false )
{
return Content ( HttpStatusCode . Unauthorized , "Invalid Token or API-Key" ) ;
}
HttpRequestMessage rmsg = ( HttpRequestMessage ) Request ;
string OwnHost = System . Configuration . ConfigurationManager . AppSettings [ "OwnHost" ] . ToString ( ) ;
string imagepath = System . Configuration . ConfigurationManager . AppSettings [ "VSImagePath" ] . ToString ( ) ;
var key = rmsg . Headers . Authorization . Parameter . ToString ( ) ;
string result = Request . Content . ReadAsStringAsync ( ) . Result ;
DocCreate doccreate = new DocCreate ( ) ;
doccreate = JsonConvert . DeserializeObject < DocCreate > ( result ) ;
clsDocData dokdata = new clsDocData ( ) ;
string dokumentid = "" ;
string CheckResult = "" ;
CheckResult = CreateDoc_Verify ( ref doccreate ) ;
if ( CheckResult ! = "" )
{
return BadRequest ( CheckResult ) ;
}
Database . DB db = new DB ( connectionstring ) ;
db . Get_Tabledata ( "Select * from dokumenttyp where dokumenttypnr=" + doccreate . VorlagenTypID , false , true ) ;
System . Data . DataRow dr = db . dsdaten . Tables [ 0 ] . Rows [ 0 ] ;
db . Get_Tabledata ( "Select beschreibung from physischesarchiv where physischesarchivnr = " + dr [ "physisches_archiv" ] . ToString ( ) , false , true ) ;
dokdata . barcode_zusatz = db . dsdaten . Tables [ 0 ] . Rows [ 0 ] [ 0 ] . ToString ( ) ;
if ( dokdata . barcode_zusatz ! = "" ) { dokdata . barcode_zusatz = " " + dokdata . barcode_zusatz ; }
db . Get_Tabledata ( "Select office_vorlagenr,kopfzeile_generieren, bcpt,bcpl, bcw, bch, bchorizontal, barcodetype, datamatrixcontent from office_vorlage where office_vorlagenr=" + dr [ "office_vorlagenr" ] . ToString ( ) , false , true ) ;
dokdata . VorlageNr = Convert . ToInt32 ( dr [ "office_vorlagenr" ] ) . ToString ( ) ; ;
try
{
dokdata . Kopfzeile_generieren = false ;
if ( Convert . ToBoolean ( db . dsdaten . Tables [ 0 ] . Rows [ 0 ] [ 1 ] ) = = true ) { dokdata . Kopfzeile_generieren = true ; }
}
catch { }
dokdata . barcode_left = Convert . ToInt32 ( db . dsdaten . Tables [ 0 ] . Rows [ 0 ] [ "bcpl" ] ) ;
dokdata . barcode_top = Convert . ToInt32 ( db . dsdaten . Tables [ 0 ] . Rows [ 0 ] [ "bcpt" ] ) ;
dokdata . barcode_width = Convert . ToInt32 ( db . dsdaten . Tables [ 0 ] . Rows [ 0 ] [ "bcw" ] ) ;
dokdata . barcode_height = Convert . ToInt32 ( db . dsdaten . Tables [ 0 ] . Rows [ 0 ] [ "bch" ] ) ;
dokdata . barcode_horizontal = Convert . ToInt32 ( db . dsdaten . Tables [ 0 ] . Rows [ 0 ] [ "bchorizontal" ] ) ;
dokdata . barcode_type = db . dsdaten . Tables [ 0 ] . Rows [ 0 ] [ "BarcodeType" ] . ToString ( ) ;
dokdata . barcode_content = db . dsdaten . Tables [ 0 ] . Rows [ 0 ] [ "DatamatrixContent" ] . ToString ( ) ;
Model . clsdocgendata docgendata = new Model . clsdocgendata ( ) ;
DataTable dokwertlist = new DataTable ( ) ;
dokwertlist = db . Get_DokumentWertList ( "" , Convert . ToInt32 ( doccreate . VorlagenTypID ) , 1 ) ;
docgendata . dokumentwerte = dokwertlist ;
docgendata . partnernr = doccreate . Partnernr ;
docgendata . inhaberadresse = "" ;
docgendata . zustelladresse = "" ;
docgendata . dokumenttypnr = doccreate . VorlagenTypID ;
docgendata . unterschriftLinks = db . Get_Mitarbeiternr ( doccreate . TGNrUnterschriftLinks ) . ToString ( ) ;
docgendata . unterschriftRehts = db . Get_Mitarbeiternr ( doccreate . TGNrUnterschriftRechts ) . ToString ( ) ;
docgendata . verantwortlich = db . Get_Mitarbeiternr ( doccreate . TGNrVerantwortlich ) . ToString ( ) ;
docgendata . ersteller = db . Get_Mitarbeiternr ( doccreate . TGNrErsteller ) . ToString ( ) ;
docgendata . team = db . Get_Teamnr ( docgendata . ersteller ) . ToString ( ) ;
docgendata . digitaleunterschrift = false ;
docgendata . frormularOhneUnterschrift = doccreate . OhneUnterschrift = = "Yes" ;
docgendata . zustaendigkube = db . Get_Mitarbeiternr ( doccreate . TGNrVerantwortlich ) . ToString ( ) ;
docgendata . status = "-1" ;
docgendata . dokumentdatum = DateTime . Now . ToString ( "dd.MM.yyyy" ) ;
docgendata . dokumentdatum = doccreate . Dokumentdatum ;
docgendata . frormularOhneUnterschrift = doccreate . OhneUnterschrift = = "Yes" ;
docgendata . bezeichnung = doccreate . Bezeichnung ;
if ( doccreate . Result_FileType = = "WORD" ) { docgendata . erstellungsart = Erstellungsart . DokumentBearbeiten ; } else { docgendata . erstellungsart = Erstellungsart . DokumentAlsPDF ; }
if ( docgendata . verantwortlich = = "0" ) { docgendata . verantwortlich = docgendata . ersteller ; }
dokdata . PartnerNr = docgendata . partnernr ;
dokdata . UseEDOKA_Values = "True" ;
dokdata . DokumenttypNr = docgendata . dokumenttypnr ;
dokdata . Unterschrift_Links = docgendata . unterschriftLinks ;
if ( dokdata . Unterschrift_Links = = "0" ) { dokdata . Unterschrift_Links = "-1" ; }
dokdata . Unterschrift_Rechts = docgendata . unterschriftRehts ;
if ( dokdata . Unterschrift_Rechts = = "0" ) { dokdata . Unterschrift_Rechts = "-1" ; }
dokdata . Verantwortlich = docgendata . verantwortlich ;
dokdata . Team = docgendata . team ;
dokdata . Zustaendig = docgendata . zustaendigkube ;
dokdata . Zustaendig = docgendata . zustaendigkube ;
dokdata . Status = docgendata . status ;
dokdata . Ersteller = docgendata . ersteller ;
dokdata . DokumentDatum = docgendata . dokumentdatum ;
dokdata . Termin = "01.01.1900" ;
dokdata . Bezeichnung = docgendata . bezeichnung ;
dokdata . dokumentwerte = docgendata . dokumentwerte ;
//Unterschriftenprüfung
dokdata . Form_ohne_Unterschrift = docgendata . frormularOhneUnterschrift . ToString ( ) ;
dokdata . approval1 = 0 ;
dokdata . approval2 = 0 ;
dokdata . approved = 0 ;
if ( dokdata . Form_ohne_Unterschrift = = "True" )
{
dokdata . Unterschrift_Links = "-1" ;
dokdata . Unterschrift_Rechts = "-1" ;
}
if ( doccreate . FaksimileUnterschrift = = "Yes" )
{
dokdata . As_Faksimile = "True" ; dokdata . sign = true ; docgendata . digitaleunterschrift = true ;
if ( dokdata . Unterschrift_Links ! = "-1" ) { dokdata . approval1 = 1 ; }
if ( dokdata . Unterschrift_Rechts ! = "-1" ) { dokdata . approval2 = 1 ; }
if ( dokdata . Unterschrift_Links ! = "-1" & & dokdata . Unterschrift_Rechts = = "-1" )
{
if ( dokdata . Ersteller = = dokdata . Unterschrift_Links )
{
dokdata . approved = 1 ;
} else {
dokdata . sign = false ;
dokdata . toapprove = 1 ;
dokdata . approved = 0 ;
dokdata . approval1 = 0 ;
dokdata . approval2 = 1 ;
docgendata . erstellungsart = Erstellungsart . DokumentBearbeiten ;
}
} else
{
docgendata . erstellungsart = Erstellungsart . DokumentBearbeiten ;
dokdata . toapprove = 1 ;
dokdata . sign = false ;
}
}
//}
dokdata . APIValues = doccreate . APIValues ;
if ( doccreate . PrintLogo = = "Yes" ) { dokdata . PrintLogo = true ; } else { dokdata . PrintLogo = false ; }
if ( docgendata . erstellungsart = = Erstellungsart . DokumentAlsPDF ) { dokdata . Result_as_PDF = "True" ; } else { dokdata . Result_as_PDF = "False" ; }
if ( docgendata . digitaleunterschrift = = true ) { dokdata . As_Faksimile = "True" ; } else { dokdata . As_Faksimile = "False" ; }
dokumentid = db . Create_EDOKA_Doc ( dokdata , false , "" ) ;
dokdata . Dokumentid = dokumentid ;
DOCGEN . Generator . DocGenerator_from_EDOKA Generator = new DOCGEN . Generator . DocGenerator_from_EDOKA ( this . connectionstring , OwnHost , key . ToString ( ) ) ;
clsdok dok = new clsdok ( "" , "" , "" , "" ) ;
dok = Generator . Generate_Doc_EDOKA ( dokumentid , ref dokdata , false , 0 , false , false ) ;
db . Save_To_DB ( dokumentid , "" , dok . dokument ) ;
APILogging . Log ( ( HttpRequestMessage ) Request , "Ende GenDoc DokumentID:" + dokumentid , LogLevelType . Debug ) ;
APILogging . DocLog ( ( HttpRequestMessage ) Request , doccreate . Partnernr , "Dokument über API erstellt" , dokumentid , LogLevelType . Info ) ;
if ( doccreate . Result_Versandstrasse = = "Yes" )
{
clsVersandstrasse vs = new clsVersandstrasse ( ) ;
string vsdoc = "" ;
vsdoc = vs . Prepare_PDF ( dokumentid , "" , connectionstring , OwnHost , key . ToString ( ) , imagepath ) ;
Versandpaket vp = new Versandpaket ( ) ;
vp . partnernr = Convert . ToInt32 ( docgendata . partnernr ) ;
vp . GASAdresse = doccreate . GAS_Adresse ;
vp . Versandoption = doccreate . Versand_Option ; ;
List < Versanddokument > vdoc = new List < Versanddokument > ( ) ;
Versanddokument vd = new Versanddokument ( dokumentid , doccreate . Partnernr + " - " + dokdata . Bezeichnung , doccreate . Partnernr ) ;
vd . dokument = vsdoc ;
vdoc . Add ( vd ) ;
vp . Dokument = vdoc ;
vp . finaldoc = vsdoc ;
vp . send_onbase_doc = true ;
vp . verified = true ;
send_vs ( ref vp , dokdata . Ersteller , doccreate . Versand_Direkt = = "Yes" , OwnHost , key . ToString ( ) , dokumentid , doccreate . Partnernr ) ;
}
if ( doccreate . ConfirmationMail = = "Yes" )
{
string message = "Dokument '" + doccreate . Bezeichnung + "' für Partner " + doccreate . Partnernr + " erstellt." + Environment . NewLine ;
if ( doccreate . Result_Versandstrasse = = "Yes" )
{
if ( doccreate . Versand_Direkt = = "Yes" )
{
message = message + " Dokument über Versandstrasse versendet." ;
}
else
{
message = message + " Dokument über Versandstrasse bereit gestellt." ;
}
}
}
return Ok ( dokumentid ) ;
}
private void send_vs ( ref Versandpaket vp , string mitarbeiternr , bool direktversenden , string url , string key , string dokumentid , string partnernr )
{
string jsonstring = JsonConvert . SerializeObject ( vp ) ;
DB db = new DB ( connectionstring ) ;
db . clear_parameter ( ) ;
db . add_parameter ( "@ersteller" , mitarbeiternr ) ;
db . Get_Tabledata ( "ondoc_create_versandpaket" , true , false ) ;
int paketid = Convert . ToInt32 ( db . dsdaten . Tables [ 0 ] . Rows [ 0 ] [ 0 ] ) ;
db . Get_Tabledata_for_Update ( "Select top 1 * from Ondoc_Versandstrasse_Paket where id=" + paketid . ToString ( ) , false , true ) ;
DataRow dr = db . daten . Tables [ 0 ] . Rows [ 0 ] ;
dr [ 2 ] = jsonstring ;
dr [ "aktiv" ] = 1 ;
dr [ "versandoption" ] = vp . Versandoption . ToString ( ) ;
dr [ "Bemerkung" ] = vp . bemerkung ;
// db.daten.Tables[0].Rows.Add(dr);
db . Update_Data ( ) ;
db . daten . Tables . Clear ( ) ;
db . Get_Tabledata_for_Update ( "Select * from ondoc_versandstrasse_paket_dokumentid where couvert_id = -1" , false , true ) ;
foreach ( Versanddokument vd in vp . Dokument )
{
DataRow dr1 = db . daten . Tables [ 0 ] . NewRow ( ) ;
dr1 [ 1 ] = paketid ;
dr1 [ 2 ] = vd . DokumentID ;
dr1 [ 3 ] = 1 ;
db . daten . Tables [ 0 ] . Rows . Add ( dr1 ) ;
}
db . Update_Data ( ) ;
Logging . DocLog . Info ( "Versandpaket vorbereitet" , "OnDoc-API" , dokumentid , partnernr , "" ) ;
if ( ! direktversenden )
{
return ;
}
string URL = url + "api/Send_Versandstrasse?paketid=" + paketid . ToString ( ) ;
WebRequest request ;
var data = Encoding . UTF8 . GetBytes ( jsonstring ) ;
request = WebRequest . Create ( URL ) ;
request . ContentLength = data . Length ;
request . ContentType = "application/json" ;
request . Method = "POST" ;
request . Headers [ "Authorization" ] = "Bearer " + key ;
string response ;
try
{
using ( Stream requestStream = request . GetRequestStream ( ) )
{
requestStream . Write ( data , 0 , data . Length ) ;
requestStream . Close ( ) ;
using ( Stream responseStream = request . GetResponse ( ) . GetResponseStream ( ) )
{
using ( var reader = new StreamReader ( responseStream ) )
{
response = reader . ReadToEnd ( ) ;
}
if ( response . ToString ( ) . Contains ( "*archiviert" ) )
{
}
}
}
Logging . DocLog . Info ( "Versandpaket versendet" , "OnDoc-API" , dokumentid , partnernr , "" ) ;
return ;
}
catch ( Exception ex )
{
Logging . DocLog . Info ( "Direktversand nicht möglich: " + ex . Message , "OnDoc-API" , dokumentid , partnernr , "" ) ;
}
}
private string CreateDoc_Verify ( ref DocCreate doccreate )
{
try
{
APILogging . Log ( ( HttpRequestMessage ) Request , "Start GenDoc " , LogLevelType . Debug ) ;
if ( ! ( ParamCheck ( "partnernr" , doccreate . Partnernr . ToString ( ) ) ) ) { return "Partnernr " + doccreate . Partnernr + " ist ungültig" ; }
if ( ! ( ParamCheck ( "dokumenttyp" , doccreate . VorlagenTypID ) ) ) { return "Vorlagentyp " + doccreate . VorlagenTypID + " ist ungültig" ; }
if ( ! ( ParamCheck ( "tgnr" , doccreate . TGNrErsteller ) ) ) { return "TGNr-Ersteller " + doccreate . TGNrErsteller + " ist ungültig" ; }
if ( ! ( ParamCheck ( "tgnr" , doccreate . TGNrVerantwortlich ) ) ) { return "TGNr-Verantwortlich " + doccreate . TGNrVerantwortlich + " ist ungültig" ; }
if ( ! ( ParamCheck ( "tgnr" , doccreate . TGNrUnterschriftLinks ) ) ) { return "TGNr-Unterschriftlinks " + doccreate . TGNrUnterschriftLinks + " ist ungültig" ; }
if ( ! ( ParamCheck ( "tgnr" , doccreate . TGNrUnterschriftRechts ) ) ) { return "TGNr-Unterschriftrechts " + doccreate . TGNrUnterschriftRechts + " ist ungültig" ; }
if ( ! ( ParamCheck ( "yesno" , doccreate . FaksimileUnterschrift ) ) ) { return "Parameter Faxsimile " + doccreate . FaksimileUnterschrift + " ist ungültig" ; }
if ( ! ( ParamCheck ( "yesno" , doccreate . OhneUnterschrift ) ) ) { return "Parameter Form ohne Unterschrift " + doccreate . OhneUnterschrift + " ist ungültig" ; }
if ( ! ( ParamCheck ( "yesno" , doccreate . PrintLogo ) ) ) { return "Parameter PrintLogo " + doccreate . PrintLogo + " ist ungültig" ; }
if ( ! ( ParamCheck ( "yesno" , doccreate . Result_Versandstrasse ) ) ) { return "Parameter Result_Versandstrasse " + doccreate . Result_Versandstrasse + " ist ungültig" ; }
if ( ! ( ParamCheck ( "yesno" , doccreate . Versand_Direkt ) ) ) { return "Parameter Versand Direkt " + doccreate . Versand_Direkt + " ist ungültig" ; }
if ( ! ( ParamCheck ( "yesno" , doccreate . Result_OnDoc ) ) ) { return "Parameter Result_OnDoc " + doccreate . Result_OnDoc + " ist ungültig" ; }
if ( ! ( ParamCheck ( "yesno" , doccreate . Result_Sender ) ) ) { return "Parameter Result_Sender " + doccreate . Result_Sender + " ist ungültig" ; }
if ( ! ( ParamCheck ( "filetype" , doccreate . Result_FileType ) ) ) { return "Parameter Result_Filetype " + doccreate . Result_FileType + " ist ungültig" ; }
if ( ! ( ParamCheck ( "yesno" , doccreate . ConfirmationMail ) ) ) { return "Parameter ConfirmationMail " + doccreate . ConfirmationMail + " ist ungültig" ; }
if ( ! ( ParamCheck ( "yesno" , doccreate . ConfirmationMail ) ) ) { return "Parameter ConfirmationMail " + doccreate . ConfirmationMail + " ist ungültig" ; }
if ( ! ( ParamCheck ( "versandoption" , doccreate . Versand_Option ) ) ) { return "Versandoption " + doccreate . Versand_Option + " ist ungültig" ; }
if ( doccreate . ConfirmationMail . ToUpper ( ) = = "YES" & & doccreate . ConfirmationMailAddress . ToString ( ) ! = "" ) { return "E-Mailadresse für Confirmation fehlt" ; }
if ( doccreate . TGNrUnterschriftLinks . ToString ( ) = = "" ) { doccreate . TGNrUnterschriftLinks = "-1" ; }
if ( doccreate . TGNrUnterschriftRechts . ToString ( ) = = "" ) { doccreate . TGNrUnterschriftRechts = "-1" ; }
if ( doccreate . FaksimileUnterschrift . ToUpper ( ) = = "YES" )
{
if ( doccreate . TGNrUnterschriftLinks . ToString ( ) = = "-1" ) { return "Faksimile Unterschrift benötigt mit den Parameter TGUnterschriftLinks" ; }
if ( doccreate . TGNrUnterschriftLinks . ToString ( ) ! = "" )
{
string path = System . Configuration . ConfigurationManager . AppSettings [ "UnterschriftPath" ] . ToString ( ) + doccreate . TGNrUnterschriftLinks . ToString ( ) + ".jpg" ;
if ( ! System . IO . File . Exists ( path ) ) { return "Image Unterschrift links " + doccreate . TGNrUnterschriftLinks + " ist nicht vorhanden" ; }
}
if ( doccreate . TGNrUnterschriftRechts . ToString ( ) ! = "-1" )
{
string path = System . Configuration . ConfigurationManager . AppSettings [ "UnterschriftPath" ] . ToString ( ) + doccreate . TGNrUnterschriftLinks . ToString ( ) + ".jpg" ;
if ( ! System . IO . File . Exists ( path ) ) { return "Image Unterschrift rechts " + doccreate . TGNrUnterschriftRechts + " ist nicht vorhanden" ; }
}
}
if ( doccreate . Result_Versandstrasse = = "Yes" )
{
if ( ParamCheck ( "doktypversandstrasse" , doccreate . VorlagenTypID ) = = false ) { return "Vorlagentyp " + doccreate . VorlagenTypID + " ist nicht für die Versandstrasse konfiguriert" ; }
if ( doccreate . TGNrUnterschriftLinks . ToLower ( ) ! = "-1" & & doccreate . TGNrUnterschriftRechts . ToString ( ) ! = "-1" ) { return "Versandstrasse mit zwei Unterschriften kann nicht automatisch angesteuert werden" ; }
if ( doccreate . Versand_Option = = "" ) { return "Versandoption fehlt (A_Post, B1_Post, B2_Post" ; }
}
return "" ;
}
catch ( Exception ex ) { return ex . Message ; }
}
[HttpPost]
[Route("API/GenDoc")]
@ -156,6 +453,8 @@ namespace API_NetFramework.Controllers
if ( ! ( ParamCheck ( "faksimile" , Faksimile ) ) ) { return BadRequest ( "Parameter Faxsimile " + Faksimile + " ist ungültig" ) ; }
if ( ! ( ParamCheck ( "formohneunterschrift" , FoU ) ) ) { return BadRequest ( "Parameter Form ohne Unterschrift " + FoU + " ist ungültig" ) ; }
if ( ! ( ParamCheck ( "printlogo" , PrintLogo ) ) ) { return BadRequest ( "Parameter PrintLogo " + PrintLogo + " ist ungültig" ) ; }
Database . DB db = new DB ( connectionstring ) ;
Model . clsdocgendata docgendata = new Model . clsdocgendata ( ) ;
@ -220,39 +519,58 @@ namespace API_NetFramework.Controllers
private bool ParamCheck ( string ParamType , string ParamValue )
{
DB db = new DB ( connectionstring ) ;
switch ( ParamType )
try
{
switch ( ParamType )
{
case "partnernr" :
db . Get_Tabledata ( "Select count(*) from partner where nrpar00=" + ParamValue , false , true ) ;
if ( db . dsdaten . Tables [ 0 ] . Rows [ 0 ] [ 0 ] . ToString ( ) = = "0" ) { return false ; }
break ;
case "dokumenttyp" :
db . Get_Tabledata ( "Select count(*) from dokumenttyp where dokumenttypnr=" + ParamValue , false , true ) ;
if ( db . dsdaten . Tables [ 0 ] . Rows [ 0 ] [ 0 ] . ToString ( ) = = "0" ) { return false ; }
break ;
case "partnerdokumenttyp" :
//Prüfung Person/Doktyp BP/Doktyp
break ;
case "tgcreator" :
case "tgresp" :
case "tgul" :
case "tgur" :
case "tgnr" :
if ( ParamType = = "tgcreator" & & ParamValue = = "" ) { return false ; } else { if ( ParamValue = = "" ) { return true ; } } ;
db . Get_Tabledata ( "Select count(*) from mitarbeiter where tgnummer='" + ParamValue + "'" , false , true ) ;
if ( db . dsdaten . Tables [ 0 ] . Rows [ 0 ] [ 0 ] . ToString ( ) = = "0" ) { return false ; }
break ;
case "yesno" :
if ( ParamValue ! = "Yes" & & ParamValue ! = "No" & & ParamValue ! = "" ) { return false ; } ;
break ;
case "filetype" :
if ( ParamValue ! = "WORD" & & ParamValue ! = "PDF" ) { return false ; }
break ;
case "versandoption" :
if ( ParamValue ! = "A_POST" & & ParamValue ! = "B1_POST" & & ParamValue ! = "B2_POST" & & ParamValue ! = "" ) { return false ; }
break ;
case "doktypversandstrasse" :
db . Get_Tabledata ( "Select versandstrasse_moeglich, versandstrasse_firstdoc from dokumenttyp where dokumenttypnr=" + ParamValue , false , true ) ;
if ( Convert . ToInt32 ( db . dsdaten . Tables [ 0 ] . Rows [ 0 ] [ 0 ] ) = = 0 | | Convert . ToInt32 ( db . dsdaten . Tables [ 0 ] . Rows [ 0 ] [ 1 ] ) = = 0 ) { return false ; }
break ;
default :
return false ;
break ;
}
return true ;
}
catch
{
return false ;
}
finally
{
case "partnernr" :
db . Get_Tabledata ( "Select count(*) from partner where nrpar00=" + ParamValue , false , true ) ;
if ( db . dsdaten . Tables [ 0 ] . Rows [ 0 ] [ 0 ] . ToString ( ) = = "0" ) { return false ; }
break ;
case "dokumenttyp" :
db . Get_Tabledata ( "Select count(*) from dokumenttyp where dokumenttypnr=" + ParamValue , false , true ) ;
if ( db . dsdaten . Tables [ 0 ] . Rows [ 0 ] [ 0 ] . ToString ( ) = = "0" ) { return false ; }
break ;
case "partnerdokumenttyp" :
//Prüfung Person/Doktyp BP/Doktyp
break ;
case "tgcreator" : case "tgresp" : case "tgul" : case "tgur" :
if ( ParamType = = "tgcreator" & & ParamValue = = "" ) { return false ; } else { if ( ParamValue = = "" ) { return true ; } } ;
db . Get_Tabledata ( "Select count(*) from mitarbeiter where tgnummer='" + ParamValue + "'" , false , true ) ;
if ( db . dsdaten . Tables [ 0 ] . Rows [ 0 ] [ 0 ] . ToString ( ) = = "0" ) { return false ; }
break ;
case "faksimile" :
if ( ParamValue ! = "Yes" & & ParamValue ! = "No" & & ParamValue ! = "" ) { return false ; } ;
break ;
case "formohneunterschrift" :
if ( ParamValue ! = "Yes" & & ParamValue ! = "No" & & ParamValue ! = "" ) { return false ; } ;
break ;
case "printlogo" :
if ( ParamValue ! = "Yes" & & ParamValue ! = "No" & & ParamValue ! = "" ) { return false ; } ;
break ;
default :
return false ;
break ;
db = null ;
}
return true ;
}