public UnitOfWork(ApplicationDbContext context) { _context = context; Teams = new TeamRepository(context); Users = new ApplicationUserRepository(context); Sprints = new SprintRepository(context); Estimations = new EstimationRepository(context); ScrumTasks = new ScrumTaskRepository(context); Events = new EventRepository(context); }
public bool SaveEstimationProject(EstimationProjectModel model) { bool status = false; try { IUnitOfWork uwork = new UnitOfWork(); IEstimationRepository estimationRepository = new EstimationRepository(uwork); Utility.SetDynamicPropertyValue(model, model.CurrentCulture); var mapModel = Mapper.Map <EstimationProjectModel, EstimationProject>(model); if (model.ID == Guid.Empty) { mapModel.ID = Guid.NewGuid(); var result = estimationRepository.SaveEstimationProject(mapModel); if (result != null) { var estimations = estimationRepository.GetSelectedEstimationList(model.EstimationList); estimations.All(e => { e.ProjectID = result.ID; return(true); }); // var dbEstimations = Mapper.Map<List<Estimation>, List<EstimationModel>>(estimations); foreach (var estimation in estimations) { //SaveEstimation(estimation); estimationRepository.UpdateEstimation(estimation); } } } else { } status = true; } catch (Exception ex) { IErrorLogService errorLog = new ErrorLogService(); string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; errorLog.SetErrorLog(model.CurrentUserID, "Estimation", message); throw new Exception(message); } return(status); }
public string GetEstimationProjectNextNumber(BaseViewModel model) { string NexrProjectNumer = string.Empty; try { IUnitOfWork uwork = new UnitOfWork(); IEstimationRepository estimationRepository = new EstimationRepository(uwork); IApplicationService appService = new ApplicationService(new ApplicationRepository(uwork)); //var NextID = estimationRepository.GetEstimationProjectNextNumber(model); var NextID = 1; NextID = NextID == null ? 0 : NextID; NextID = NextID + 1; NexrProjectNumer = Helper.GenerateUniqueID(appService.GetApplicationCode(model.ApplicationId), NextID.ToString()); } catch (Exception ex) { } return(NexrProjectNumer); }