Exemplo n.º 1
0
 public static Payroll FindLatestByEmpID(int EmpID)
 {
     MySqlConnection c = getConnection();
     MySqlCommand cmd = c.CreateCommand();
     c.Open();
     cmd.CommandText = @"SELECT *
                         FROM PAYROLLHISTORY
                         WHERE EmpID = @EmpID
                         ORDER BY PayDate DESC
                         LIMIT 1;";
     cmd.Prepare();
     cmd.Parameters.AddWithValue("@EmpID", EmpID);
     cmd.CommandType = System.Data.CommandType.Text;
     MySqlDataReader dr = cmd.ExecuteReader();
     Payroll d = new Payroll();
     while (dr.Read())
     {
         d.EmpID = dr.GetInt32("EmpID");
         d.PayDate = dr.GetDateTime("PayDate");
         d.MonthSalary = dr.GetDecimal("MonthSalary");
         d.MonthHours = dr["MonthHours"] as int?;
         d.FedTax = dr.GetDecimal("FedTax");
         d.StateTax = dr.GetDecimal("StateTax");
         d.OtherTax = dr["OtherTax"] as decimal?;
         d.NetPay = dr.GetDecimal("NetPay");
     }
     c.Close();
     return d;
 }
Exemplo n.º 2
0
 public IEnumerable <Payroll> PayrollHistory()
 {
     return(Payroll.FindAllByEmpID(this.EmpID));
 }
Exemplo n.º 3
0
 public ActionResult Payroll(int EmpID, Payroll payroll)
 {
     payroll.EmpID = EmpID;
     payroll.Save();
     return RedirectToAction("Payroll", new { id = EmpID });
 }