Example #1
0
        public object GetProjectEquipmentList(Guid projectId, DateTime reportDate)
        {
            CurrentUserInfo currentUserInfo = _tokenHelper.GetUserInfo();

            if (!_projectLogic.IsProjectExist(currentUserInfo.Id, projectId))
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound, new BaseResponse(ResponseStatus.Notfound.ToString(), ResponseMessagesModel.ProjectNotFound)));
            }

            IEnumerable <EquipmentData> equipmentDatas = _equipmentLogic.GetProjectEquipment(projectId, reportDate);

            return(Request.CreateResponse(HttpStatusCode.OK, new BaseResponse(ResponseStatus.Success.ToString(),
                                                                              ResponseMessagesModel.Success, equipmentDatas.Select(EquipmentViewModel.GetEquipmentViewModel))));
        }
Example #2
0
        // GET: Report
        public ActionResult ReportResult(Guid projectId, DateTime reportDate)
        {
            IList <DailyActivityData> dailyActivityDatas = _dailyActivityLogic.GetProjectDailyActivies(projectId, reportDate).ToList();
            IList <MaterialData>      materialDatas      = _materialLogic.GetProjectMaterials(projectId, reportDate).ToList();
            IList <EquipmentData>     equipmentDatas     = _equipmentLogic.GetProjectEquipment(projectId, reportDate).ToList();
            IList <NoteData>          noteDatas          = _noteLogic.GetProjectNote(projectId, reportDate).ToList();

            ProjectData projectData = _projectLogic.GetProjectData(projectId);

            UserData userData = _accountLogic.GetUser(projectData.UserData.Id);

            ReportViewModel reportViewModel = new ReportViewModel
            {
                DailyActivitesViewModel = dailyActivityDatas.Select(DailyActivityViewModel.GetDailyActivityViewModel).ToList(),
                MaterialsViewModel      = materialDatas.Select(MaterialViewModel.GetMaterialViewModel).ToList(),
                EquipmentViewModel      = equipmentDatas.Select(EquipmentViewModel.GetEquipmentViewModel).ToList(),
                NotesViewModel          = noteDatas.Select(NoteViewModel.GetNoteViewModel).ToList(),
                ProjectViewModel        = ProjectViewModel.GetProjectViewModel(projectData, UserRole.Admin),
                ProjectCreator          = UserInformationViewModel.GetUserInformationViewModel(userData)
            };

            return(View(reportViewModel));
        }