コード例 #1
0
ファイル: Service.cs プロジェクト: hari316/Projects
    public iSmartEntity getPurchaseRequestDetails(string PReqNo)
    {
        logger.Debug("Service:getPurchaseRequestDetails() called");
        logger.InfoFormat("PReqNo  received as {0} to get details",PReqNo);

        try
        {
            iSmartEntity result = new iSmartEntity();
            iSmartInterface getIS_SI = new iSmartInterface();
            result = getIS_SI.getPurchaseRequestDetails_SI(PReqNo);
            return result;
        }
        catch (SqlException ex)
        {
            webServiceExHandling.ExceptionLog(ex);
            string mailBody = string.Format(iSmart_Constants.mail_BodyFormat,System.DateTime.Now.ToString("F"),PReqNo,ex.TargetSite.ToString(),ex.ToString());
            webServiceExHandling.Send_Email(iSmart_Constants.Email_Dic, mailBody);

            iSmartEntity Error = new iSmartEntity();
            Error.IS_headerDetails.ErrorCode = ex.Number;
            string expCode = ExpType(ex);
            Error.IS_headerDetails.ErrorMessage = iSmart_Constants.cnfgErrMessages[expCode];

            logger.Error("ErrorCode : " + Error.IS_headerDetails.ErrorCode.ToString());
            logger.Error("ErrorMessage : " + Error.IS_headerDetails.ErrorMessage);
            logger.Error(string.Format(" ErrorStack : {0}", ex.StackTrace));
            logger.Error("Service:getPurchaseRequestDetails() returning error");

            return Error;
        }

        catch (Exception ex)
        {
            webServiceExHandling.ExceptionLog(ex);
            string mailBody = string.Format(iSmart_Constants.mail_BodyFormat, System.DateTime.Now.ToString("F"), PReqNo, ex.TargetSite.ToString(), ex.ToString());
            webServiceExHandling.Send_Email(iSmart_Constants.Email_Dic, mailBody);

            iSmartEntity Error = new iSmartEntity();
            Error.IS_headerDetails.ErrorCode = 1;
            Error.IS_headerDetails.ErrorMessage = iSmart_Constants.Error;

            logger.Error("ErrorCode : " + Error.IS_headerDetails.ErrorCode.ToString());
            logger.Error("ErrorMessage : " + Error.IS_headerDetails.ErrorMessage);
            logger.Error(string.Format(" ErrorStack : {0}", ex.StackTrace));
            logger.Error("Service:getPurchaseRequestDetails() returning error");

            return Error;
        }
    }