public void InsertProject(Project item, IEnumerable<string> technologies) { try { _bll.BeginTransaction(); var existsItem = _dal.ProjectRepository.SelectProject(item.Name); if (existsItem != null) { string message = string.Format("Project (Name = {0}) exists.", item.Name); throw new Exception(message); } _dal.ProjectRepository.InsertProject(item); _dal.ProjectRepository.UpdateProjectTechnologies(item.Id, technologies); _bll.CommitTransaction(); } catch { _bll.RollbackTransaction(); } }
private void FillReferenceProperties(Project item) { item.CategoryRef = _bll.DictManager.SelectDict(item.Category); item.CustomerRef = _bll.CustomerManager.SelectCustomer(item.Customer); List<string> technologies = _dal.ProjectRepository.SelectProjectTechnologies(item.Id); item.TechnologyRefs = _bll.DictManager.SelectDicts().Where(dict => technologies.Contains(dict.Id)).ToList(); }