Esempio n. 1
0
        public void LogOrder(object orderInformation, int vendorID, string fileName, AuditLog4Net.Adapter.IAuditLogAdapter log)
        {
            try
            {
                var logPath = ConfigurationManager.AppSettings["ConcentratorOrderLog"];

                logPath = Path.Combine(logPath, DateTime.Now.ToString("yyyyMMdd"), vendorID.ToString());

                if (!Directory.Exists(logPath))
                {
                    Directory.CreateDirectory(logPath);
                }

                var order = (BrightPointOrder.Order1_1)orderInformation;

                System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(order.GetType());

                using (FileStream fs = File.Open(
                           Path.Combine(logPath, fileName),
                           FileMode.OpenOrCreate,
                           FileAccess.Write,
                           FileShare.ReadWrite))
                {
                    x.Serialize(fs, order);
                }
            }
            catch (Exception ex)
            {
                log.AuditError("Failed to log order information for " + vendorID, ex);
            }
        }
Esempio n. 2
0
        public void LogOrder(object orderInformation, int vendorID, string fileName, AuditLog4Net.Adapter.IAuditLogAdapter log)
        {
            try
            {
                var logPath = ConfigurationManager.AppSettings["ConcentratorOrderLog"];

                logPath = Path.Combine(logPath, DateTime.Now.ToString("yyyyMMdd"), vendorID.ToString());

                if (!Directory.Exists(logPath))
                {
                    Directory.CreateDirectory(logPath);
                }

                ((XDocument)orderInformation).Save(Path.Combine(logPath, fileName));
            }
            catch (Exception ex)
            {
                log.AuditError("Failed to log order information for " + vendorID, ex);
            }
        }