bia-framework
Version:
Bia Framework to work with angular 2
84 lines • 2.77 kB
text/typescript
// /// <reference path="../../typings/main.d.ts" />
//
// import {Injectable, OnInit} from '@angular/core';
// import "rxjs/add/operator/concat";
// import db from "nedb";
// import NeDBDataStore = require("nedb");
// import {IMunicipio} from "./OdisseiaDataBase/IMunicipio";
// import {ITableSync} from "./OdisseiaDataBase/TableSync";
// import {IUsuario} from "./OdisseiaDataBase/IUsuario";
//
// @Injectable()
// export class DataBaseContext implements OnInit
// {
//
// public Documents:IDocument[] = [
// {
// name: "Municipio",
// description: "Tabela com todos os municípios",
// synchronized: false,
// isSync: true
// },
// {
// name: "Usuario",
// description: "Tabela com todos os clientes da aplicação",
// synchronized: false,
// isSync: true
// }
// ];
//
//
// //private db:Nedb;
// private COLLECTION_MUNICIPIOS_NAME:string = 'bia_municipios.db';
// private COLLECTION_TABLESYNC_NAME:string = 'bia_tablesync.db';
// private COLLECTION_USUARIO_NAME:string = 'bia_usuario.db';
//
// //Stores
// public Municipio:NeDBDataStore<IMunicipio>;
// public TableSync:NeDBDataStore<ITableSync>;
// public Usuario:NeDBDataStore<IUsuario>;
//
// ngOnInit():any
// {
// return undefined;
// }
//
// constructor()
// {
// this.Municipio = new db({filename: this.COLLECTION_MUNICIPIOS_NAME, autoload: true});
// this.TableSync = new db({filename: this.COLLECTION_TABLESYNC_NAME, autoload: true});
// this.Usuario = new db({filename: this.COLLECTION_USUARIO_NAME, autoload: true});
// }
//
//
// public getStore = <T>(table:string):NeDBDataStore<T> =>
// {
// return <NeDBDataStore<T>>this[table];
// };
//
//
// private pad2 = (n:number) =>
// {
// return (n < 10 ? '0' : '') + n;
// };
//
// public GetCurrentUtcDate = ():Date =>
// {
// var now = new Date();
// return new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds());
// };
//
// public GetSyncNumberFromDate = (date:Date):number =>
// {
// var dateNumber = date.getUTCFullYear() +
// this.pad2(date.getUTCMonth() + 1) +
// this.pad2(date.getUTCDate()) +
// this.pad2(date.getUTCHours()) +
// this.pad2(date.getUTCMinutes()) +
// this.pad2(date.getUTCSeconds()) +
// this.pad2(date.getUTCMilliseconds());
// return Number.parseInt(dateNumber);
// };
//
//
// }