Пример #1
0
        private static bool WriteExceptionToDatabase(DataContracts.LogixLogException payLoad)
        {
            using (IQueryRepository <DataContracts.LogixLogException> repository = new QueryRepository <DataContracts.LogixLogException>(ConnectionString))
            {
                payLoad.IsLoggedFromMsmq = false;

                ICollection <NameValueType> nameValuePair = new System.Collections.ObjectModel.Collection <NameValueType>
                {
                    new NameValueType
                    {
                        Name          = USP_InsertExceptionLogs_ParamName_Udtt_LogixLogException,
                        Value         = payLoad,
                        TableTypeName = Udtt_Name_LogixLogException,
                        IsTableType   = true
                    },
                    new NameValueType
                    {
                        Name          = USP_InsertExceptionLogs_ParamName_Udtt_LogixLogError,
                        Value         = payLoad.UserErrorInfo,
                        TableTypeName = Udtt_Name_LogixLogError,
                        IsTableType   = true
                    }
                };

                return(repository.InsertOrUpdate(USP_InsertExceptionLogs_Name, nameValuePair));
            }
        }
Пример #2
0
 public static void WriteExceptionLogs(DataContracts.LogixLogException payLoad)
 {
     if (CanWriteToQueue.ToUpper() == CanWriteToQueue_VALUE_YES)
     {
         WriteExceptionToQueue(payLoad);
     }
     else
     {
         WriteExceptionToDatabase(payLoad);
     }
 }
Пример #3
0
        private static void WriteExceptionToQueue(DataContracts.LogixLogException payLoad)
        {
            using (MessageQueue queue = new MessageQueue(MsmqExceptionLog.Replace("MACHINENAME", Environment.MachineName)))
            {
                payLoad.IsLoggedFromMsmq = true;

                Message message = new Message(payLoad)
                {
                    Formatter = new XmlMessageFormatter
                                (
                        new List <Type>
                    {
                        payLoad.GetType()
                    }.ToArray()
                                )
                };

                queue.Send(message, MsmqExceptionLogTarget);
            }
        }