2021-09-21 06:09:41 +01:00
import { Injectable } from '@angular/core' ;
import { Platform } from '@ionic/angular' ;
import { SQLite , SQLiteObject } from '@ionic-native/sqlite/ngx' ;
@Injectable ( {
providedIn : 'root'
} )
export class SqliteService {
private dbInstance : SQLiteObject ;
readonly db_name : string = "gabinetedigital.db" ;
readonly events : string = "Events" ;
readonly expedientes : string = "Expedientes" ;
2021-09-27 08:52:41 +01:00
readonly allprocess : string = "ALLPROCESS" ;
2021-10-09 09:15:22 +01:00
readonly actions : string = "ACTIONS" ;
readonly publications : string = "PUBLICATIONS" ;
2021-09-21 06:09:41 +01:00
EVENTS : Array < any > ;
EXPEDIENTES : Array < any > ;
2021-09-27 08:52:41 +01:00
ALLPROCESS : Array < any > ;
PROCESS : Array < any > ;
2021-10-09 09:15:22 +01:00
ALLACTIONS : Array < any > ;
2021-09-21 06:09:41 +01:00
constructor ( private platform : Platform ,
private sqlite : SQLite ) {
this . databaseConn ( ) ;
}
2021-11-03 12:21:19 +01:00
databaseConn() {
console . log ( 'SQLDBConnect' )
2021-10-20 11:06:00 +01:00
if ( this . platform . is ( 'desktop' ) || this . platform . is ( 'mobileweb' ) ) {
} else {
2021-11-03 12:21:19 +01:00
console . log ( 'SQLDBConnect22' )
2021-10-20 11:06:00 +01:00
this . platform . ready ( ) . then ( async ( ) = > {
2021-11-03 12:21:19 +01:00
console . log ( 'SQLDBConnect33' )
this . sqlite . create ( {
2021-10-20 11:06:00 +01:00
name : this.db_name ,
location : 'default'
} ) . then ( async ( sqLite : SQLiteObject ) = > {
this . dbInstance = sqLite ;
2021-10-30 16:51:29 +01:00
console . log ( 'SQLITE INSTACE ' , this . dbInstance ) ;
2021-10-20 11:06:00 +01:00
await sqLite . executeSql ( `
2021-09-21 06:09:41 +01:00
CREATE TABLE IF NOT EXISTS ${ this . events } (
EventId varchar(255) PRIMARY KEY,
Subject varchar(255),
HasAttachments BIT,
Location varchar(255),
CalendarId varchar(255),
CalendarName varchar(255),
StartDate varchar(255),
EndDate varchar(255),
EventType varchar(255),
Attendees Text,
IsMeeting BIT,
IsRecurring BIT,
IsAllDayEvent BIT,
AppointmentState INTERGER,
TimeZone varchar(255),
Organizer Text,
Category varchar(255),
EventRecurrence Text,
Attachments Text,
2021-10-07 17:05:14 +01:00
Body Text,
2021-10-09 09:15:22 +01:00
Profile varchar(255),
HumanDate varchar(255)
2021-09-21 06:09:41 +01:00
) ` , [ ] )
2021-10-20 11:06:00 +01:00
. then ( ( res ) = > {
console . log ( "Sucess Events Table created: " , res )
} )
. catch ( ( error ) = > console . log ( JSON . stringify ( error ) ) ) ;
2021-09-21 06:09:41 +01:00
2021-10-20 11:06:00 +01:00
await sqLite . executeSql ( `
2021-09-21 06:09:41 +01:00
CREATE TABLE IF NOT EXISTS ${ this . expedientes } (
serialNumber varchar(255) PRIMARY KEY,
workflowInstanceFolio varchar(255),
Documents Text,
actions Text,
activityInstanceName varchar(255),
formURL varchar(255),
originator Text,
taskStartDate varchar(255),
totalDocuments INTERGER,
workflowDisplayName varchar(255),
workflowID INTERGER,
workflowInstanceDataFields Text,
workflowInstanceID INTERGER,
workflowName varchar(255)
) ` , [ ] )
2021-10-20 11:06:00 +01:00
. then ( ( res ) = > {
console . log ( "Sucess Espedientes Table created: " , res )
} )
. catch ( ( error ) = > console . log ( JSON . stringify ( error ) ) ) ;
2021-09-27 08:52:41 +01:00
2021-10-20 11:06:00 +01:00
await sqLite . executeSql ( `
2021-09-27 08:52:41 +01:00
CREATE TABLE IF NOT EXISTS ${ this . allprocess } (
serialNumber varchar(255) PRIMARY KEY,
workflowInstanceFolio varchar(255),
Documents Text,
actions Text,
activityInstanceName varchar(255),
formURL varchar(255),
originator Text,
taskStartDate varchar(255),
totalDocuments INTERGER,
workflowDisplayName varchar(255),
workflowID INTERGER,
workflowInstanceDataFields Text,
workflowInstanceID INTERGER,
2021-09-29 16:47:58 +01:00
workflowName varchar(255),
interveners Text
2021-09-27 08:52:41 +01:00
) ` , [ ] )
2021-10-20 11:06:00 +01:00
. then ( ( res ) = > {
console . log ( "Sucess AllProcess Table created: " , res )
} )
. catch ( ( error ) = > console . log ( JSON . stringify ( error ) ) ) ;
2021-10-09 09:15:22 +01:00
2021-10-20 11:06:00 +01:00
await sqLite . executeSql ( `
2021-10-09 09:15:22 +01:00
CREATE TABLE IF NOT EXISTS ${ this . actions } (
ProcessId INTERGER PRIMARY KEY,
ActionType varchar(255),
DateBegin varchar(255),
DateEnd varchar(255),
Detail varchar(255),
Description varchar(255),
2021-10-11 17:22:01 +01:00
publications Text
2021-10-09 09:15:22 +01:00
) ` , [ ] )
2021-10-20 11:06:00 +01:00
. then ( ( res ) = > {
console . log ( "Sucess action Table created: " , res )
} )
. catch ( ( error ) = > console . log ( JSON . stringify ( error ) ) ) ;
} )
2021-10-09 09:15:22 +01:00
. catch ( ( error ) = > console . log ( JSON . stringify ( error ) ) ) ;
2021-11-03 12:21:19 +01:00
} ) . catch ( ( error ) = > {
console . log ( 'Platform ready error' , error )
2021-10-20 11:06:00 +01:00
} ) ;
}
2021-09-21 06:09:41 +01:00
}
2021-10-09 09:15:22 +01:00
//addactions
public addactions ( data ) {
2021-10-11 17:22:01 +01:00
console . log ( 'Action insert' , data )
2021-10-09 09:15:22 +01:00
this . dbInstance . executeSql ( `
2021-10-11 17:22:01 +01:00
INSERT OR IGNORE INTO ${ this . actions } (ActionType,DateBegin,DateEnd,Description,Detail,ProcessId,publications)
VALUES (' ${ data . ActionType } ',' ${ data . DateBegin } ', ' ${ data . DateEnd } ',' ${ data . Description } ',' ${ data . Detail } ',' ${ data . ProcessId } ',' ${ data . publications } ') ` , [ ] )
2021-10-09 09:15:22 +01:00
. then ( ( ) = > {
console . log ( "action add with Success" ) ;
} , ( e ) = > {
console . log ( JSON . stringify ( e . err ) ) ;
} ) ;
}
2021-09-21 06:09:41 +01:00
//addEvent
public addEvent ( data ) {
this . dbInstance . executeSql ( `
2021-10-09 09:15:22 +01:00
INSERT OR IGNORE INTO ${ this . events } (EventId,Subject,HasAttachments,Location,CalendarId,CalendarName,StartDate,EndDate,EventType,Attendees,IsMeeting,IsRecurring,IsAllDayEvent,AppointmentState,TimeZone,Organizer,Category,EventRecurrence,Attachments,Body,Profile,HumanDate )
VALUES (' ${ data . EventId } ',' ${ data . Subject } ',' ${ data . HasAttachments } ',' ${ data . Location } ',' ${ data . CalendarId } ',' ${ data . CalendarName } ',' ${ data . StartDate } ',' ${ data . EndDate } ',' ${ data . EventType } ',' ${ data . Attendees } ',' ${ data . IsMeeting } ',' ${ data . IsRecurring } ',
' ${ data . IsAllDayEvent } ',' ${ data . AppointmentState } ',' ${ data . TimeZone } ',' ${ data . Organizer } ',' ${ data . Category } ',' ${ data . EventRecurrence } ',' ${ data . Attachments } ',' ${ data . Body } ',' ${ data . Profile } ',' ${ data . HumanDate } ') ` , [ ] )
2021-09-21 06:09:41 +01:00
. then ( ( ) = > {
console . log ( "event add with Success" ) ;
} , ( e ) = > {
2021-10-09 09:15:22 +01:00
console . log ( JSON . stringify ( e ) ) ;
2021-09-21 06:09:41 +01:00
} ) ;
}
//addExpediente
public addExpediente ( data ) {
this . dbInstance . executeSql ( `
INSERT OR REPLACE INTO ${ this . expedientes } (serialNumber,workflowInstanceFolio,Documents,actions,activityInstanceName,formURL,originator,taskStartDate,totalDocuments,workflowDisplayName,workflowID,workflowInstanceDataFields,workflowInstanceID,workflowName)
VALUES (' ${ data . serialNumber } ',' ${ data . workflowInstanceFolio } ', ' ${ data . Documents } ',' ${ data . actions } ',' ${ data . activityInstanceName } ',' ${ data . formURL } ',' ${ data . originator } ',' ${ data . taskStartDate } ',' ${ data . totalDocuments } ',' ${ data . workflowDisplayName } ',' ${ data . workflowID } ',
' ${ data . workflowInstanceDataFields } ',' ${ data . workflowInstanceID } ',' ${ data . workflowName } ') ` , [ ] )
. then ( ( ) = > {
console . log ( "expediente add with Success" ) ;
} , ( e ) = > {
console . log ( JSON . stringify ( e . err ) ) ;
} ) ;
}
2021-09-27 08:52:41 +01:00
//addprocess
public addProcess ( data ) {
this . dbInstance . executeSql ( `
INSERT OR IGNORE INTO ${ this . allprocess } (serialNumber,workflowInstanceFolio,Documents,actions,activityInstanceName,formURL,originator,taskStartDate,totalDocuments,workflowDisplayName,workflowID,workflowInstanceDataFields,workflowInstanceID,workflowName)
VALUES (' ${ data . serialNumber } ',' ${ data . workflowInstanceFolio } ', ' ${ JSON . stringify ( data . Documents ) } ',' ${ JSON . stringify ( data . actions ) } ',' ${ data . activityInstanceName } ',' ${ data . formURL } ',' ${ JSON . stringify ( data . originator ) } ',' ${ data . taskStartDate } ',' ${ data . totalDocuments } ',' ${ data . workflowDisplayName } ',' ${ data . workflowID } ',
' ${ JSON . stringify ( data . workflowInstanceDataFields ) } ',' ${ data . workflowInstanceID } ',' ${ data . workflowName } ') ` , [ ] )
. then ( ( ) = > {
console . log ( "process add with Success" ) ;
} , ( e ) = > {
console . log ( JSON . stringify ( e . err ) ) ;
} ) ;
}
2021-10-20 11:06:00 +01:00
//updateevent
public updateEvent ( data ) {
2021-10-18 07:44:24 +01:00
this . dbInstance . executeSql ( `
INSERT OR REPLACE INTO ${ this . events } (EventId,Subject,HasAttachments,Location,CalendarId,CalendarName,StartDate,EndDate,EventType,Attendees,IsMeeting,IsRecurring,IsAllDayEvent,AppointmentState,TimeZone,Organizer,Category,EventRecurrence,Attachments,Body,Profile,HumanDate )
VALUES (' ${ data . EventId } ',' ${ data . Subject } ',' ${ data . HasAttachments } ',' ${ data . Location } ',' ${ data . CalendarId } ',' ${ data . CalendarName } ',' ${ data . StartDate } ',' ${ data . EndDate } ',' ${ data . EventType } ',' ${ data . Attendees } ',' ${ data . IsMeeting } ',' ${ data . IsRecurring } ',
' ${ data . IsAllDayEvent } ',' ${ data . AppointmentState } ',' ${ data . TimeZone } ',' ${ data . Organizer } ',' ${ data . Category } ',' ${ data . EventRecurrence } ',' ${ data . Attachments } ',' ${ data . Body } ',' ${ data . Profile } ',' ${ data . HumanDate } ') ` , [ ] )
. then ( ( ) = > {
console . log ( "event update with Success" ) ;
} , ( e ) = > {
console . log ( JSON . stringify ( e ) ) ;
} ) ;
}
2021-10-09 09:15:22 +01:00
//updateActions
2021-10-20 11:06:00 +01:00
public updateactions ( id , data ) {
2021-11-19 14:56:29 +01:00
try {
console . log ( "update action data" , data )
this . dbInstance . executeSql ( `
UPDATE ${ this . actions } SET publications = ? WHERE ProcessId = ${ id } ` , [ data ] )
. then ( ( ) = > {
console . log ( "action update with Success" ) ;
} , ( e ) = > {
console . log ( JSON . stringify ( e . err ) ) ;
} ) ;
} catch ( error ) { }
2021-10-09 09:15:22 +01:00
}
//updateprocess
public updateProcess ( data ) {
this . dbInstance . executeSql ( `
2021-09-27 08:52:41 +01:00
INSERT OR REPLACE INTO ${ this . allprocess } (serialNumber,workflowInstanceFolio,Documents,actions,activityInstanceName,formURL,originator,taskStartDate,totalDocuments,workflowDisplayName,workflowID,workflowInstanceDataFields,workflowInstanceID,workflowName)
VALUES (' ${ data . serialNumber } ',' ${ data . workflowInstanceFolio } ', ' ${ JSON . stringify ( data . Documents ) } ',' ${ JSON . stringify ( data . actions ) } ',' ${ data . activityInstanceName } ',' ${ data . formURL } ',' ${ JSON . stringify ( data . originator ) } ',' ${ data . taskStartDate } ',' ${ data . totalDocuments } ',' ${ data . workflowDisplayName } ',' ${ data . workflowID } ',
' ${ JSON . stringify ( data . workflowInstanceDataFields ) } ',' ${ data . workflowInstanceID } ',' ${ data . workflowName } ') ` , [ ] )
2021-10-09 09:15:22 +01:00
. then ( ( ) = > {
console . log ( "process add with Success" ) ;
2021-09-27 08:52:41 +01:00
2021-10-09 09:15:22 +01:00
} , ( e ) = > {
console . log ( JSON . stringify ( e . err ) ) ;
} ) ;
}
//updateAttachment
updateUser ( id , document , ) {
let data = [ document ] ;
return this . dbInstance . executeSql ( ` UPDATE ${ this . allprocess } SET Documents = ? WHERE serialNumber = ${ id } ` , [ document ] ) . then ( ( ) = > {
console . log ( "process attachment updated" )
} )
}
//updateAttachment
updateProcessInterveners ( id , interveners , ) {
let data = [ document ] ;
return this . dbInstance . executeSql ( ` UPDATE ${ this . allprocess } SET interveners = ? WHERE serialNumber = ${ id } ` , [ interveners ] ) . then ( ( ) = > {
console . log ( "process interveners updated" )
} )
}
2021-09-21 06:09:41 +01:00
//getAllEvents
getAllEvents() {
var hashattachment = false ;
var ismeeting = false ;
var isrecurring = false ;
var isallday = false ;
return this . dbInstance . executeSql ( ` SELECT * FROM ${ this . events } ` , [ ] ) . then ( ( res ) = > {
this . EVENTS = [ ] ;
if ( res . rows . length > 0 ) {
for ( var i = 0 ; i < res . rows . length ; i ++ ) {
if ( res . rows . item ( i ) . HasAttachments === "true" ) {
hashattachment = true
}
if ( res . rows . item ( i ) . IsMeeting === "true" ) {
ismeeting = true
}
if ( res . rows . item ( i ) . IsRecurring === "true" ) {
isrecurring = true
}
if ( res . rows . item ( i ) . IsAllDayEvent === "true" ) {
isallday = true
}
let event = {
EventId : res.rows.item ( i ) . EventId ,
HasAttachments : hashattachment ,
Subject : res.rows.item ( i ) . Subject ,
Location : res.rows.item ( i ) . Location ,
CalendarId : res.rows.item ( i ) . CalendarId ,
CalendarName : res.rows.item ( i ) . CalendarName ,
StartDate : res.rows.item ( i ) . StartDate ,
EndDate : res.rows.item ( i ) . EndDate ,
EventType : res.rows.item ( i ) . EventType ,
Attendees : res.rows.item ( i ) . Attendees ,
IsMeeting : ismeeting ,
IsRecurring : isrecurring ,
IsAllDayEvent : isallday ,
AppointmentState : res.rows.item ( i ) . AppointmentState ,
TimeZone : res.rows.item ( i ) . TimeZone ,
Organizer : res.rows.item ( i ) . Organizer ,
Category : res.rows.item ( i ) . Category ,
EventRecurrence : res.rows.item ( i ) . EventRecurrence ,
2021-10-09 09:15:22 +01:00
Attachments : res.rows.item ( i ) . Attachments ,
Profile : res.rows.item ( i ) . Profile ,
HumanDate : res.rows.item ( i ) . HumanDate
2021-09-21 06:09:41 +01:00
}
this . EVENTS . push ( event ) ;
}
return this . EVENTS ;
}
} , ( e ) = > {
console . log ( " Get all events error" , JSON . stringify ( e ) ) ;
} ) ;
}
getAllExpedientes() {
return this . dbInstance . executeSql ( ` SELECT * FROM ${ this . expedientes } ` , [ ] ) . then ( ( res ) = > {
this . EXPEDIENTES = [ ] ;
if ( res . rows . length > 0 ) {
for ( var i = 0 ; i < res . rows . length ; i ++ ) {
this . EXPEDIENTES . push ( res . rows . item ( i ) ) ;
}
return this . EXPEDIENTES ;
}
} , ( e ) = > {
console . log ( " Get all expedientes error" , JSON . stringify ( e ) ) ;
} ) ;
}
2021-09-27 08:52:41 +01:00
getAllProcess() {
return this . dbInstance . executeSql ( ` SELECT * FROM ${ this . allprocess } ` , [ ] ) . then ( ( res ) = > {
this . ALLPROCESS = [ ] ;
if ( res . rows . length > 0 ) {
for ( var i = 0 ; i < res . rows . length ; i ++ ) {
this . ALLPROCESS . push ( res . rows . item ( i ) ) ;
}
return this . ALLPROCESS ;
}
} , ( e ) = > {
console . log ( " Get all process error" , JSON . stringify ( e ) ) ;
} ) ;
}
2021-10-09 09:15:22 +01:00
//getAllAtions
getAllActions() {
return this . dbInstance . executeSql ( ` SELECT * FROM ${ this . actions } ` , [ ] ) . then ( ( res ) = > {
this . ALLACTIONS = [ ] ;
if ( res . rows . length > 0 ) {
for ( var i = 0 ; i < res . rows . length ; i ++ ) {
this . ALLACTIONS . push ( res . rows . item ( i ) ) ;
}
return this . ALLACTIONS ;
}
} , ( e ) = > {
console . log ( " Get all actions error" , JSON . stringify ( e ) ) ;
} ) ;
}
2021-09-27 08:52:41 +01:00
//getlistOfEventAprove
getListOfEventAprove ( process , type ) {
2021-10-09 09:15:22 +01:00
return this . dbInstance . executeSql ( ` SELECT * FROM ${ this . allprocess } WHERE workflowDisplayName = ? OR workflowDisplayName = ? ` , [ process , type ] ) . then ( ( res ) = > {
2021-09-27 08:52:41 +01:00
this . ALLPROCESS = [ ] ;
if ( res . rows . length > 0 ) {
for ( var i = 0 ; i < res . rows . length ; i ++ ) {
this . ALLPROCESS . push ( res . rows . item ( i ) ) ;
}
return this . ALLPROCESS ;
}
} , ( e ) = > {
console . log ( " Get all process error" , JSON . stringify ( e ) ) ;
} ) ;
}
2021-09-29 16:47:58 +01:00
//getDespachosProcess
getDespachosProcess ( process ) {
return this . dbInstance . executeSql ( ` SELECT * FROM ${ this . allprocess } WHERE activityInstanceName = ? ` , [ process ] ) . then ( ( res ) = > {
this . ALLPROCESS = [ ] ;
if ( res . rows . length > 0 ) {
for ( var i = 0 ; i < res . rows . length ; i ++ ) {
this . ALLPROCESS . push ( res . rows . item ( i ) ) ;
}
return this . ALLPROCESS ;
}
} , ( e ) = > {
console . log ( " Get all process error" , JSON . stringify ( e ) ) ;
} ) ;
}
2021-10-09 09:15:22 +01:00
//getprocessByworkflow
getprocessByworkflow ( process ) {
return this . dbInstance . executeSql ( ` SELECT * FROM ${ this . allprocess } WHERE workflowDisplayName = ? ` , [ process ] ) . then ( ( res ) = > {
this . ALLPROCESS = [ ] ;
if ( res . rows . length > 0 ) {
for ( var i = 0 ; i < res . rows . length ; i ++ ) {
this . ALLPROCESS . push ( res . rows . item ( i ) ) ;
2021-10-18 07:44:24 +01:00
console . log ( 'getEXPEDIENTE DB LOOP' )
2021-09-27 08:52:41 +01:00
}
2021-10-09 09:15:22 +01:00
return this . ALLPROCESS ;
}
} , ( e ) = > {
console . log ( " Get all process error" , JSON . stringify ( e ) ) ;
} ) ;
}
2021-09-27 08:52:41 +01:00
2021-10-09 09:15:22 +01:00
//getprocessByworkflowpedido
getprocessByworkflowpedido ( process , process2 ) {
return this . dbInstance . executeSql ( ` SELECT * FROM ${ this . allprocess } WHERE workflowDisplayName = ? OR workflowDisplayName = ? ` , [ process , process2 ] ) . then ( ( res ) = > {
this . ALLPROCESS = [ ] ;
if ( res . rows . length > 0 ) {
for ( var i = 0 ; i < res . rows . length ; i ++ ) {
this . ALLPROCESS . push ( res . rows . item ( i ) ) ;
2021-09-29 16:47:58 +01:00
}
2021-10-09 09:15:22 +01:00
return this . ALLPROCESS ;
}
} , ( e ) = > {
console . log ( " Get all process error" , JSON . stringify ( e ) ) ;
} ) ;
}
2021-09-29 16:47:58 +01:00
2021-09-27 08:52:41 +01:00
getProcessById ( serial ) {
return this . dbInstance . executeSql ( ` SELECT * FROM ${ this . allprocess } WHERE serialNumber = ? ` , [ serial ] ) . then ( ( res ) = > {
this . PROCESS = [ ] ;
if ( res . rows . length > 0 ) {
for ( var i = 0 ; i < res . rows . length ; i ++ ) {
this . PROCESS . push ( res . rows . item ( i ) )
}
return this . PROCESS ;
}
} , ( e ) = > {
console . log ( " Get process by serial error" , JSON . stringify ( e ) ) ;
} ) ;
}
2021-10-11 17:22:01 +01:00
//getActionById
getActionById ( id ) {
return this . dbInstance . executeSql ( ` SELECT * FROM ${ this . actions } WHERE ProcessId = ? ` , [ id ] ) . then ( ( res ) = > {
this . ALLACTIONS = [ ] ;
if ( res . rows . length > 0 ) {
for ( var i = 0 ; i < res . rows . length ; i ++ ) {
this . ALLACTIONS . push ( res . rows . item ( i ) )
}
return this . ALLACTIONS ;
}
} , ( e ) = > {
console . log ( " Get actions by processId error" , JSON . stringify ( e ) ) ;
} ) ;
}
2021-09-21 06:09:41 +01:00
//getEventBy id
getEventById ( id ) {
var hashattachment = false ;
var ismeeting = false ;
var isrecurring = false ;
var isallday = false ;
var body ;
var attendes ;
var organizer ;
var eventrecurrence ;
var attachment ;
return this . dbInstance . executeSql ( ` SELECT * FROM ${ this . events } WHERE EventId = ? ` , [ id ] ) . then ( ( res ) = > {
this . EVENTS = [ ] ;
if ( res . rows . length > 0 ) {
for ( var i = 0 ; i < res . rows . length ; i ++ ) {
if ( res . rows . item ( i ) . HasAttachments === "true" ) {
hashattachment = true
}
if ( res . rows . item ( i ) . IsMeeting === "true" ) {
ismeeting = true
}
if ( res . rows . item ( i ) . IsRecurring === "true" ) {
isrecurring = true
}
if ( res . rows . item ( i ) . IsAllDayEvent === "true" ) {
isallday = true
}
/* if (res.rows.item(i).Body != "") {
body = JSON.parse(res.rows.item(i).Body);
}
if (res.rows.item(i).Attendees !="") {
attendes = JSON.parse(res.rows.item(i).Attendees);
}
if(res.rows.item(i).Organizer !=""){
organizer = JSON.parse(res.rows.item(i).Organizer);
}
if(res.row.item(i).EventRecurrence != ""){
eventrecurrence = JSON.parse(res.row.item(i).EventRecurrence);
}
if(res.row.item(i).Attachments != ""){
attachment = JSON.parse(res.row.item(i).Attachments);
}
*/
let event = {
EventId : res.rows.item ( i ) . EventId ,
HasAttachments : hashattachment ,
Subject : res.rows.item ( i ) . Subject ,
Location : res.rows.item ( i ) . Location ,
CalendarId : res.rows.item ( i ) . CalendarId ,
CalendarName : res.rows.item ( i ) . CalendarName ,
StartDate : res.rows.item ( i ) . StartDate ,
EndDate : res.rows.item ( i ) . EndDate ,
EventType : res.rows.item ( i ) . EventType ,
Attendees : res.rows.item ( i ) . Attendees ,
IsMeeting : ismeeting ,
IsRecurring : isrecurring ,
IsAllDayEvent : isallday ,
2021-09-27 08:52:41 +01:00
Body : res.rows.item ( i ) . Body ,
2021-09-21 06:09:41 +01:00
AppointmentState : res.rows.item ( i ) . AppointmentState ,
TimeZone : res.rows.item ( i ) . TimeZone ,
Organizer : res.rows.item ( i ) . Organizer ,
Category : res.rows.item ( i ) . Category ,
EventRecurrence : res.rows.item ( i ) . EventRecurrence ,
Attachments : res.rows.item ( i ) . Attachments
}
this . EVENTS . push ( event ) ;
}
return this . EVENTS ;
}
} , ( e ) = > {
console . log ( " Get events by id error" , JSON . stringify ( e ) ) ;
} ) ;
}
2021-11-16 13:12:25 +01:00
deleteEventTable() {
this . dbInstance . executeSql ( "delete from " + this . events ) . then ( ( res ) = > {
console . log ( 'DELETE EVENT TABLE RESULT ' , res )
} ) ;
}
2021-09-21 06:09:41 +01:00
}