public static FinanceBank getFinanceBank() { //try //{ DBConnector dbcon = new DBConnector(); if (dbcon.openConnection()) { MySqlCommand cmd = new MySqlCommand(); cmd.CommandText = "SELECT * FROM finance_bank WHERE employee_idemployee=" + Employee.employee_id; cmd.Connection = dbcon.connection; MySqlDataReader reader = cmd.ExecuteReader(); FinanceBank fb = null; if (reader.Read()) { fb = new FinanceBank(); fb.fb_id = int.Parse(reader["idfinance_bank"].ToString()); fb.bank_name = reader["bank_name"].ToString(); fb.branch_name = reader["branch_name"].ToString(); fb.account_number = reader["account_number"].ToString(); fb.account_type = reader["account_type"].ToString(); fb.qualification = reader["qualification"].ToString(); fb.Qual_year = reader["qual_year"].ToString(); fb.setBegin_date(Convert.ToDateTime(reader["begin_date"])); fb.setEnd_date(Convert.ToDateTime(reader["end_date"])); } reader.Close(); dbcon.closeConnection(); return fb; } 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 btnSave1_Click(object sender, EventArgs e) { FinanceBank fb = new FinanceBank(); fb.bank_name = bank_name.Text; fb.branch_name = bank_branch_name.Text; fb.account_number = bank_account_number.Text; fb.account_type = bank_account_type.Text; fb.setBegin_date(bank_account_started_date.Value.Date); fb.setEnd_date(bank_account_closed_date.Value.Date); fb.Qual_year = bank_qualified_year.Text; fb.qualification = bank_qualification.Text; bool state = FinanceBankHandler.addFinanceBank(fb); if (state) { MessageBox.Show("Employee bank details added succesfully...!"); } else { MessageBox.Show("Adding employee personal details failed...!"); } }