Ejemplo n.º 1
0
 void ITimeZoneService.Create(TimeZone timeZone)
 {
     if (_repository.FindByName(timeZone.Name) != null)
     {
         throw new InvalidOperationException("已经存在同名的时区信息");
     }
     _repository.Add(timeZone);
 }
Ejemplo n.º 2
0
        public int CreateTimeZone(string name)
        {
            using (IUnitOfWork work = UnitOfWork.Begin())
            {
                TimeZone timeZone = DomainObjectFactory.CreateTimeZone();

                timeZone.Name      = name;
                timeZone.IsActive  = true;
                timeZone.IsDeleted = false;

                _timeZoneRepository.Add(timeZone);

                work.Commit();

                var message = new XElement(XMLLogLiterals.LOG_MESSAGE);
                message.Add(XMLLogMessageHelper.TemplateToXml("LogMessageTimeZoneCreated", new List <string> {
                    timeZone.Name
                }));
                _logService.CreateLog(CurrentUser.Get().Id, "web", CurrentUser.Get().HostName, CurrentUser.Get().CompanyId,
                                      message.ToString());
                return(timeZone.Id);
            }
        }