import { Injectable } from '@angular/core'; import { CommonEnum } from "../../../../models/common-enum"; import { CustomerAdministration } from "../../../../models/admin/company/customer-administration/customer-administration"; import { CoredataService } from '../../../../core/coredata.service'; @Injectable({ providedIn: 'root' }) export class CustomerAdministrationService { constructor(private coreData: CoredataService) { } getCustomer(CompanyId:number,success, error) { this.coreData.Get(CommonEnum.CompanyAPP, CommonEnum.CustomerAdministrationAPI + '/GetCustomerList/' + CompanyId, null, (result) => { if (result != null) { return success(result); } return null; }, (error) => { return error(error); }); } GetCommonMultiDropDownList(pageName: string, success, error) { this.coreData.Get(CommonEnum.CompanyAPP, CommonEnum.CommonMultiDropdownListAPI + '?pageName=' + pageName, null, (result) => { if (result != null) { return success(result); } return null; }, (error) => { return error(error); }); } getCustomerById(id: number, success, error) { this.coreData.Get(CommonEnum.CompanyAPP, CommonEnum.CustomerAdministrationAPI + '/' + id, null, (result) => { if (result != null) { return success(result); } return null; }, (error) => { return error(error); }); } deleteCustomerById(id: number, success, error) { this.coreData.Delete(CommonEnum.CompanyAPP, CommonEnum.CustomerAdministrationAPI + '/' + id, null, (result) => { if (result != null) { return success(result); } return null; }, (error) => { return error(error); }); } //SetDefaultById(id: number, success, error) { // this.coreData.Get(CommonEnum.CompanyAPP, CommonEnum.CustomerAdministrationAPI + '/SetDefaultRecord/' + id, null, // (result) => { // if (result != null) { // return success(result); // } // return null; // }, // (error) => { // return error(error); // }); //} SetDefaultById(tableName, recordId, defaultValue, userId, ipAddress, success, error) { this.coreData.Get(CommonEnum.CompanyAPP, CommonEnum.CommonDefaultUnDefaultAPI + '/' + tableName + '/' + recordId + '/' + defaultValue + '/' + userId + '/' + ipAddress, null, (result) => { if (result != null) { return success(result); } return null; }, (error) => { return error(error); }); } saveCustomer(modelCustomerAdministration: CustomerAdministration, success, error) { this.coreData.Post(CommonEnum.CompanyAPP, CommonEnum.CustomerAdministrationAPI, modelCustomerAdministration, (result) => { if (result != null) { return success(result); } return null; }, (error) => { return error(error); }); } }