コード例 #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;
        }
    }
コード例 #2
0
ファイル: Service.cs プロジェクト: hari316/Projects
    public iSmart_UpdateOutputEntity updatePurchaseRequest([XmlElement("IS_Input")] iSmart_UpdateInputEntity[] IS_Entry)
    {
        logger.Debug("Service:updatePurchaseRequest() called");
        logger.Debug(string.Format("PReqNo. received as {0} for update  ", IS_Entry[0].PReqNo.ToString()));

        iSmart_UpdateOutputEntity result = new iSmart_UpdateOutputEntity();
        try
        {
            iSmartInterface updateTS_IS = new iSmartInterface();
            result = updateTS_IS.updatePurchaseRequest_SI(IS_Entry);
            return result;
        }
        catch (SqlException ex)
        {
            webServiceExHandling.ExceptionLog(ex);
            string mailBody = string.Format(iSmart_Constants.mail_BodyFormat, System.DateTime.Now.ToString("F"), IS_Entry[0].PReqNo, ex.TargetSite.ToString(), ex.ToString());
            webServiceExHandling.Send_Email(iSmart_Constants.Email_Dic, mailBody);

            result.StatusFlag = 1;
            string expCode = ExpType(ex);
            result.Message = iSmart_Constants.cnfgErrMessages[expCode];

            logger.Error(string.Format(" ErrorCode : {0}", result.StatusFlag.ToString()));
            logger.Error(string.Format(" ErrorMessage : {0}", result.Message));
            logger.Error(string.Format(" ErrorStack : {0}", ex.StackTrace));
            logger.Error("Service:updatePurchaseRequest() returning error");

            return result;

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

            result.StatusFlag = 1;
            result.Message = iSmart_Constants.Error;

            logger.Error(string.Format(" ErrorCode : {0}", result.StatusFlag.ToString()));
            logger.Error(string.Format(" ErrorMessage : {0}", result.Message));
            logger.Error(string.Format(" ErrorStack : {0}", ex.StackTrace));
            logger.Error("Service:updatePurchaseRequest() returning error");

            return result;
        }
    }