Exemplo n.º 1
0
        public MoQueryResponse MoQuery(MoQuery moquery)
        {
            string methodName = MethodBase.GetCurrentMethod().Name;
            BaseLog.LoggingBegin(logger, methodName);
            string msgName = "MOQuery";
            string responseMsg = "MOQueryResponse";
            try
            {
                WS.Common.SQL.InsertTxnDataLog(EnumMsgCategory.Receive,
                                                                               msgName,
                                                                               string.IsNullOrEmpty(moquery.MoNumber) ? "" : moquery.MoNumber,
                                                                               "",
                                                                               "",
                                                                               "",
                                                                               "",
                                                                               EnumMsgState.Received,
                                                                               "");
                Execute.ValidateParameter(moquery);

                //Execute.BuildResponseMsg(moquery.MoNumber);

                //4.Build Response Message
                MoQueryResponse moresponse = Execute.BuildResponseMsg(moquery.MoNumber);
                WS.Common.SQL.InsertTxnDataLog(EnumMsgCategory.Send,
                                                                               responseMsg,  
                                                                               string.IsNullOrEmpty( moquery.MoNumber)? "":moquery.MoNumber , 
                                                                               moresponse.Result,
                                                                               "", 
                                                                               "",
                                                                               "",
                                                                               EnumMsgState.Success,  
                                                                               moresponse.HoldResult);
                return moresponse;
            }
            catch (Exception e)
            {
                logger.Error(MethodBase.GetCurrentMethod(), e);
                //  UTL.SendMail("test", e.Message);
                //4.Build Response Error Message
                MoQueryResponse moresponse = new MoQueryResponse() { MoNumber = moquery.MoNumber, HoldResult = "N", Result = "NotFound" };
                WS.Common.SQL.InsertTxnDataLog(EnumMsgCategory.Send, 
                                                                            responseMsg, 
                                                                            string.IsNullOrEmpty( moquery.MoNumber)? "":moquery.MoNumber , 
                                                                            "NotFound", 
                                                                            "",
                                                                            "", 
                                                                            e.Message, 
                                                                             EnumMsgState.Fail, 
                                                                             "N");
                
                return moresponse;
            }
            finally
            {
                BaseLog.LoggingEnd(logger, methodName);
            }
        
        }
Exemplo n.º 2
0
        //1.檢查必要的input parameter
        public static void ValidateParameter(MoQuery moquery)
        {
            string methodName = MethodBase.GetCurrentMethod().Name;
            BaseLog.LoggingBegin(logger, methodName);
            try
            {
                BaseLog.LoggingInfo(logger, "Header: \r\n{0}", ObjectTool.ObjectTostring(moquery));
                if (string.IsNullOrEmpty(moquery.MoNumber))
                {
                    throw new Exception("The MoNumber of moquery is null or no data");
                }

            }
            catch
            {
                throw;
            }
            finally
            {
                BaseLog.LoggingEnd(logger, methodName);
            }
            
        }