Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            dbClass   db      = new dbClass();
            DataTable dt_job  = new DataTable();
            DataTable dt_dept = new DataTable();

            dt_job  = db.dbSelect("SELECT id FROM tb_job WHERE description='" + cmbJob.Text + "'");
            dt_dept = db.dbSelect("SELECT id FROM tb_department WHERE code='" + cmbDept.Text + "'");
            DataTable parent = db.dbSelect("SELECT id from tb_department WHERE code='" + cmbParent.Text + "'");

            if (this.activeForm == "Information")
            {
                db.dbInsert("INSERT INTO tb_info (lastname, firstname, middlename, address, birthdate, birthplace, contact, department, job) VALUES ('" + txtLN.Text + "', '" + txtFN.Text + "', '" + txtMN.Text + "', '" + txtAdd.Text + "', '" + pickBday.Text + "', '" + txtBPlace.Text + "', '" + txtContact.Text + "', " + Convert.ToInt32(dt_dept.Rows[0][0]) + ", " + Convert.ToInt32(dt_job.Rows[0][0]) + ")");
            }
            if (this.activeForm == "Department")
            {
                db.dbInsert("INSERT INTO tb_department (code, description) VALUES ('" + txtCode.Text + "', '" + txtDesc.Text + "')");
            }
            if (this.activeForm == "Job")
            {
                db.dbInsert("INSERT INTO tb_job (description, parent, salary) VALUES ('" + txtJob.Text + "', " + parent.Rows[0][0] + ", " + txtSalary.Text + ")");
            }
            Main main = new Main();

            this.Hide();
            main.Show();
            MessageBox.Show("Added!");
        }
Ejemplo n.º 2
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (txtOtherLoansName.Text == "Name")
     {
         txtOtherLoansName.Text = "Other";
     }
     if (this.txtNetPay.Text != "0.00")
     {
         dbClass  db    = new dbClass();
         DateTime date  = DateTime.Now;
         String   query = "insert into tb_employee (fullname, department, job, rate, no_of_days, gross_income, overtime_hrs, no_of_absences, loan_pagibig, loan_sss, loan_other_name, loan_other, prem_pagibig, prem_sss, prem_philhealth, total_loans, total_prem_loans, total_deduction, net_pay, date) values ('" + cmbEmployees.Text + "', '" + lblDept.Text + "', '" + lblJob.Text + "', " + txtSalary.Text + ", " + numWorkDays.Value + ", " + this.gross_pay + ", " + numOT.Value + ", " + numAbsent.Value + ", " + txtPagibigLoans.Text + ", " + txtSSSLoans.Text + ", '" + txtOtherLoansName.Text + "', " + txtOtherLoans.Text + ", " + txtPremPagibig.Text + ", " + txtPremSSS.Text + ", " + txtPremPhil.Text + ", " + labelLoans.Text + ", " + lblPremLoans.Text + ", " + lblTotalDeductions.Text + ", " + txtNetPay.Text + ", '" + date + "')";
         db.dbInsert(query);
         Main main = new Main();
         this.Hide();
         main.Show();
         MessageBox.Show("Record added!");
     }
     else
     {
         MessageBox.Show("Please fill all forms!");
     }
 }