public Offender Save(Offender offender)
        {
            try
            {
                offender = (Offender)Database.Save(offender);

                if (offender.OffenderId > 0)
                {
                    SendNotification(string.Format("Offender {0} saved", offender.OffenderId));
                }
            }
            catch (Exception exc)
            {
                File.WriteAllText(@"c:\Error.txt", exc.ToString());
            }

            return(offender);
        }
        public Offender Save(Offender offender)
        {
            try
            {
                offender = offenderRepository.Save(offender);

                if (offender.OffenderId > 0)
                {
                    notificationEngine.Notify(string.Format("Offender {0} saved", offender.OffenderId));
                }

                systemLogger.Log("Successfull Save operation!");
            }
            catch (Exception exc)
            {
                systemLogger.Log(exc.ToString());
            }

            return(offender);
        }
示例#3
0
        public Offender Save(Offender offender)
        {
            var offenderRepository = new OffenderRepository();
            var errorLogger        = new ErrorLogger();
            var notificationEngine = new NotificationEngine();

            try
            {
                offender = offenderRepository.Save(offender);

                if (offender.OffenderId > 0)
                {
                    notificationEngine.Notify(string.Format("Offender {0} saved", offender.OffenderId));
                }
            }
            catch (Exception exc)
            {
                errorLogger.Log(exc.ToString(), LoggerType.Database);
            }

            return(offender);
        }
        public Offender Save(Offender offender)
        {
            IOffenderRepository offenderRepository = new CommunityOffenderRepository();
            ILogger             errorLogger        = new FileLogger();
            INotificationEngine notificationEngine = new EmailNotificationEngine();

            try
            {
                offender = offenderRepository.Save(offender);

                if (offender.OffenderId > 0)
                {
                    notificationEngine.Notify(string.Format("Offender {0} saved", offender.OffenderId));
                }
            }
            catch (Exception exc)
            {
                errorLogger.Log(exc.ToString());
            }

            return(offender);
        }