public static propProject Get(string projectCode) { var project = new propProject(); var data = DataAccess.Project.Get(projectCode); while (data.Read()) { project.id = int.Parse(data["Id"].ToString()); project.code = data["ProjectCode"].ToString(); project.name = data["Name"].ToString(); project.startDate = DateTime.Parse(data["StartDate"].ToString()); project.endDate = DateTime.Parse(data["EndDate"].ToString()); project.createdAt = DateTime.Parse(data["CreatedAt"].ToString()); project.createdBy = int.Parse(data["CreatedBy"].ToString()); } data.Close(); return(project); }
public static List <propProject> GetByProfessor(int id) { var projectList = new List <propProject>(); var data = DataAccess.Project.GetByProfessor(id); while (data.Read()) { var project = new propProject(); project.id = int.Parse(data["Id"].ToString()); project.code = data["ProjectCode"].ToString(); project.name = data["Name"].ToString(); project.startDate = DateTime.Parse(data["StartDate"].ToString()); project.endDate = DateTime.Parse(data["EndDate"].ToString()); project.createdAt = DateTime.Parse(data["CreatedAt"].ToString()); project.createdBy = int.Parse(data["CreatedBy"].ToString()); projectList.Add(project); } data.Close(); return(projectList); }