public void SubmitPtoRequestTest() { PaidTimeOff pto = new PaidTimeOff() { EmpID = 6, Date = new DateTime(2015, 07, 15), HoursRequested = 4 }; PaidTimeOffRepository repo = new PaidTimeOffRepository(); repo.SubmitPtoRequest(pto); var ptoList = repo.ViewAllPtoRequests(); Assert.AreEqual(7, ptoList.Count); }
public void EditPtoRequestTest() { PaidTimeOff ptoRequest = new PaidTimeOff() { EmpID = 6, Date = new DateTime(2015, 07, 15), HoursRequested = 4 }; PaidTimeOffRepository repo = new PaidTimeOffRepository(); repo.EditPtoRequest(ptoRequest); }
public void SubmitPtoRequest(PaidTimeOff ptoRequest) { using (SqlConnection cn = new SqlConnection(Settings.ConnectionString)) { var p = new DynamicParameters(); p.Add("EmpId", ptoRequest.EmpID); p.Add("HoursRequested", ptoRequest.HoursRequested); p.Add("Date", ptoRequest.Date); cn.Query<PaidTimeOff>("SubmitPtoRequest", p, commandType: CommandType.StoredProcedure); } }
public ActionResult SubmitPtoRequest(PaidTimeOffVM ptoVM) { if (ModelState.IsValidField("HoursRequested")) { var ptoRequest = new PaidTimeOff(); ptoRequest.EmpID = ptoVM.EmpId; ptoRequest.Date = ptoVM.Date; ptoRequest.HoursRequested = ptoVM.HoursRequested; ptoRequest.ManagerID = ptoVM.ManagerId; var ops = OperationsFactory.CreatePaidTimeOffOperations(); ops.SubmitPtoRequest(ptoRequest); } else { return RedirectToAction("SubmitPtoRequest"); } return RedirectToAction("ViewPtoRequests"); }
public void EditPtoRequestTest() { //tests against DB; altered test app config setting var ops = OperationsFactory.CreatePaidTimeOffOperations(); PaidTimeOff ptoRequest = new PaidTimeOff() { PtoRequestID = 1, PtoStatus = "Approved", EmpID = 5, Date = new DateTime(2015, 07, 15), HoursRequested = 4, ManagerID = 2, ReasonRejected = "N/A" }; PaidTimeOffRepository repo = new PaidTimeOffRepository(); repo.EditPtoRequest(ptoRequest); var response = new Response<List<PaidTimeOff>>(); response = ops.ViewAllPtoRequests(); PaidTimeOff updatedPto = response.Data.FirstOrDefault(p => p.PtoRequestID == 1); Assert.AreEqual("Approved", updatedPto.PtoStatus); }
public void EditPtoRequest(PaidTimeOff paidTimeOff) { using (var cn = new SqlConnection(Settings.ConnectionString)) { var cmd = new SqlCommand("UPDATE [dbo].[PaidTimeOff] " + "SET [PtoStatus] = @PtoStatus, " + "[EmpID] = @EmpId, " + "[HoursRequested] = @HoursRequested, " + "[Date] = @Date, " + "[ReasonRejected] = @ReasonReject, " + "[ManagerID] = @ManagerId " + "WHERE PtoRequestID = @PtoRequestId", cn); cmd.Parameters.AddWithValue("@PtoRequestId", paidTimeOff.PtoRequestID); cmd.Parameters.AddWithValue("@PtoStatus", paidTimeOff.PtoStatus); cmd.Parameters.AddWithValue("@EmpID", paidTimeOff.EmpID); cmd.Parameters.AddWithValue("@HoursRequested", paidTimeOff.HoursRequested); cmd.Parameters.AddWithValue("@Date", paidTimeOff.Date); cmd.Parameters.AddWithValue("@ReasonReject", paidTimeOff.ReasonRejected); cmd.Parameters.AddWithValue("@ManagerID", paidTimeOff.ManagerID); cn.Open(); cmd.ExecuteNonQuery(); } }
public void SubmitPtoRequest(PaidTimeOff pto) { PaidTimeOffRepository repo = new PaidTimeOffRepository(); repo.SubmitPtoRequest(pto); }
public void EditPtoRequest(PaidTimeOff ptoRequest) { var repo = new PaidTimeOffRepository(); repo.EditPtoRequest(ptoRequest); }
public void SubmitPtoRequest(PaidTimeOff ptoRequest) { }