/// <summary> /// Получить интерьвью из БД /// </summary> public override void dbSelect(int id) { using (var conn = new SqlConnection(SqlConnStrings.crmConnString)) { var cmd = new SqlCommand(SqlCommands.SelectInterview, conn); cmd.Parameters.AddWithValue("@id", id); conn.Open(); var dr = cmd.ExecuteReader(); if (dr.Read()) { ID = dr.GetInt32("id"); Candidate = new TSQLCandidate(dr.GetInt32("candidate_id")); InterviewerName = dr.GetString("interviewer"); DTime = dr.GetDateTime("dtime"); State = (InterviewState)dr.GetInt32("status_id"); } conn.Close(); } }
/// <summary> /// Получить задачу из БД /// </summary> public override void dbSelect(int id) { using (var conn = new SqlConnection(SqlConnStrings.crmConnString)) { var cmd = new SqlCommand(SqlCommands.SelectCandidateTask, conn); cmd.Parameters.AddWithValue("@id", id); conn.Open(); var dr = cmd.ExecuteReader(); if (dr.Read()) { ID = dr.GetInt32("id"); Candidate = new TSQLCandidate(dr.GetInt32("candidate_id")); Descr = dr.IsDBNull("descr") ? "" : dr.GetString("descr"); InspectorName = dr.IsDBNull("inspector") ? "" : dr.GetString("inspector"); ReceiptDate = dr.GetDateTime("receipt_dtime"); ExpectedCompletionDate = dr.GetDateTime("expected_completion_dtime"); FactCompletionDate = dr.IsDBNull("completion_dtime") ? DateTime.MinValue : dr.GetDateTime("completion_dtime"); State = (CandidateTaskState)dr.GetInt32("id"); InspectorRating = dr.IsDBNull("inspector_rating") ? -1d : dr.GetDouble("inspector_rating"); } conn.Close(); } }