private JobCandidate InitializeObject(DataRow dr) { try { JobCandidate retVal = null; if (dr != null) { retVal = new JobCandidate(); retVal.Id = Convert.ToInt32(dr["Id"]); retVal.JobId = new Guid(dr["JobId"].ToString()); retVal.FirstName = dr["FirstName"].ToString(); retVal.LastName = dr["LastName"].ToString(); retVal.Phone = dr["Phone"].ToString(); retVal.Email = dr["Email"].ToString(); retVal.Comments = dr["Comments"].ToString(); retVal.CV = dr["CV"] != DBNull.Value ? dr["CV"] as Byte[] : null; retVal.CVName = dr["CVName"].ToString(); retVal.CreatedDate = Convert.ToDateTime(dr["CreatedDate"]); retVal.ModifiedDate = Convert.ToDateTime(dr["ModifiedDate"]); } return(retVal); } catch (Exception ex) { throw ex; } }
private JobCandidateCollection InitializeCollection(DataTable dt) { JobCandidateCollection retVal = null; if (dt != null && dt.Columns.Count > 0) { retVal = new JobCandidateCollection(); foreach (DataRow row in dt.Rows) { JobCandidate item = InitializeObject(row); retVal.Add(item); } } return(retVal); }