Beispiel #1
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = salaryGrid.CurrentRow;

            int staff_id = int.Parse(row.Cells[0].Value.ToString());

            MySqlDataReader reader = DBConnection.getData("SELECT * from Salary where staff_id= " + staff_id + ";");

            reader.Read();

            Role.Salary sal = new Role.Salary(new Staff(int.Parse(reader["staff_id"].ToString())), Double.Parse(reader["basic_sal_amount"].ToString()), float.Parse(reader["rate"].ToString()),
                                              new Attendance(int.Parse(reader["hours"].ToString())), float.Parse(reader["allowance"].ToString()), Double.Parse(reader["etf_epf_amount"].ToString()));

            reader.Close();

            UpdateSalaryForm salaryfrm = new UpdateSalaryForm(sal);

            salaryfrm.Show();

            /*while (reader.Read())
             * {
             *  Role.Salary sal = new Role.Salary(new Staff(int.Parse(reader["staff_id"].ToString())), Double.Parse(reader["basic_sal_amount"].ToString()), float.Parse(reader["rate"].ToString()),
             *      new Attendance(int.Parse(reader["hours"].ToString())), float.Parse(reader["allowance"].ToString()), Double.Parse(reader["etf_epf_amount"].ToString()));
             *
             *  reader.Close();
             *
             *  UpdateSalaryForm salaryfrm = new UpdateSalaryForm(sal);
             *
             * }
             * reader.Close();
             */
        }
Beispiel #2
0
        //  catch (Exception)
        //{
        //MessageBox.Show("Something went wrong!", "Add Expenses", MessageBoxButtons.OK, MessageBoxIcon.Error);

        //}


        /*public static void updateOfficeExpense(OfficeExpenses exp)
         * {
         *  try
         *  {
         *      DBConnection.updateDB("update client set name='" ( staff_id, date, category, amount)" +
         *                            " values (" + exp.StaffIssued.StaffId + "', '" + exp.Date + "', " +
         *                            "'" + exp.Category + "', '" + exp.Amount + "')");
         *
         *  }
         *  catch (Exception)
         *  {
         *      MessageBox.Show("Something went wrong!", "Update client", MessageBoxButtons.OK, MessageBoxIcon.Error);
         *  }
         * }
         */
        public static void addSalary(Role.Salary s)
        {
            //try
            //{


            DBConnection.updateDB("Insert into Salary(staff_id, basic_sal_amount, rate, hours, allowance, gross_sal, etf_epf_amount, net_sal) " +
                                  "values" + "( " + s.Empid + " , " + s.BasicSalAmount + ", " + s.Rate + " , " + s.Hours.HoursWorked + ", " + s.Allowance + ", " + s.Gross + ", " + s.EtfEpf + ", " + s.Net + " );");
            MessageBox.Show("Successfully added");
        }
        public UpdateSalaryForm(Role.Salary sal)
        {
            InitializeComponent();

            this.sal = sal;



            empid.DataSource    = display();
            empid.ValueMember   = "staff_id";
            empid.DisplayMember = "staff_id";



            empid.SelectedValue = sal.StaffOfSalary.StaffId;
            basicsal.Text       = sal.BasicSalAmount.ToString();
            rate.Text           = sal.Rate.ToString();
            hours.Text          = sal.Hours.HoursWorked.ToString();
            allowance.Text      = sal.Allowance.ToString();
            Gsal.Text           = sal.Gross.ToString();
            metroTextBox12.Text = sal.Gross.ToString();
            metroTextBox13.Text = sal.EtfEpf.ToString();
            netSal.Text         = sal.Net.ToString();
        }
Beispiel #4
0
 public static void updateSalary(Role.Salary s)
 {
     DBConnection.updateDB("Update Salary set basic_sal_amount = " + s.BasicSalAmount + ", rate = " + s.Rate + ", hours = " + s.Hours.HoursWorked + ", allowance = " + s.Allowance + ", gross_sal = " + s.Gross + ", etf_epf_amount = " + s.EtfEpf + ", net_sal = " + s.Net + " " +
                           " where staff_id = " + s.Empid + "");
     MessageBox.Show("Successfully added");
 }