123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- import { Injectable } from '@angular/core';
- import { Http } from '@angular/http';
- import { AppConfig } from '../../app.config';
- import { ResultMessage } from '../../../viewmodel/result';
- import { ServiceCommon } from "../service.common";
- import {RefundView} from "../../../viewmodel/myexam/RefundView";
- import 'rxjs/add/operator/toPromise';
- @Injectable()
- export class MyexamService {
- constructor(private http: Http) { }
- getMyexamListView(count: number): Promise<ResultMessage> {
- let url: string = AppConfig.getServiceUrl();
- url += "MyexamServices/MyexamListView";
- return this.http.post(url, JSON.stringify({
- userID: localStorage.userID,
- pageIndex: 0,
- pageSize: count
- }), {headers: ServiceCommon.getHeader()})
- .toPromise()
- .then(res => {
- return {
- isSuccess: true,
- message: "",
- data: res.json().rows
- } as ResultMessage;
- })
- .catch(ServiceCommon.serviceErrorHandler);
- }
- canPay(examinationRegistrationID:string): Promise<ResultMessage> {
- let url: string = AppConfig.getServiceUrl();
- url += "ExamineApply/CanPay";
- return this.http.post(url, JSON.stringify({
- examinationRegistrationID: examinationRegistrationID
- }), {headers: ServiceCommon.getHeader()})
- .toPromise()
- .then(res => {
- let result = res.json();
- return {
- isSuccess: result.IsSuccess,
- message: result.Message,
- data: null
- } as ResultMessage;
- })
- .catch(ServiceCommon.serviceErrorHandler);
- }
- cancel(ExaminationRegistrationID:string): Promise<ResultMessage>{
- let url: string = AppConfig.getServiceUrl();
- url += "MyexamServices/Cancel";
- return this.http.post(url, JSON.stringify({ExaminationRegistrationID:ExaminationRegistrationID}), {headers: ServiceCommon.getHeader()})
- .toPromise()
- .then(res => {
- return res.json() as ResultMessage;
- })
- .catch(ServiceCommon.serviceErrorHandler);
- }
- messageSubmit(ExaminationRegistrationID:string,refundView:RefundView): Promise<ResultMessage>{
- let url: string = AppConfig.getServiceUrl();
- url += "MyexamServices/CancelApply";
- return this.http.post(url, JSON.stringify({ExaminationRegistrationID:ExaminationRegistrationID,RefundView:refundView}), {headers: ServiceCommon.getHeader()})
- .toPromise()
- .then(res => {
- return res.json() as ResultMessage;
- })
- .catch(ServiceCommon.serviceErrorHandler);
- }
- }
|