README
Bpaslib
This library was generated with Angular CLI version 8.2.14.
Code scaffolding
Run ng generate component component-name --project bpaslib
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module --project bpaslib
.
Note: Don't forget to add
--project bpaslib
or else it will be added to the default project in yourangular.json
file.
Build
Run ng build bpaslib
to build the project. The build artifacts will be stored in the dist/
directory.
Publishing
After building your library with ng build bpaslib
, go to the dist folder cd dist/bpaslib
and run npm publish
.
Running unit tests
Run ng test bpaslib
to execute the unit tests via Karma.
Further help
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.
Services
BpaslibService --> This provides a litany of methods
Date Formatting: calculateMinMaxDate(date:Date):void --> Minimum Date will be 50 years in the past. Maximum Date will be 50 years in the future. Saves dates into variables minDate / maxDate. datediff(startdate:any,enddate:any):number --> Return number of days between two dates getJSONtoDate(date:string):Date --> Convert Date from JSON format to Date Object getDatetoJSON(date:any):string --> Convert Date Object to JSON format addDays(date:string,adddays:number):Date --> Add days to a Date Object formattime(elapsedtime:number):string --> Format elapsed time to hh:mm:ss format getOEDateTime(date:string,elapsedtime:number):Date --> Convert OpenEdge Date and Time to Date Ojbect getDateString(date:Date):string --> Format Date Object to MM/DD/YYYY getjsondate(date:Date):string --> Format Date Object to yyy-mm-dd getdatetime(date:string,elapsedtime:number) --> Format Open Edge date string with elapsed time to MM/DD/YYY HH:MM:SS getdatestring(date:string) --> Format Open Edge date to MM/DD/YYYY using date pipe getYear(date:string) --> Get Year from Open Edge date add_months(date:Date,month:number):Date --> Add months to a Date Object getMonthNumber(monthname:string):number --> Using switch case return month number
String Formatting: GetBuildDateTime:string --> Creates a Build Date Time Stamp (YYMMDDHHMM) returnPositive(data:number):number --> Always return positive number maskPartNumber(partnumber:string,maskdata:boolean):string --> Environment value will indicate whether partnumber will be masked createFileName(filename:string,filextension:string):string --> Add DateTime Stamp to file name getInt(value:any):number --> Convert any object to number or return zero isIntvalue:any):boolean --> Check whether object is a number
Function Calls:
getrouterUrl:string --> Returns current Route URL
getDownLoadLink(urllinktype:string,userrole:string):string --> Transaction pages have download links which we can be different based of user role and transaction type
getUser:LoginUser --> Return object with currently logged user details
isLoggedIn:boolean --> Check whether user is currently logged in a valid session
getEnvironment:string --> Get Environment Name
base64ToUint8Array(object):ArrayObject --> Convert any object into Base 64 Unit Array
base64(object):any --> Convert object to Base 64 object
getExcelTemplate:strin --> Return Excel Template for file download
downloadfile(data:any,header:string,filename:string,filextension:string) --> Convert data object to a blob and using file saver make file available for download irrespective of browser
exportToExcel(tableid:string,worksheetname:string,filename:string):boolean --> Pass htmlid of a html table which will be converted to an excel and available for download
exportToCSV(event:any,tableid:string,filename:strong):boolean --> Pass htmlid of a html table which will be converted to an csv and available for download
isEmpty(object:any):boolean --> Check whether object is undefined or null
isNumberNullOrZero(object:number):boolean --> Check whether number is zero or null
isStringEmpty(object:string):boolean --> Check whether string is empty
isStringBlank(object:string):boolean --> Check whether string is empty
isBiggerThanZero(object:number):boolean --> Check whether number is greater than zero
findIndexInArray(data:any,value:any):number --> Search value in data and return Array Index number
findinArray(data:any,searchvalue:string):boolean --> Recursive search to check whether search value exists in data array
findIndexInData(data:any,propertyname:string,searchvalue:string,operator?:string):any --> Search array recursively for propertyname and if operator is provided (first / last) stop search after operator has been applied
openPDF(data:any,filename:string,showdata:boolean):boolean --> For Safari browsers open PDF content in new browser or tab, for IE browsers make pdf available for download, other browser return true for the browser to open pdf as embedded object
getEmptyRequest:any --> Build PUT Request parameters
initRequest(user:LoginUser,Page?string):any --> Build PUT Request parameters and add logged user details. If Page is not undefined pass SponsorReport LoginID
buildInputData(parametername:string,parametervalue:string,recordnumber?:number):any --> Build PUT Request parameters
addPutRequest(request:any,parametername:string,parametervalue:string,recordnumber?:number):request --> Add PUT Request Parameters to array received which will be returned back
updatePropValue(request[]:any,searchvalue:string,updatevalue:string):request[] --> Update Parameter value with update value on finding searchvalue
cleanUpNull(object[]:any):any[] --> Recursive process to make all null string values blank
getPropertyTotal(data:any,propertyname:string):any --> Sum up value where array property name matches provided propertyname
cloneObject
Web Requests:
getHTMLdata(url:string):Observable