示例#1
0
 public bool DeleteProjectCode(ProjectCode projectCode)
 {
     if (projectCode == null) return false;
     _unitOfWork.ProjectCodeRepository.Delete(projectCode);
     _unitOfWork.Save();
     return true;
 }
示例#2
0
 public bool EditProjectCode(ProjectCode projectCode)
 {
     _unitOfWork.ProjectCodeRepository.Edit(projectCode);
     _unitOfWork.Save();
     return true;
 }
示例#3
0
 public bool AddProjectCode(ProjectCode projectCode)
 {
     _unitOfWork.ProjectCodeRepository.Add(projectCode);
     _unitOfWork.Save();
     return true;
 }
示例#4
0
        /// <summary>
        /// Gets the project code id W ith create.
        /// </summary>
        /// <param name="projectNumber">The project number.</param>
        /// <returns></returns>
        public ProjectCode GetProjectCodeIdWIthCreate(string projectNumber)
        {
            var projCode = _unitOfWork.ProjectCodeRepository.FindBy(i => i.Value.ToUpper() == projectNumber.ToUpper()).SingleOrDefault();

            if (projCode != null)
            {
                return projCode;
            }
            else
            {
                ProjectCode newProjectCode = new ProjectCode()
                {
                    Value = projectNumber.ToUpperInvariant()
                };
                _unitOfWork.ProjectCodeRepository.Add(newProjectCode);
                _unitOfWork.Save();

                return newProjectCode;
            }
        }