public static bool addFinanceTax(FinanceTax ft)
        {
            DBConnector dbcon = new DBConnector();

            //try
            //{
            if (dbcon.openConnection())
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = "INSERT INTO finance_tax (type, number, payment_method, status, note, employee_idemployee) VALUES (N'" + ft.type + "', N'" + ft.number + "', N'" + ft.payment_method + "', N'" + ft.status + "', N'" + ft.note + "', " + Employee.employee_id + ")";
                cmd.Connection = dbcon.connection;
                cmd.Prepare();
                cmd.ExecuteNonQuery();

                dbcon.closeConnection();
                return true;
            }
            else
            {
                dbcon.closeConnection();
                return false;
            }

            //}
            //catch (MySqlException e)
            //{
            //int errorcode = e.Number;
            //dbcon.closeConnection();
            //return false;
            //}
        }
        public static FinanceTax getFinanceTax()
        {
            //try
            //{

            DBConnector dbcon = new DBConnector();

            if (dbcon.openConnection())
            {

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = "SELECT * FROM finance_tax WHERE employee_idemployee=" + Employee.employee_id;
                cmd.Connection = dbcon.connection;

                MySqlDataReader reader = cmd.ExecuteReader();

                FinanceTax ft = null;

                if (reader.Read())
                {
                    ft = new FinanceTax();
                    ft.ft_id = int.Parse(reader["idfinance_tax"].ToString());
                    ft.type = reader["type"].ToString();
                    ft.number = reader["number"].ToString();
                    ft.note = reader["note"].ToString();
                    ft.payment_method = reader["payment_method"].ToString();
                    ft.status = reader["status"].ToString();

                }

                reader.Close();

                dbcon.closeConnection();

                return ft;
            }
            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 btnSave3_Click(object sender, EventArgs e)
        {
            FinanceTax ft = new FinanceTax();

            ft.type = tax_type.Text;
            ft.number = tax_no.Text;
            ft.payment_method = tax_paying_method.Text;
            ft.status = tax_status.Text;
            ft.note = tax_notes.Text;

            bool state = FinanceTaxHandler.addFinanceTax(ft);

            if (state)
            {
                MessageBox.Show("Employee tax details added succesfully...!");

            }
            else
            {
                MessageBox.Show("Adding employee tax details failed...!");
            }
        }
        public static bool updateFinanceTax(FinanceTax ft)
        {
            //try
            //{

            DBConnector dbcon = new DBConnector();

            if (dbcon.openConnection())
            {

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = "UPDATE finance_tax SET type=N'" + ft.type + "', number=" + ft.number + ", payment_method=N'" + ft.payment_method + "', status=N'" + ft.status + "', note=N'" + ft.note + "' WHERE employee_idemployee=" + Employee.employee_id + " AND idfinance_tax=" + ft.ft_id;
                cmd.Connection = dbcon.connection;
                cmd.Prepare();
                cmd.ExecuteNonQuery();

                dbcon.closeConnection();

                return true;
            }
            else
            {

                return false;
            }

            //}
            //catch (MySqlException e)
            //{
            //int errorcode = e.Number;
            //return false;
            //}
        }