mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
remove sqlite and unused import
This commit is contained in:
@@ -1,728 +1,11 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { SQLite, SQLiteObject } from '@ionic-native/sqlite/ngx';
|
||||
//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";
|
||||
readonly allprocess: string = "ALLPROCESS";
|
||||
readonly actions: string = "ACTIONS";
|
||||
readonly publications: string = "PUBLICATIONS";
|
||||
readonly chatlistroom: string = "CHATLISTROOM";
|
||||
readonly chatlistUsers: string = "CHATLISTUSERS";
|
||||
readonly chatmsg: string = "CHATMSG";
|
||||
EVENTS: Array<any>;
|
||||
EXPEDIENTES: Array<any>;
|
||||
ALLPROCESS: Array<any>;
|
||||
PROCESS: Array<any>;
|
||||
ALLACTIONS: Array<any>;
|
||||
ALLChatROOM: Array<any>;
|
||||
ALLChatUSERs: Array<any>;
|
||||
ALLCHATMSG: Array<any>;
|
||||
|
||||
constructor(private platform: Platform,
|
||||
private sqlite: SQLite) {
|
||||
this.databaseConn();
|
||||
}
|
||||
|
||||
databaseConn() {
|
||||
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
} else {
|
||||
|
||||
this.platform.ready().then(async () => {
|
||||
|
||||
this.sqlite.create({
|
||||
name: this.db_name,
|
||||
location: 'default'
|
||||
}).then(async (sqLite: SQLiteObject) => {
|
||||
this.dbInstance = sqLite;
|
||||
|
||||
await sqLite.executeSql(`
|
||||
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,
|
||||
Body Text,
|
||||
Profile varchar(255),
|
||||
HumanDate varchar(255)
|
||||
)`, [])
|
||||
.then((res) => {
|
||||
|
||||
})
|
||||
.catch((error) => console.error(error));
|
||||
|
||||
await sqLite.executeSql(`
|
||||
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)
|
||||
)`, [])
|
||||
.then((res) => {
|
||||
|
||||
})
|
||||
.catch((error) => console.error(error));
|
||||
|
||||
await sqLite.executeSql(`
|
||||
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,
|
||||
workflowName varchar(255),
|
||||
interveners Text
|
||||
)`, [])
|
||||
.then((res) => {
|
||||
|
||||
})
|
||||
.catch((error) => console.error(error));
|
||||
|
||||
await sqLite.executeSql(`
|
||||
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),
|
||||
publications Text,
|
||||
publicationsDetails Text
|
||||
)`, [])
|
||||
.then((res) => {
|
||||
|
||||
})
|
||||
.catch((error) => console.error(error));
|
||||
|
||||
await sqLite.executeSql(`
|
||||
CREATE TABLE IF NOT EXISTS ${this.chatlistroom} (
|
||||
Id varchar(255) PRIMARY KEY,
|
||||
Uids Text,
|
||||
Usernames Text,
|
||||
LastMessage Text,
|
||||
UpdatedAt varchar(255),
|
||||
customFields Text,
|
||||
name varchar(255)
|
||||
)`, [])
|
||||
.then((res) => {
|
||||
})
|
||||
.catch((error) => console.error(error));
|
||||
|
||||
await sqLite.executeSql(`
|
||||
CREATE TABLE IF NOT EXISTS ${this.chatlistUsers} (
|
||||
Id varchar(255) PRIMARY KEY,
|
||||
Name varchar(255),
|
||||
Username varchar(255)
|
||||
|
||||
)`, [])
|
||||
.then((res) => {
|
||||
})
|
||||
.catch((error) => console.error(error));
|
||||
|
||||
await sqLite.executeSql(`
|
||||
CREATE TABLE IF NOT EXISTS ${this.chatmsg} (
|
||||
Id varchar(255) PRIMARY KEY,
|
||||
Attachments Text,
|
||||
Channels Text,
|
||||
File Text,
|
||||
Mentions Text,
|
||||
Msg varchar(255),
|
||||
Rid varchar(255),
|
||||
Ts varchar(255),
|
||||
U Text,
|
||||
UpdatedAt varchar(255),
|
||||
image_url Text
|
||||
)`, [])
|
||||
.then((res) => {
|
||||
})
|
||||
.catch((error) => console.error(error));
|
||||
|
||||
|
||||
})
|
||||
.catch((error) => console.error(error));
|
||||
|
||||
|
||||
}).catch((error) => {
|
||||
console.error( error)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//addactions
|
||||
public addactions(data) {
|
||||
|
||||
this.dbInstance.executeSql(`
|
||||
INSERT OR IGNORE INTO ${this.actions} (ActionType,DateBegin,DateEnd,Description,Detail,ProcessId,publications,publicationsDetails)
|
||||
VALUES ('${data.ActionType}','${data.DateBegin}', '${data.DateEnd}','${data.Description}','${data.Detail}','${data.ProcessId}','${data.publications}','${data.publicationsDetails}')`, [])
|
||||
.then(() => {
|
||||
|
||||
|
||||
}, (e) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//addEvent
|
||||
public addEvent(data) {
|
||||
this.dbInstance.executeSql(`
|
||||
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}')`, [])
|
||||
.then(() => {
|
||||
|
||||
|
||||
}, (e) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//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(() => {
|
||||
|
||||
|
||||
}, (e) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//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(() => {
|
||||
|
||||
|
||||
}, (e) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//chatlistroom
|
||||
public addChatListRoom(data) {
|
||||
|
||||
this.dbInstance.executeSql(`
|
||||
INSERT OR REPLACE INTO ${this.chatlistroom} (Id,Uids,Usernames,LastMessage,UpdatedAt,customFields,name)
|
||||
VALUES ('${data.id}','${JSON.stringify(data.uids)}','${JSON.stringify(data.usernames)}','${JSON.stringify(data.lastMessage)}','${data.updatedat}','${JSON.stringify(data.customFields)}','${data.name}')`, [])
|
||||
.then(() => {
|
||||
|
||||
|
||||
}, (e) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//chatlistusers
|
||||
public addChatListUsers(data) {
|
||||
|
||||
this.dbInstance.executeSql(`
|
||||
INSERT OR REPLACE INTO ${this.chatlistUsers} (Id,Name,Username)
|
||||
VALUES ('${data.id}','${data.name}','${data.username}')`, [])
|
||||
.then(() => {
|
||||
|
||||
|
||||
}, (e) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//chatlistusers
|
||||
public addChatMSG(data) {
|
||||
|
||||
this.dbInstance.executeSql(`
|
||||
INSERT OR IGNORE INTO ${this.chatmsg} (Id,Attachments,Channels,File,Mentions,Msg,Rid, Ts ,U, UpdatedAt)
|
||||
VALUES ('${data._id}','${JSON.stringify(data.attachments)}','${JSON.stringify(data.channels)}','${JSON.stringify(data.file)}','${JSON.stringify(data.mentions)}','${data.msg}','${data.rid}','${data.ts}','${JSON.stringify(data.u)}','${JSON.stringify(data._updatedAt)}')`, [])
|
||||
.then(() => {
|
||||
|
||||
|
||||
}, (e) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//updateevent
|
||||
public updateEvent(data) {
|
||||
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(() => {
|
||||
|
||||
|
||||
}, (e) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//updateActions
|
||||
public updateactions(id, data) {
|
||||
try {
|
||||
|
||||
this.dbInstance.executeSql(`
|
||||
UPDATE ${this.actions} SET publications = ? WHERE ProcessId = ${id}`, [data])
|
||||
.then(() => {
|
||||
|
||||
|
||||
}, (e) => {
|
||||
|
||||
});
|
||||
} catch(error) {}
|
||||
|
||||
}
|
||||
|
||||
//updatePublicationsDetails
|
||||
public updatePublicationsDetails(id, data) {
|
||||
try {
|
||||
|
||||
this.dbInstance.executeSql(`
|
||||
UPDATE ${this.actions} SET publicationsDetails = ? WHERE ProcessId = ${id}`, [data])
|
||||
.then(() => {
|
||||
|
||||
|
||||
}, (e) => {
|
||||
|
||||
});
|
||||
} catch(error) {}
|
||||
|
||||
}
|
||||
|
||||
//updateChatMsg
|
||||
public updateChatMsg(id, data) {
|
||||
let jsonId = JSON.stringify(id)
|
||||
let jsondata = JSON.stringify(data)
|
||||
try {
|
||||
|
||||
this.dbInstance.executeSql(`
|
||||
UPDATE ${this.chatmsg} SET image_url = ? WHERE Id = ${jsonId}`, [jsondata])
|
||||
.then(() => {
|
||||
|
||||
|
||||
}, (e) => {
|
||||
|
||||
});
|
||||
} catch(error) {}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//updateprocess
|
||||
public updateProcess(data) {
|
||||
this.dbInstance.executeSql(`
|
||||
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}')`, [])
|
||||
.then(() => {
|
||||
|
||||
|
||||
}, (e) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//updateAttachment
|
||||
updateUser(id, document,) {
|
||||
let data = [document];
|
||||
return this.dbInstance.executeSql(`UPDATE ${this.allprocess} SET Documents = ? WHERE serialNumber = ${id}`, [document]).then(() => {
|
||||
|
||||
})
|
||||
}
|
||||
//updateAttachment
|
||||
updateProcessInterveners(id, interveners,) {
|
||||
let data = [document];
|
||||
return this.dbInstance.executeSql(`UPDATE ${this.allprocess} SET interveners = ? WHERE serialNumber = ${id}`, [interveners]).then(() => {
|
||||
|
||||
})
|
||||
}
|
||||
//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,
|
||||
Attachments: res.rows.item(i).Attachments,
|
||||
Profile: res.rows.item(i).Profile,
|
||||
HumanDate: res.rows.item(i).HumanDate
|
||||
|
||||
}
|
||||
this.EVENTS.push(event);
|
||||
}
|
||||
|
||||
return this.EVENTS;
|
||||
}
|
||||
}, (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) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
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) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//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) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//getAllChatRoom
|
||||
getAllChatRoom() {
|
||||
return this.dbInstance.executeSql(`SELECT * FROM ${this.chatlistroom}`, []).then((res) => {
|
||||
this.ALLChatROOM = [];
|
||||
if (res.rows.length > 0) {
|
||||
for (var i = 0; i < res.rows.length; i++) {
|
||||
this.ALLChatROOM.push(res.rows.item(i));
|
||||
}
|
||||
return this.ALLChatROOM;
|
||||
}
|
||||
}, (e) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//getAllChatUsers
|
||||
getAllChatUsers() {
|
||||
return this.dbInstance.executeSql(`SELECT * FROM ${this.chatlistUsers}`, []).then((res) => {
|
||||
this.ALLChatUSERs = [];
|
||||
if (res.rows.length > 0) {
|
||||
for (var i = 0; i < res.rows.length; i++) {
|
||||
this.ALLChatUSERs.push(res.rows.item(i));
|
||||
}
|
||||
return this.ALLChatUSERs;
|
||||
}
|
||||
}, (e) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//getAllChatMSG
|
||||
getAllChatMSG(roomId) {
|
||||
return this.dbInstance.executeSql(`SELECT * FROM ${this.chatmsg} WHERE Rid = ?`, [roomId]).then((res) => {
|
||||
this.ALLCHATMSG = [];
|
||||
if (res.rows.length > 0) {
|
||||
for (var i = 0; i < res.rows.length; i++) {
|
||||
this.ALLCHATMSG.push(res.rows.item(i));
|
||||
}
|
||||
return this.ALLCHATMSG;
|
||||
}
|
||||
}, (e) => {
|
||||
|
||||
});
|
||||
}
|
||||
//getlistOfEventAprove
|
||||
getListOfEventAprove(process, type) {
|
||||
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE workflowDisplayName = ? OR workflowDisplayName = ? `, [process, type]).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) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//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) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//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));
|
||||
|
||||
}
|
||||
return this.ALLPROCESS;
|
||||
}
|
||||
}, (e) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//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));
|
||||
}
|
||||
return this.ALLPROCESS;
|
||||
}
|
||||
}, (e) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
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) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//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) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
//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,
|
||||
Body: res.rows.item(i).Body,
|
||||
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) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
deleteAllTables() {
|
||||
this.deleteeventsTable();
|
||||
this.deleteallprocessTable();
|
||||
this.deleteactionsTable();
|
||||
this.deletepublicationsTable();
|
||||
|
||||
|
||||
}
|
||||
|
||||
deleteeventsTable() {
|
||||
return this.dbInstance.executeSql("DELETE from "+ this.events).then((res) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
deleteallprocessTable() {
|
||||
return this.dbInstance.executeSql("DELETE from "+ this.allprocess).then((res) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
deleteactionsTable() {
|
||||
return this.dbInstance.executeSql("DELETE from "+ this.actions).then((res) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
deletepublicationsTable() {
|
||||
return this.dbInstance.executeSql("DELETE from "+ this.publications).then((res) => {
|
||||
|
||||
});
|
||||
}
|
||||
// y
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user