1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- /// <reference path="../js/jquery-1.11.1.min.js" />
- /// <reference path="../js/knockout-3.1.0.js" />
- /// <reference path="../js/dx.all.js" />
- (function() {
- var endpointSelector = new DevExpress.EndpointSelector(BemsWebApplication.config.endpoints);
- var serviceConfig = $.extend(true, {}, BemsWebApplication.config.services, {
- db: {
- url: endpointSelector.urlFor("db"),
- // To enable JSONP support, uncomment the following line
- //jsonp: !window.WinJS,
- // To allow cookies and HTTP authentication with CORS, uncomment the following line
- // withCredentials: true,
- errorHandler: handleServiceError
- }
- });
- function handleServiceError(error) {
- var message = '알 수 없는 오류';
- if (window.WinJS) {
- try {
- message = error.message;
- } catch (e) {
- message = e.message;
- }
- }
- else {
- if (_.isUndefined(error.message)) {
- if (error.responseJSON) {
- if (error.responseJSON.ExceptionType === "System.Data.Entity.Infrastructure.DbUpdateException") {
- message = "이미 다른 화면에서 사용중이므로 삭제할 수 없습니다";
- }
- else {
- message = error.responseJSON.ExceptionMessage || error.responseJSON.Message;
- }
- }
- }
- else {
- //message = "데이터베이스 작업중 오류가 발생하였습니다. 입력 혹은 삭제하려는 값을 확인하시기 바랍니다."
- message = error.message;
- //if (error.message === "이 요청을 처리하는 동안 오류가 발생했습니다.") {
- // if (!_.isUndefined(error.httpStatus)) {
- // if (error.httpStatus == 500) {
- // message = "필수입력 정보가 입력되지 않았습니다.";
- // } else if (error.httpStatus == 400) {
- // message = "필수입력 정보가 입력되지 않았습니다.";
- // } else {
- // message = error.message;
- // }
-
- // }
- //}
- //else {
- //message = error.message;
- //}
-
- }
- utils.toast.show('오류: ' + message, 'error');
- }
- }
- // Enable partial CORS support for IE < 10
- $.support.cors = true;
- BemsWebApplication.db = new DevExpress.data.ODataContext(serviceConfig.db);
-
- }());
|