コード例 #1
0
ファイル: Payroll.Finders.cs プロジェクト: metin/ProTracker
 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;
 }
コード例 #2
0
ファイル: Employee.Instance.cs プロジェクト: metin/ProTracker
 public IEnumerable <Payroll> PayrollHistory()
 {
     return(Payroll.FindAllByEmpID(this.EmpID));
 }
コード例 #3
0
 public ActionResult Payroll(int EmpID, Payroll payroll)
 {
     payroll.EmpID = EmpID;
     payroll.Save();
     return RedirectToAction("Payroll", new { id = EmpID });
 }