public List<project_labour_payment> GetProjectLabourPayment(String CmdText) { try { Connect(); Debug.WriteLine(CmdText); if (CmdText == "") { CmdText = "SELECT * FROM project_labour_working_D"; } datareader = GetReader(CmdText); List<project_labour_payment> plalist = new List<project_labour_payment>(); while (datareader.Read()) { project_labour_payment pla = new project_labour_payment(); pla.project_labour_allocation_id = Convert.ToInt16(datareader["project_labour_allocation_id"].ToString()); pla.days_worked = Convert.ToInt16((datareader["days_worked"].ToString())); plalist.Add(pla); } datareader.Close(); datareader = null; return plalist; } catch { return null; } }
public bool InsertLabourPayment(project_labour_payment p) { try { string CmdText = "INSERT INTO project_labour_payment (project_labour_allocation_id , amount , date_payed) VALUES (@project_labour_allocation_id , @amount , @date_payed)"; cmd = new MySqlCommand(CmdText, this.conn); cmd.Parameters.AddWithValue("@project_labour_allocation_id", p.project_labour_allocation_id); cmd.Parameters.AddWithValue("@amount", p.amount); cmd.Parameters.AddWithValue("@date_payed", p.date_paid); cmd.ExecuteNonQuery(); return true; } catch { return false; } }