Created
January 10, 2019 12:19
-
-
Save AhsanNissar/b90b0cd12d3467a15caa27816eb9443d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// student list Dto starts here | |
export interface IStudentListDto { | |
firstName: string | undefined; | |
lastName: string | undefined; | |
middleName: string | undefined; | |
fatherName: string | undefined; | |
dateOfBirth: string | undefined; | |
guardianName: string | undefined; | |
gender: string | undefined; | |
email: string | undefined; | |
avatar: string | undefined; | |
studentKey: string | undefined; | |
studentId: string | undefined; | |
contactNumber: string | undefined; | |
class: {name: string, code: string}; | |
section: {name: string, code: string}; | |
} | |
export class StudentListDto implements IStudentListDto { | |
firstName: string | undefined; | |
lastName: string | undefined; | |
middleName: string | undefined; | |
fatherName: string | undefined; | |
dateOfBirth: string | undefined; | |
guardianName: string | undefined; | |
gender: string | undefined; | |
email: string | undefined; | |
avatar: string | undefined; | |
studentKey: string | undefined; | |
studentId: string | undefined; | |
contactNumber: string | undefined; | |
class: {name: string, code: string}; | |
section: {name: string, code: string}; | |
static fromJS(data: any): StudentListDto { | |
data = typeof data === 'object' ? data : {}; | |
const result = new StudentListDto(); | |
result.init(data); | |
return result; | |
} | |
constructor(data?: IStudentListDto) { | |
if (data) { | |
for (let property in data) { | |
if (data.hasOwnProperty(property)) { | |
(<any>this)[property] = (<any>data)[property]; | |
} | |
} | |
} | |
} | |
init(data?: any) { | |
if (data) { | |
this.firstName = data['firstName']; | |
this.lastName = data['lastName']; | |
this.middleName = data['middleName']; | |
this.fatherName = data['fatherName']; | |
this.dateOfBirth = data['dateOfBirth']; | |
this.guardianName = data['guardianName']; | |
this.gender = data['gender']; | |
this.email = data['email']; | |
this.avatar = data['avatar']; | |
this.studentKey = data['studentKey']; | |
this.studentId = data['studentId']; | |
this.contactNumber = data['contactNumber']; | |
this.class = data['class']; | |
this.section = data['section']; | |
} | |
} | |
toJSON(data?: any) { | |
data = typeof data === 'object' ? data : {}; | |
data['firstName'] = this.firstName; | |
data['lastName'] = this.lastName; | |
data['middleName'] = this.middleName; | |
data['fatherName'] = this.fatherName; | |
data['dateOfBirth'] = this.dateOfBirth; | |
data['guardianName'] = this.guardianName; | |
data['gender'] = this.gender; | |
data['email'] = this.email; | |
data['avatar'] = this.avatar; | |
data['studentKey'] = this.studentKey; | |
data['studentId'] = this.studentId; | |
data['contactNumber'] = this.contactNumber; | |
data['class'] = this.class; | |
data['section'] = this.section; | |
return data; | |
} | |
clone() { | |
const json = this.toJSON(); | |
const result = new StudentListDto(); | |
result.init(json); | |
return result; | |
} | |
} | |
// student list Dto ends here | |
// student list result Dto starts here | |
export class IListResultDtoOfStudentDto { | |
studentList: StudentListDto[] | undefined; | |
schoolName: string | undefined; | |
schoolTenanatName: string | undefined; | |
} | |
export class ListResultDtoOfStudentDto implements IListResultDtoOfStudentDto { | |
studentList: StudentListDto[] | undefined; | |
schoolName: string | undefined; | |
schoolTenanatName: string | undefined; | |
static fromJS(data: any): IListResultDtoOfStudentDto { | |
data = typeof data === 'object' ? data : {}; | |
const result = new ListResultDtoOfStudentDto(); | |
result.init(data); | |
return result; | |
} | |
constructor(data?: IListResultDtoOfStudentDto) { | |
if (data) { | |
for (const property in data) { | |
if (data.hasOwnProperty(property)) { | |
(<any>this)[property] = (<any>data)[property]; | |
} | |
} | |
} | |
} | |
init(data?: any) { | |
if (data) { | |
if (data['studentList'] && data['studentList'].constructor === Array) { | |
this.studentList = []; | |
for (const item of data['studentList']) { | |
this.studentList.push(StudentListDto.fromJS(item)); | |
} | |
} | |
this.schoolName = data['schoolName']; | |
this.schoolTenanatName = data['schoolTenanatName']; | |
} | |
} | |
toJSON(data?: any) { | |
data = typeof data === 'object' ? data : {}; | |
if (this.studentList && this.studentList.constructor === Array) { | |
data['studentList'] = []; | |
for (let result of this.studentList) { | |
data['studentList'].push(result.toJSON()); | |
} | |
} | |
data['schoolName'] = this.schoolName; | |
data['schoolTenanatName'] = this.schoolTenanatName; | |
return data; | |
} | |
clone() { | |
const json = this.toJSON(); | |
const result = new ListResultDtoOfStudentDto(); | |
result.init(json); | |
return result; | |
} | |
} | |
// student list result Dto ends here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment