示例#1
0
        public List<PGIStatusResponse> PGIStatus(PGIStatus[] PGIItems)
        {
            string connectionDB_BK = "SD_DBServer_BK";
            
            string methodName = MethodBase.GetCurrentMethod().Name;
            BaseLog.LoggingBegin(logger, methodName);

            try
            {            
                //1.檢查必要的input parameter
                Execute.ValidateParameter(connectionDB_BK, PGIItems);

                //3.執行DB insert
                Execute.Process(connectionDB_BK, PGIItems);

                //4.Build Response Message
                List<PGIStatusResponse> pgiresponse = Execute.BuildResponseMsg(connectionDB_BK, PGIItems);

                return pgiresponse;
            }
            catch (Exception e)
            {
                logger.Error(MethodBase.GetCurrentMethod(), e);
                //  UTL.SendMail("test", e.Message);
                //4.Build Response Error Message
                List<PGIStatusResponse> ResponseList = new List<PGIStatusResponse>();
                foreach (PGIStatus item in PGIItems)
                {
                    PGIStatusResponse response = new PGIStatusResponse();
                    string SerialNumber = "";
                    string State = "F";
                    response.SerialNumber = SerialNumber;
                    response.Result = State;
                    ResponseList.Add(response);
                }
                return ResponseList;
            }
            finally
            {
                BaseLog.LoggingEnd(logger, methodName);
            }
        
        }
示例#2
0
文件: Execute.cs 项目: wra222/testgit
        //4.Build Response message structure
        public static List<PGIStatusResponse> BuildResponseMsg(string connectionDB, PGIStatus[] results)
        {
            int dbIndex = 0;
            string methodName = MethodBase.GetCurrentMethod().Name;
            BaseLog.LoggingBegin(logger, methodName);
            List<PGIStatusResponse> ResponseList = new List<PGIStatusResponse>();
            try
            {
                foreach (PGIStatus item in results)
                {
                    BaseLog.LoggingInfo(logger, "SerialNumber: \r\n{0}", ObjectTool.ObjectTostring(item.SerialNumber));
                }

                foreach (PGIStatus item in results)
                {
                    PGIStatusResponse response = new PGIStatusResponse();
                    string SerialNumber = item.SerialNumber;
                    string State = SQL.GetPGIState(connectionDB, dbIndex, SerialNumber);
                    if (State == "N") State = "F";
                    response.SerialNumber = item.SerialNumber;
                    response.Result = State;
                    ResponseList.Add(response);
                }
                return ResponseList;
            }
            catch (Exception e)
            {
                BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
                throw e;
            }
            finally
            {
                BaseLog.LoggingEnd(logger, methodName);
            }                 

        }