/*******************************************************************

PROGRAM NAME: bnk_util.c

DESCRIPTIVE NAME: misc utilities for the bank daemon

(C) COPYRIGHT International Business Machines Corp. 1992, 1994
All Rights Reserved
Licensed Materials - Property of IBM

US Government Users Restricted Rights - Use, duplication or
disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

FUNCTION: ErrorMsgDisplay

*******************************************************************/
#define INCL_PM

#include <os2.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dce/dce_error.h>
#include "bnk_util.h"

VOID ErrorMsgDisplay(HWND hWnd, error_status_t st)
{
	CHAR  errText[dce_c_error_string_len + 20];
	CHAR  tmpBuf[dce_c_error_string_len];
	error_status_t	e_status;

	switch(st)
	{
		case ACCOUNT_EXISTS:
			strcpy(errText,"Account exists");
			break;

		case ACCT_NOT_FOUND:
			strcpy(errText,"Account not found");
			break;

		case BAD_DEPOSIT_AMOUNT:
			strcpy(errText,"Must deposit multiples of $500.00");
			break;

		case UNMATURE_ACCOUNT:
			strcpy(errText,"Account not mature");
			break;

		case INSUFFICIENT_FUNDS:
			strcpy(errText,"Insufficient funds");
			break;

		case FAIL:
			strcpy(errText,"Transaction attempt failed");
			break;

		default:
			dce_error_inq_text(st, tmpBuf, (int *)&e_status);
			sprintf(errText,"(%x) %s",st,tmpBuf);
      break;
  }
	WinMessageBox(HWND_DESKTOP, hWnd, errText, "!! Error !!", 0, MB_OK  | MB_ERROR);
	return;
}
