public void TestRetrieveTimeOffRequestByRequestID() { // arrange TimeOffRequestVM request = null; IRequestManager requestManager = new RequestManager(_requestAccessor); // act request = requestManager.RetrieveTimeOffRequestByRequestID(1000000); // assert Assert.IsNotNull(request); }
/// <summary> /// CREATOR: Kaleb Bachert /// CREATED: 2020/3/7 /// APPROVER: Lane Sandburg /// /// This method gets a TimeOffRequest by RequestID /// </summary> /// <remarks> /// UPDATER: NA /// UPDATED: NA /// UPDATE: NA /// /// </remarks> /// <param name="requestID"></param> /// <param name="userID"></param> public TimeOffRequestVM SelectTimeOffRequestByRequestID(int requestID) { TimeOffRequestVM request = null; var conn = DBConnection.GetConnection(); var cmd = new SqlCommand("sp_select_time_off_request_by_requestid", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("RequestID", requestID); try { conn.Open(); var reader = cmd.ExecuteReader(); if (reader.HasRows) { reader.Read(); { request = new TimeOffRequestVM(); request.TimeOffRequestID = reader.GetInt32(0); request.EffectiveStart = reader.GetDateTime(1).ToString(); request.EffectiveEnd = reader.IsDBNull(2) ? "" : reader.GetDateTime(2).ToString(); request.ApprovalDate = reader.IsDBNull(3) ? "" : reader.GetDateTime(3).ToString(); request.ApprovingUserID = reader.IsDBNull(4) ? 0 : reader.GetInt32(4); request.RequestID = reader.GetInt32(5); } reader.Close(); } } catch (Exception ex) { throw ex; } finally { conn.Close(); } return(request); }