internal static BaseEntityRepo GetRepo <T>(EO.CivilWorksEntities context) { BaseEntityRepo repo = null; if (typeof(T) == typeof(BO.User)) { repo = new UserRepository(context); } if (typeof(T) == typeof(BO.UserPasswordActivation)) { repo = new InvitationRepository(context); } if (typeof(T) == typeof(BO.Project)) { repo = new ProjectRepository(context); } if (typeof(T) == typeof(BO.Item)) { repo = new ItemRepository(context); } if (typeof(T) == typeof(BO.ProjectTeam)) { repo = new ProjectTeamRepository(context); } if (typeof(T) == typeof(BO.ProjectReport)) { repo = new ProjectReportRepository(context); } return(repo); }
//Constructor public ProjectReportsController( IDataRepository <ProjectReport> projectReportRepository, IDataRepository <Employee> employeeRepository, IDataRepository <WorkPackageReportSnapshot> workPackageReportSnapShotRepository, IDataRepository <EmployeeProjectAssignment> employeeProjectAssignmentRepository ) { this._projectReportRepository = (ProjectReportRepository)projectReportRepository; this._employeeRepository = (EmployeeRepository)employeeRepository; this._workPackageReportSnapshotRepository = (WorkPackageReportSnapshotRepository)workPackageReportSnapShotRepository; this._employeeProjectAssignmentRepository = (EmployeeProjectAssignmentRepository)employeeProjectAssignmentRepository; }
public dynamic Put(ReportDTO objreport) { CustomResponse objresult = new CustomResponse(); objresult.Response = null; try { // Step1 : get relavent data from the database and prepare mail body and get clietn id. // Step2 : send mail to the client of the project // return ProjectReportRepository.GetReportData(objreport.ProjectID, objreport.TaskTypeID, objreport.TaskStatusID, objreport.FromDate, objreport.ToDate); List <ReportData> objmaildata = ProjectReportRepository.GetReportDataAsync(objreport.ProjectID, objreport.TaskTypeID, objreport.TaskStatusID, objreport.FromDate, objreport.ToDate); //prepare mail body StringBuilder sbmailbody = new StringBuilder(); sbmailbody.Append("<table width=100%><tr><th>ProjectName</th><th>TicketID</th><th>AssignedDate</th><th>Assign To</th><th>Task Status</th><th>Task Type</th></tr>"); //foreach (ReportData objreport1 in objmaildata) List <string> uids = ProjectRepository.GetProjectUsers(objreport.ProjectID); string subject = "Project Activity Report from " + objreport.FromDate + "-" + objreport.ToDate; List <string> mails = UserRepository.GetEmailAddressesByUserIds(uids); foreach (string toMail in mails) { MailSender.TaskStatusCreate_UpdationMail(UserReportRepository.GetFnameByEmail(toMail), subject, sbmailbody.ToString(), toMail); } objresult.Status = CustomResponseStatus.Successful; objresult.Message = "Email Sent Successfully"; } catch (Exception ex) { objresult.Status = CustomResponseStatus.Successful; objresult.Message = "Failed to send email"; } return(objresult); }
//get project level report public dynamic Post(ReportDTO objreport) { return(ProjectReportRepository.GetReportData(objreport.ProjectID, objreport.TaskTypeID, objreport.TaskStatusID, objreport.FromDate, objreport.ToDate)); }