public static FinanceInsurance getFinanceInsurance() { //try //{ DBConnector dbcon = new DBConnector(); if (dbcon.openConnection()) { MySqlCommand cmd = new MySqlCommand(); cmd.CommandText = "SELECT * FROM finance_insurance WHERE employee_idemployee=" + Employee.employee_id; cmd.Connection = dbcon.connection; MySqlDataReader reader = cmd.ExecuteReader(); FinanceInsurance fi = null; if (reader.Read()) { fi = new FinanceInsurance(); fi.fi_id = int.Parse(reader["idfinance_insurance"].ToString()); fi.type = reader["type"].ToString(); fi.value = double.Parse(reader["value"].ToString()); fi.note = reader["note"].ToString(); fi.setBegin_date(Convert.ToDateTime(reader["begin_date"])); fi.setEnd_date(Convert.ToDateTime(reader["end_date"])); } reader.Close(); dbcon.closeConnection(); return fi; } else { return null; } //} //catch (MySqlException e) //{ //int errorcode = e.Number; //return null; //} }
public void updateFinance() { //Update finance bank details FinanceBank fb = new FinanceBank(); fb.fb_id = this.fb_id; fb.bank_name = this.bank_name.Text; fb.branch_name = this.bank_branch_name.Text; fb.account_number = this.bank_account_name.Text; fb.account_type = this.bank_account_type.Text; fb.setBegin_date(this.bank_account_started_year.Value.Date); fb.setEnd_date(this.bank_account_closed_year.Value.Date); fb.Qual_year = this.bank_qualified_year.Text; fb.qualification = this.bank_qualification.Text; bool state = FinanceBankHandler.updateFinanceBank(fb); Console.Write(state + "\n"); //Update finance insurance details FinanceInsurance fi = new FinanceInsurance(); fi.fi_id = this.fi_id; fi.type = this.insurance_type.Text; fi.value = Convert.ToDouble(this.insurance_value.Text); fi.setBegin_date(this.insurance_started_date.Value.Date); fi.setEnd_date(this.insurance_ended_year.Value.Date); fi.note = this.insurance_notes.Text; state = FinanceInsuranceHandler.updateFinanceInsurance(fi); Console.Write(state + "\n"); //Update finance tax details FinanceTax ft = new FinanceTax(); ft.ft_id = this.ft_id; ft.type = this.tax_type.Text; ft.number = this.tax_no.Text; ft.payment_method = this.tax_paying_method.Text; ft.status = this.tax_status.Text; ft.note = this.tax_notes.Text; state = FinanceTaxHandler.updateFinanceTax(ft); Console.Write(state + "\n"); }
private void btnSave2_Click(object sender, EventArgs e) { FinanceInsurance fi = new FinanceInsurance(); fi.type = insurance_type.Text; fi.value = Convert.ToDouble(insurance_value.Text); fi.setBegin_date(insurance_started_date.Value.Date); fi.setEnd_date(insurance_ended_date.Value.Date); fi.note = insurance_notes.Text; bool state = FinanceInsuranceHandler.addFinanceInsurance(fi); if (state) { MessageBox.Show("Employee insurance details added succesfully...!"); } else { MessageBox.Show("Adding employee insurance details failed...!"); } }