public void Add(IssueServiceClientDTO issueClientDto) { if (issueClientDto == null) throw new ArgumentNullException("issueClientDto"); // // O cliente so pode inserir um issue se, o projecto a que pertence o issue // pertence ao cliente. // Verificar se sou cliente Client dbClient = GetDbClient(); // Obter o projecto a partir do Dto data e ver se o cliente sou eu.. Project dbProject = _db.Query<Project>().GetByIdIncludeClient(issueClientDto.ProjectId); if (dbProject == null || dbProject.Client.UserID != dbClient.UserID) { throw new HijackedException("ProjectID hijacked"); } if(dbProject != null && !dbProject.Enabled) throw new ProjectDisabledException("Project disabled"); // Se estou aqui então eu sou o owner do projecto _db.Insert(issueClientDto.CopyToDomainObject(dbProject, dbClient)); // // Executar o serviço de enviar emails para os membros do projecto deste issue. NotificatorClientDTO clientDto = new NotificatorClientDTO( dbClient.Name, dbProject.ProjectID, dbProject.Name, issueClientDto.Priority, issueClientDto.Type, issueClientDto.ShortDescription, issueClientDto.LongDescription ); // Notificar _notificator.NotifyMembers(clientDto); }
public void NotifyMembers(NotificatorClientDTO clientDto) { if(clientDto == null) throw new ArgumentNullException("clientDto"); string subject = string.Format("{0} reported a new issue on the system with {1} Priority", clientDto.ClientName, clientDto.Priority); string message = string.Format("New issue reported at {0} by {1} with {2} priority. \n Subject: {3}. \n\n Description: {4} \n", DateTime.Now, clientDto.ClientName, clientDto.Priority, clientDto.ShortDescription, clientDto.DetailedDescription ); SendEmailForMembersWithEmailInProject( _mngr, clientDto.ProjectId, subject, message, EmailConfig.Member_NewRequestSubmited ); }
public void NotifyMembers(NotificatorClientDTO clientDto) { }