Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
        public void EditPtoRequestTest()
        {
            PaidTimeOff ptoRequest = new PaidTimeOff()
            {
                EmpID = 6,
                Date = new DateTime(2015, 07, 15),
                HoursRequested = 4

            };
            PaidTimeOffRepository repo = new PaidTimeOffRepository();
            repo.EditPtoRequest(ptoRequest);

        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 6
0
        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();
            }
        }
Ejemplo n.º 7
0
 public void SubmitPtoRequest(PaidTimeOff pto)
 {
     PaidTimeOffRepository repo = new PaidTimeOffRepository();
     repo.SubmitPtoRequest(pto);
 }
Ejemplo n.º 8
0
 public void EditPtoRequest(PaidTimeOff ptoRequest)
 {
     var repo = new PaidTimeOffRepository();
     repo.EditPtoRequest(ptoRequest);
 }
Ejemplo n.º 9
0
 public void SubmitPtoRequest(PaidTimeOff ptoRequest)
 {
     
 }