private void btnSave3_Click(object sender, EventArgs e)
        {
            NonCashBenefit ncb = new NonCashBenefit();

            ncb.approved_benefit = noncash_approved_benefit.Text;
            ncb.price = (float)Convert.ToDouble(noncash_price.Text);
            ncb.amount = (float)Convert.ToDouble(noncash_quantity.Text);
            ncb.setdate_issued(noncash_issued_date.Value.Date);

            bool state = BenefitsHandler.addNonCashBenefit(ncb);

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

            }
            else
            {
                MessageBox.Show("Adding employee NonCash Benefit details failed...!");
            }
        }
        public static bool addNonCashBenefit(NonCashBenefit ncb)
        {
            DBConnector dbcon = new DBConnector();

            if (dbcon.openConnection())
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = "INSERT INTO noncash_benefit (approved_benefit, date_issued, amount, price, employee_idemployee) VALUES (N'" + ncb.approved_benefit + "', '" + ncb.getdate_issued().ToString("yyyy-MM-dd") + "', " + ncb.amount + ", " + ncb.price + ", " + Employee.employee_id + ")";
                cmd.Connection = dbcon.connection;
                cmd.Prepare();
                cmd.ExecuteNonQuery();

                dbcon.closeConnection();
                return true;
            }
            else
            {
                dbcon.closeConnection();
                return false;
            }
        }
        public void updateBenefits()
        {
            CashBenefit cb = new CashBenefit();
            cb.cb_id = this.cb_id;
            cb.approved_benefit = this.cash_approved_benefit.Text;
            cb.price = (float)Convert.ToDouble(this.cash_issued_price.Text);
            cb.setdate_issued(this.cash_issued_date.Value.Date);
            bool state = BenefitsHandler.updateCashBenefit(cb);
            Console.Write(state + "\n");

            NonCashBenefit ncb = new NonCashBenefit();
            ncb.ncb_id = this.ncb_id;
            ncb.approved_benefit = this.noncash_approved_benefit.Text;
            ncb.price = (float)Convert.ToDouble(this.noncash_price.Text);
            ncb.amount = (float)Convert.ToDouble(this.noncash_quantity.Text);
            ncb.setdate_issued(this.noncash_issued_date.Value.Date);
            state = BenefitsHandler.updateNonCashBenefit(ncb);
            Console.Write(state + "\n");
        }
        public static NonCashBenefit getNonCashBenefit()
        {
            DBConnector dbcon = new DBConnector();

            if (dbcon.openConnection())
            {

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

                MySqlDataReader reader = cmd.ExecuteReader();

                NonCashBenefit ncb = null;

                if (reader.Read())
                {
                    ncb = new NonCashBenefit();

                    ncb.ncb_id = int.Parse(reader["idnoncash_benefit"].ToString());
                    ncb.approved_benefit = reader["approved_benefit"].ToString();
                    ncb.price = (float)Convert.ToDouble(reader["price"].ToString());
                    ncb.setdate_issued(Convert.ToDateTime(reader["date_issued"]));
                    ncb.amount = (float)Convert.ToDouble(reader["amount"].ToString());

                }

                reader.Close();

                dbcon.closeConnection();

                return ncb;
            }
            else
            {

                return null;
            }
        }
        public static bool updateNonCashBenefit(NonCashBenefit ncb)
        {
            DBConnector dbcon = new DBConnector();

            if (dbcon.openConnection())
            {

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = "UPDATE noncash_benefit SET approved_benefit=N'" + ncb.approved_benefit + "', date_issued='" + ncb.getdate_issued().ToString("yyyy-MM-dd") + "', amount=" + ncb.amount + ", price=" + ncb.price + " WHERE employee_idemployee=" + Employee.employee_id + " AND idnoncash_benefit=" + ncb.ncb_id;
                cmd.Connection = dbcon.connection;
                cmd.Prepare();
                cmd.ExecuteNonQuery();

                dbcon.closeConnection();

                return true;
            }
            else
            {

                return false;
            }
        }