Store in GIT
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
export class User {
|
||||
|
||||
id:number;
|
||||
name:string;
|
||||
card:string;
|
||||
role:string;
|
||||
|
||||
constructor(id: number,
|
||||
name: string,
|
||||
cardId: string,
|
||||
role: string) {
|
||||
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.card = cardId;
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public equals(other:User): boolean
|
||||
{
|
||||
if(other)
|
||||
{
|
||||
var keySet1 = Object.keys(this);
|
||||
var keySet2 = Object.keys(other);
|
||||
|
||||
var j = 0;
|
||||
var isTheSame = true;
|
||||
|
||||
for(j; j < keySet1.length; j++) {
|
||||
if (this[keySet1[j]] !== other[keySet2[j]]) {
|
||||
// Shit is not the same
|
||||
isTheSame = false;
|
||||
}
|
||||
}
|
||||
|
||||
return isTheSame;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static toUser(r:any): User{
|
||||
|
||||
let user = new User(r.ID, r.NAME, r.CARD_ID, r.ROLE)
|
||||
|
||||
//console.log('Parsed user:', user);
|
||||
return user;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user